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