fix(Scripts/Karazhan): allow Moroes and adds to reset when an add is pulled out of the room (#17072)

* initial

* doforallsummons

* error fix
This commit is contained in:
Dan
2023-08-27 21:08:34 +02:00
committed by GitHub
parent 3eb2463c69
commit 3ce2627c05

View File

@@ -209,10 +209,36 @@ struct boss_moroes : public BossAI
return Acore::Containers::SelectRandomContainerElement(guestList);
}
bool CheckGuestsInRoom()
{
bool guestsInRoom = true;
summons.DoForAllSummons([&guestsInRoom](WorldObject* summon)
{
if ((summon->ToCreature()->GetPositionX()) < -11028.f || (summon->ToCreature()->GetPositionY()) < -1955.f) //boundaries of the two doors
{
guestsInRoom = false;
return false;
}
return true;
});
return guestsInRoom;
}
void UpdateAI(uint32 diff) override
{
scheduler.Update(diff);
if (!CheckGuestsInRoom())
{
EnterEvadeMode();
summons.DoForAllSummons([](WorldObject* summon)
{
summon->ToCreature()->AI()->EnterEvadeMode();
});
return;
}
if (!UpdateVictim())
return;