Core/Spells: Fixed spell range check

Closes #17060
This commit is contained in:
Shauren authored and Aokromes committed 2016-07-20 18:26:18 +02:00
1 parent 4305129672
commit fa7026cee3
4 files changed
+63 -40

No files matched your search

+1 -7
View File
@@ -462,12 +462,6 @@ void Unit::resetAttackTimer(WeaponAttackType type)
m_attackTimer[type] = uint32(GetAttackTime(type) * m_modAttackSpeedPct[type]);
}
float Unit::GetMeleeReach() const
{
float reach = m_floatValues[UNIT_FIELD_COMBATREACH];
return reach > MIN_MELEE_REACH ? reach : MIN_MELEE_REACH;
}
bool Unit::IsWithinCombatRange(const Unit* obj, float dist2compare) const
{
if (!obj || !IsInMap(obj) || !IsInPhase(obj))
@@ -494,7 +488,7 @@ bool Unit::IsWithinMeleeRange(const Unit* obj, float dist) const
float dz = GetPositionZMinusOffset() - obj->GetPositionZMinusOffset();
float distsq = dx*dx + dy*dy + dz*dz;
float sizefactor = GetMeleeReach() + obj->GetMeleeReach();
float sizefactor = GetCombatReach() + obj->GetCombatReach() + 4.0f / 3.0f;
float maxdist = dist + sizefactor;
return distsq < maxdist * maxdist;