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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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;

View file

@ -82,20 +82,22 @@ public:
dropSludgeTimer = 0;
}
void PullChamberAdds()
void PullChamberAdds(Unit* target)
{
if (!target)
return;
std::list<Creature*> StichedGiants;
me->GetCreaturesWithEntryInRange(StichedGiants, 300.0f, NPC_STICHED_GIANT);
for (std::list<Creature*>::const_iterator itr = StichedGiants.begin(); itr != StichedGiants.end(); ++itr)
{
(*itr)->ToCreature()->AI()->AttackStart(me->GetVictim());
(*itr)->ToCreature()->AI()->AttackStart(target);
}
}
void JustEngagedWith(Unit* who) override
{
BossAI::JustEngagedWith(who);
PullChamberAdds();
PullChamberAdds(who);
me->SetInCombatWithZone();
events.ScheduleEvent(EVENT_POISON_CLOUD, 15s);
events.ScheduleEvent(EVENT_MUTATING_INJECTION, 20s);

View file

@ -516,11 +516,14 @@ public:
// pull all the trash if not killed
if (Creature* patchwerk = GetCreature(DATA_PATCHWERK_BOSS))
{
for (auto& itr : _patchwerkRoomTrash)
if (Unit* target = patchwerk->GetThreatMgr().GetCurrentVictim())
{
Creature* trash = ObjectAccessor::GetCreature(*patchwerk, itr);
if (trash && trash->IsAlive() && !trash->IsInCombat())
trash->AI()->AttackStart(patchwerk->GetVictim());
for (auto& itr : _patchwerkRoomTrash)
{
Creature* trash = ObjectAccessor::GetCreature(*patchwerk, itr);
if (trash && trash->IsAlive() && !trash->IsInCombat())
trash->AI()->AttackStart(target);
}
}
}