From f4a2428a4e9b579280ae331076944d8ea1ed03fa Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Thu, 30 Aug 2018 01:13:27 +0200 Subject: [PATCH] Core/Spells: updated Rip formular to Catalcysm and updated spell script to new model --- src/server/scripts/Spells/spell_druid.cpp | 71 ++++++++++------------- 1 file changed, 32 insertions(+), 39 deletions(-) diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 073587e588a..07967dbcaa3 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -818,51 +818,44 @@ class spell_dru_living_seed_proc : public SpellScriptLoader }; // 1079 - Rip -class spell_dru_rip : public SpellScriptLoader +// Updated 4.3.4 +class spell_dru_rip : public AuraScript { - public: - spell_dru_rip() : SpellScriptLoader("spell_dru_rip") { } + PrepareAuraScript(spell_dru_rip); - class spell_dru_rip_AuraScript : public AuraScript + bool Load() override + { + Unit* caster = GetCaster(); + return caster && caster->GetTypeId() == TYPEID_PLAYER; + } + + void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) + { + canBeRecalculated = false; + + if (Unit* caster = GetCaster()) { - PrepareAuraScript(spell_dru_rip_AuraScript); + // Formular: bp + 0.0207 * ap + uint8 cp = caster->ToPlayer()->GetComboPoints(); + float ap = caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.0207f; - bool Load() override - { - Unit* caster = GetCaster(); - return caster && caster->GetTypeId() == TYPEID_PLAYER; - } + float bonus = ap * cp; - void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) - { - canBeRecalculated = false; + // Idol of Feral Shadows. Can't be handled as SpellMod due its dependency from CPs + if (AuraEffect const* auraEffIdolOfFeralShadows = caster->GetAuraEffect(SPELL_DRUID_IDOL_OF_FERAL_SHADOWS, EFFECT_0)) + amount += cp * auraEffIdolOfFeralShadows->GetAmount(); + // Idol of Worship. Can't be handled as SpellMod due its dependency from CPs + else if (AuraEffect const* auraEffIdolOfWorship = caster->GetAuraEffect(SPELL_DRUID_IDOL_OF_WORSHIP, EFFECT_0)) + amount += cp * auraEffIdolOfWorship->GetAmount(); - if (Unit* caster = GetCaster()) - { - // 0.01 * $AP * cp - uint8 cp = caster->ToPlayer()->GetComboPoints(); - - // Idol of Feral Shadows. Can't be handled as SpellMod due its dependency from CPs - if (AuraEffect const* auraEffIdolOfFeralShadows = caster->GetAuraEffect(SPELL_DRUID_IDOL_OF_FERAL_SHADOWS, EFFECT_0)) - amount += cp * auraEffIdolOfFeralShadows->GetAmount(); - // Idol of Worship. Can't be handled as SpellMod due its dependency from CPs - else if (AuraEffect const* auraEffIdolOfWorship = caster->GetAuraEffect(SPELL_DRUID_IDOL_OF_WORSHIP, EFFECT_0)) - amount += cp * auraEffIdolOfWorship->GetAmount(); - - amount += int32(CalculatePct(caster->GetTotalAttackPowerValue(BASE_ATTACK), cp)); - } - } - - void Register() override - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_rip_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); - } - }; - - AuraScript* GetAuraScript() const override - { - return new spell_dru_rip_AuraScript(); + amount += int32(bonus); } + } + + void Register() override + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_rip::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); + } }; // 62606 - Savage Defense @@ -1898,7 +1891,7 @@ void AddSC_druid_spell_scripts() new spell_dru_living_seed_proc(); RegisterAuraScript(spell_dru_moonfire); new spell_dru_rejuvenation(); - new spell_dru_rip(); + RegisterAuraScript(spell_dru_rip); RegisterAuraScript(spell_dru_savage_defense); new spell_dru_savage_roar(); new spell_dru_starfall_dummy();