Core/Scripts: Added SpellEffectInfo argument to CalcDamage and CalcHealing spell script hooks
Port From (https://github.com/TrinityCore/TrinityCore/commit/884662a75a901af6f61cab9efc171d052e8042f4)
This commit is contained in:
@@ -1221,7 +1221,7 @@ namespace Game.Entities
|
||||
uint damage = 0;
|
||||
damage += CalculateDamage(damageInfo.AttackType, false, true);
|
||||
// Add melee damage bonus
|
||||
damage = (uint)MeleeDamageBonusDone(damageInfo.Target, (int)damage, damageInfo.AttackType, DamageEffectType.Direct, null, default, (SpellSchoolMask)damageInfo.DamageSchoolMask);
|
||||
damage = (uint)MeleeDamageBonusDone(damageInfo.Target, (int)damage, damageInfo.AttackType, DamageEffectType.Direct, null, null, Mechanics.None, (SpellSchoolMask)damageInfo.DamageSchoolMask);
|
||||
damage = (uint)damageInfo.Target.MeleeDamageBonusTaken(this, (int)damage, damageInfo.AttackType, DamageEffectType.Direct, null, (SpellSchoolMask)damageInfo.DamageSchoolMask);
|
||||
|
||||
// Script Hook For CalculateMeleeDamage -- Allow scripts to change the Damage pre class mitigation calculations
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Game.Entities
|
||||
void callDamageScript(ref int dmg, ref int flatMod, ref float pctMod)
|
||||
{
|
||||
if (spell != null)
|
||||
spell.CallScriptCalcDamageHandlers(victim, ref dmg, ref flatMod, ref pctMod);
|
||||
spell.CallScriptCalcDamageHandlers(spellEffectInfo, victim, ref dmg, ref flatMod, ref pctMod);
|
||||
else if (aurEff != null)
|
||||
aurEff.GetBase().CallScriptCalcDamageAndHealingHandlers(aurEff, aurEff.GetBase().GetApplicationOfTarget(victim.GetGUID()), victim, ref dmg, ref flatMod, ref pctMod);
|
||||
}
|
||||
@@ -483,7 +483,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
if (spell != null)
|
||||
spell.CallScriptCalcHealingHandlers(victim, ref healamount, ref DoneTotal, ref DoneTotalMod);
|
||||
spell.CallScriptCalcHealingHandlers(spellEffectInfo, victim, ref healamount, ref DoneTotal, ref DoneTotalMod);
|
||||
else if (aurEff != null)
|
||||
aurEff.GetBase().CallScriptCalcDamageAndHealingHandlers(aurEff, aurEff.GetBase().GetApplicationOfTarget(victim.GetGUID()), victim, ref healamount, ref DoneTotal, ref DoneTotalMod);
|
||||
|
||||
|
||||
@@ -3876,7 +3876,7 @@ namespace Game.Entities
|
||||
return (uint)Math.Max(damage * (1.0f - mitigation), 0.0f);
|
||||
}
|
||||
|
||||
public int MeleeDamageBonusDone(Unit victim, int damage, WeaponAttackType attType, DamageEffectType damagetype, SpellInfo spellProto = null, Mechanics mechanic = default, SpellSchoolMask damageSchoolMask = SpellSchoolMask.Normal, Spell spell = null, AuraEffect aurEff = null)
|
||||
public int MeleeDamageBonusDone(Unit victim, int damage, WeaponAttackType attType, DamageEffectType damagetype, SpellInfo spellProto = null, SpellEffectInfo spellEffectInfo = null, Mechanics mechanic = default, SpellSchoolMask damageSchoolMask = SpellSchoolMask.Normal, Spell spell = null, AuraEffect aurEff = null)
|
||||
{
|
||||
if (victim == null || damage == 0)
|
||||
return 0;
|
||||
@@ -3976,7 +3976,7 @@ namespace Game.Entities
|
||||
MathFunctions.AddPct(ref DoneTotalMod, GetTotalAuraModifierByMiscValue(AuraType.ModDamageDoneForMechanic, (int)spellProto.Mechanic));
|
||||
|
||||
if (spell != null)
|
||||
spell.CallScriptCalcDamageHandlers(victim, ref damage, ref DoneFlatBenefit, ref DoneTotalMod);
|
||||
spell.CallScriptCalcDamageHandlers(spellEffectInfo, victim, ref damage, ref DoneFlatBenefit, ref DoneTotalMod);
|
||||
else if (aurEff != null)
|
||||
aurEff.GetBase().CallScriptCalcDamageAndHealingHandlers(aurEff, aurEff.GetBase().GetApplicationOfTarget(victim.GetGUID()), victim, ref damage, ref DoneFlatBenefit, ref DoneTotalMod);
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace Game.Scripting
|
||||
// internal use classes & functions
|
||||
// DO NOT OVERRIDE THESE IN SCRIPTS
|
||||
public delegate SpellCastResult SpellCheckCastFnType();
|
||||
public delegate void DamageAndHealingCalcFnType(Unit victim, ref int damageOrHealing, ref int flatMod, ref float pctMod);
|
||||
public delegate void DamageAndHealingCalcFnType(SpellEffectInfo spellEffectInfo, Unit victim, ref int damageOrHealing, ref int flatMod, ref float pctMod);
|
||||
public delegate void SpellOnResistAbsorbCalculateFnType(DamageInfo damageInfo, ref uint resistAmount, ref int absorbAmount);
|
||||
public delegate void SpellEffectFnType(uint index);
|
||||
public delegate void SpellBeforeHitFnType(SpellMissInfo missInfo);
|
||||
@@ -212,9 +212,9 @@ namespace Game.Scripting
|
||||
_callImpl = handler;
|
||||
}
|
||||
|
||||
public void Call(Unit victim, ref int damageOrHealing, ref int flatMod, ref float pctMod)
|
||||
public void Call(SpellEffectInfo spellEffectInfo, Unit victim, ref int damageOrHealing, ref int flatMod, ref float pctMod)
|
||||
{
|
||||
_callImpl(victim, ref damageOrHealing, ref flatMod, ref pctMod);
|
||||
_callImpl(spellEffectInfo, victim, ref damageOrHealing, ref flatMod, ref pctMod);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5238,7 +5238,7 @@ namespace Game.Spells
|
||||
|
||||
// Add melee damage bonuses (also check for negative)
|
||||
if (caster != null)
|
||||
damage = (uint)caster.MeleeDamageBonusDone(target, (int)damage, attackType, DamageEffectType.DOT, GetSpellInfo(), GetSpellEffectInfo().Mechanic, GetSpellInfo().GetSchoolMask(), null, this);
|
||||
damage = (uint)caster.MeleeDamageBonusDone(target, (int)damage, attackType, DamageEffectType.DOT, GetSpellInfo(), GetSpellEffectInfo(), GetSpellEffectInfo().Mechanic, GetSpellInfo().GetSchoolMask(), null, this);
|
||||
|
||||
damage = (uint)target.MeleeDamageBonusTaken(caster, (int)damage, attackType, DamageEffectType.DOT, GetSpellInfo());
|
||||
break;
|
||||
|
||||
@@ -8077,25 +8077,25 @@ namespace Game.Spells
|
||||
}
|
||||
}
|
||||
|
||||
public void CallScriptCalcDamageHandlers(Unit victim, ref int damage, ref int flatMod, ref float pctMod)
|
||||
public void CallScriptCalcDamageHandlers(SpellEffectInfo spellEffectInfo, Unit victim, ref int damage, ref int flatMod, ref float pctMod)
|
||||
{
|
||||
foreach (SpellScript script in m_loadedScripts)
|
||||
{
|
||||
script._PrepareScriptCall(SpellScriptHookType.CalcDamage);
|
||||
foreach (var calcDamage in script.CalcDamage)
|
||||
calcDamage.Call(victim, ref damage, ref flatMod, ref pctMod);
|
||||
calcDamage.Call(spellEffectInfo, victim, ref damage, ref flatMod, ref pctMod);
|
||||
|
||||
script._FinishScriptCall();
|
||||
}
|
||||
}
|
||||
|
||||
public void CallScriptCalcHealingHandlers(Unit victim, ref int healing, ref int flatMod, ref float pctMod)
|
||||
public void CallScriptCalcHealingHandlers(SpellEffectInfo spellEffectInfo, Unit victim, ref int healing, ref int flatMod, ref float pctMod)
|
||||
{
|
||||
foreach (SpellScript script in m_loadedScripts)
|
||||
{
|
||||
script._PrepareScriptCall(SpellScriptHookType.CalcHealing);
|
||||
foreach (var calcHealing in script.CalcHealing)
|
||||
calcHealing.Call(victim, ref healing, ref flatMod, ref pctMod);
|
||||
calcHealing.Call(spellEffectInfo, victim, ref healing, ref flatMod, ref pctMod);
|
||||
|
||||
script._FinishScriptCall();
|
||||
}
|
||||
|
||||
@@ -2498,7 +2498,7 @@ namespace Game.Spells
|
||||
weaponDamage = Math.Max(weaponDamage, 0);
|
||||
|
||||
// Add melee damage bonuses (also check for negative)
|
||||
weaponDamage = (uint)unitCaster.MeleeDamageBonusDone(unitTarget, (int)weaponDamage, m_attackType, DamageEffectType.SpellDirect, m_spellInfo, mechanic, m_spellSchoolMask, this);
|
||||
weaponDamage = (uint)unitCaster.MeleeDamageBonusDone(unitTarget, (int)weaponDamage, m_attackType, DamageEffectType.SpellDirect, m_spellInfo, effectInfo, mechanic, m_spellSchoolMask, this);
|
||||
m_damage += unitTarget.MeleeDamageBonusTaken(unitCaster, (int)weaponDamage, m_attackType, DamageEffectType.SpellDirect, m_spellInfo);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user