From 4fabaee5975257f81dd77a728e42af60e3ad04d9 Mon Sep 17 00:00:00 2001 From: KJack Date: Mon, 13 Nov 2023 01:42:16 -0500 Subject: [PATCH] fix(Scripts/ZulGurub): Jeklik (Bat Boss) - fix double-run scheduler (#17693) * Don't double-run scheduler. Only run out of combat when needed. * Comment clarification * Rename variable * Replace janky scheduling with `DespawnOnEvade()` --- .../EasternKingdoms/ZulGurub/boss_jeklik.cpp | 62 +------------------ 1 file changed, 3 insertions(+), 59 deletions(-) diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp index 1186c657a..cd8c177d0 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp @@ -115,21 +115,10 @@ struct boss_jeklik : public BossAI boss_jeklik(Creature* creature) : BossAI(creature, DATA_JEKLIK) { } - void InitializeAI() override - { - BossAI::InitializeAI(); - } - void Reset() override { BossAI::Reset(); - // allow the scheduler to interrupt casting - scheduler.ClearValidator(); - - // start invisible so we can setup the green channeling effect - me->SetVisible(false); - me->SetHomePosition(JeklikCaveHomePosition); me->SetDisableGravity(false); @@ -137,41 +126,13 @@ struct boss_jeklik : public BossAI BossAI::SetCombatMovement(false); batRidersCount = 0; - // once the path for her to come down to the ground starts, it appears to be near-impossible to stop it - // instead, simply wait the 3 seconds it takes the path to complete, then teleport her home - scheduler.Schedule(3s, [this](TaskContext) - { - float x, y, z, o; - JeklikCaveHomePosition.GetPosition(x, y, z, o); - - me->NearTeleportTo(x, y, z, o); - }); - - scheduler.Schedule(4s, [this](TaskContext) - { - DoCastSelf(SPELL_GREEN_CHANNELING, true); - - }); - - // restore visibility and unlock root - scheduler.Schedule(5s, [this](TaskContext) - { - me->SetVisible(true); - me->ClearUnitState(UNIT_STATE_ROOT); - }); + DoCastSelf(SPELL_GREEN_CHANNELING, true); } void JustEngagedWith(Unit* who) override { BossAI::JustEngagedWith(who); - scheduler.SetValidator([this] - { - return !me->HasUnitState(UNIT_STATE_CASTING); - }); - - scheduler.CancelAll(); - Talk(SAY_AGGRO); DoZoneInCombat(); @@ -190,8 +151,6 @@ struct boss_jeklik : public BossAI SetCombatMovement(true); me->SetReactState(REACT_AGGRESSIVE); - scheduler.CancelAll(); - // // Phase 1 // @@ -292,27 +251,12 @@ struct boss_jeklik : public BossAI void EnterEvadeMode(EvadeReason why) override { - BossAI::EnterEvadeMode(why); - if (why != EvadeReason::EVADE_REASON_NO_PATH) { - // make invisible to hide wonky-looking movement - me->SetVisible(false); - - // cancel any pending moves and stop moving - me->GetMotionMaster()->Clear(); - me->AddUnitState(UNIT_STATE_ROOT); - - Reset(); + me->DespawnOnEvade(5s); } - } - void UpdateAI(uint32 diff) override - { - // ensures that the scheduler gets updated even out of combat - scheduler.Update(diff); - - BossAI::UpdateAI(diff); + BossAI::EnterEvadeMode(why); } void JustDied(Unit* killer) override