diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 66f49eea8..95771f77e 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1201,7 +1201,7 @@ void Player::Update( uint32 p_time ) } } - if(m_regenTimer > 0) + if (m_regenTimer) { if(p_time >= m_regenTimer) m_regenTimer = 0; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index f917dfd6e..8d63d569d 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -3518,7 +3518,7 @@ void Spell::TakePower() // Set the five second timer if (powerType == POWER_MANA && m_powerCost > 0) - m_caster->SetLastManaUse(getMSTime()); + m_caster->SetLastManaUse(); } SpellCastResult Spell::CheckRuneCost(uint32 runeCostID) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 9fdc3f158..2725018f0 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -140,7 +140,7 @@ Unit::Unit() m_baseSpellCritChance = 5; m_CombatTimer = 0; - m_lastManaUse = 0; + m_lastManaUseTimer = 0; //m_victimThreat = 0.0f; for (int i = 0; i < MAX_SPELL_SCHOOL; ++i) @@ -192,6 +192,14 @@ void Unit::Update( uint32 p_time ) m_Events.Update( p_time ); _UpdateSpells( p_time ); + if (m_lastManaUseTimer) + { + if (p_time >= m_lastManaUseTimer) + m_lastManaUseTimer = 0; + else + m_lastManaUseTimer -= p_time; + } + // really delete auras "deleted" while processing its ApplyModify code for(AuraList::const_iterator itr = m_deletedAuras.begin(); itr != m_deletedAuras.begin(); ++itr) delete *itr; @@ -11803,11 +11811,6 @@ Aura* Unit::GetDummyAura( uint32 spell_id ) const return NULL; } -bool Unit::IsUnderLastManaUseEffect() const -{ - return getMSTimeDiff(m_lastManaUse,getMSTime()) < 5000; -} - void Unit::SetContestedPvP(Player *attackedPlayer) { Player* player = GetCharmerOrOwnerPlayerOrPlayerItself(); diff --git a/src/game/Unit.h b/src/game/Unit.h index 41c037990..20c175471 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1427,15 +1427,14 @@ class MANGOS_DLL_SPEC Unit : public WorldObject uint32 SpellCriticalDamageBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim); uint32 SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim); - void SetLastManaUse(uint32 spellCastTime) + void SetLastManaUse() { if (GetTypeId() == TYPEID_PLAYER && !IsUnderLastManaUseEffect()) - { RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER); - } - m_lastManaUse = spellCastTime; + + m_lastManaUseTimer = 5000; } - bool IsUnderLastManaUseEffect() const; + bool IsUnderLastManaUseEffect() const { return m_lastManaUseTimer; } uint32 GetRegenTimer() const { return m_regenTimer; } @@ -1559,6 +1558,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject uint32 m_reactiveTimer[MAX_REACTIVE]; uint32 m_regenTimer; + uint32 m_lastManaUseTimer; private: bool IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura* aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const*& spellProcEvent ); @@ -1571,7 +1571,6 @@ class MANGOS_DLL_SPEC Unit : public WorldObject uint32 m_state; // Even derived shouldn't modify uint32 m_CombatTimer; - uint32 m_lastManaUse; // msecs Spell* m_currentSpells[CURRENT_MAX_SPELL]; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e3c6ae35b..9a5b605e1 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8477" + #define REVISION_NR "8478" #endif // __REVISION_NR_H__