[svn] Add Unit::IsWithinCombatDist function to check melee range and spell range (now range is related to the attacker's bounding_radius and target's combat_reach, not sure if both should be combat_reach).
--HG-- branch : trunk
This commit is contained in:
1 parent
e7519059c9
commit
672d304a44
5 files changed
+21
-6
No files matched your search
+2
-3
@@ -4337,10 +4337,9 @@ uint8 Spell::CheckRange(bool strict)
|
||||
if(target && target != m_caster)
|
||||
{
|
||||
// distance from target center in checks
|
||||
float dist = m_caster->GetDistance(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ());
|
||||
if(dist > max_range)
|
||||
if(!m_caster->IsWithinCombatDist(target, max_range))
|
||||
return SPELL_FAILED_OUT_OF_RANGE; //0x5A;
|
||||
if(dist < min_range)
|
||||
if(min_range && m_caster->IsWithinCombatDist(target, min_range)) // skip this check if min_range = 0
|
||||
return SPELL_FAILED_TOO_CLOSE;
|
||||
if( m_caster->GetTypeId() == TYPEID_PLAYER &&
|
||||
(m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc( M_PI, target ) )
|
||||
|
||||
Reference in new issue
Block a user