diff options
| -rw-r--r-- | src/game/Spell.cpp | 2 | ||||
| -rw-r--r-- | src/game/Unit.cpp | 4 | ||||
| -rw-r--r-- | src/game/Unit.h | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 307c7770cae..53261ef03ab 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4695,7 +4695,7 @@ uint8 Spell::CheckRange(bool strict) { if(range_type == SPELL_RANGE_MELEE) { - if(!m_caster->IsWithinMeleeRange(target)) + if(!m_caster->IsWithinMeleeRange(target, max_range - 2*MIN_MELEE_REACH)) return SPELL_FAILED_OUT_OF_RANGE; } else if(!m_caster->IsWithinCombatRange(target, max_range)) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 862c9a6c2eb..36ba1af2e3c 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -435,7 +435,7 @@ bool Unit::IsWithinCombatRange(Unit *obj, float dist2compare) const return distsq < maxdist * maxdist; } -bool Unit::IsWithinMeleeRange(Unit *obj) const +bool Unit::IsWithinMeleeRange(Unit *obj, float dist) const { if (!obj || !IsInMap(obj)) return false; @@ -445,7 +445,7 @@ bool Unit::IsWithinMeleeRange(Unit *obj) const float distsq = dx*dx + dy*dy + dz*dz; float sizefactor = GetMeleeReach() + obj->GetMeleeReach(); - float maxdist = MELEE_RANGE + sizefactor; + float maxdist = dist + sizefactor; return distsq < maxdist * maxdist; } diff --git a/src/game/Unit.h b/src/game/Unit.h index 50eebabdd6d..1dfa34dc720 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -774,7 +774,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject float GetCombatReach() const { return m_floatValues[UNIT_FIELD_COMBATREACH]; } float GetMeleeReach() const { float reach = m_floatValues[UNIT_FIELD_COMBATREACH]; return reach > MIN_MELEE_REACH ? reach : MIN_MELEE_REACH; } bool IsWithinCombatRange(Unit *obj, float dist2compare) const; - bool IsWithinMeleeRange(Unit *obj) const; + bool IsWithinMeleeRange(Unit *obj, float dist = MELEE_RANGE) const; void GetRandomContactPoint( const Unit* target, float &x, float &y, float &z, float distance2dMin, float distance2dMax ) const; uint32 m_extraAttacks; bool m_canDualWield; |
