From 417bb39e4628aaf54d74419843f792f596c18e26 Mon Sep 17 00:00:00 2001 From: ccrs Date: Fri, 10 Oct 2025 17:48:14 +0200 Subject: Scripts/Misc: use the new SetAggressiveStateAfter AI method in several scripts --- .../HallsOfReflection/halls_of_reflection.cpp | 21 ++------------- .../IcecrownCitadel/boss_the_lich_king.cpp | 24 +---------------- .../Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp | 30 +++------------------- 3 files changed, 7 insertions(+), 68 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index 0d1b6b11020..a3cccf6919e 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -2148,23 +2148,6 @@ enum EscapeEvents EVENT_LUMBERING_ABOMINATION_CLEAVE }; -class HoRStartMovementEvent : public BasicEvent -{ - public: - explicit HoRStartMovementEvent(Creature* owner) : _owner(owner) { } - - bool Execute(uint64 /*execTime*/, uint32 /*diff*/) override - { - _owner->SetReactState(REACT_AGGRESSIVE); - if (Unit* target = _owner->AI()->SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true)) - _owner->AI()->AttackStart(target); - return true; - } - - private: - Creature* _owner; -}; - struct npc_escape_event_trash : public ScriptedAI { npc_escape_event_trash(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { } @@ -2217,7 +2200,7 @@ class npc_raging_ghoul : public CreatureScript me->CastSpell(me, SPELL_RAGING_GHOUL_SPAWN, true); me->SetReactState(REACT_PASSIVE); me->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); - me->m_Events.AddEvent(new HoRStartMovementEvent(me), me->m_Events.CalculateTime(5s)); + SetAggressiveStateAfter(5s); npc_escape_event_trash::IsSummonedBy(summoner); } @@ -2283,7 +2266,7 @@ class npc_risen_witch_doctor : public CreatureScript me->CastSpell(me, SPELL_RISEN_WITCH_DOCTOR_SPAWN, true); me->SetReactState(REACT_PASSIVE); me->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); - me->m_Events.AddEvent(new HoRStartMovementEvent(me), me->m_Events.CalculateTime(5s)); + SetAggressiveStateAfter(5s); npc_escape_event_trash::IsSummonedBy(summoner); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 129836b4b69..995cb8d78bb 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -425,28 +425,6 @@ class FrozenThroneResetWorker } }; -class LichKingStartMovementEvent : public BasicEvent -{ - public: - LichKingStartMovementEvent(Creature* summoner, Creature* owner) - : _summonerGuid(summoner->GetGUID()), _owner(owner) - { - } - - bool Execute(uint64 /*time*/, uint32 /*diff*/) override - { - _owner->SetReactState(REACT_AGGRESSIVE); - if (Creature* _summoner = ObjectAccessor::GetCreature(*_owner, _summonerGuid)) - if (Unit* target = _summoner->AI()->SelectTarget(SelectTargetMethod::Random, 0, NonTankTargetSelector(_summoner))) - _owner->AI()->AttackStart(target); - return true; - } - - private: - ObjectGuid _summonerGuid; - Creature* _owner; -}; - class VileSpiritActivateEvent : public BasicEvent { public: @@ -720,7 +698,7 @@ struct boss_the_lich_king : public BossAI summon->CastSpell(summon, SPELL_RISEN_WITCH_DOCTOR_SPAWN, true); summon->SetReactState(REACT_PASSIVE); summon->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); - summon->m_Events.AddEvent(new LichKingStartMovementEvent(me, summon), summon->m_Events.CalculateTime(5s)); + SetAggressiveStateAfter(5s, summon, true, me, StartCombatArgs().SetAvoidTargetVictim(true)); break; case NPC_SHADOW_TRAP: summon->CastSpell(summon, SPELL_SHADOW_TRAP_VISUAL, true); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp index b6516af3939..b038d013fa1 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp @@ -15,7 +15,7 @@ * with this program. If not, see . */ -#include "ScriptMgr.h" +#include "ulduar.h" #include "CreatureTextMgr.h" #include "GridNotifiers.h" #include "InstanceScript.h" @@ -26,12 +26,12 @@ #include "PassiveAI.h" #include "Player.h" #include "ScriptedCreature.h" +#include "ScriptMgr.h" #include "Spell.h" #include "SpellAuraEffects.h" #include "SpellMgr.h" #include "SpellScript.h" #include "TemporarySummon.h" -#include "ulduar.h" enum Yells { @@ -417,28 +417,6 @@ uint32 const IllusionSpells[MAX_ILLUSION_ROOMS] SPELL_TELEPORT_TO_STORMWIND_ILLUSION }; -class StartAttackEvent : public BasicEvent -{ - public: - StartAttackEvent(Creature* summoner, Creature* owner) - : _summonerGuid(summoner->GetGUID()), _owner(owner) - { - } - - bool Execute(uint64 /*time*/, uint32 /*diff*/) override - { - _owner->SetReactState(REACT_AGGRESSIVE); - if (Creature* _summoner = ObjectAccessor::GetCreature(*_owner, _summonerGuid)) - if (Unit* target = _summoner->AI()->SelectTarget(SelectTargetMethod::Random, 0, 300.0f)) - _owner->AI()->AttackStart(target); - return true; - } - - private: - ObjectGuid _summonerGuid; - Creature* _owner; -}; - class boss_voice_of_yogg_saron : public CreatureScript { public: @@ -649,7 +627,7 @@ class boss_voice_of_yogg_saron : public CreatureScript switch (summon->GetEntry()) { case NPC_GUARDIAN_OF_YOGG_SARON: - summon->m_Events.AddEvent(new StartAttackEvent(me, summon), summon->m_Events.CalculateTime(1s)); + SetAggressiveStateAfter(1s, summon, true, me, StartCombatArgs().SetDistance(300.f)); break; case NPC_YOGG_SARON: summon->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); @@ -661,7 +639,7 @@ class boss_voice_of_yogg_saron : public CreatureScript case NPC_CORRUPTOR_TENTACLE: summon->SetReactState(REACT_PASSIVE); summon->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); - summon->m_Events.AddEvent(new StartAttackEvent(me, summon), summon->m_Events.CalculateTime(5s)); + SetAggressiveStateAfter(5s, summon, true, me, StartCombatArgs().SetDistance(300.f)); break; case NPC_DESCEND_INTO_MADNESS: summon->CastSpell(summon, SPELL_TELEPORT_PORTAL_VISUAL, true); -- cgit v1.2.3