Core/Scripts: Added damage and healing calculation hook to spell and aura scripts allowing to override base damage amount, flat value mod and percent value mod separately

Port From (https://github.com/TrinityCore/TrinityCore/commit/9cdf3530f41e18fc815e7b164e40c01a18c3d757)
This commit is contained in:
hondacrx
2023-09-13 18:18:29 -04:00
parent 44e79ec8ea
commit d7c2fa52f4
10 changed files with 248 additions and 107 deletions
+15 -2
View File
@@ -577,7 +577,7 @@ namespace Game.Spells
}
}
}
}
if (!addUnit)
@@ -994,7 +994,7 @@ namespace Game.Spells
&& !m_spellInfo.HasAttribute(SpellAttr2.AllowWhileNotShapeshiftedCasterForm)
&& !m_spellInfo.HasAttribute(SpellAttr0.NotShapeshifted);
}
public bool CanBeSaved()
{
if (IsPassive())
@@ -2115,6 +2115,19 @@ namespace Game.Spells
loadedScript._FinishScriptCall();
}
}
public void CallScriptCalcDamageAndHealingHandlers(AuraEffect aurEff, AuraApplication aurApp, Unit victim, ref int damageOrHealing, ref int flatMod, ref float pctMod)
{
foreach (AuraScript script in m_loadedScripts)
{
script._PrepareScriptCall(AuraScriptHookType.EffectCalcDamageAndHealing, aurApp);
foreach (var effectCalcDamageAndHealing in script.DoEffectCalcDamageAndHealing)
if (effectCalcDamageAndHealing.IsEffectAffected(m_spellInfo, aurEff.GetEffIndex()))
effectCalcDamageAndHealing.Call(aurEff, victim, ref damageOrHealing, ref flatMod, ref pctMod);
script._FinishScriptCall();
}
}
public void CallScriptEffectAbsorbHandlers(AuraEffect aurEff, AuraApplication aurApp, DamageInfo dmgInfo, ref uint absorbAmount, ref bool defaultPrevented)
{