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
This commit is contained in:
thenecromancer
2010-02-18 01:06:47 +01:00
parent 54d8411eb9
commit cedf706f29
5 changed files with 31 additions and 17 deletions
+21 -8
View File
@@ -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)