mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[12184] Implement mastery scaling
Signed-off-by: Yaki Khadafi <elsoldollo@gmail.com>
This commit is contained in:
parent
66c52c748b
commit
b9772a9355
5 changed files with 70 additions and 2 deletions
|
|
@ -5382,6 +5382,9 @@ void Player::UpdateRating(CombatRating cr)
|
||||||
if (affectStats)
|
if (affectStats)
|
||||||
UpdateArmorPenetration();
|
UpdateArmorPenetration();
|
||||||
break;
|
break;
|
||||||
|
case CR_MASTERY:
|
||||||
|
UpdateMasteryAuras();
|
||||||
|
break;
|
||||||
// deprecated
|
// deprecated
|
||||||
case CR_HIT_TAKEN_MELEE:
|
case CR_HIT_TAKEN_MELEE:
|
||||||
case CR_HIT_TAKEN_RANGED:
|
case CR_HIT_TAKEN_RANGED:
|
||||||
|
|
|
||||||
|
|
@ -1847,6 +1847,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
void UpdateArmorPenetration();
|
void UpdateArmorPenetration();
|
||||||
void ApplyManaRegenBonus(int32 amount, bool apply);
|
void ApplyManaRegenBonus(int32 amount, bool apply);
|
||||||
void UpdateManaRegen();
|
void UpdateManaRegen();
|
||||||
|
void UpdateMasteryAuras();
|
||||||
|
|
||||||
ObjectGuid const& GetLootGuid() const { return m_lootGuid; }
|
ObjectGuid const& GetLootGuid() const { return m_lootGuid; }
|
||||||
void SetLootGuid(ObjectGuid const& guid) { m_lootGuid = guid; }
|
void SetLootGuid(ObjectGuid const& guid) { m_lootGuid = guid; }
|
||||||
|
|
|
||||||
|
|
@ -781,6 +781,70 @@ void Player::UpdateManaRegen()
|
||||||
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, power_regen_mp5 + power_regen);
|
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, power_regen_mp5 + power_regen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::UpdateMasteryAuras()
|
||||||
|
{
|
||||||
|
if (!HasAuraType(SPELL_AURA_MASTERY))
|
||||||
|
{
|
||||||
|
SetFloatValue(PLAYER_MASTERY, 0.0f);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float masteryValue = GetTotalAuraModifier(SPELL_AURA_MASTERY) + GetRatingBonusValue(CR_MASTERY);
|
||||||
|
SetFloatValue(PLAYER_MASTERY, masteryValue);
|
||||||
|
|
||||||
|
std::vector<uint32> const* masterySpells = GetTalentTreeMasterySpells(m_talentsPrimaryTree[m_activeSpec]);
|
||||||
|
if (!masterySpells)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (int i = 0; i < masterySpells->size(); ++i)
|
||||||
|
{
|
||||||
|
SpellAuraHolder* holder = GetSpellAuraHolder(masterySpells->at(i));
|
||||||
|
if (!holder)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
SpellEntry const* spellEntry = holder->GetSpellProto();
|
||||||
|
|
||||||
|
// Find mastery scaling coef
|
||||||
|
int32 masteryBonus = 0;
|
||||||
|
for (uint32 j = 0; j < MAX_EFFECT_INDEX; ++j)
|
||||||
|
{
|
||||||
|
SpellEffectEntry const * effectEntry = spellEntry->GetSpellEffect(SpellEffectIndex(j));
|
||||||
|
if (!effectEntry)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// mastery scaling coef is stored in dummy aura, except 77215 (Potent Afflictions, zero effect)
|
||||||
|
// and 76808 (Executioner, not stored at all)
|
||||||
|
uint32 bp = effectEntry->CalculateSimpleValue();
|
||||||
|
if (holder->GetId() == 76808)
|
||||||
|
bp = 250;
|
||||||
|
|
||||||
|
if (!bp)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
masteryBonus = bp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!masteryBonus)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// update aura modifiers
|
||||||
|
for (uint32 j = 0; j < MAX_EFFECT_INDEX; ++j)
|
||||||
|
{
|
||||||
|
Aura* aura = holder->GetAuraByEffectIndex(SpellEffectIndex(j));
|
||||||
|
if (!aura)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (aura->GetSpellProto()->CalculateSimpleValue(SpellEffectIndex(j)))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
aura->ApplyModifier(false, false);
|
||||||
|
aura->GetModifier()->m_amount = int32(masteryValue * masteryBonus / 100.0f);
|
||||||
|
aura->ApplyModifier(true, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Player::_ApplyAllStatBonuses()
|
void Player::_ApplyAllStatBonuses()
|
||||||
{
|
{
|
||||||
SetCanModifyStats(false);
|
SetCanModifyStats(false);
|
||||||
|
|
|
||||||
|
|
@ -335,7 +335,7 @@ enum UnitMods
|
||||||
UNIT_MOD_STAT_INTELLECT,
|
UNIT_MOD_STAT_INTELLECT,
|
||||||
UNIT_MOD_STAT_SPIRIT,
|
UNIT_MOD_STAT_SPIRIT,
|
||||||
UNIT_MOD_HEALTH,
|
UNIT_MOD_HEALTH,
|
||||||
UNIT_MOD_MANA, // UNIT_MOD_MANA..UNIT_MOD_RUNIC_POWER must be in existing order, it's accessed by index values of Powers enum.
|
UNIT_MOD_MANA, // UNIT_MOD_MANA..UNIT_MOD_ALTERNATIVE must be in existing order, it's accessed by index values of Powers enum.
|
||||||
UNIT_MOD_RAGE,
|
UNIT_MOD_RAGE,
|
||||||
UNIT_MOD_FOCUS,
|
UNIT_MOD_FOCUS,
|
||||||
UNIT_MOD_ENERGY,
|
UNIT_MOD_ENERGY,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "12183"
|
#define REVISION_NR "12184"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue