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)

This commit is contained in:
xinef1
2017-01-27 20:50:25 +01:00
committed by Shauren
parent 587786ce66
commit 66dc97bb27
2 changed files with 8 additions and 0 deletions

View File

@@ -2833,6 +2833,9 @@ bool Spell::UpdateChanneledTargetList()
range = m_spellInfo->GetMaxRange(m_spellInfo->IsPositive());
if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod<SPELLMOD_RANGE>(m_spellInfo->Id, 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::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
@@ -5981,6 +5984,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->type != 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

@@ -35,6 +35,7 @@ class SpellScript;
class ByteBuffer;
#define SPELL_CHANNEL_UPDATE_INTERVAL (1 * IN_MILLISECONDS)
#define MAX_SPELL_RANGE_TOLERANCE 3.0f
enum SpellCastFlags
{