aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorxinef1 <w.szyszko2@gmail.com>2017-01-27 20:50:25 +0100
committerShauren <shauren.trinity@gmail.com>2017-01-27 20:50:25 +0100
commit66dc97bb27382f3c0935ed6ca1abe91ceba6058d (patch)
tree1a25f6ca2dbfdf6338de5518790c28e8950a7921 /src
parent587786ce6661fb4741ff623458b3c6c590f642fe (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)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Spells/Spell.cpp7
-rw-r--r--src/server/game/Spells/Spell.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 7e13cd371ea..9c0d6e9fa8e 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -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;
diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h
index 7ef73d0801c..e2508da33e0 100644
--- a/src/server/game/Spells/Spell.h
+++ b/src/server/game/Spells/Spell.h
@@ -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
{