mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-21 15:27:47 -04:00
Core/Auras: Rewritten conditionally applying SPELL_AURA_MOD_WEAPON_CRIT_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
(cherry picked from commit b9f7b500a3)
This commit is contained in:
@@ -184,8 +184,17 @@ void Player::UpdateSpellDamageAndHealingBonus()
|
||||
// Get healing bonus for all schools
|
||||
SetStatInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, SpellBaseHealingBonusDone(SPELL_SCHOOL_MASK_ALL));
|
||||
// Get damage bonus for all schools
|
||||
for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
|
||||
SetStatInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i, SpellBaseDamageBonusDone(SpellSchoolMask(1 << i)));
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
bool Player::UpdateAllStats()
|
||||
@@ -530,9 +539,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;
|
||||
@@ -546,8 +555,8 @@ void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bo
|
||||
if (lvl > 60)
|
||||
lvl = 60;
|
||||
|
||||
weaponMinDamage = lvl * 0.85f * attackSpeedMod;
|
||||
weaponMaxDamage = lvl * 1.25f * attackSpeedMod;
|
||||
weaponMinDamage = lvl * 0.85f * attackPowerMod;
|
||||
weaponMaxDamage = lvl * 1.25f * attackPowerMod;
|
||||
}
|
||||
else if (!CanUseAttackType(attType)) // check if player not in form but still can't use (disarm case)
|
||||
{
|
||||
@@ -563,8 +572,8 @@ void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bo
|
||||
}
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user