From 4e7d6d590fe7629935a22f238e120db9428045a4 Mon Sep 17 00:00:00 2001 From: Aqua Deus <95978183+aquadeus@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:07:39 +0200 Subject: Scripts/Spells: Update Haunt script (#30156) --- src/server/scripts/Spells/spell_warlock.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 3ef27e7b922..74582ca57e9 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -33,6 +33,7 @@ #include "Random.h" #include "SpellAuraEffects.h" #include "SpellAuras.h" +#include "SpellHistory.h" #include "SpellMgr.h" #include "SpellScript.h" @@ -422,18 +423,18 @@ class spell_warl_drain_soul : public AuraScript }; // 48181 - Haunt -class spell_warl_haunt : public SpellScript +class spell_warl_haunt : public AuraScript { - void HandleAfterHit() + void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (Aura* aura = GetHitAura()) - if (AuraEffect* aurEff = aura->GetEffect(EFFECT_1)) - aurEff->SetAmount(CalculatePct(GetHitDamage(), aurEff->GetAmount())); + if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH) + if (Unit* caster = GetCaster()) + caster->GetSpellHistory()->ResetCooldown(GetId(), true); } void Register() override { - AfterHit += SpellHitFn(spell_warl_haunt::HandleAfterHit); + OnEffectRemove += AuraEffectApplyFn(spell_warl_haunt::HandleRemove, EFFECT_1, SPELL_AURA_MOD_SCHOOL_MASK_DAMAGE_FROM_CASTER, AURA_EFFECT_HANDLE_REAL); } }; -- cgit v1.2.3