forked from mirror/azerothcore-wotlk
fix(Scripts/Karazhan): fix Moroes guests not respawning on evade (#25851)
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -77,18 +77,6 @@ struct boss_moroes : public BossAI
|
|||||||
_activeGuests = 0;
|
_activeGuests = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializeAI() override
|
|
||||||
{
|
|
||||||
BossAI::InitializeAI();
|
|
||||||
InitializeGuests();
|
|
||||||
}
|
|
||||||
|
|
||||||
void JustReachedHome() override
|
|
||||||
{
|
|
||||||
BossAI::JustReachedHome();
|
|
||||||
InitializeGuests();
|
|
||||||
}
|
|
||||||
|
|
||||||
void InitializeGuests()
|
void InitializeGuests()
|
||||||
{
|
{
|
||||||
if (!me->IsAlive())
|
if (!me->IsAlive())
|
||||||
@@ -96,16 +84,18 @@ struct boss_moroes : public BossAI
|
|||||||
|
|
||||||
if (_activeGuests == 0)
|
if (_activeGuests == 0)
|
||||||
{
|
{
|
||||||
_activeGuests |= 0x3F;
|
_activeGuests = 0x3F;
|
||||||
uint8 rand1 = RAND(0x01, 0x02, 0x04);
|
uint8 rand1 = RAND(0x01, 0x02, 0x04);
|
||||||
uint8 rand2 = RAND(0x08, 0x10, 0x20);
|
uint8 rand2 = RAND(0x08, 0x10, 0x20);
|
||||||
_activeGuests &= ~(rand1 | rand2);
|
_activeGuests &= ~(rand1 | rand2);
|
||||||
}
|
}
|
||||||
for (uint8 i = 0; i < MAX_GUEST_COUNT; ++i)
|
|
||||||
|
uint8 positionIndex = 0;
|
||||||
|
for (uint8 i = 0; i < MAX_GUEST_COUNT && positionIndex < ACTIVE_GUEST_COUNT; ++i)
|
||||||
{
|
{
|
||||||
if ((1 << i) & _activeGuests)
|
if ((1 << i) & _activeGuests)
|
||||||
{
|
{
|
||||||
me->SummonCreature(GuestEntries[i], GuestsPosition[summons.size()], TEMPSUMMON_MANUAL_DESPAWN);
|
me->SummonCreature(GuestEntries[i], GuestsPosition[positionIndex++], TEMPSUMMON_MANUAL_DESPAWN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,6 +120,8 @@ struct boss_moroes : public BossAI
|
|||||||
_recentlySpoken = false;
|
_recentlySpoken = false;
|
||||||
_vanished = false;
|
_vanished = false;
|
||||||
|
|
||||||
|
InitializeGuests();
|
||||||
|
|
||||||
ScheduleHealthCheckEvent(30, [&] {
|
ScheduleHealthCheckEvent(30, [&] {
|
||||||
DoCastSelf(SPELL_FRENZY, true);
|
DoCastSelf(SPELL_FRENZY, true);
|
||||||
});
|
});
|
||||||
@@ -203,6 +195,9 @@ struct boss_moroes : public BossAI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (guestList.empty())
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
return Acore::Containers::SelectRandomContainerElement(guestList);
|
return Acore::Containers::SelectRandomContainerElement(guestList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,12 +206,12 @@ struct boss_moroes : public BossAI
|
|||||||
bool guestsInRoom = true;
|
bool guestsInRoom = true;
|
||||||
summons.DoForAllSummons([&guestsInRoom](WorldObject* summon)
|
summons.DoForAllSummons([&guestsInRoom](WorldObject* summon)
|
||||||
{
|
{
|
||||||
if ((summon->ToCreature()->GetPositionX()) < -11028.f || (summon->ToCreature()->GetPositionY()) < -1955.f) //boundaries of the two doors
|
Creature* creature = summon->ToCreature();
|
||||||
|
if (creature->IsAlive() &&
|
||||||
|
((creature->GetPositionX() < -11028.f) || (creature->GetPositionY() < -1955.f))) // boundaries of the two doors
|
||||||
{
|
{
|
||||||
guestsInRoom = false;
|
guestsInRoom = false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return guestsInRoom;
|
return guestsInRoom;
|
||||||
@@ -229,10 +224,6 @@ struct boss_moroes : public BossAI
|
|||||||
if (!CheckGuestsInRoom())
|
if (!CheckGuestsInRoom())
|
||||||
{
|
{
|
||||||
EnterEvadeMode();
|
EnterEvadeMode();
|
||||||
summons.DoForAllSummons([](WorldObject* summon)
|
|
||||||
{
|
|
||||||
summon->ToCreature()->DespawnOnEvade(5s);
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user