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:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user