Scripts/Mechanar: Update gatewatchers to new model (#26471)

Co-authored-by: offl <offl@users.noreply.github.com>
(cherry picked from commit 2b6632e50a)
This commit is contained in:
offl
2021-04-26 10:12:15 +03:00
committed by Shauren
parent 83ca66cd40
commit 8e5895c809
3 changed files with 116 additions and 136 deletions

View File

@@ -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") { }
boss_gatewatcher_gyrokill(Creature* creature) : BossAI(creature, DATA_GATEWATCHER_GYROKILL) { }
struct boss_gatewatcher_gyrokillAI : public BossAI
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);
}

View File

@@ -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") { }
boss_gatewatcher_iron_hand(Creature* creature) : BossAI(creature, DATA_GATEWATCHER_IRON_HAND) { }
struct boss_gatewatcher_iron_handAI : public BossAI
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);
}

View File

@@ -47,4 +47,6 @@ inline AI* GetMechanarAI(T* obj)
return GetInstanceAI<AI>(obj, MechanarScriptName);
}
#define RegisterMechanarCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetMechanarAI)
#endif