refactor(Scripts/Mechanar): Modernize Gatewatchers script (#15492)
This commit is contained in:
@@ -34,81 +34,48 @@ enum Spells
|
|||||||
SPELL_SHADOW_POWER = 35322
|
SPELL_SHADOW_POWER = 35322
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Events
|
struct boss_gatewatcher_gyrokill : public BossAI
|
||||||
{
|
{
|
||||||
EVENT_STREAM_OF_MACHINE_FLUID = 1,
|
boss_gatewatcher_gyrokill(Creature* creature) : BossAI(creature, DATA_GATEWATCHER_GYROKILL) { }
|
||||||
EVENT_SAW_BLADE = 2,
|
|
||||||
EVENT_SHADOW_POWER = 3
|
|
||||||
};
|
|
||||||
|
|
||||||
class boss_gatewatcher_gyrokill : public CreatureScript
|
void JustDied(Unit* /*killer*/) override
|
||||||
{
|
|
||||||
public:
|
|
||||||
boss_gatewatcher_gyrokill() : CreatureScript("boss_gatewatcher_gyrokill") { }
|
|
||||||
|
|
||||||
struct boss_gatewatcher_gyrokillAI : public BossAI
|
|
||||||
{
|
{
|
||||||
boss_gatewatcher_gyrokillAI(Creature* creature) : BossAI(creature, DATA_GATEWATCHER_GYROKILL) { }
|
_JustDied();
|
||||||
|
Talk(SAY_DEATH);
|
||||||
|
}
|
||||||
|
|
||||||
void JustDied(Unit* /*killer*/) override
|
void JustEngagedWith(Unit* /*who*/) override
|
||||||
{
|
|
||||||
_JustDied();
|
|
||||||
Talk(SAY_DEATH);
|
|
||||||
}
|
|
||||||
|
|
||||||
void JustEngagedWith(Unit* /*who*/) override
|
|
||||||
{
|
|
||||||
_JustEngagedWith();
|
|
||||||
events.ScheduleEvent(EVENT_STREAM_OF_MACHINE_FLUID, 10000);
|
|
||||||
events.ScheduleEvent(EVENT_SAW_BLADE, 20000);
|
|
||||||
events.ScheduleEvent(EVENT_SHADOW_POWER, 30000);
|
|
||||||
Talk(SAY_AGGRO);
|
|
||||||
}
|
|
||||||
|
|
||||||
void KilledUnit(Unit* victim) override
|
|
||||||
{
|
|
||||||
if (victim->GetTypeId() == TYPEID_PLAYER)
|
|
||||||
Talk(SAY_SLAY);
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
|
||||||
{
|
|
||||||
if (!UpdateVictim())
|
|
||||||
return;
|
|
||||||
|
|
||||||
events.Update(diff);
|
|
||||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch (events.ExecuteEvent())
|
|
||||||
{
|
|
||||||
case EVENT_STREAM_OF_MACHINE_FLUID:
|
|
||||||
me->CastSpell(me->GetVictim(), SPELL_STREAM_OF_MACHINE_FLUID, false);
|
|
||||||
events.ScheduleEvent(EVENT_STREAM_OF_MACHINE_FLUID, urand(12000, 14000));
|
|
||||||
break;
|
|
||||||
case EVENT_SAW_BLADE:
|
|
||||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50.0f))
|
|
||||||
me->CastSpell(target, SPELL_SAW_BLADE, false);
|
|
||||||
Talk(SAY_SAW_BLADE);
|
|
||||||
events.ScheduleEvent(EVENT_SAW_BLADE, 25000);
|
|
||||||
break;
|
|
||||||
case EVENT_SHADOW_POWER:
|
|
||||||
me->CastSpell(me, SPELL_SHADOW_POWER, false);
|
|
||||||
events.ScheduleEvent(EVENT_SAW_BLADE, 25000);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
DoMeleeAttackIfReady();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* creature) const override
|
|
||||||
{
|
{
|
||||||
return GetMechanarAI<boss_gatewatcher_gyrokillAI>(creature);
|
_JustEngagedWith();
|
||||||
|
|
||||||
|
scheduler.Schedule(10s, [this](TaskContext context)
|
||||||
|
{
|
||||||
|
DoCastVictim(SPELL_STREAM_OF_MACHINE_FLUID);
|
||||||
|
context.Repeat(12s, 14s);
|
||||||
|
}).Schedule(20s, [this](TaskContext context)
|
||||||
|
{
|
||||||
|
DoCastRandomTarget(SPELL_SAW_BLADE, 0, 50.0f);
|
||||||
|
Talk(SAY_SAW_BLADE);
|
||||||
|
context.Repeat(25s);
|
||||||
|
}).Schedule(30s, [this](TaskContext context)
|
||||||
|
{
|
||||||
|
me->CastSpell(me, SPELL_SHADOW_POWER, false);
|
||||||
|
context.Repeat(25s);
|
||||||
|
});
|
||||||
|
|
||||||
|
Talk(SAY_AGGRO);
|
||||||
|
}
|
||||||
|
|
||||||
|
void KilledUnit(Unit* victim) override
|
||||||
|
{
|
||||||
|
if (victim->IsPlayer())
|
||||||
|
{
|
||||||
|
Talk(SAY_SLAY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddSC_boss_gatewatcher_gyrokill()
|
void AddSC_boss_gatewatcher_gyrokill()
|
||||||
{
|
{
|
||||||
new boss_gatewatcher_gyrokill();
|
RegisterMechanarCreatureAI(boss_gatewatcher_gyrokill);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,83 +35,49 @@ enum Spells
|
|||||||
SPELL_STREAM_OF_MACHINE_FLUID = 35311
|
SPELL_STREAM_OF_MACHINE_FLUID = 35311
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Events
|
struct boss_gatewatcher_iron_hand : public BossAI
|
||||||
{
|
{
|
||||||
EVENT_STREAM_OF_MACHINE_FLUID = 1,
|
boss_gatewatcher_iron_hand(Creature* creature) : BossAI(creature, DATA_GATEWATCHER_IRON_HAND) { }
|
||||||
EVENT_JACKHAMMER = 2,
|
|
||||||
EVENT_SHADOW_POWER = 3
|
|
||||||
};
|
|
||||||
|
|
||||||
class boss_gatewatcher_iron_hand : public CreatureScript
|
void JustEngagedWith(Unit* /*who*/) override
|
||||||
{
|
|
||||||
public:
|
|
||||||
boss_gatewatcher_iron_hand(): CreatureScript("boss_gatewatcher_iron_hand") { }
|
|
||||||
|
|
||||||
struct boss_gatewatcher_iron_handAI : public BossAI
|
|
||||||
{
|
{
|
||||||
boss_gatewatcher_iron_handAI(Creature* creature) : BossAI(creature, DATA_GATEWATCHER_IRON_HAND) { }
|
_JustEngagedWith();
|
||||||
|
|
||||||
void JustEngagedWith(Unit* /*who*/) override
|
scheduler.Schedule(15s, [this](TaskContext context)
|
||||||
{
|
{
|
||||||
_JustEngagedWith();
|
DoCastVictim(SPELL_STREAM_OF_MACHINE_FLUID);
|
||||||
events.ScheduleEvent(EVENT_STREAM_OF_MACHINE_FLUID, 15000);
|
context.Repeat(20s);
|
||||||
events.ScheduleEvent(EVENT_JACKHAMMER, 35000);
|
}).Schedule(35s, [this](TaskContext context)
|
||||||
events.ScheduleEvent(EVENT_SHADOW_POWER, 25000);
|
|
||||||
Talk(SAY_AGGRO);
|
|
||||||
}
|
|
||||||
|
|
||||||
void KilledUnit(Unit* victim) override
|
|
||||||
{
|
{
|
||||||
if (victim->GetTypeId() == TYPEID_PLAYER)
|
Talk(EMOTE_HAMMER);
|
||||||
Talk(SAY_SLAY);
|
Talk(SAY_HAMMER);
|
||||||
}
|
DoCastSelf(SPELL_JACKHAMMER);
|
||||||
|
context.Repeat(40s);
|
||||||
void JustDied(Unit* /*killer*/) override
|
}).Schedule(25s, [this](TaskContext context)
|
||||||
{
|
{
|
||||||
_JustDied();
|
DoCastSelf(SPELL_SHADOW_POWER);
|
||||||
Talk(SAY_DEATH);
|
context.Repeat(25s);
|
||||||
}
|
});
|
||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
Talk(SAY_AGGRO);
|
||||||
{
|
}
|
||||||
if (!UpdateVictim())
|
|
||||||
return;
|
|
||||||
|
|
||||||
events.Update(diff);
|
void KilledUnit(Unit* victim) override
|
||||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch (events.ExecuteEvent())
|
|
||||||
{
|
|
||||||
case EVENT_STREAM_OF_MACHINE_FLUID:
|
|
||||||
me->CastSpell(me->GetVictim(), SPELL_STREAM_OF_MACHINE_FLUID, false);
|
|
||||||
events.ScheduleEvent(EVENT_STREAM_OF_MACHINE_FLUID, 20000);
|
|
||||||
break;
|
|
||||||
case EVENT_JACKHAMMER:
|
|
||||||
Talk(EMOTE_HAMMER);
|
|
||||||
Talk(SAY_HAMMER);
|
|
||||||
me->CastSpell(me, SPELL_JACKHAMMER, false);
|
|
||||||
events.ScheduleEvent(EVENT_JACKHAMMER, 40000);
|
|
||||||
break;
|
|
||||||
case EVENT_SHADOW_POWER:
|
|
||||||
me->CastSpell(me, SPELL_SHADOW_POWER, false);
|
|
||||||
events.ScheduleEvent(EVENT_SHADOW_POWER, 25000);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
DoMeleeAttackIfReady();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* creature) const override
|
|
||||||
{
|
{
|
||||||
return GetMechanarAI<boss_gatewatcher_iron_handAI>(creature);
|
if (victim->IsPlayer())
|
||||||
|
{
|
||||||
|
Talk(SAY_SLAY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void JustDied(Unit* /*killer*/) override
|
||||||
|
{
|
||||||
|
_JustDied();
|
||||||
|
Talk(SAY_DEATH);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddSC_boss_gatewatcher_iron_hand()
|
void AddSC_boss_gatewatcher_iron_hand()
|
||||||
{
|
{
|
||||||
new boss_gatewatcher_iron_hand();
|
RegisterMechanarCreatureAI(boss_gatewatcher_iron_hand);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user