fix(Core/Scripts): Fix GetVictim() returning null during JustEngagedWith (#25131)

Co-authored-by: blinkysc <blinkysc@users.noreply.github.com>
Co-authored-by: Treeston <treeston.mmoc@gmail.com>
This commit is contained in:
blinkysc
2026-03-19 18:37:03 -05:00
committed by GitHub
parent 8f5900b36b
commit e5746fbc89
3 changed files with 19 additions and 16 deletions

View File

@@ -225,7 +225,7 @@ bool AssistDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
// When nearby mobs aggro from another mob's initial call for assistance
// their leash timers become linked and attacking one will keep the rest from evading.
if (assistant->GetVictim())
if (assistant->IsEngaged())
assistant->SetLastLeashExtensionTimePtr(m_owner->GetLastLeashExtensionTimePtr());
}
}
@@ -2394,20 +2394,18 @@ void Creature::CallAssistance(Unit* target /*= nullptr*/)
void Creature::CallForHelp(float radius, Unit* target /*= nullptr*/)
{
if (radius <= 0.0f || IsPet() || IsCharmed())
{
if (radius <= 0.0f || !IsEngaged() || !IsAlive() || IsPet() || IsCharmed())
return;
}
if (!target)
{
target = GetVictim();
}
target = GetThreatMgr().GetCurrentVictim();
if (!target)
target = GetThreatMgr().GetAnyTarget();
if (!target)
target = GetCombatManager().GetAnyTarget();
if (!target)
{
return;
}
if (m_alreadyCallForHelp) // avoid recursive call for help for any reason
return;