refactor(Scripts/Midsummer): use scheduler provided by CreatureAI (#17955)

This commit is contained in:
sudlud
2023-12-08 23:44:51 +01:00
committed by GitHub
parent 9e9ccc8b93
commit f2007aa59e
+5 -6
View File
@@ -269,7 +269,7 @@ struct npc_midsummer_ribbon_pole_target : public ScriptedAI
LocateRibbonPole(); LocateRibbonPole();
SpawnFireSpiralBunny(); SpawnFireSpiralBunny();
_scheduler.Schedule(1s, [this](TaskContext context) scheduler.Schedule(1s, [this](TaskContext context)
{ {
DoCleanupChecks(); DoCleanupChecks();
context.Repeat(); context.Repeat();
@@ -326,7 +326,7 @@ struct npc_midsummer_ribbon_pole_target : public ScriptedAI
void LocateRibbonPole() void LocateRibbonPole()
{ {
_scheduler.Schedule(420ms, [this](TaskContext context) scheduler.Schedule(420ms, [this](TaskContext context)
{ {
_ribbonPole = me->FindNearestGameObject(GO_RIBBON_POLE, 10.0f); _ribbonPole = me->FindNearestGameObject(GO_RIBBON_POLE, 10.0f);
@@ -380,7 +380,7 @@ struct npc_midsummer_ribbon_pole_target : public ScriptedAI
} }
if (_dancerList.size() >= THRESHOLD_FIREWORK_3) if (_dancerList.size() >= THRESHOLD_FIREWORK_3)
{ {
_scheduler.Schedule(500ms, [this](TaskContext /*context*/) scheduler.Schedule(500ms, [this](TaskContext /*context*/)
{ {
_bunny->CastSpell(nullptr, SPELL_RIBBON_POLE_FIREWORK); _bunny->CastSpell(nullptr, SPELL_RIBBON_POLE_FIREWORK);
}) })
@@ -391,7 +391,7 @@ struct npc_midsummer_ribbon_pole_target : public ScriptedAI
} }
if (_dancerList.size() >= THRESHOLD_FIREWORK_5) if (_dancerList.size() >= THRESHOLD_FIREWORK_5)
{ {
_scheduler.Schedule(1500ms, [this](TaskContext /*context*/) scheduler.Schedule(1500ms, [this](TaskContext /*context*/)
{ {
_bunny->CastSpell(nullptr, SPELL_RIBBON_POLE_FIREWORK); _bunny->CastSpell(nullptr, SPELL_RIBBON_POLE_FIREWORK);
}) })
@@ -461,11 +461,10 @@ struct npc_midsummer_ribbon_pole_target : public ScriptedAI
void UpdateAI(uint32 diff) override void UpdateAI(uint32 diff) override
{ {
_scheduler.Update(diff); scheduler.Update(diff);
} }
private: private:
TaskScheduler _scheduler;
std::vector<Player*> _dancerList; std::vector<Player*> _dancerList;
GameObject* _ribbonPole; GameObject* _ribbonPole;
Creature* _bunny; Creature* _bunny;