diff options
| author | xinef1 <w.szyszko2@gmail.com> | 2017-01-27 20:50:25 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2018-12-09 14:18:42 +0100 |
| commit | 2b20cb5a64d35ec0db874a94b927d78659c2f469 (patch) | |
| tree | c4dcad38f31cfe7d7f48e018924b23ce5adda72e | |
| parent | 49cd81a1c98f6fc219d12f401846b96d29fda637 (diff) | |
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 66dc97bb27382f3c0935ed6ca1abe91ceba6058d)
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 7 | ||||
| -rw-r--r-- | src/server/game/Spells/Spell.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 25551136255..8cc2a1b7f6d 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -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; diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index 88ca04bd7a8..45b012a82e6 100644 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -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 { |
