mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
Core/Spells: Adjust range checks to GameObject targets
(cherry picked from commit 72052aa9a5)
This commit is contained in:
@@ -6494,7 +6494,7 @@ SpellCastResult Spell::CheckRange(bool strict) const
|
||||
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 origMaxRange = maxRange;
|
||||
float origMinRange = minRange, origMaxRange = maxRange;
|
||||
|
||||
// get square values for sqr distance checks
|
||||
minRange *= minRange;
|
||||
@@ -6517,6 +6517,9 @@ 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))
|
||||
return SPELL_FAILED_OUT_OF_RANGE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user