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

+9 -13
View File
@@ -3062,8 +3062,10 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
}
}
// apply to non-weapon bonus weapon total pct effect, weapon total flat effect included in weapon damage
if (fixed_bonus || spell_bonus)
// if (addPctMods) { percent mods are added in Unit::CalculateDamage } else { percent mods are added in Unit::MeleeDamageBonusDone }
// this distinction is neccessary to properly inform the client about his autoattack damage values from Script_UnitDamage
bool addPctMods = !m_spellInfo->HasAttribute(SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) && (m_spellSchoolMask & SPELL_SCHOOL_MASK_NORMAL);
if (addPctMods)
{
UnitMods unitMod;
switch (m_attackType)
@@ -3074,17 +3076,14 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
case RANGED_ATTACK: unitMod = UNIT_MOD_DAMAGE_RANGED; break;
}
float weapon_total_pct = 1.0f;
if (m_spellInfo->SchoolMask & SPELL_SCHOOL_MASK_NORMAL)
weapon_total_pct = m_caster->GetModifierValue(unitMod, TOTAL_PCT);
float weapon_total_pct = m_caster->GetModifierValue(unitMod, TOTAL_PCT);
if (fixed_bonus)
fixed_bonus = int32(fixed_bonus * weapon_total_pct);
if (spell_bonus)
spell_bonus = int32(spell_bonus * weapon_total_pct);
}
int32 weaponDamage = m_caster->CalculateDamage(m_attackType, normalized, true);
int32 weaponDamage = m_caster->CalculateDamage(m_attackType, normalized, addPctMods);
// Sequence is important
for (int j = 0; j < MAX_SPELL_EFFECTS; ++j)
@@ -3099,17 +3098,14 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
weaponDamage += fixed_bonus;
break;
case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE:
weaponDamage = int32(weaponDamage* weaponDamagePercentMod);
weaponDamage = int32(weaponDamage * weaponDamagePercentMod);
default:
break; // not weapon damage effect, just skip
}
}
if (spell_bonus)
weaponDamage += spell_bonus;
if (totalDamagePercentMod != 1.0f)
weaponDamage = int32(weaponDamage* totalDamagePercentMod);
weaponDamage += spell_bonus;
weaponDamage = int32(weaponDamage * totalDamagePercentMod);
// prevent negative damage
uint32 eff_damage(std::max(weaponDamage, 0));