From e31144fd1134c5949466a034ce2a122d80d92afb Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Fri, 10 May 2019 06:20:05 +0200 Subject: [PATCH] Core/Spells: simplify and correct damage calculation for Howling Blast's secondary targets --- src/server/scripts/Spells/spell_dk.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 9de9b17a76..91721fb194 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -1381,26 +1381,18 @@ class spell_dk_howling_blast : public SpellScript { PrepareSpellScript(spell_dk_howling_blast); - void HandleBeforeCast() + void HandleDamage(SpellEffIndex /*effIndex*/) { - if (Unit* target = GetExplTargetUnit()) - guid = target->GetGUID(); - } + if (GetExplTargetUnit() && GetHitUnit()) - void HandleHit(SpellEffIndex /*effIndex*/) - { - if (GetHitUnit()->GetGUID() != guid) - SetHitDamage(CalculatePct(GetHitDamage(), GetSpellInfo()->Effects[EFFECT_2].BasePoints)); + if (GetExplTargetUnit() != GetHitUnit()) + SetEffectValue(CalculatePct(GetEffectValue(), GetSpellInfo()->Effects[EFFECT_2].BasePoints)); } void Register() override { - BeforeCast += SpellCastFn(spell_dk_howling_blast::HandleBeforeCast); - OnEffectHitTarget += SpellEffectFn(spell_dk_howling_blast::HandleHit, EFFECT_1, SPELL_EFFECT_SCHOOL_DAMAGE); + OnEffectLaunchTarget += SpellEffectFn(spell_dk_howling_blast::HandleDamage, EFFECT_1, SPELL_EFFECT_SCHOOL_DAMAGE); } - -private: - ObjectGuid guid; }; // -49149 - Chill of the Grave