aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua Deus <95978183+aquadeus@users.noreply.github.com>2024-09-06 14:07:39 +0200
committerGitHub <noreply@github.com>2024-09-06 14:07:39 +0200
commit4e7d6d590fe7629935a22f238e120db9428045a4 (patch)
tree398a701c2529ff71e26c736de3f51dafdbabad29
parent39e45637b2cc21773b1b77e3957058037811c47b (diff)
Scripts/Spells: Update Haunt script (#30156)
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp13
1 files changed, 7 insertions, 6 deletions
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);
}
};