aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
authorJozef DĂșc <D0d0@users.noreply.github.com>2019-04-24 20:39:01 +0200
committerShauren <shauren.trinity@gmail.com>2021-12-02 00:39:20 +0100
commitb717603a9b3a676e800fc401f4544735287791a9 (patch)
tree31cb5689c27f4058a1b34b4a0bd27847c78836a3 /src/server/game/Spells/Spell.cpp
parent73c6c13ace28dc62bb13789e75c304426a16d5bf (diff)
Core/Object: Range check (#23179)
* Should solve #23062. All credits to @xvwyh * Remove unused variables * Remove unused variable * Cast int32 to uint32 * Remove G3D headers from core header file * Change door distance * Update GameObject.cpp Add newline * Update GameObject.h Indentation (cherry picked from commit 32e1de39a26628dcb64bc21ad415afb2ad938925)
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rw-r--r--src/server/game/Spells/Spell.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 40949c52d6b..34bcb020e4b 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -6492,9 +6492,6 @@ SpellCastResult Spell::CheckRange(bool strict) const
if (m_spellInfo->RangeEntry && m_spellInfo->RangeEntry->Flags != SPELL_RANGE_MELEE && !strict)
maxRange += std::min(MAX_SPELL_RANGE_TOLERANCE, maxRange*0.1f); // 10% but no more than MAX_SPELL_RANGE_TOLERANCE
- // save the original values before squaring them
- float origMinRange = minRange, origMaxRange = maxRange;
-
// get square values for sqr distance checks
minRange *= minRange;
maxRange *= maxRange;
@@ -6516,10 +6513,7 @@ SpellCastResult Spell::CheckRange(bool strict) const
if (GameObject* goTarget = m_targets.GetGOTarget())
{
- if (origMinRange > 0.0f && goTarget->IsInRange(m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ(), origMinRange))
- return SPELL_FAILED_OUT_OF_RANGE;
-
- if (!goTarget->IsInRange(m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ(), origMaxRange))
+ if (!goTarget->IsAtInteractDistance(m_caster->ToPlayer(), m_spellInfo))
return SPELL_FAILED_OUT_OF_RANGE;
}