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

@@ -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);
}
}
}