Core/Auras: Rewritten conditionally applying SPELL_AURA_MOD_WEAPON_CR…

…IT_PERCENT, SPELL_AURA_MOD_DAMAGE_DONE and SPELL_AURA_MOD_DAMAGE_PERCENT_DONE auras

* Now the entire aura is removed when changing equipment
* All aura types can now depend on equipped items
This commit is contained in:
Aokromes committed 2016-11-27 03:09:29 +01:00
1 parent 0ca62b97e0
commit c0ba6c2dfe
8 files changed
+133 -285

No files matched your search

+15 -6
View File
@@ -158,8 +158,17 @@ void Player::ApplySpellPowerBonus(int32 amount, bool apply)
// For speed just update for client
ApplyModUInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, amount, apply);
for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + i, amount, apply);
Unit::AuraEffectList const& modDamageAuras = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE);
for (uint16 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
{
SetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + i, std::accumulate(modDamageAuras.begin(), modDamageAuras.end(), 0, [i](int32 negativeMod, AuraEffect const* aurEff)
{
if (aurEff->GetAmount() < 0 && aurEff->GetMiscValue() & (1 << i))
negativeMod += aurEff->GetAmount();
return negativeMod;
}));
SetStatInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + i, SpellBaseDamageBonusDone(SpellSchoolMask(1 << i)) - GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + i));
}
}
void Player::UpdateSpellDamageAndHealingBonus()
@@ -396,9 +405,9 @@ void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bo
break;
}
float attackSpeedMod = GetAPMultiplier(attType, normalized);
float const attackPowerMod = std::max(GetAPMultiplier(attType, normalized), 0.25f);
float baseValue = GetModifierValue(unitMod, BASE_VALUE) + GetTotalAttackPowerValue(attType) / 14.0f * attackSpeedMod;
float baseValue = GetModifierValue(unitMod, BASE_VALUE) + GetTotalAttackPowerValue(attType) / 14.0f * attackPowerMod;
float basePct = GetModifierValue(unitMod, BASE_PCT);
float totalValue = GetModifierValue(unitMod, TOTAL_VALUE);
float totalPct = addTotalPct ? GetModifierValue(unitMod, TOTAL_PCT) : 1.0f;
@@ -439,8 +448,8 @@ void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bo
TODO: Is this still needed after ammo has been removed?
else if (attType == RANGED_ATTACK) // add ammo DPS to ranged damage
{
weaponMinDamage += GetAmmoDPS() * attackSpeedMod;
weaponMaxDamage += GetAmmoDPS() * attackSpeedMod;
weaponMinDamage += GetAmmoDPS() * attackPowerMod;
weaponMaxDamage += GetAmmoDPS() * attackPowerMod;
}*/
minDamage = ((weaponMinDamage + baseValue) * basePct + totalValue) * totalPct;