fix(Scripts/Naxx): Thaddius Ball Lightning should check all players i… (#24392)

Co-authored-by: victor <vngodoyr@unap.cl>
This commit is contained in:
Victor Godoy
2026-01-31 13:44:19 -03:00
committed by GitHub
parent 324d014bb8
commit 4864b800b0
@@ -129,6 +129,15 @@ public:
uint32 resetTimer{}; uint32 resetTimer{};
bool ballLightningEnabled; bool ballLightningEnabled;
bool IsAnyPlayerInMeleeRange() const
{
for (auto const& ref : me->GetThreatMgr().GetThreatList())
if (Unit* target = ref->getTarget())
if (target->IsPlayer() && me->IsWithinMeleeRange(target))
return true;
return false;
}
void DoAction(int32 param) override void DoAction(int32 param) override
{ {
if (param == ACTION_SUMMON_DIED) if (param == ACTION_SUMMON_DIED)
@@ -327,18 +336,12 @@ public:
break; break;
} }
if (me->IsWithinMeleeRange(me->GetVictim())) if (IsAnyPlayerInMeleeRange())
{
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} else if (ballLightningEnabled && !IsAnyPlayerInMeleeRange())
else if (ballLightningEnabled)
{
if (Unit* target = SelectTarget(SelectTargetMethod::MaxThreat)) if (Unit* target = SelectTarget(SelectTargetMethod::MaxThreat))
{
me->CastSpell(target, SPELL_BALL_LIGHTNING, false); me->CastSpell(target, SPELL_BALL_LIGHTNING, false);
} }
}
}
}; };
}; };