*Apply range mod also for melee spells.
--HG-- branch : trunk
This commit is contained in:
+1
-1
@@ -4695,7 +4695,7 @@ uint8 Spell::CheckRange(bool strict)
|
|||||||
{
|
{
|
||||||
if(range_type == SPELL_RANGE_MELEE)
|
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;
|
return SPELL_FAILED_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
else if(!m_caster->IsWithinCombatRange(target, max_range))
|
else if(!m_caster->IsWithinCombatRange(target, max_range))
|
||||||
|
|||||||
+2
-2
@@ -435,7 +435,7 @@ bool Unit::IsWithinCombatRange(Unit *obj, float dist2compare) const
|
|||||||
return distsq < maxdist * maxdist;
|
return distsq < maxdist * maxdist;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Unit::IsWithinMeleeRange(Unit *obj) const
|
bool Unit::IsWithinMeleeRange(Unit *obj, float dist) const
|
||||||
{
|
{
|
||||||
if (!obj || !IsInMap(obj)) return false;
|
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 distsq = dx*dx + dy*dy + dz*dz;
|
||||||
|
|
||||||
float sizefactor = GetMeleeReach() + obj->GetMeleeReach();
|
float sizefactor = GetMeleeReach() + obj->GetMeleeReach();
|
||||||
float maxdist = MELEE_RANGE + sizefactor;
|
float maxdist = dist + sizefactor;
|
||||||
|
|
||||||
return distsq < maxdist * maxdist;
|
return distsq < maxdist * maxdist;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -774,7 +774,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
|||||||
float GetCombatReach() const { return m_floatValues[UNIT_FIELD_COMBATREACH]; }
|
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; }
|
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 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;
|
void GetRandomContactPoint( const Unit* target, float &x, float &y, float &z, float distance2dMin, float distance2dMax ) const;
|
||||||
uint32 m_extraAttacks;
|
uint32 m_extraAttacks;
|
||||||
bool m_canDualWield;
|
bool m_canDualWield;
|
||||||
|
|||||||
Reference in New Issue
Block a user