From 0dd4b685df53d9b61a53aaf3a577c2a9ed8cdd47 Mon Sep 17 00:00:00 2001 From: Carbenium Date: Sat, 1 Aug 2020 22:40:10 +0200 Subject: Scripts/AzjolNerub: Fix potential error in pound spell script Cast damage spell in AfterEffectApply instead OnEffectHitTarget. This avoids the scenario where we try to apply an aura to a potential dead target. Ref #21856 --- .../Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp index 2a5b1ab613c..b41eee19780 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp @@ -600,24 +600,24 @@ struct npc_anubarak_impale_target : public NullCreatureAI } }; -class spell_anubarak_pound : public SpellScript +class spell_anubarak_pound : public AuraScript { - PrepareSpellScript(spell_anubarak_pound); + PrepareAuraScript(spell_anubarak_pound); bool Validate(SpellInfo const* /*spell*/) override { return ValidateSpellInfo({ SPELL_POUND_DAMAGE }); } - void HandleDummy(SpellEffIndex /*effIndex*/) + void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (Unit* target = GetHitUnit()) + if (Unit* target = GetTarget()) GetCaster()->CastSpell(target, SPELL_POUND_DAMAGE, true); } void Register() override { - OnEffectHitTarget += SpellEffectFn(spell_anubarak_pound::HandleDummy, EFFECT_0, SPELL_EFFECT_APPLY_AURA); + AfterEffectApply += AuraEffectApplyFn(spell_anubarak_pound::AfterApply, EFFECT_2, SPELL_AURA_FLY, AURA_EFFECT_HANDLE_REAL); } }; @@ -652,6 +652,6 @@ void AddSC_boss_anub_arak() RegisterCreatureAIWithFactory(npc_anubarak_anub_ar_venomancer, GetAzjolNerubAI); RegisterCreatureAIWithFactory(npc_anubarak_impale_target, GetAzjolNerubAI); - RegisterSpellScript(spell_anubarak_pound); + RegisterAuraScript(spell_anubarak_pound); RegisterAuraScript(spell_anubarak_carrion_beetles); } -- cgit v1.2.3