mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-28 14:35:57 +00:00
fix(Scripts/Naxx): Thaddius Ball Lightning should check all players i… (#24392)
Co-authored-by: victor <vngodoyr@unap.cl>
This commit is contained in:
@@ -129,6 +129,15 @@ public:
|
||||
uint32 resetTimer{};
|
||||
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
|
||||
{
|
||||
if (param == ACTION_SUMMON_DIED)
|
||||
@@ -327,17 +336,11 @@ public:
|
||||
break;
|
||||
}
|
||||
|
||||
if (me->IsWithinMeleeRange(me->GetVictim()))
|
||||
{
|
||||
if (IsAnyPlayerInMeleeRange())
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
else if (ballLightningEnabled)
|
||||
{
|
||||
else if (ballLightningEnabled && !IsAnyPlayerInMeleeRange())
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::MaxThreat))
|
||||
{
|
||||
me->CastSpell(target, SPELL_BALL_LIGHTNING, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user