diff options
author | thenecromancer <none@none> | 2010-02-18 01:06:47 +0100 |
---|---|---|
committer | thenecromancer <none@none> | 2010-02-18 01:06:47 +0100 |
commit | cedf706f29fa4fdaccd9d12ee88ac47e6b4a4f16 (patch) | |
tree | 330ac4db12021614960080eaee6be61301e5add0 /src/game/Player.cpp | |
parent | 54d8411eb950e68f2abee2be9f4491d368e024fe (diff) |
Treat rune cooldowns as timers and not as remaining tick counts
Implement support for modifiers changing rune regeneration rate
Apply all spells from Improved Unholy Aura
--HG--
branch : trunk
Diffstat (limited to 'src/game/Player.cpp')
-rw-r--r-- | src/game/Player.cpp | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp index f83fc526009..2c58e8cf9e7 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -2025,6 +2025,12 @@ void Player::RegenerateAll() Regenerate(POWER_MANA); + // Runes act as cooldowns, and they don't need to send any data + if(getClass() == CLASS_DEATH_KNIGHT) + for (uint32 i = 0; i < MAX_RUNES; ++i) + if(uint32 cd = GetRuneCooldown(i)) + SetRuneCooldown(i, (cd > m_regenTimer) ? cd - m_regenTimer : 0); + if (m_regenTimerCount >= 2000) { // Not in combat or they have regeneration @@ -2038,9 +2044,6 @@ void Player::RegenerateAll() if (getClass() == CLASS_DEATH_KNIGHT) Regenerate(POWER_RUNIC_POWER); - if(getClass() == CLASS_DEATH_KNIGHT) - Regenerate(POWER_RUNE); - m_regenTimerCount -= 2000; } @@ -2049,11 +2052,6 @@ void Player::RegenerateAll() void Player::Regenerate(Powers power) { - if (power == POWER_RUNE) - for (uint32 i = 0; i < MAX_RUNES; ++i) - if (uint8 cd = GetRuneCooldown(i)) // if we have cooldown, reduce it... - SetRuneCooldown(i, cd - 1); // ... by 2 sec (because update is every 2 sec) - uint32 maxValue = GetMaxPower(power); if (!maxValue) return; @@ -21791,6 +21789,21 @@ void Player::UpdateCharmedAI() } } +uint32 Player::GetRuneBaseCooldown(uint8 index) +{ + uint8 rune = GetBaseRune(index); + uint32 cooldown = RUNE_COOLDOWN; + + AuraEffectList const& regenAura = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT); + for(AuraEffectList::const_iterator i = regenAura.begin();i != regenAura.end(); ++i) + { + if((*i)->GetMiscValue() == POWER_RUNE && (*i)->GetMiscValueB() == rune) + cooldown = cooldown*(100-(*i)->GetAmount())/100; + } + + return cooldown; +} + void Player::RemoveRunesByAuraEffect(AuraEffect const * aura) { for(uint8 i = 0; i < MAX_RUNES; ++i) |