mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 17:54:48 +01:00
Core/Spells: Fixed spell dest range check failing on 0 distance max range requirement even if standing directly on top of destination
This commit is contained in:
@@ -5988,12 +5988,15 @@ SpellCastResult Spell::CheckRange(bool strict)
|
||||
|
||||
maxRange += rangeMod;
|
||||
|
||||
minRange *= minRange;
|
||||
maxRange *= maxRange;
|
||||
|
||||
if (target && target != m_caster)
|
||||
{
|
||||
if (!m_caster->IsInDist(target, maxRange))
|
||||
if (m_caster->GetExactDistSq(target) > maxRange)
|
||||
return !(_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) ? SPELL_FAILED_OUT_OF_RANGE : SPELL_FAILED_DONT_REPORT;
|
||||
|
||||
if (minRange > 0.0f && m_caster->IsInDist(target, minRange))
|
||||
if (minRange > 0.0f && m_caster->GetExactDistSq(target) < minRange)
|
||||
return !(_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) ? SPELL_FAILED_OUT_OF_RANGE : SPELL_FAILED_DONT_REPORT;
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER &&
|
||||
@@ -6003,9 +6006,9 @@ SpellCastResult Spell::CheckRange(bool strict)
|
||||
|
||||
if (m_targets.HasDst() && !m_targets.HasTraj())
|
||||
{
|
||||
if (!m_caster->IsInDist(m_targets.GetDstPos(), maxRange))
|
||||
if (m_caster->GetExactDistSq(m_targets.GetDstPos()) > maxRange)
|
||||
return !(_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) ? SPELL_FAILED_OUT_OF_RANGE : SPELL_FAILED_DONT_REPORT;
|
||||
if (minRange > 0.0f && m_caster->IsInDist(m_targets.GetDstPos(), minRange))
|
||||
if (minRange > 0.0f && m_caster->GetExactDistSq(m_targets.GetDstPos()) < minRange)
|
||||
return !(_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) ? SPELL_FAILED_OUT_OF_RANGE : SPELL_FAILED_DONT_REPORT;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user