mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-21 15:27:47 -04:00
Core/Utilities: Use generic templates with AddPct, ApplyPct and CalculatePct
This commit is contained in:
@@ -213,7 +213,7 @@ void Player::UpdateArmor()
|
||||
for (AuraEffectList::const_iterator i = mResbyIntellect.begin(); i != mResbyIntellect.end(); ++i)
|
||||
{
|
||||
if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
|
||||
value += CalculatePctN(GetStat(Stats((*i)->GetMiscValueB())), (*i)->GetAmount());
|
||||
value += CalculatePct(GetStat(Stats((*i)->GetMiscValueB())), (*i)->GetAmount());
|
||||
}
|
||||
|
||||
value *= GetModifierValue(unitMod, TOTAL_PCT);
|
||||
@@ -359,7 +359,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
|
||||
switch (aurEff->GetEffIndex())
|
||||
{
|
||||
case 0: // Predatory Strikes (effect 0)
|
||||
mLevelMult = CalculatePctN(1.0f, aurEff->GetAmount());
|
||||
mLevelMult = CalculatePct(1.0f, aurEff->GetAmount());
|
||||
break;
|
||||
case 1: // Predatory Strikes (effect 1)
|
||||
if (Item* mainHand = m_items[EQUIPMENT_SLOT_MAINHAND])
|
||||
@@ -369,7 +369,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
|
||||
if (!proto)
|
||||
continue;
|
||||
|
||||
weapon_bonus = CalculatePctN(float(proto->getFeralBonus()), aurEff->GetAmount());
|
||||
weapon_bonus = CalculatePct(float(proto->getFeralBonus()), aurEff->GetAmount());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -421,14 +421,14 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
|
||||
{
|
||||
AuraEffectList const& mRAPbyStat = GetAuraEffectsByType(SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT);
|
||||
for (AuraEffectList::const_iterator i = mRAPbyStat.begin(); i != mRAPbyStat.end(); ++i)
|
||||
attPowerMod += CalculatePctN(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetAmount());
|
||||
attPowerMod += CalculatePct(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetAmount());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AuraEffectList const& mAPbyStat = GetAuraEffectsByType(SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT);
|
||||
for (AuraEffectList::const_iterator i = mAPbyStat.begin(); i != mAPbyStat.end(); ++i)
|
||||
attPowerMod += CalculatePctN(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetAmount());
|
||||
attPowerMod += CalculatePct(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetAmount());
|
||||
|
||||
AuraEffectList const& mAPbyArmor = GetAuraEffectsByType(SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR);
|
||||
for (AuraEffectList::const_iterator iter = mAPbyArmor.begin(); iter != mAPbyArmor.end(); ++iter)
|
||||
@@ -856,7 +856,7 @@ void Player::UpdateManaRegen()
|
||||
int32 modManaRegenInterrupt = GetTotalAuraModifier(SPELL_AURA_MOD_MANA_REGEN_INTERRUPT);
|
||||
if (modManaRegenInterrupt > 100)
|
||||
modManaRegenInterrupt = 100;
|
||||
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, power_regen_mp5 + CalculatePctN(power_regen, modManaRegenInterrupt));
|
||||
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, power_regen_mp5 + CalculatePct(power_regen, modManaRegenInterrupt));
|
||||
|
||||
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, power_regen_mp5 + power_regen);
|
||||
}
|
||||
@@ -1098,12 +1098,12 @@ bool Guardian::UpdateStats(Stats stat)
|
||||
if (aurEff)
|
||||
{
|
||||
SpellInfo const* spellInfo = aurEff->GetSpellInfo(); // Then get the SpellProto and add the dummy effect value
|
||||
AddPctN(mod, spellInfo->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
|
||||
AddPct(mod, spellInfo->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
|
||||
}
|
||||
// Glyph of the Ghoul
|
||||
aurEff = owner->GetAuraEffect(58686, 0);
|
||||
if (aurEff)
|
||||
mod += CalculatePctN(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod
|
||||
mod += CalculatePct(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod
|
||||
ownersBonus = float(owner->GetStat(stat)) * mod;
|
||||
value += ownersBonus;
|
||||
}
|
||||
@@ -1111,7 +1111,7 @@ bool Guardian::UpdateStats(Stats stat)
|
||||
{
|
||||
if (owner->getClass() == CLASS_WARLOCK && isPet())
|
||||
{
|
||||
ownersBonus = CalculatePctN(owner->GetStat(STAT_STAMINA), 75);
|
||||
ownersBonus = CalculatePct(owner->GetStat(STAT_STAMINA), 75);
|
||||
value += ownersBonus;
|
||||
}
|
||||
else
|
||||
@@ -1126,7 +1126,7 @@ bool Guardian::UpdateStats(Stats stat)
|
||||
if (itr != ToPet()->m_spells.end()) // If pet has Wild Hunt
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
|
||||
AddPctN(mod, spellInfo->Effects[EFFECT_0].CalcValue());
|
||||
AddPct(mod, spellInfo->Effects[EFFECT_0].CalcValue());
|
||||
}
|
||||
}
|
||||
ownersBonus = float(owner->GetStat(stat)) * mod;
|
||||
@@ -1138,7 +1138,7 @@ bool Guardian::UpdateStats(Stats stat)
|
||||
{
|
||||
if (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE)
|
||||
{
|
||||
ownersBonus = CalculatePctN(owner->GetStat(stat), 30);
|
||||
ownersBonus = CalculatePct(owner->GetStat(stat), 30);
|
||||
value += ownersBonus;
|
||||
}
|
||||
}
|
||||
@@ -1190,7 +1190,7 @@ void Guardian::UpdateResistances(uint32 school)
|
||||
|
||||
// hunter and warlock pets gain 40% of owner's resistance
|
||||
if (isPet())
|
||||
value += float(CalculatePctN(m_owner->GetResistance(SpellSchools(school)), 40));
|
||||
value += float(CalculatePct(m_owner->GetResistance(SpellSchools(school)), 40));
|
||||
|
||||
SetResistance(SpellSchools(school), int32(value));
|
||||
}
|
||||
@@ -1206,7 +1206,7 @@ void Guardian::UpdateArmor()
|
||||
|
||||
// hunter and warlock pets gain 35% of owner's armor value
|
||||
if (isPet())
|
||||
bonus_armor = float(CalculatePctN(m_owner->GetArmor(), 35));
|
||||
bonus_armor = float(CalculatePct(m_owner->GetArmor(), 35));
|
||||
|
||||
value = GetModifierValue(unitMod, BASE_VALUE);
|
||||
value *= GetModifierValue(unitMod, BASE_PCT);
|
||||
@@ -1296,7 +1296,7 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged)
|
||||
if (itr != ToPet()->m_spells.end()) // If pet has Wild Hunt
|
||||
{
|
||||
SpellInfo const* sProto = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
|
||||
mod += CalculatePctN(1.0f, sProto->Effects[1].CalcValue());
|
||||
mod += CalculatePct(1.0f, sProto->Effects[1].CalcValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1414,8 +1414,8 @@ void Guardian::UpdateDamagePhysical(WeaponAttackType attType)
|
||||
{
|
||||
case 61682:
|
||||
case 61683:
|
||||
AddPctN(mindamage, -(*itr)->GetAmount());
|
||||
AddPctN(maxdamage, -(*itr)->GetAmount());
|
||||
AddPct(mindamage, -(*itr)->GetAmount());
|
||||
AddPct(maxdamage, -(*itr)->GetAmount());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user