Show
Ignore:
Timestamp:
11/19/08 13:31:22 (17 years ago)
Author:
yumileroy
Message:

[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).

Original author: megamage
Date: 2008-10-19 14:42:12-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/Spell.cpp

    r55 r69  
    43384338    { 
    43394339        // distance from target center in checks 
    4340         float dist = m_caster->GetDistance(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ()); 
    4341         if(dist > max_range) 
     4340        if(!m_caster->IsWithinCombatDist(target, max_range)) 
    43424341            return SPELL_FAILED_OUT_OF_RANGE;               //0x5A; 
    4343         if(dist < min_range) 
     4342        if(min_range && m_caster->IsWithinCombatDist(target, min_range)) // skip this check if min_range = 0 
    43444343            return SPELL_FAILED_TOO_CLOSE; 
    43454344        if( m_caster->GetTypeId() == TYPEID_PLAYER &&