From ceba0aedff37680c0d5ac6e4773e59e13d867882 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Tue, 23 Nov 2021 22:48:05 -0500 Subject: [PATCH] Core/Spells: Add range checks to GameObject targets Port From (https://github.com/TrinityCore/TrinityCore/commit/abb36a1e5bbbebb7197d859cbd9c2dbf71665152) --- Source/Game/Spells/Spell.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index b7647ba38..edc9e7ff6 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -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)