[8478] Removed dependency on getMSTime() for last mana use.

Signed-off-by: ApoC <apoc@nymfe.net>
This commit is contained in:
ApoC 2009-09-06 01:25:20 +02:00
parent dffa5d43bd
commit 71e736abc6
5 changed files with 17 additions and 15 deletions

View file

@ -1201,7 +1201,7 @@ void Player::Update( uint32 p_time )
} }
} }
if(m_regenTimer > 0) if (m_regenTimer)
{ {
if(p_time >= m_regenTimer) if(p_time >= m_regenTimer)
m_regenTimer = 0; m_regenTimer = 0;

View file

@ -3518,7 +3518,7 @@ void Spell::TakePower()
// Set the five second timer // Set the five second timer
if (powerType == POWER_MANA && m_powerCost > 0) if (powerType == POWER_MANA && m_powerCost > 0)
m_caster->SetLastManaUse(getMSTime()); m_caster->SetLastManaUse();
} }
SpellCastResult Spell::CheckRuneCost(uint32 runeCostID) SpellCastResult Spell::CheckRuneCost(uint32 runeCostID)

View file

@ -140,7 +140,7 @@ Unit::Unit()
m_baseSpellCritChance = 5; m_baseSpellCritChance = 5;
m_CombatTimer = 0; m_CombatTimer = 0;
m_lastManaUse = 0; m_lastManaUseTimer = 0;
//m_victimThreat = 0.0f; //m_victimThreat = 0.0f;
for (int i = 0; i < MAX_SPELL_SCHOOL; ++i) for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
@ -192,6 +192,14 @@ void Unit::Update( uint32 p_time )
m_Events.Update( p_time ); m_Events.Update( p_time );
_UpdateSpells( 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 // really delete auras "deleted" while processing its ApplyModify code
for(AuraList::const_iterator itr = m_deletedAuras.begin(); itr != m_deletedAuras.begin(); ++itr) for(AuraList::const_iterator itr = m_deletedAuras.begin(); itr != m_deletedAuras.begin(); ++itr)
delete *itr; delete *itr;
@ -11803,11 +11811,6 @@ Aura* Unit::GetDummyAura( uint32 spell_id ) const
return NULL; return NULL;
} }
bool Unit::IsUnderLastManaUseEffect() const
{
return getMSTimeDiff(m_lastManaUse,getMSTime()) < 5000;
}
void Unit::SetContestedPvP(Player *attackedPlayer) void Unit::SetContestedPvP(Player *attackedPlayer)
{ {
Player* player = GetCharmerOrOwnerPlayerOrPlayerItself(); Player* player = GetCharmerOrOwnerPlayerOrPlayerItself();

View file

@ -1427,15 +1427,14 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
uint32 SpellCriticalDamageBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim); uint32 SpellCriticalDamageBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim);
uint32 SpellCriticalHealingBonus(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()) if (GetTypeId() == TYPEID_PLAYER && !IsUnderLastManaUseEffect())
{
RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER); 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; } uint32 GetRegenTimer() const { return m_regenTimer; }
@ -1559,6 +1558,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
uint32 m_reactiveTimer[MAX_REACTIVE]; uint32 m_reactiveTimer[MAX_REACTIVE];
uint32 m_regenTimer; uint32 m_regenTimer;
uint32 m_lastManaUseTimer;
private: private:
bool IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura* aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const*& spellProcEvent ); 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_state; // Even derived shouldn't modify
uint32 m_CombatTimer; uint32 m_CombatTimer;
uint32 m_lastManaUse; // msecs
Spell* m_currentSpells[CURRENT_MAX_SPELL]; Spell* m_currentSpells[CURRENT_MAX_SPELL];

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "8477" #define REVISION_NR "8478"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__