From deea079d073383fc7b2cc17f6dedbbf69f5ee441 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sat, 30 Oct 2021 20:18:02 -0400 Subject: [PATCH] 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) --- Source/Game/Entities/Creature/Creature.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/Game/Entities/Creature/Creature.cs b/Source/Game/Entities/Creature/Creature.cs index 6d20e4f74..33a536ddd 100644 --- a/Source/Game/Entities/Creature/Creature.cs +++ b/Source/Game/Entities/Creature/Creature.cs @@ -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); }