diff options
author | offl <11556157+offl@users.noreply.github.com> | 2021-04-16 20:14:49 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-16 20:14:49 +0300 |
commit | 82969a691cfc0fc14bd90888a79dfe0dc5cea9e7 (patch) | |
tree | d2cbf1186ab8ce393143b8645cefa35c91d54c17 | |
parent | e5a34d94a6b2802452f34afa35dd37626d3ebf15 (diff) |
Scripts/Oculus: Update Drakos to new model (#26423)
-rw-r--r-- | src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp | 228 | ||||
-rw-r--r-- | src/server/scripts/Northrend/Nexus/Oculus/oculus.h | 2 |
2 files changed, 105 insertions, 125 deletions
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp index 7e8a914f7d2..24f688ab4ad 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp @@ -52,163 +52,141 @@ enum DrakosEvents EVENT_BOMB_SUMMON }; -class boss_drakos : public CreatureScript +struct boss_drakos : public BossAI { - public: - boss_drakos() : CreatureScript("boss_drakos") { } + boss_drakos(Creature* creature) : BossAI(creature, DATA_DRAKOS) + { + Initialize(); + } - struct boss_drakosAI : public BossAI - { - boss_drakosAI(Creature* creature) : BossAI(creature, DATA_DRAKOS) - { - Initialize(); - } + void Initialize() + { + postPull = false; + } - void Initialize() - { - postPull = false; - } + void Reset() override + { + _Reset(); - void Reset() override - { - _Reset(); - - events.ScheduleEvent(EVENT_MAGIC_PULL, 15s); - events.ScheduleEvent(EVENT_STOMP, 15s); - events.ScheduleEvent(EVENT_BOMB_SUMMON, 2s); + events.ScheduleEvent(EVENT_MAGIC_PULL, 15s); + events.ScheduleEvent(EVENT_STOMP, 15s); + events.ScheduleEvent(EVENT_BOMB_SUMMON, 2s); - Initialize(); - } + Initialize(); + } - void JustEngagedWith(Unit* who) override - { - BossAI::JustEngagedWith(who); - Talk(SAY_AGGRO); - } + void JustEngagedWith(Unit* who) override + { + BossAI::JustEngagedWith(who); + Talk(SAY_AGGRO); + } - void UpdateAI(uint32 diff) override - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_BOMB_SUMMON: { - case EVENT_BOMB_SUMMON: - { - for (uint8 i = 0; i <= (postPull ? 3 : 0); i++) - { - Position position = me->GetRandomNearPosition(frand(0.0f, 10.0f)); - me->SummonCreature(NPC_UNSTABLE_SPHERE, position); - } - } - events.ScheduleEvent(EVENT_BOMB_SUMMON, 2s); - break; - case EVENT_MAGIC_PULL: - DoCast(SPELL_MAGIC_PULL); - postPull = true; - events.ScheduleEvent(EVENT_MAGIC_PULL, 15s); - break; - case EVENT_STOMP: - Talk(SAY_STOMP); - DoCast(SPELL_THUNDERING_STOMP); - events.ScheduleEvent(EVENT_STOMP, 15s); - break; - default: - break; + for (uint8 i = 0; i <= (postPull ? 3 : 0); i++) + { + Position position = me->GetRandomNearPosition(frand(0.0f, 10.0f)); + me->SummonCreature(NPC_UNSTABLE_SPHERE, position); + } } - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - } - - DoMeleeAttackIfReady(); + events.ScheduleEvent(EVENT_BOMB_SUMMON, 2s); + break; + case EVENT_MAGIC_PULL: + DoCast(SPELL_MAGIC_PULL); + postPull = true; + events.ScheduleEvent(EVENT_MAGIC_PULL, 15s); + break; + case EVENT_STOMP: + Talk(SAY_STOMP); + DoCast(SPELL_THUNDERING_STOMP); + events.ScheduleEvent(EVENT_STOMP, 15s); + break; + default: + break; } - void JustDied(Unit* /*killer*/) override - { - _JustDied(); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + } - Talk(SAY_DEATH); + DoMeleeAttackIfReady(); + } - // start achievement timer (kill Eregos within 20 min) - instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - } + void JustDied(Unit* /*killer*/) override + { + _JustDied(); - void KilledUnit(Unit* /*victim*/) override - { - Talk(SAY_KILL); - } + Talk(SAY_DEATH); - private: - bool postPull; - }; + // start achievement timer (kill Eregos within 20 min) + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + } - CreatureAI* GetAI(Creature* creature) const override - { - return GetOculusAI<boss_drakosAI>(creature); - } + void KilledUnit(Unit* /*victim*/) override + { + Talk(SAY_KILL); + } + +private: + bool postPull; }; -class npc_unstable_sphere : public CreatureScript +struct npc_unstable_sphere : public ScriptedAI { - public: - npc_unstable_sphere() : CreatureScript("npc_unstable_sphere") { } - - struct npc_unstable_sphereAI : public ScriptedAI - { - npc_unstable_sphereAI(Creature* creature) : ScriptedAI(creature) - { - Initialize(); - } + npc_unstable_sphere(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } - void Initialize() - { - pulseTimer = 3000; - } + void Initialize() + { + pulseTimer = 3000; + } - void Reset() override - { - me->SetReactState(REACT_PASSIVE); - me->GetMotionMaster()->MoveRandom(40.0f); + void Reset() override + { + me->SetReactState(REACT_PASSIVE); + me->GetMotionMaster()->MoveRandom(40.0f); - me->AddAura(SPELL_UNSTABLE_SPHERE_PASSIVE, me); - me->AddAura(SPELL_UNSTABLE_SPHERE_TIMER, me); + me->AddAura(SPELL_UNSTABLE_SPHERE_PASSIVE, me); + me->AddAura(SPELL_UNSTABLE_SPHERE_TIMER, me); - Initialize(); + Initialize(); - me->DespawnOrUnsummon(19s); - } + me->DespawnOrUnsummon(19s); + } - void UpdateAI(uint32 diff) override - { - if (pulseTimer <= diff) - { - DoCast(SPELL_UNSTABLE_SPHERE_PULSE); - pulseTimer = 3 * IN_MILLISECONDS; - } - else - pulseTimer -= diff; - } - - private: - uint32 pulseTimer; - }; - - CreatureAI* GetAI(Creature* creature) const override + void UpdateAI(uint32 diff) override + { + if (pulseTimer <= diff) { - return GetOculusAI<npc_unstable_sphereAI>(creature); + DoCast(SPELL_UNSTABLE_SPHERE_PULSE); + pulseTimer = 3 * IN_MILLISECONDS; } + else + pulseTimer -= diff; + } + +private: + uint32 pulseTimer; }; void AddSC_boss_drakos() { - new boss_drakos(); - new npc_unstable_sphere(); + RegisterOculusCreatureAI(boss_drakos); + RegisterOculusCreatureAI(npc_unstable_sphere); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.h b/src/server/scripts/Northrend/Nexus/Oculus/oculus.h index 83c6e8eca40..355f93ba266 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.h +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.h @@ -113,4 +113,6 @@ inline AI* GetOculusAI(T* obj) return GetInstanceAI<AI>(obj, OculusScriptName); } +#define RegisterOculusCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetOculusAI) + #endif // OCULUS_H_ |