fix(Scripts/MoltenCore): Ragnaros melee retarget on knockback#25390
fix(Scripts/MoltenCore): Ragnaros melee retarget on knockback#25390Nyeriah merged 3 commits intoazerothcore:masterfrom
Conversation
Reimplements Ragnaros' out-of-melee-range behavior to be compatible with the new threat system. Removes the CanAIAttack/EnterEvadeMode overrides (which marked all threat refs offline on knockback and caused a full evade) and instead drives target switching through a 500ms repeating EVENT_MELEE_SCAN scheduled on the existing EventMap. When the current victim is out of melee range, Ragnaros switches to the highest-threat target within melee range. If none exists, Magma Blast is scheduled in 4s; if a melee target appears before then, the cast is cancelled. Magma Blast targets the current victim (not a random unit) and only repeats while no one is in melee range. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Reimplements Ragnaros’ “no melee targets available” behavior to work correctly with the updated threat system (retarget in-melee when possible; otherwise cast Magma Blast after a delay, cancelling if melee becomes available).
Changes:
- Removes the custom
EnterEvadeModeandCanAIAttackoverrides previously used to drive Magma Blast behavior. - Adds a fast repeating
EVENT_MELEE_SCANto retarget to an in-melee threat target, or arm/cancelEVENT_MAGMA_BLASTdepending on melee availability. - Updates
EVENT_MAGMA_BLASTto re-check for a melee target on fire and to target the current victim rather than a random target.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (meleeTarget != me->GetVictim()) | ||
| AttackStart(meleeTarget); | ||
| if (_processingMagmaBurst) | ||
| { | ||
| events.CancelEvent(EVENT_MAGMA_BLAST); | ||
| _processingMagmaBurst = false; | ||
| } | ||
| } | ||
| else if (!_processingMagmaBurst) | ||
| { | ||
| _processingMagmaBurst = true; | ||
| events.ScheduleEvent(EVENT_MAGMA_BLAST, 4s, PHASE_EMERGED, PHASE_EMERGED); | ||
| } | ||
| } | ||
| else if (_processingMagmaBurst) | ||
| { | ||
| events.CancelEvent(EVENT_MAGMA_BLAST); | ||
| _processingMagmaBurst = false; |
There was a problem hiding this comment.
EVENT_MELEE_SCAN calls AttackStart(meleeTarget) to temporarily swap the victim, but on the next AI update CreatureAI::UpdateVictim() will call me->SelectVictim() (driven by ThreatManager::GetCurrentVictim()) and may immediately switch the victim back to the highest-threat target (even if out of melee). This can cause the target to flap and other events in the same/next tick to cast on the out-of-melee victim. To make the retarget stable while the current victim is out of melee, consider explicitly updating threat selection (e.g., me->GetThreatMgr().FixateTarget(meleeTarget) while out-of-melee, and ClearFixate() once a valid melee victim exists / original victim is back in range).
| if (meleeTarget != me->GetVictim()) | |
| AttackStart(meleeTarget); | |
| if (_processingMagmaBurst) | |
| { | |
| events.CancelEvent(EVENT_MAGMA_BLAST); | |
| _processingMagmaBurst = false; | |
| } | |
| } | |
| else if (!_processingMagmaBurst) | |
| { | |
| _processingMagmaBurst = true; | |
| events.ScheduleEvent(EVENT_MAGMA_BLAST, 4s, PHASE_EMERGED, PHASE_EMERGED); | |
| } | |
| } | |
| else if (_processingMagmaBurst) | |
| { | |
| events.CancelEvent(EVENT_MAGMA_BLAST); | |
| _processingMagmaBurst = false; | |
| me->GetThreatMgr().FixateTarget(meleeTarget); | |
| if (meleeTarget != me->GetVictim()) | |
| AttackStart(meleeTarget); | |
| if (_processingMagmaBurst) | |
| { | |
| events.CancelEvent(EVENT_MAGMA_BLAST); | |
| _processingMagmaBurst = false; | |
| } | |
| } | |
| else | |
| { | |
| me->GetThreatMgr().ClearFixate(); | |
| if (!_processingMagmaBurst) | |
| { | |
| _processingMagmaBurst = true; | |
| events.ScheduleEvent(EVENT_MAGMA_BLAST, 4s, PHASE_EMERGED, PHASE_EMERGED); | |
| } | |
| } | |
| } | |
| else | |
| { | |
| me->GetThreatMgr().ClearFixate(); | |
| if (_processingMagmaBurst) | |
| { | |
| events.CancelEvent(EVENT_MAGMA_BLAST); | |
| _processingMagmaBurst = false; | |
| } |
| if (Unit* meleeTarget = SelectMeleeThreatTarget()) | ||
| { | ||
| DoCastRandomTarget(SPELL_MAGMA_BLAST); | ||
| if (meleeTarget != me->GetVictim()) | ||
| AttackStart(meleeTarget); | ||
| break; |
There was a problem hiding this comment.
Same issue as in EVENT_MELEE_SCAN: calling AttackStart(meleeTarget) here does not update the threat manager’s selected victim, so the next UpdateVictim() can immediately revert to ThreatManager::GetCurrentVictim() (often the out-of-melee target you were trying to avoid). If the intent is to force melee retargeting until someone is back in range, use a threat-level mechanism (e.g. temporary FixateTarget/ClearFixate) rather than only swapping me->GetVictim().
|
Doesn't work good enough, boss keeps flickering to next melee target instead of switching fully |
ThreatManager::ReselectVictim() already prefers in-melee-range targets when the highest-threat target is out of range, so the manual threat-list scan and target switching in the script were redundant. Drop SelectMeleeThreatTarget and rely on the core threat system for target selection; the script now only owns the Magma Blast fallback (scheduled in 4s when the victim is out of melee range, cancelled if a melee target becomes available). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
...actually seems like this will do |
|
Unsure, but shadowmeld works fairly different than what you would expect when used inside instances/raids e.g it doesn't put you out of combat |
|
Pet ghoul seems to be broken, it is just evading all attacks |

Changes Proposed:
This PR proposes changes to:
This PR implements that faithfully:
EVENT_MELEE_SCAN(500ms) on the existingEventMap, scheduled inScheduleCombatEventsand auto-cleaned viaCancelEventGroup(PHASE_EMERGED)on submerge.EVENT_MAGMA_BLASTis scheduled in 4s. If a melee target appears before then, the cast is cancelled.EVENT_MAGMA_BLASTre-checks on fire (in case a melee target arrived in the same tick), targets the current victim (not random), and re-arms itself in 4s only while no one is in melee range.CanAIAttackand the customEnterEvadeModeare removed entirely so the threat system operates normally —ShouldBeOfflineonly checks visibility/CanCreatureAttack/flags, not melee range, so the threat list stays populated and Ragnaros never evades.AI-assisted Pull Requests
Important
While the use of AI tools when preparing pull requests is not prohibited, contributors must clearly disclose when such tools have been used and specify the model involved.
Issues Addressed:
SOURCE:
The changes have been validated through:
Behavior specified by @Nyeriah in review of #25326.
Tests Performed:
This PR has been:
How to Test the Changes:
.go xyz 838.31 -831.47 -232.19 409.instance setbossstate 8 3.npc add temp 12018.npc set faction 1080.npc set flag 1Known Issues and TODO List: