aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoroffl <11556157+offl@users.noreply.github.com>2021-04-26 10:12:15 +0300
committerGitHub <noreply@github.com>2021-04-26 09:12:15 +0200
commit2b6632e50a25882442b26a3a8b0c21261e1565dc (patch)
tree0f75337e1c8a72cfe2b57d3770dba021cc8264cf /src
parent5991dcb12b638a0ef483fddeeda3e5744012dda6 (diff)
Scripts/Mechanar: Update gatewatchers to new model (#26471)
Co-authored-by: offl <offl@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp123
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp131
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h2
3 files changed, 118 insertions, 138 deletions
diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp
index 99ec166eaa2..1697cf13df2 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp
@@ -50,81 +50,70 @@ enum Events
EVENT_SHADOW_POWER = 3
};
-class boss_gatewatcher_gyrokill : public CreatureScript
+struct boss_gatewatcher_gyrokill : public BossAI
{
- public:
- boss_gatewatcher_gyrokill() : CreatureScript("boss_gatewatcher_gyrokill") { }
-
- struct boss_gatewatcher_gyrokillAI : public BossAI
+ boss_gatewatcher_gyrokill(Creature* creature) : BossAI(creature, DATA_GATEWATCHER_GYROKILL) { }
+
+ void JustDied(Unit* /*killer*/) override
+ {
+ _JustDied();
+ Talk(SAY_DEATH);
+ }
+
+ void JustEngagedWith(Unit* who) override
+ {
+ BossAI::JustEngagedWith(who);
+ events.ScheduleEvent(EVENT_STREAM_OF_MACHINE_FLUID, 10s);
+ events.ScheduleEvent(EVENT_SAW_BLADE, 20s);
+ events.ScheduleEvent(EVENT_SHADOW_POWER, 25s);
+ Talk(SAY_AGGRO);
+ }
+
+ void KilledUnit(Unit* /*victim*/) override
+ {
+ Talk(SAY_SLAY);
+ }
+
+ void UpdateAI(uint32 diff) override
+ {
+ if (!UpdateVictim())
+ return;
+
+ events.Update(diff);
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = events.ExecuteEvent())
{
- boss_gatewatcher_gyrokillAI(Creature* creature) : BossAI(creature, DATA_GATEWATCHER_GYROKILL) { }
-
- void JustDied(Unit* /*killer*/) override
+ switch (eventId)
{
- _JustDied();
- Talk(SAY_DEATH);
+ case EVENT_STREAM_OF_MACHINE_FLUID:
+ DoCastVictim(SPELL_STREAM_OF_MACHINE_FLUID, true);
+ events.ScheduleEvent(EVENT_STREAM_OF_MACHINE_FLUID, 13s, 17s);
+ break;
+ case EVENT_SAW_BLADE:
+ DoCast(me, SPELL_SAW_BLADE);
+ Talk(SAY_SAW_BLADEs);
+ events.ScheduleEvent(EVENT_SAW_BLADE, 20s, 30s);
+ break;
+ case EVENT_SHADOW_POWER:
+ DoCast(me, SPELL_SHADOW_POWER);
+ events.ScheduleEvent(EVENT_SAW_BLADE, 25s, 35s);
+ break;
+ default:
+ break;
}
- void JustEngagedWith(Unit* who) override
- {
- BossAI::JustEngagedWith(who);
- events.ScheduleEvent(EVENT_STREAM_OF_MACHINE_FLUID, 10s);
- events.ScheduleEvent(EVENT_SAW_BLADE, 20s);
- events.ScheduleEvent(EVENT_SHADOW_POWER, 25s);
- Talk(SAY_AGGRO);
- }
-
- void KilledUnit(Unit* /*victim*/) override
- {
- Talk(SAY_SLAY);
- }
-
- void UpdateAI(uint32 diff) override
- {
- if (!UpdateVictim())
- return;
-
- events.Update(diff);
-
- if (me->HasUnitState(UNIT_STATE_CASTING))
- return;
-
- while (uint32 eventId = events.ExecuteEvent())
- {
- switch (eventId)
- {
- case EVENT_STREAM_OF_MACHINE_FLUID:
- DoCastVictim(SPELL_STREAM_OF_MACHINE_FLUID, true);
- events.ScheduleEvent(EVENT_STREAM_OF_MACHINE_FLUID, 13s, 17s);
- break;
- case EVENT_SAW_BLADE:
- DoCast(me, SPELL_SAW_BLADE);
- Talk(SAY_SAW_BLADEs);
- events.ScheduleEvent(EVENT_SAW_BLADE, 20s, 30s);
- break;
- case EVENT_SHADOW_POWER:
- DoCast(me, SPELL_SHADOW_POWER);
- events.ScheduleEvent(EVENT_SAW_BLADE, 25s, 35s);
- break;
- default:
- break;
- }
-
- if (me->HasUnitState(UNIT_STATE_CASTING))
- return;
- }
-
- DoMeleeAttackIfReady();
- }
- };
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return GetMechanarAI<boss_gatewatcher_gyrokillAI>(creature);
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
}
+
+ DoMeleeAttackIfReady();
+ }
};
void AddSC_boss_gatewatcher_gyrokill()
{
- new boss_gatewatcher_gyrokill();
+ RegisterMechanarCreatureAI(boss_gatewatcher_gyrokill);
}
diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp
index 09d10519333..8d09645b02a 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp
@@ -52,85 +52,74 @@ enum Events
EVENT_SHADOW_POWER = 3
};
-class boss_gatewatcher_iron_hand : public CreatureScript
+struct boss_gatewatcher_iron_hand : public BossAI
{
- public:
- boss_gatewatcher_iron_hand(): CreatureScript("boss_gatewatcher_iron_hand") { }
-
- struct boss_gatewatcher_iron_handAI : public BossAI
+ boss_gatewatcher_iron_hand(Creature* creature) : BossAI(creature, DATA_GATEWATCHER_IRON_HAND) { }
+
+ void JustEngagedWith(Unit* who) override
+ {
+ BossAI::JustEngagedWith(who);
+ events.ScheduleEvent(EVENT_STREAM_OF_MACHINE_FLUID, 55s);
+ events.ScheduleEvent(EVENT_JACKHAMMER, 45s);
+ events.ScheduleEvent(EVENT_SHADOW_POWER, 25s);
+ Talk(SAY_AGGRO);
+ }
+
+ void KilledUnit(Unit* /*victim*/) override
+ {
+ if (roll_chance_i(50))
+ Talk(SAY_SLAY);
+ }
+
+ void JustDied(Unit* /*killer*/) override
+ {
+ _JustDied();
+ Talk(SAY_DEATH);
+ }
+
+ void UpdateAI(uint32 diff) override
+ {
+ if (!UpdateVictim())
+ return;
+
+ events.Update(diff);
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = events.ExecuteEvent())
{
- boss_gatewatcher_iron_handAI(Creature* creature) : BossAI(creature, DATA_GATEWATCHER_IRON_HAND) { }
-
- void JustEngagedWith(Unit* who) override
+ switch (eventId)
{
- BossAI::JustEngagedWith(who);
- events.ScheduleEvent(EVENT_STREAM_OF_MACHINE_FLUID, 55s);
- events.ScheduleEvent(EVENT_JACKHAMMER, 45s);
- events.ScheduleEvent(EVENT_SHADOW_POWER, 25s);
- Talk(SAY_AGGRO);
+ case EVENT_STREAM_OF_MACHINE_FLUID:
+ DoCastVictim(SPELL_STREAM_OF_MACHINE_FLUID, true);
+ events.ScheduleEvent(EVENT_STREAM_OF_MACHINE_FLUID, 35s, 50s);
+ break;
+ case EVENT_JACKHAMMER:
+ Talk(EMOTE_HAMMER);
+ /// @todo expect cast this about 5 times in a row (?), announce it by emote only once
+ DoCastVictim(SPELL_JACKHAMMER, true);
+ if (roll_chance_i(50))
+ Talk(SAY_HAMMER);
+ events.ScheduleEvent(EVENT_JACKHAMMER, 30s);
+ break;
+ case EVENT_SHADOW_POWER:
+ DoCast(me, SPELL_SHADOW_POWER);
+ events.ScheduleEvent(EVENT_SHADOW_POWER, 20s, 28s);
+ break;
+ default:
+ break;
}
- void KilledUnit(Unit* /*victim*/) override
- {
- if (roll_chance_i(50))
- Talk(SAY_SLAY);
- }
-
- void JustDied(Unit* /*killer*/) override
- {
- _JustDied();
- Talk(SAY_DEATH);
- }
-
- void UpdateAI(uint32 diff) override
- {
- if (!UpdateVictim())
- return;
-
- events.Update(diff);
-
- if (me->HasUnitState(UNIT_STATE_CASTING))
- return;
-
- while (uint32 eventId = events.ExecuteEvent())
- {
- switch (eventId)
- {
- case EVENT_STREAM_OF_MACHINE_FLUID:
- DoCastVictim(SPELL_STREAM_OF_MACHINE_FLUID, true);
- events.ScheduleEvent(EVENT_STREAM_OF_MACHINE_FLUID, 35s, 50s);
- break;
- case EVENT_JACKHAMMER:
- Talk(EMOTE_HAMMER);
- /// @todo expect cast this about 5 times in a row (?), announce it by emote only once
- DoCastVictim(SPELL_JACKHAMMER, true);
- if (roll_chance_i(50))
- Talk(SAY_HAMMER);
- events.ScheduleEvent(EVENT_JACKHAMMER, 30s);
- break;
- case EVENT_SHADOW_POWER:
- DoCast(me, SPELL_SHADOW_POWER);
- events.ScheduleEvent(EVENT_SHADOW_POWER, 20s, 28s);
- break;
- default:
- break;
- }
-
- if (me->HasUnitState(UNIT_STATE_CASTING))
- return;
- }
-
- DoMeleeAttackIfReady();
- }
- };
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return GetMechanarAI<boss_gatewatcher_iron_handAI>(creature);
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
}
+
+ DoMeleeAttackIfReady();
+ }
};
void AddSC_boss_gatewatcher_iron_hand()
{
- new boss_gatewatcher_iron_hand();
+ RegisterMechanarCreatureAI(boss_gatewatcher_iron_hand);
}
diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h b/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h
index beca8bd3849..ad63f0b9f25 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h
@@ -47,4 +47,6 @@ inline AI* GetMechanarAI(T* obj)
return GetInstanceAI<AI>(obj, MechanarScriptName);
}
+#define RegisterMechanarCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetMechanarAI)
+
#endif