Core/Utilities: Use generic templates with AddPct, ApplyPct and CalculatePct
This commit is contained in:
1 parent
f8846cdeaf
commit
380db44583
31 files changed
+321
-357
No files matched your search
@@ -520,7 +520,7 @@ inline void KillRewarder::_RewardXP(Player* player, float rate)
|
||||
// 4.2.2. Apply auras modifying rewarded XP (SPELL_AURA_MOD_XP_PCT).
|
||||
Unit::AuraEffectList const& auras = player->GetAuraEffectsByType(SPELL_AURA_MOD_XP_PCT);
|
||||
for (Unit::AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
|
||||
AddPctN(xp, (*i)->GetAmount());
|
||||
AddPct(xp, (*i)->GetAmount());
|
||||
|
||||
// 4.2.3. Give XP to player.
|
||||
player->GiveXP(xp, _victim, _groupRate);
|
||||
@@ -1325,7 +1325,7 @@ int32 Player::getMaxTimer(MirrorTimerType timer)
|
||||
int32 UnderWaterTime = 3 * MINUTE * IN_MILLISECONDS;
|
||||
AuraEffectList const& mModWaterBreathing = GetAuraEffectsByType(SPELL_AURA_MOD_WATER_BREATHING);
|
||||
for (AuraEffectList::const_iterator i = mModWaterBreathing.begin(); i != mModWaterBreathing.end(); ++i)
|
||||
AddPctN(UnderWaterTime, (*i)->GetAmount());
|
||||
AddPct(UnderWaterTime, (*i)->GetAmount());
|
||||
return UnderWaterTime;
|
||||
}
|
||||
case FIRE_TIMER:
|
||||
@@ -2540,7 +2540,7 @@ void Player::Regenerate(Powers power)
|
||||
AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
|
||||
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
|
||||
if (Powers((*i)->GetMiscValue()) == power)
|
||||
AddPctN(addvalue, (*i)->GetAmount());
|
||||
AddPct(addvalue, (*i)->GetAmount());
|
||||
|
||||
// Butchery requires combat for this effect
|
||||
if (power != POWER_RUNIC_POWER || isInCombat())
|
||||
@@ -2620,12 +2620,12 @@ void Player::RegenerateHealth()
|
||||
{
|
||||
AuraEffectList const& mModHealthRegenPct = GetAuraEffectsByType(SPELL_AURA_MOD_HEALTH_REGEN_PERCENT);
|
||||
for (AuraEffectList::const_iterator i = mModHealthRegenPct.begin(); i != mModHealthRegenPct.end(); ++i)
|
||||
AddPctN(addvalue, (*i)->GetAmount());
|
||||
AddPct(addvalue, (*i)->GetAmount());
|
||||
|
||||
addvalue += GetTotalAuraModifier(SPELL_AURA_MOD_REGEN) * 2 * IN_MILLISECONDS / (5 * IN_MILLISECONDS);
|
||||
}
|
||||
else if (HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT))
|
||||
ApplyPctN(addvalue, GetTotalAuraModifier(SPELL_AURA_MOD_REGEN_DURING_COMBAT));
|
||||
ApplyPct(addvalue, GetTotalAuraModifier(SPELL_AURA_MOD_REGEN_DURING_COMBAT));
|
||||
|
||||
if (!IsStandState())
|
||||
addvalue *= 1.5f;
|
||||
@@ -5947,7 +5947,7 @@ void Player::UpdateRating(CombatRating cr)
|
||||
AuraEffectList const& modRatingFromStat = GetAuraEffectsByType(SPELL_AURA_MOD_RATING_FROM_STAT);
|
||||
for (AuraEffectList::const_iterator i = modRatingFromStat.begin(); i != modRatingFromStat.end(); ++i)
|
||||
if ((*i)->GetMiscValue() & (1<<cr))
|
||||
amount += int32(CalculatePctN(GetStat(Stats((*i)->GetMiscValueB())), (*i)->GetAmount()));
|
||||
amount += int32(CalculatePct(GetStat(Stats((*i)->GetMiscValueB())), (*i)->GetAmount()));
|
||||
if (amount < 0)
|
||||
amount = 0;
|
||||
SetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + cr, uint32(amount));
|
||||
@@ -7187,7 +7187,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool pvpt
|
||||
honor_f /= groupsize;
|
||||
|
||||
// apply honor multiplier from aura (not stacking-get highest)
|
||||
AddPctN(honor_f, GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HONOR_GAIN_PCT));
|
||||
AddPct(honor_f, GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HONOR_GAIN_PCT));
|
||||
}
|
||||
|
||||
honor_f *= sWorld->getRate(RATE_HONOR);
|
||||
@@ -15146,7 +15146,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
|
||||
// handle SPELL_AURA_MOD_XP_QUEST_PCT auras
|
||||
Unit::AuraEffectList const& ModXPPctAuras = GetAuraEffectsByType(SPELL_AURA_MOD_XP_QUEST_PCT);
|
||||
for (Unit::AuraEffectList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i)
|
||||
AddPctN(XP, (*i)->GetAmount());
|
||||
AddPct(XP, (*i)->GetAmount());
|
||||
|
||||
int32 moneyRew = 0;
|
||||
if (getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
|
||||
Reference in new issue
Block a user