fix(Core/Spells): prevent aura rank downranking based on hostile target level (#25045)

Co-authored-by: blinkysc <blinkysc@users.noreply.github.com>
This commit is contained in:
blinkysc
2026-03-09 13:30:38 -05:00
committed by GitHub
parent 26d006ebd2
commit 9d8a9cc770

View File

@@ -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);