diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/Spell.cpp | 14 | ||||
| -rw-r--r-- | src/game/Unit.cpp | 15 | ||||
| -rw-r--r-- | src/game/Unit.h | 1 |
3 files changed, 19 insertions, 11 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index fdedd0e7d78..5d9c81ea3fc 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2142,6 +2142,7 @@ void Spell::prepare(SpellCastTargets * targets, Aura* triggeredByAura) m_caster->SetCurrentCastedSpell( this ); m_selfContainer = &(m_caster->m_currentSpells[GetCurrentContainer()]); SendSpellStart(); + m_caster->addUnitState(UNIT_STAT_CASTING); } } @@ -2666,14 +2667,17 @@ void Spell::finish(bool ok) if(!m_caster) return; - if(IsChanneledSpell(m_spellInfo)) - m_caster->UpdateInterruptMask(); - if(m_spellState == SPELL_STATE_FINISHED) return; m_spellState = SPELL_STATE_FINISHED; + if(IsChanneledSpell(m_spellInfo)) + m_caster->UpdateInterruptMask(); + + if(!m_caster->IsNonMeleeSpellCasted(false, false, true)) + m_caster->clearUnitState(UNIT_STAT_CASTING); + //remove spell mods if (m_caster->GetTypeId() == TYPEID_PLAYER) ((Player*)m_caster)->RemoveSpellMods(this); @@ -2707,12 +2711,12 @@ void Spell::finish(bool ok) } } - if (IsMeleeAttackResetSpell()) + /*if (IsMeleeAttackResetSpell()) { m_caster->resetAttackTimer(BASE_ATTACK); if(m_caster->haveOffhandWeapon()) m_caster->resetAttackTimer(OFF_ATTACK); - } + }*/ /*if (IsRangedAttackResetSpell()) m_caster->resetAttackTimer(RANGED_ATTACK);*/ diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index d1a1c128744..0ca07ff2c1c 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -283,12 +283,15 @@ void Unit::Update( uint32 p_time ) } } - if(uint32 base_att = getAttackTimer(BASE_ATTACK)) - setAttackTimer(BASE_ATTACK, (p_time >= base_att ? 0 : base_att - p_time) ); - if(uint32 ranged_att = getAttackTimer(RANGED_ATTACK)) - setAttackTimer(RANGED_ATTACK, (p_time >= ranged_att ? 0 : ranged_att - p_time) ); - if(uint32 off_att = getAttackTimer(OFF_ATTACK)) - setAttackTimer(OFF_ATTACK, (p_time >= off_att ? 0 : off_att - p_time) ); + if(!hasUnitState(UNIT_STAT_CASTING)) + { + if(uint32 base_att = getAttackTimer(BASE_ATTACK)) + setAttackTimer(BASE_ATTACK, (p_time >= base_att ? 0 : base_att - p_time) ); + if(uint32 ranged_att = getAttackTimer(RANGED_ATTACK)) + setAttackTimer(RANGED_ATTACK, (p_time >= ranged_att ? 0 : ranged_att - p_time) ); + if(uint32 off_att = getAttackTimer(OFF_ATTACK)) + setAttackTimer(OFF_ATTACK, (p_time >= off_att ? 0 : off_att - p_time) ); + } // update abilities available only for fraction of time UpdateReactives( p_time ); diff --git a/src/game/Unit.h b/src/game/Unit.h index 6f58e8655c4..8e5d9237951 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -363,6 +363,7 @@ enum UnitState UNIT_STAT_DISTRACTED = 0x1000, UNIT_STAT_ISOLATED = 0x2000, // area auras do not affect other players UNIT_STAT_ATTACK_PLAYER = 0x4000, + UNIT_STAT_CASTING = 0x8000, UNIT_STAT_ALL_STATE = 0xffff //(UNIT_STAT_STOPPED | UNIT_STAT_MOVING | UNIT_STAT_IN_COMBAT | UNIT_STAT_IN_FLIGHT) }; |
