Changeset 231 for trunk

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

[svn] Add UNIT_STAT_CASTING, and use it to update attack timer as test.

Original author: megamage
Date: 2008-11-14 17:42:00-06:00

Location:
trunk/src/game
Files:
3 modified

Legend:

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

    r229 r231  
    21432143        m_selfContainer = &(m_caster->m_currentSpells[GetCurrentContainer()]); 
    21442144        SendSpellStart(); 
     2145        m_caster->addUnitState(UNIT_STAT_CASTING); 
    21452146    } 
    21462147} 
     
    26672668        return; 
    26682669 
     2670    if(m_spellState == SPELL_STATE_FINISHED) 
     2671        return; 
     2672 
     2673    m_spellState = SPELL_STATE_FINISHED; 
     2674 
    26692675    if(IsChanneledSpell(m_spellInfo)) 
    26702676        m_caster->UpdateInterruptMask(); 
    26712677 
    2672     if(m_spellState == SPELL_STATE_FINISHED) 
    2673         return; 
    2674  
    2675     m_spellState = SPELL_STATE_FINISHED; 
     2678    if(!m_caster->IsNonMeleeSpellCasted(false, false, true)) 
     2679        m_caster->clearUnitState(UNIT_STAT_CASTING); 
    26762680 
    26772681    //remove spell mods 
     
    27082712    } 
    27092713 
    2710     if (IsMeleeAttackResetSpell()) 
     2714    /*if (IsMeleeAttackResetSpell()) 
    27112715    { 
    27122716        m_caster->resetAttackTimer(BASE_ATTACK); 
    27132717        if(m_caster->haveOffhandWeapon()) 
    27142718            m_caster->resetAttackTimer(OFF_ATTACK); 
    2715     } 
     2719    }*/ 
    27162720 
    27172721    /*if (IsRangedAttackResetSpell()) 
  • trunk/src/game/Unit.cpp

    r229 r231  
    284284    } 
    285285 
    286     if(uint32 base_att = getAttackTimer(BASE_ATTACK)) 
    287         setAttackTimer(BASE_ATTACK, (p_time >= base_att ? 0 : base_att - p_time) ); 
    288     if(uint32 ranged_att = getAttackTimer(RANGED_ATTACK)) 
    289         setAttackTimer(RANGED_ATTACK, (p_time >= ranged_att ? 0 : ranged_att - p_time) ); 
    290     if(uint32 off_att = getAttackTimer(OFF_ATTACK)) 
    291         setAttackTimer(OFF_ATTACK, (p_time >= off_att ? 0 : off_att - p_time) ); 
     286    if(!hasUnitState(UNIT_STAT_CASTING)) 
     287    { 
     288        if(uint32 base_att = getAttackTimer(BASE_ATTACK)) 
     289            setAttackTimer(BASE_ATTACK, (p_time >= base_att ? 0 : base_att - p_time) ); 
     290        if(uint32 ranged_att = getAttackTimer(RANGED_ATTACK)) 
     291            setAttackTimer(RANGED_ATTACK, (p_time >= ranged_att ? 0 : ranged_att - p_time) ); 
     292        if(uint32 off_att = getAttackTimer(OFF_ATTACK)) 
     293            setAttackTimer(OFF_ATTACK, (p_time >= off_att ? 0 : off_att - p_time) ); 
     294    } 
    292295 
    293296    // update abilities available only for fraction of time 
  • trunk/src/game/Unit.h

    r229 r231  
    364364    UNIT_STAT_ISOLATED        = 0x2000,                     // area auras do not affect other players 
    365365    UNIT_STAT_ATTACK_PLAYER   = 0x4000, 
     366    UNIT_STAT_CASTING         = 0x8000, 
    366367    UNIT_STAT_ALL_STATE       = 0xffff                      //(UNIT_STAT_STOPPED | UNIT_STAT_MOVING | UNIT_STAT_IN_COMBAT | UNIT_STAT_IN_FLIGHT) 
    367368};