diff options
| author | megamage <none@none> | 2008-10-19 14:42:12 -0500 |
|---|---|---|
| committer | megamage <none@none> | 2008-10-19 14:42:12 -0500 |
| commit | 672d304a4478afa58d6e094b1bf53ae25b176356 (patch) | |
| tree | 6c8524a714d9885415249a20274e773be71a10d6 /src/game/Spell.cpp | |
| parent | e7519059c93476d2ea78225d3785ddbf6d607900 (diff) | |
[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
Diffstat (limited to 'src/game/Spell.cpp')
| -rw-r--r-- | src/game/Spell.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index f82f2bd29bf..3c44df10cb9 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -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 ) ) |
