mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 17:27:36 +01:00
Core/Spells: Adjust range checks to GameObject targets
This commit is contained in:
@@ -6439,6 +6439,9 @@ SpellCastResult Spell::CheckRange(bool strict) const
|
||||
if (m_spellInfo->RangeEntry && m_spellInfo->RangeEntry->type != 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 origMaxRange = maxRange;
|
||||
|
||||
// get square values for sqr distance checks
|
||||
minRange *= minRange;
|
||||
maxRange *= maxRange;
|
||||
@@ -6460,10 +6463,7 @@ SpellCastResult Spell::CheckRange(bool strict) const
|
||||
|
||||
if (GameObject* goTarget = m_targets.GetGOTarget())
|
||||
{
|
||||
if (m_caster->GetExactDistSq(goTarget) > maxRange)
|
||||
return SPELL_FAILED_OUT_OF_RANGE;
|
||||
|
||||
if (minRange > 0.0f && m_caster->GetExactDistSq(goTarget) < minRange)
|
||||
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