Core/Spells: Add range checks to GameObject targets

Port From (https://github.com/TrinityCore/TrinityCore/commit/abb36a1e5bbbebb7197d859cbd9c2dbf71665152)
This commit is contained in:
hondacrx
2021-11-23 22:48:05 -05:00
parent 195fe6316e
commit ceba0aedff
+10
View File
@@ -5755,6 +5755,16 @@ namespace Game.Spells
return SpellCastResult.UnitNotInfront;
}
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)
return SpellCastResult.OutOfRange;
}
if (m_targets.HasDst() && !m_targets.HasTraj())
{
if (m_caster.GetExactDistSq(m_targets.GetDstPos()) > maxRange)