Skip to content

Conversation

@xDevICCI
Copy link
Contributor

Ball Lightning was being cast even when melee players (other than the tank) were in range of the boss. Added IsAnyPlayerInMeleeRange() helper function to check if any player on the threat list is within melee range.

Closes #24372

Changes Proposed:

This PR proposes changes to:

  • Core (units, players, creatures, game systems).
  • Scripts (bosses, spell scripts, creature scripts).
  • Database (SAI, creatures, etc).

AI-assisted Pull Requests

  • AI tools (e.g. ChatGPT, Claude, or similar) were used entirely or partially in preparing this pull request. Please specify which tools were used, if any.

Claude was used to help analyze the code and identify the root cause of the issue.

Issues Addressed:

SOURCE:

The changes have been validated through:

  • Live research (checked on live servers, e.g Classic WotLK, Retail, etc.)
  • Sniffs (remember to share them with the open source community!)
  • Video evidence, knowledge databases or other public sources (e.g forums, Wowhead, etc.)
  • The changes promoted by this pull request come partially or entirely from another project (cherry-pick).

Sources from the issue:

Both sources confirm Ball Lightning should only be cast when no players are in melee range.

Tests Performed:

This PR has been:

  • Tested in-game by the author.
  • Tested in-game by other community members/someone else other than the author/has been live on production servers.
  • This pull request requires further testing and may have edge cases to be tested.

How to Test the Changes:

  • This pull request can be tested by following the reproduction steps provided in the linked issue
  • This pull request requires further testing.
  1. Start Thaddius encounter with at least 2 players
  2. Have one player (tank) move away from melee range
  3. Keep another player in melee range of Thaddius
  4. Verify Thaddius does NOT cast Ball Lightning while any player is in melee range
  5. Have all players move out of melee range
  6. Verify Thaddius now casts Ball Lightning

Known Issues and TODO List:

  • The issue mentions pets/summons should possibly be checked too - this may need additional testing/confirmation

@github-actions github-actions bot added Script Refers to C++ Scripts for the Core file-cpp Used to trigger the matrix build labels Jan 12, 2026
}

if (me->IsWithinMeleeRange(me->GetVictim()))
if (IsAnyPlayerInMeleeRange())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This IsAnyPlayerInMeleeRange is better part of the ballLightningEnabled check.

            else if (ballLightningEnabled && !IsAnyPlayerInMeleeRange)

bool IsAnyPlayerInMeleeRange() const
{
for (auto const& ref : me->GetThreatMgr().GetThreatList())
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forced pushed commit

@Nyeriah
Copy link
Member

Nyeriah commented Jan 12, 2026

I faintly remember something like SelectNearestPlayer() existing

…n melee range

Ball Lightning was being cast even when melee players (other than the tank)
were in range of the boss. Added IsAnyPlayerInMeleeRange() helper function
to check if any player on the threat list is within melee range.

Closes azerothcore#24372
@xDevICCI xDevICCI force-pushed the fix-thaddius-ball-lightning branch from b12bf4f to 62b7346 Compare January 12, 2026 17:37
Comment on lines +132 to +140
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;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could just use SelectNearestTarget() to see if it returns anything within melee range

@Rorschach91 Rorschach91 added Ready to be Reviewed Tested This PR has been tested and is working. labels Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

file-cpp Used to trigger the matrix build Ready to be Reviewed Script Refers to C++ Scripts for the Core Tested This PR has been tested and is working.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Raid-Naxx] Thaddius' ball lightning is being cast even with melee in range of boss

6 participants