Scripts/TotFW: fixed a crash when Anshal tries to select a Ravenous Creeper for Soothing Breeze while no creeper is available

This commit is contained in:
Ovahlord
2020-05-01 21:29:50 +02:00
parent 518d0ce669
commit cd57f79a1c

View File

@@ -411,11 +411,15 @@ struct boss_anshal : public BossAI
_ravenousCreeperGUIDs.erase(guid);
}
if (ObjectGuid creeperGuid = Trinity::Containers::SelectRandomContainerElement(_ravenousCreeperGUIDs))
if (Creature* creeper = ObjectAccessor::GetCreature(*me, creeperGuid))
target = creeper;
if (!_ravenousCreeperGUIDs.empty())
{
if (ObjectGuid creeperGuid = Trinity::Containers::SelectRandomContainerElement(_ravenousCreeperGUIDs))
if (Creature* creeper = ObjectAccessor::GetCreature(*me, creeperGuid))
target = creeper;
DoCast(target, SPELL_SOOTHING_BREEZE);
}
DoCast(target, SPELL_SOOTHING_BREEZE);
events.Repeat(31s, 33s);
break;
}