refactor(Scripts/TheBotanica): Modernize the Warp Splinter script (#14951)
This commit is contained in:
@@ -37,87 +37,51 @@ enum Spells
|
|||||||
SPELL_SUMMON_SAPLINGS_PERIODIC = 34741
|
SPELL_SUMMON_SAPLINGS_PERIODIC = 34741
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Misc
|
struct boss_warp_splinter : public BossAI
|
||||||
{
|
{
|
||||||
EVENT_ARCANE_VOLLEY = 1,
|
boss_warp_splinter(Creature* creature) : BossAI(creature, DATA_WARP_SPLINTER) { }
|
||||||
EVENT_WAR_STOMP = 2,
|
|
||||||
EVENT_SUMMON_TREANT = 3
|
|
||||||
};
|
|
||||||
|
|
||||||
class boss_warp_splinter : public CreatureScript
|
void EnterCombat(Unit* /*who*/) override
|
||||||
{
|
|
||||||
public:
|
|
||||||
boss_warp_splinter() : CreatureScript("boss_warp_splinter") { }
|
|
||||||
struct boss_warp_splinterAI : public BossAI
|
|
||||||
{
|
{
|
||||||
boss_warp_splinterAI(Creature* creature) : BossAI(creature, DATA_WARP_SPLINTER) { }
|
_EnterCombat();
|
||||||
|
Talk(SAY_AGGRO);
|
||||||
|
|
||||||
void Reset() override
|
scheduler.Schedule(8s, [this](TaskContext context)
|
||||||
{
|
{
|
||||||
_Reset();
|
DoCastAOE(SPELL_ARCANE_VOLLEY);
|
||||||
}
|
context.Repeat(20s);
|
||||||
|
}).Schedule(15s, [this](TaskContext context)
|
||||||
void EnterCombat(Unit* /*who*/) override
|
|
||||||
{
|
{
|
||||||
_EnterCombat();
|
DoCastAOE(SPELL_WAR_STOMP);
|
||||||
Talk(SAY_AGGRO);
|
context.Repeat(30s);
|
||||||
|
}).Schedule(20s, [this](TaskContext context)
|
||||||
events.ScheduleEvent(EVENT_ARCANE_VOLLEY, 8000);
|
|
||||||
events.ScheduleEvent(EVENT_WAR_STOMP, 15000);
|
|
||||||
events.ScheduleEvent(EVENT_SUMMON_TREANT, 20000);
|
|
||||||
}
|
|
||||||
|
|
||||||
void KilledUnit(Unit* victim) override
|
|
||||||
{
|
{
|
||||||
if (victim->GetTypeId() == TYPEID_PLAYER)
|
Talk(SAY_SUMMON);
|
||||||
Talk(SAY_SLAY);
|
DoCastAOE(SPELL_SUMMON_SAPLINGS_PERIODIC, true);
|
||||||
}
|
for (uint8 i = 0; i < 6; ++i)
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
switch (events.ExecuteEvent())
|
|
||||||
{
|
{
|
||||||
case EVENT_ARCANE_VOLLEY:
|
DoCastAOE(SPELL_SUMMON_SAPLINGS_SUMMON + i, true);
|
||||||
me->CastSpell(me, SPELL_ARCANE_VOLLEY, false);
|
|
||||||
events.ScheduleEvent(EVENT_ARCANE_VOLLEY, 20000);
|
|
||||||
break;
|
|
||||||
case EVENT_WAR_STOMP:
|
|
||||||
me->CastSpell(me, SPELL_WAR_STOMP, false);
|
|
||||||
events.ScheduleEvent(EVENT_WAR_STOMP, 30000);
|
|
||||||
break;
|
|
||||||
case EVENT_SUMMON_TREANT:
|
|
||||||
Talk(SAY_SUMMON);
|
|
||||||
me->CastSpell(me, SPELL_SUMMON_SAPLINGS_PERIODIC, true);
|
|
||||||
for (uint8 i = 0; i < 6; ++i)
|
|
||||||
me->CastSpell(me, SPELL_SUMMON_SAPLINGS_SUMMON + i, true);
|
|
||||||
events.ScheduleEvent(EVENT_SUMMON_TREANT, 40000);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
context.Repeat(40s);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
DoMeleeAttackIfReady();
|
void KilledUnit(Unit* victim) override
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* creature) const override
|
|
||||||
{
|
{
|
||||||
return GetTheBotanicaAI<boss_warp_splinterAI>(creature);
|
if (victim->IsPlayer())
|
||||||
|
{
|
||||||
|
Talk(SAY_SLAY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void JustDied(Unit* /*killer*/) override
|
||||||
|
{
|
||||||
|
_JustDied();
|
||||||
|
Talk(SAY_DEATH);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddSC_boss_warp_splinter()
|
void AddSC_boss_warp_splinter()
|
||||||
{
|
{
|
||||||
new boss_warp_splinter();
|
RegisterTheBotanicaCreatureAI(boss_warp_splinter);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,4 +58,6 @@ inline AI* GetTheBotanicaAI(T* obj)
|
|||||||
return GetInstanceAI<AI>(obj, TheBotanicaScriptName);
|
return GetInstanceAI<AI>(obj, TheBotanicaScriptName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define RegisterTheBotanicaCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetTheBotanicaAI)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user