Core/Spells: Add range checks to GameObject targets

Close #23062
Patch by robinsch
This commit is contained in:
jackpoz authored and Ovahlord committed 2019-04-26 18:01:05 +02:00
1 parent 5ef08fa5e8
commit d99de4db33
1 file changed
+9
+9
View File
@@ -6458,6 +6458,15 @@ SpellCastResult Spell::CheckRange(bool strict) const
return SPELL_FAILED_UNIT_NOT_INFRONT;
}
if (GameObject* goTarget = m_targets.GetGOTarget())
{
if (m_caster->GetExactDistSq(goTarget) > maxRange)
return SPELL_FAILED_OUT_OF_RANGE;
if (minRange > 0.0f && m_caster->GetExactDistSq(goTarget) < minRange)
return SPELL_FAILED_OUT_OF_RANGE;
}
if (m_targets.HasDst() && !m_targets.HasTraj())
{
if (m_caster->GetExactDistSq(m_targets.GetDstPos()) > maxRange)