Core/Spells: Adjust range checks to GameObject targets
Port From (https://github.com/TrinityCore/TrinityCore/commit/71b58c2e6215aaf81ced9964ca10983f54fbe14c)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user