Core/Players: Fixed setting rune regen fields, thanks Lordron for noticing

This commit is contained in:
Shauren
2012-08-19 15:42:05 +02:00
parent 56495da72e
commit 69cfc0f7bf
3 changed files with 10 additions and 20 deletions

View File

@@ -23805,18 +23805,15 @@ void Player::UpdateCharmedAI()
}
}
uint32 Player::GetRuneBaseCooldown(uint8 index)
uint32 Player::GetRuneTypeBaseCooldown(RuneType runeType) const
{
uint8 rune = GetBaseRune(index);
uint32 cooldown = RUNE_BASE_COOLDOWN;
float cooldown = RUNE_BASE_COOLDOWN;
float hastePct = 0.0f;
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_RUNES && (*i)->GetMiscValueB() == rune)
cooldown = cooldown*(100-(*i)->GetAmount())/100;
}
if ((*i)->GetMiscValue() == POWER_RUNES && (*i)->GetMiscValueB() == runeType)
cooldown *= 1.0f - (*i)->GetAmount() / 100.0f;
// Runes cooldown are now affected by player's haste from equipment ...
hastePct = GetRatingBonusValue(CR_HASTE_MELEE);
@@ -23920,7 +23917,7 @@ void Player::InitRunes()
m_runes->SetRuneState(i);
}
for (uint8 i = 0; i < MAX_RUNES; ++i)
for (uint8 i = 0; i < NUM_RUNE_TYPES; ++i)
SetFloatValue(PLAYER_RUNE_REGEN_1 + i, 0.1f); // set a base regen timer equal to 10 sec
}

View File

@@ -2508,7 +2508,8 @@ class Player : public Unit, public GridObject<Player>
RuneType GetBaseRune(uint8 index) const { return RuneType(m_runes->runes[index].BaseRune); }
RuneType GetCurrentRune(uint8 index) const { return RuneType(m_runes->runes[index].CurrentRune); }
uint32 GetRuneCooldown(uint8 index) const { return m_runes->runes[index].Cooldown; }
uint32 GetRuneBaseCooldown(uint8 index);
uint32 GetRuneBaseCooldown(uint8 index) const { return GetRuneTypeBaseCooldown(GetBaseRune(index)); }
uint32 GetRuneTypeBaseCooldown(RuneType runeType) const;
bool IsBaseRuneSlotsOnCooldown(RuneType runeType) const;
RuneType GetLastUsedRune() { return m_runes->lastUsedRune; }
void SetLastUsedRune(RuneType type) { m_runes->lastUsedRune = type; }

View File

@@ -730,17 +730,9 @@ void Player::UpdateRuneRegen(RuneType rune)
void Player::UpdateAllRunesRegen()
{
uint32 cooldown = 0;
for (uint8 i = 0; i < MAX_RUNES; ++i)
{
cooldown = GetRuneBaseCooldown(i);
if (cooldown)
{
float regen = float(1 * IN_MILLISECONDS) / float(cooldown);
SetFloatValue(PLAYER_RUNE_REGEN_1 + i, regen);
}
}
for (uint8 i = 0; i < NUM_RUNE_TYPES; ++i)
if (uint32 cooldown = GetRuneTypeBaseCooldown(RuneType(i)))
SetFloatValue(PLAYER_RUNE_REGEN_1 + i, float(1 * IN_MILLISECONDS) / float(cooldown));
}
void Player::_ApplyAllStatBonuses()