fix(Core/Scripts): Renataki crash (#13811)

This commit is contained in:
Angelo Venturini 2022-11-13 18:41:10 -03:00 committed by GitHub
parent d466dc70c1
commit 5cf7d3d198
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -179,7 +179,7 @@ public:
{
if (!target->IsWithinMeleeRange(me))
{
_thousandBladesTargets.push_back(target);
_thousandBladesTargets.push_back(target->GetGUID());
}
}
@ -190,7 +190,7 @@ public:
{
if (target->IsWithinMeleeRange(me))
{
_thousandBladesTargets.push_back(target);
_thousandBladesTargets.push_back(target->GetGUID());
}
}
}
@ -204,12 +204,12 @@ public:
if (!_thousandBladesTargets.empty())
{
std::vector<Unit*>::iterator itr = _thousandBladesTargets.begin();
GuidVector::iterator itr = _thousandBladesTargets.begin();
std::advance(itr, urand(0, _thousandBladesTargets.size() - 1));
if (Unit* target = *itr)
if (Unit* target = ObjectAccessor::GetUnit(*me, *itr))
{
DoCast(target, SPELL_THOUSAND_BLADES, false);
DoCast(target, SPELL_THOUSAND_BLADES);
}
if (_thousandBladesTargets.erase(itr) != _thousandBladesTargets.end())
@ -242,7 +242,7 @@ public:
bool _enraged;
uint32 _dynamicFlags;
uint8 _thousandBladesCount;
std::vector<Unit*> _thousandBladesTargets;
GuidVector _thousandBladesTargets;
};
CreatureAI* GetAI(Creature* creature) const override