diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp index 4bf335c9de0fb9..0b0353ea80817a 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp @@ -70,7 +70,7 @@ struct boss_azgalor : public BossAI context.Repeat(18s, 20s); }).Schedule(45s, 55s, [this](TaskContext context) { - DoCastRandomTarget(SPELL_DOOM, 1, 100.f, true, false, false); + DoCastAOE(SPELL_DOOM); Talk(SAY_DOOM); context.Repeat(); }).Schedule(10min, [this](TaskContext context) @@ -118,9 +118,27 @@ struct boss_azgalor : public BossAI bool _recentlySpoken; }; -class spell_azgalor_doom : public AuraScript +class spell_azgalor_doom : public SpellScript { - PrepareAuraScript(spell_azgalor_doom); + PrepareSpellScript(spell_azgalor_doom); + + void FilterTargets(std::list& targets) + { + if (Unit* victim = GetCaster()->GetVictim()) + { + targets.remove_if(Acore::ObjectGUIDCheck(victim->GetGUID(), true)); + } + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_azgalor_doom::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } +}; + +class spell_azgalor_doom_aura : public AuraScript +{ + PrepareAuraScript(spell_azgalor_doom_aura); void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { @@ -133,12 +151,12 @@ class spell_azgalor_doom : public AuraScript void Register() override { - OnEffectRemove += AuraEffectRemoveFn(spell_azgalor_doom::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_azgalor_doom_aura::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); } }; void AddSC_boss_azgalor() { RegisterHyjalAI(boss_azgalor); - RegisterSpellScript(spell_azgalor_doom); + RegisterSpellAndAuraScriptPair(spell_azgalor_doom, spell_azgalor_doom_aura); }