fix(Scripts/VioletHold): start escort in InitializeAI to avoid Start-in-combat error (#25978)

Co-authored-by: sudlud <sudlud@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
mpfans
2026-06-26 04:29:19 +08:00
committed by GitHub
parent 4e65712d75
commit cf4171fa69
@@ -166,7 +166,6 @@ struct violet_hold_trashAI : public npc_escortAI
{ {
Instance = c->GetInstanceScript(); Instance = c->GetInstanceScript();
PortalLoc = Instance->GetData(DATA_PORTAL_LOCATION); PortalLoc = Instance->GetData(DATA_PORTAL_LOCATION);
AddedWaypoints = false;
UseAlternate = false; UseAlternate = false;
} }
@@ -209,11 +208,10 @@ struct violet_hold_trashAI : public npc_escortAI
ScriptedAI::MoveInLineOfSight(who); ScriptedAI::MoveInLineOfSight(who);
} }
void UpdateAI(uint32 diff) override void InitializeAI() override
{ {
if (!AddedWaypoints) npc_escortAI::InitializeAI();
{
AddedWaypoints = true;
switch (PortalLoc) switch (PortalLoc)
{ {
case 0: case 0:
@@ -261,6 +259,8 @@ struct violet_hold_trashAI : public npc_escortAI
Start(true); Start(true);
} }
void UpdateAI(uint32 diff) override
{
npc_escortAI::UpdateAI(diff); npc_escortAI::UpdateAI(diff);
} }
@@ -302,7 +302,6 @@ struct violet_hold_trashAI : public npc_escortAI
protected: protected:
InstanceScript* Instance; InstanceScript* Instance;
bool AddedWaypoints;
uint32 PortalLoc; uint32 PortalLoc;
bool UseAlternate; bool UseAlternate;
}; };
@@ -834,7 +833,6 @@ struct npc_azure_saboteur : public npc_escortAI
_boss = _instance->GetData(DATA_WAVE_COUNT) == 6 _boss = _instance->GetData(DATA_WAVE_COUNT) == 6
? _instance->GetPersistentData(PERSISTENT_DATA_FIRST_BOSS) ? _instance->GetPersistentData(PERSISTENT_DATA_FIRST_BOSS)
: _instance->GetPersistentData(PERSISTENT_DATA_SECOND_BOSS); : _instance->GetPersistentData(PERSISTENT_DATA_SECOND_BOSS);
_addedWaypoints = false;
_isOpening = false; _isOpening = false;
} }
@@ -870,13 +868,10 @@ struct npc_azure_saboteur : public npc_escortAI
} }
} }
void UpdateAI(uint32 diff) override void InitializeAI() override
{ {
npc_escortAI::UpdateAI(diff); npc_escortAI::InitializeAI();
if (!_addedWaypoints)
{
_addedWaypoints = true;
switch (_boss) switch (_boss)
{ {
case BOSS_MORAGG: case BOSS_MORAGG:
@@ -912,6 +907,10 @@ struct npc_azure_saboteur : public npc_escortAI
Start(true); Start(true);
} }
void UpdateAI(uint32 diff) override
{
npc_escortAI::UpdateAI(diff);
if (_isOpening) if (_isOpening)
{ {
_events.Update(diff); _events.Update(diff);
@@ -951,7 +950,6 @@ struct npc_azure_saboteur : public npc_escortAI
private: private:
InstanceScript* _instance; InstanceScript* _instance;
bool _addedWaypoints;
uint8 _boss; uint8 _boss;
bool _isOpening; bool _isOpening;
EventMap _events; EventMap _events;