Core/Spells: Added very little tolerance level to completed casts to ensure that spell cast at target standing at the max possible range is finished properly even if target moves a little (#18969)

(cherry-picked from 66dc97bb27)
This commit is contained in:
xinef1
2017-01-27 20:50:25 +01:00
committed by Shauren
parent 49cd81a1c9
commit 2b20cb5a64
2 changed files with 8 additions and 0 deletions

View File

@@ -2892,6 +2892,9 @@ bool Spell::UpdateChanneledTargetList()
range = m_spellInfo->GetMaxRange(m_spellInfo->IsPositive());
if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
// add little tolerance level
range += std::min(MAX_SPELL_RANGE_TOLERANCE, range*0.1f); // 10% but no more than MAX_SPELL_RANGE_TOLERANCE
}
for (std::vector<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
@@ -6125,6 +6128,10 @@ SpellCastResult Spell::CheckRange(bool strict) const
float minRange, maxRange;
std::tie(minRange, maxRange) = GetMinMaxRange(strict);
// dont check max_range to strictly after cast
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
// get square values for sqr distance checks
minRange *= minRange;
maxRange *= maxRange;

View File

@@ -65,6 +65,7 @@ enum TriggerCastFlags : uint32;
enum WeaponAttackType : uint8;
#define SPELL_CHANNEL_UPDATE_INTERVAL (1 * IN_MILLISECONDS)
#define MAX_SPELL_RANGE_TOLERANCE 3.0f
enum SpellCastFlags
{