mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 09:17:36 +01:00
Core/Creature: Some adjustments to Creature::CallForHelp. Now works even if the Creature hasn't selected a victim yet.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user