Core/StatSystem: Implemented mastery.

This commit is contained in:
Shauren
2013-05-12 17:56:37 +02:00
parent 1c91680f9c
commit 64f0e99958
10 changed files with 364 additions and 147 deletions
@@ -488,6 +488,44 @@ void Player::UpdateAllCritPercentages()
UpdateCritPercentage(RANGED_ATTACK);
}
void Player::UpdateMastery()
{
if (!CanUseMastery())
{
SetFloatValue(PLAYER_MASTERY, 0.0f);
return;
}
float value = GetTotalAuraModifier(SPELL_AURA_MASTERY);
value += GetRatingBonusValue(CR_MASTERY);
SetFloatValue(PLAYER_MASTERY, value);
TalentTabEntry const* talentTab = sTalentTabStore.LookupEntry(GetPrimaryTalentTree(GetActiveSpec()));
if (!talentTab)
return;
for (uint32 i = 0; i < MAX_MASTERY_SPELLS; ++i)
{
if (!talentTab->MasterySpellId[i])
continue;
if (Aura* aura = GetAura(talentTab->MasterySpellId[i]))
{
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
if (!aura->HasEffect(j))
continue;
float mult = aura->GetSpellInfo()->Effects[j].BonusMultiplier;
if (G3D::fuzzyEq(mult, 0.0f))
continue;
aura->GetEffect(j)->ChangeAmount(int32(value * aura->GetSpellInfo()->Effects[j].BonusMultiplier));
}
}
}
}
const float m_diminishing_k[MAX_CLASSES] =
{
0.9560f, // Warrior