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:
hondacrx
2021-10-30 20:18:02 -04:00
parent 0275a1405f
commit deea079d07
+7 -2
View File
@@ -2176,10 +2176,15 @@ namespace Game.Entities
public void CallForHelp(float radius)
{
if (radius <= 0.0f || GetVictim() == null || IsPet() || IsCharmed())
if (radius <= 0.0f || !IsEngaged() || IsPet() || IsCharmed())
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);
Cell.VisitGridObjects(this, worker, radius);
}