fix(Scripts/Eye): Kael'thas advisors fail to engage and aggro before being called (#25513)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Andrew 2026-04-20 18:08:24 -03:00 committed by GitHub
parent 37b60cd0bc
commit ec9fd3f15b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 46 deletions

View file

@ -229,9 +229,6 @@ struct boss_kaelthas : public BossAI
{ {
advisor->Respawn(true); advisor->Respawn(true);
advisor->StopMovingOnCurrentPos(); advisor->StopMovingOnCurrentPos();
advisor->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
advisor->SetReactState(REACT_PASSIVE);
summons.Summon(advisor);
} }
} }
} }
@ -550,7 +547,7 @@ struct boss_kaelthas : public BossAI
void IntroduceNewAdvisor(KTYells talkIntroduction, KTActions kaelAction) void IntroduceNewAdvisor(KTYells talkIntroduction, KTActions kaelAction)
{ {
std::chrono::milliseconds attackStartTimer = 0ms; std::chrono::milliseconds attackStartTimer = 0ms;
EyeNPCs advisorNPCId = NPC_THALADRED; uint32 dataIdx = DATA_THALADRED;
scheduler.Schedule(2s, [this, talkIntroduction](TaskContext) scheduler.Schedule(2s, [this, talkIntroduction](TaskContext)
{ {
Talk(talkIntroduction); Talk(talkIntroduction);
@ -560,26 +557,26 @@ struct boss_kaelthas : public BossAI
{ {
case ACTION_START_THALADRED: case ACTION_START_THALADRED:
attackStartTimer = 7s; attackStartTimer = 7s;
advisorNPCId = NPC_THALADRED; dataIdx = DATA_THALADRED;
break; break;
case ACTION_START_SANGUINAR: case ACTION_START_SANGUINAR:
attackStartTimer = 14500ms; attackStartTimer = 14500ms;
advisorNPCId = NPC_LORD_SANGUINAR; dataIdx = DATA_LORD_SANGUINAR;
break; break;
case ACTION_START_CAPERNIAN: case ACTION_START_CAPERNIAN:
attackStartTimer = 9s; attackStartTimer = 9s;
advisorNPCId = NPC_CAPERNIAN; dataIdx = DATA_CAPERNIAN;
break; break;
case ACTION_START_TELONICUS: case ACTION_START_TELONICUS:
attackStartTimer = 10400ms; attackStartTimer = 10400ms;
advisorNPCId = NPC_TELONICUS; dataIdx = DATA_TELONICUS;
break; break;
default: default:
break; break;
} }
scheduler.Schedule(attackStartTimer, [this, advisorNPCId](TaskContext) scheduler.Schedule(attackStartTimer, [this, dataIdx](TaskContext)
{ {
if (Creature* advisor = summons.GetCreatureWithEntry(advisorNPCId)) if (Creature* advisor = instance->GetCreature(dataIdx))
{ {
advisor->SetReactState(REACT_AGGRESSIVE); advisor->SetReactState(REACT_AGGRESSIVE);
advisor->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); advisor->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
@ -737,6 +734,13 @@ struct advisor_baseAI : public ScriptedAI
scheduler.CancelAll(); scheduler.CancelAll();
} }
void JustRespawned() override
{
ScriptedAI::JustRespawned();
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetReactState(REACT_PASSIVE);
}
void JustEngagedWith(Unit* /*who*/) override { ScheduleEvents(); } void JustEngagedWith(Unit* /*who*/) override { ScheduleEvents(); }
void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageEffectType*/, SpellSchoolMask /*spellSchoolMask*/) override void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageEffectType*/, SpellSchoolMask /*spellSchoolMask*/) override

View file

@ -67,42 +67,10 @@ public:
LoadBossBoundaries(boundaries); LoadBossBoundaries(boundaries);
} }
ObjectGuid ThaladredTheDarkenerGUID;
ObjectGuid LordSanguinarGUID;
ObjectGuid GrandAstromancerCapernianGUID;
ObjectGuid MasterEngineerTelonicusGUID;
ObjectGuid AlarGUID;
ObjectGuid KaelthasGUID;
ObjectGuid BridgeWindowGUID; ObjectGuid BridgeWindowGUID;
ObjectGuid KaelStateRightGUID; ObjectGuid KaelStateRightGUID;
ObjectGuid KaelStateLeftGUID; ObjectGuid KaelStateLeftGUID;
void OnCreatureCreate(Creature* creature) override
{
switch (creature->GetEntry())
{
case NPC_ALAR:
AlarGUID = creature->GetGUID();
break;
case NPC_KAELTHAS:
KaelthasGUID = creature->GetGUID();
break;
case NPC_THALADRED:
ThaladredTheDarkenerGUID = creature->GetGUID();
break;
case NPC_TELONICUS:
MasterEngineerTelonicusGUID = creature->GetGUID();
break;
case NPC_CAPERNIAN:
GrandAstromancerCapernianGUID = creature->GetGUID();
break;
case NPC_LORD_SANGUINAR:
LordSanguinarGUID = creature->GetGUID();
break;
}
InstanceScript::OnCreatureCreate(creature);
}
void OnGameObjectCreate(GameObject* gobject) override void OnGameObjectCreate(GameObject* gobject) override
{ {
switch (gobject->GetEntry()) switch (gobject->GetEntry())
@ -130,10 +98,6 @@ public:
return KaelStateRightGUID; return KaelStateRightGUID;
case GO_KAEL_STATUE_LEFT: case GO_KAEL_STATUE_LEFT:
return KaelStateLeftGUID; return KaelStateLeftGUID;
case NPC_ALAR:
return AlarGUID;
case NPC_KAELTHAS:
return KaelthasGUID;
} }
return ObjectGuid::Empty; return ObjectGuid::Empty;