diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index edc9e7ff6..ff8880ad0 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -5736,6 +5736,9 @@ namespace Game.Spells if (m_spellInfo.RangeEntry != null && m_spellInfo.RangeEntry.Flags != SpellRangeFlag.Melee && !strict) maxRange += Math.Min(3.0f, maxRange * 0.1f); // 10% but no more than 3.0f + // save the original values before squaring them + float origMaxRange = maxRange; + // get square values for sqr distance checks minRange *= minRange; maxRange *= maxRange; @@ -5758,10 +5761,7 @@ namespace Game.Spells GameObject goTarget = m_targets.GetGOTarget(); if (goTarget != null) { - if (m_caster.GetExactDistSq(goTarget) > maxRange) - return SpellCastResult.OutOfRange; - - if (minRange > 0.0f && m_caster.GetExactDistSq(goTarget) < minRange) + if (!goTarget.IsInRange(m_caster.GetPositionX(), m_caster.GetPositionY(), m_caster.GetPositionZ(), origMaxRange)) return SpellCastResult.OutOfRange; }