mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Spells: Add range checks to GameObject targets
Close #23062
Patch by robinsch
(cherry picked from commit 76cc94f325)
This commit is contained in:
@@ -6512,6 +6512,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)
|
||||
|
||||
Reference in New Issue
Block a user