Core/Creature: Some adjustments to Creature::CallForHelp. Now works even if the Creature hasn't selected a victim yet.

This commit is contained in:
Treeston
2018-08-22 22:21:47 +02:00
committed by Ovahlord
parent 607069de36
commit 6f6b6534bf

View File

@@ -2334,10 +2334,15 @@ void Creature::CallAssistance()
void Creature::CallForHelp(float radius)
{
if (radius <= 0.0f || !GetVictim() || IsPet() || IsCharmed())
if (radius <= 0.0f || !IsEngaged() || IsPet() || IsCharmed())
return;
Trinity::CallOfHelpCreatureInRangeDo u_do(this, GetVictim(), radius);
Unit* target = GetThreatManager().GetCurrentVictim();
if (!target)
target = GetThreatManager().GetAnyTarget();
ASSERT(target, "Creature %u (%s) is engaged without threat list", GetEntry(), GetName().c_str());
Trinity::CallOfHelpCreatureInRangeDo u_do(this, target, radius);
Trinity::CreatureWorker<Trinity::CallOfHelpCreatureInRangeDo> worker(this, u_do);
Cell::VisitGridObjects(this, worker, radius);
}