mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-27 20:32:21 +01:00
Core/Creature: Some adjustments to Creature::CallForHelp. Now works even if the Creature hasn't selected a victim yet.
(cherry picked from commit 79f0e55dcb)
This commit is contained in:
@@ -2487,10 +2487,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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user