From 9d8a9cc7706249f13e63013a311a53573c70e62c Mon Sep 17 00:00:00 2001 From: blinkysc <37940565+blinkysc@users.noreply.github.com> Date: Mon, 9 Mar 2026 13:30:38 -0500 Subject: [PATCH] fix(Core/Spells): prevent aura rank downranking based on hostile target level (#25045) Co-authored-by: blinkysc --- src/server/game/Handlers/SpellHandler.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index 0ab498b43..bbb3a1f55 100644 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -530,14 +530,16 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) } // auto-selection buff level base at target level (in spellInfo) - if (targets.GetUnitTarget()) - { - SpellInfo const* actualSpellInfo = spellInfo->GetAuraRankForLevel(targets.GetUnitTarget()->GetLevel()); + if (spellInfo->IsPositive()) + if (Unit* target = targets.GetUnitTarget()) + if (mover->IsFriendlyTo(target)) + { + SpellInfo const* actualSpellInfo = spellInfo->GetAuraRankForLevel(target->GetLevel()); - // if rank not found then function return nullptr but in explicit cast case original spell can be casted and later failed with appropriate error message - if (actualSpellInfo) - spellInfo = actualSpellInfo; - } + // if rank not found then function return nullptr but in explicit cast case original spell can be casted and later failed with appropriate error message + if (actualSpellInfo) + spellInfo = actualSpellInfo; + } Spell* spell = new Spell(mover, spellInfo, triggerFlag, ObjectGuid::Empty, false);