Core/Auras: Fix SPELL_AURA_MOD_DAMAGE_DONE_FOR_MECHANIC for effects mechanics
Port From (https://github.com/TrinityCore/TrinityCore/commit/64e8e11377c9b0bf92e81afb38e0668ba3fdf3f4)
This commit is contained in:
@@ -1079,7 +1079,7 @@ namespace Game.Entities
|
|||||||
uint damage = 0;
|
uint damage = 0;
|
||||||
damage += CalculateDamage(damageInfo.AttackType, false, true);
|
damage += CalculateDamage(damageInfo.AttackType, false, true);
|
||||||
// Add melee damage bonus
|
// Add melee damage bonus
|
||||||
damage = MeleeDamageBonusDone(damageInfo.Target, damage, damageInfo.AttackType, DamageEffectType.Direct, null, (SpellSchoolMask)damageInfo.DamageSchoolMask);
|
damage = MeleeDamageBonusDone(damageInfo.Target, damage, damageInfo.AttackType, DamageEffectType.Direct, null, null, (SpellSchoolMask)damageInfo.DamageSchoolMask);
|
||||||
damage = damageInfo.Target.MeleeDamageBonusTaken(this, damage, damageInfo.AttackType, DamageEffectType.Direct, null, (SpellSchoolMask)damageInfo.DamageSchoolMask);
|
damage = damageInfo.Target.MeleeDamageBonusTaken(this, damage, damageInfo.AttackType, DamageEffectType.Direct, null, (SpellSchoolMask)damageInfo.DamageSchoolMask);
|
||||||
|
|
||||||
// Script Hook For CalculateMeleeDamage -- Allow scripts to change the Damage pre class mitigation calculations
|
// Script Hook For CalculateMeleeDamage -- Allow scripts to change the Damage pre class mitigation calculations
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
int DoneTotal = 0;
|
int DoneTotal = 0;
|
||||||
float DoneTotalMod = SpellDamagePctDone(victim, spellProto, damagetype);
|
float DoneTotalMod = SpellDamagePctDone(victim, spellProto, damagetype, spellEffectInfo);
|
||||||
|
|
||||||
// Done fixed damage bonus auras
|
// Done fixed damage bonus auras
|
||||||
int DoneAdvertisedBenefit = SpellBaseDamageBonusDone(spellProto.GetSchoolMask());
|
int DoneAdvertisedBenefit = SpellBaseDamageBonusDone(spellProto.GetSchoolMask());
|
||||||
@@ -154,7 +154,7 @@ namespace Game.Entities
|
|||||||
return (uint)Math.Max(tmpDamage, 0.0f);
|
return (uint)Math.Max(tmpDamage, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float SpellDamagePctDone(Unit victim, SpellInfo spellProto, DamageEffectType damagetype)
|
public float SpellDamagePctDone(Unit victim, SpellInfo spellProto, DamageEffectType damagetype, SpellEffectInfo spellEffectInfo)
|
||||||
{
|
{
|
||||||
if (spellProto == null || !victim || damagetype == DamageEffectType.Direct)
|
if (spellProto == null || !victim || damagetype == DamageEffectType.Direct)
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
@@ -172,7 +172,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
Unit owner = GetOwner();
|
Unit owner = GetOwner();
|
||||||
if (owner != null)
|
if (owner != null)
|
||||||
return owner.SpellDamagePctDone(victim, spellProto, damagetype);
|
return owner.SpellDamagePctDone(victim, spellProto, damagetype, spellEffectInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done total percent damage auras
|
// Done total percent damage auras
|
||||||
@@ -215,7 +215,10 @@ namespace Game.Entities
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Add SPELL_AURA_MOD_DAMAGE_DONE_FOR_MECHANIC percent bonus
|
// Add SPELL_AURA_MOD_DAMAGE_DONE_FOR_MECHANIC percent bonus
|
||||||
MathFunctions.AddPct(ref DoneTotalMod, GetTotalAuraModifierByMiscValue(AuraType.ModDamageDoneForMechanic, (int)spellProto.Mechanic));
|
if (spellEffectInfo.Mechanic != 0)
|
||||||
|
MathFunctions.AddPct(ref DoneTotalMod, GetTotalAuraModifierByMiscValue(AuraType.ModDamageDoneForMechanic, (int)spellEffectInfo.Mechanic));
|
||||||
|
else if (spellProto.Mechanic != 0)
|
||||||
|
MathFunctions.AddPct(ref DoneTotalMod, GetTotalAuraModifierByMiscValue(AuraType.ModDamageDoneForMechanic, (int)spellProto.Mechanic));
|
||||||
|
|
||||||
// Custom scripted damage
|
// Custom scripted damage
|
||||||
switch (spellProto.SpellFamilyName)
|
switch (spellProto.SpellFamilyName)
|
||||||
|
|||||||
@@ -3655,7 +3655,7 @@ namespace Game.Entities
|
|||||||
return (uint)Math.Max(damage * (1.0f - mitigation), 0.0f);
|
return (uint)Math.Max(damage * (1.0f - mitigation), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint MeleeDamageBonusDone(Unit victim, uint damage, WeaponAttackType attType, DamageEffectType damagetype, SpellInfo spellProto = null, SpellSchoolMask damageSchoolMask = SpellSchoolMask.Normal)
|
public uint MeleeDamageBonusDone(Unit victim, uint damage, WeaponAttackType attType, DamageEffectType damagetype, SpellInfo spellProto = null, SpellEffectInfo spellEffectInfo = null, SpellSchoolMask damageSchoolMask = SpellSchoolMask.Normal)
|
||||||
{
|
{
|
||||||
if (victim == null || damage == 0)
|
if (victim == null || damage == 0)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3741,7 +3741,9 @@ namespace Game.Entities
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Add SPELL_AURA_MOD_DAMAGE_DONE_FOR_MECHANIC percent bonus
|
// Add SPELL_AURA_MOD_DAMAGE_DONE_FOR_MECHANIC percent bonus
|
||||||
if (spellProto != null)
|
if (spellEffectInfo != null && spellEffectInfo.Mechanic != 0)
|
||||||
|
MathFunctions.AddPct(ref DoneTotalMod, GetTotalAuraModifierByMiscValue(AuraType.ModDamageDoneForMechanic, (int)spellEffectInfo.Mechanic));
|
||||||
|
else if (spellProto != null && spellProto.Mechanic != 0)
|
||||||
MathFunctions.AddPct(ref DoneTotalMod, GetTotalAuraModifierByMiscValue(AuraType.ModDamageDoneForMechanic, (int)spellProto.Mechanic));
|
MathFunctions.AddPct(ref DoneTotalMod, GetTotalAuraModifierByMiscValue(AuraType.ModDamageDoneForMechanic, (int)spellProto.Mechanic));
|
||||||
|
|
||||||
float damageF = damage;
|
float damageF = damage;
|
||||||
|
|||||||
@@ -2550,7 +2550,7 @@ namespace Game.Spells
|
|||||||
weaponDamage = Math.Max(weaponDamage, 0);
|
weaponDamage = Math.Max(weaponDamage, 0);
|
||||||
|
|
||||||
// Add melee damage bonuses (also check for negative)
|
// Add melee damage bonuses (also check for negative)
|
||||||
weaponDamage = unitCaster.MeleeDamageBonusDone(unitTarget, weaponDamage, m_attackType, DamageEffectType.SpellDirect, m_spellInfo);
|
weaponDamage = unitCaster.MeleeDamageBonusDone(unitTarget, weaponDamage, m_attackType, DamageEffectType.SpellDirect, m_spellInfo, effectInfo);
|
||||||
m_damage += (int)unitTarget.MeleeDamageBonusTaken(unitCaster, weaponDamage, m_attackType, DamageEffectType.SpellDirect, m_spellInfo);
|
m_damage += (int)unitTarget.MeleeDamageBonusTaken(unitCaster, weaponDamage, m_attackType, DamageEffectType.SpellDirect, m_spellInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user