diff options
author | Carbenium <carbenium@outlook.com> | 2020-08-01 22:40:10 +0200 |
---|---|---|
committer | Peter Keresztes Schmidt <carbenium@outlook.com> | 2020-08-04 17:22:18 +0200 |
commit | 0dd4b685df53d9b61a53aaf3a577c2a9ed8cdd47 (patch) | |
tree | 4539df2e0139d5fcd5a5d36234efd65dd6ddea37 | |
parent | 7b8b999516a824b0c417631a77f133eb47b8b2f4 (diff) |
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
-rw-r--r-- | src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
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); } |