From 6ae530a740d55b3b2e20d9977c8fe0370553ad0c Mon Sep 17 00:00:00 2001 From: hondacrx Date: Mon, 29 Nov 2021 14:24:28 -0500 Subject: [PATCH] Core/Spells: Adjust range checks to GameObject targets Port From (https://github.com/TrinityCore/TrinityCore/commit/7a2ef474952e6d57f4d8282a8cd3d068dcf3f38c) --- Source/Game/Spells/Spell.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index ff8880ad0..7cfc9f7d2 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -5737,6 +5737,7 @@ namespace Game.Spells maxRange += Math.Min(3.0f, maxRange * 0.1f); // 10% but no more than 3.0f // save the original values before squaring them + float origMinRange = minRange; float origMaxRange = maxRange; // get square values for sqr distance checks @@ -5761,6 +5762,9 @@ namespace Game.Spells GameObject goTarget = m_targets.GetGOTarget(); if (goTarget != null) { + if (origMinRange > 0.0f && goTarget.IsInRange(m_caster.GetPositionX(), m_caster.GetPositionY(), m_caster.GetPositionZ(), origMinRange)) + return SpellCastResult.OutOfRange; + if (!goTarget.IsInRange(m_caster.GetPositionX(), m_caster.GetPositionY(), m_caster.GetPositionZ(), origMaxRange)) return SpellCastResult.OutOfRange; }