Core/Creature: Some adjustments to Creature.CallForHelp. Now works even if the Creature hasn't selected a victim yet.
Port From (https://github.com/TrinityCore/TrinityCore/commit/6b8329f6af801dae065a15322f07b95e83ed34fc)
This commit is contained in:
@@ -2176,10 +2176,15 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void CallForHelp(float radius)
|
public void CallForHelp(float radius)
|
||||||
{
|
{
|
||||||
if (radius <= 0.0f || GetVictim() == null || IsPet() || IsCharmed())
|
if (radius <= 0.0f || !IsEngaged() || IsPet() || IsCharmed())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var u_do = new CallOfHelpCreatureInRangeDo(this, GetVictim(), radius);
|
Unit target = GetThreatManager().GetCurrentVictim();
|
||||||
|
if (target == null)
|
||||||
|
target = GetThreatManager().GetAnyTarget();
|
||||||
|
Cypher.Assert(target != null, $"Creature {GetEntry()} ({GetName()}) is engaged without threat list");
|
||||||
|
|
||||||
|
var u_do = new CallOfHelpCreatureInRangeDo(this, target, radius);
|
||||||
var worker = new CreatureWorker(this, u_do);
|
var worker = new CreatureWorker(this, u_do);
|
||||||
Cell.VisitGridObjects(this, worker, radius);
|
Cell.VisitGridObjects(this, worker, radius);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user