Core/Entities: Replace existing GetAuraEffectsByType + iteration uses with proper helper functions

This commit is contained in:
ariel-
2016-12-13 02:06:07 -03:00
parent 8b0122e7ed
commit 3a52ad8d38
10 changed files with 125 additions and 237 deletions
+8 -10
View File
@@ -837,17 +837,17 @@ void Player::UpdateExpertise(WeaponAttackType attack)
int32 expertise = int32(GetRatingBonusValue(CR_EXPERTISE));
Item* weapon = GetWeaponForAttack(attack, true);
AuraEffectList const& expAuras = GetAuraEffectsByType(SPELL_AURA_MOD_EXPERTISE);
for (AuraEffectList::const_iterator itr = expAuras.begin(); itr != expAuras.end(); ++itr)
expertise += GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE, [weapon](AuraEffect const* aurEff) -> bool
{
// item neutral spell
if ((*itr)->GetSpellInfo()->EquippedItemClass == -1)
expertise += (*itr)->GetAmount();
if (aurEff->GetSpellInfo()->EquippedItemClass == -1)
return true;
// item dependent spell
else if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellInfo()))
expertise += (*itr)->GetAmount();
}
else if (weapon && weapon->IsFitToSpellRequirements(aurEff->GetSpellInfo()))
return true;
return false;
});
if (expertise < 0)
expertise = 0;
@@ -890,9 +890,7 @@ void Player::UpdateManaRegen()
// Get bonus from SPELL_AURA_MOD_MANA_REGEN_FROM_STAT aura
AuraEffectList const& regenAura = GetAuraEffectsByType(SPELL_AURA_MOD_MANA_REGEN_FROM_STAT);
for (AuraEffectList::const_iterator i = regenAura.begin(); i != regenAura.end(); ++i)
{
power_regen_mp5 += GetStat(Stats((*i)->GetMiscValue())) * (*i)->GetAmount() / 500.0f;
}
// Set regen rate in cast state apply only on spirit based regen
int32 modManaRegenInterrupt = GetTotalAuraModifier(SPELL_AURA_MOD_MANA_REGEN_INTERRUPT);