feat(Core/Scripting): Implement Unit hooks to modify damage before ca… (#17785)

This commit is contained in:
Andrew
2023-11-18 23:36:59 -03:00
committed by GitHub
parent ed3737b809
commit d55b6753c9
3 changed files with 32 additions and 0 deletions

View File

@@ -6701,6 +6701,11 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
// Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage, GetSpellInfo());
if (target->GetAI())
{
target->GetAI()->OnCalculatePeriodicTickReceived(damage, caster);
}
if (GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE)
{
// xinef: leave only target depending bonuses, rest is handled in calculate amount
@@ -6811,6 +6816,11 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c
// Script Hook For HandlePeriodicHealthLeechAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage, GetSpellInfo());
if (target->GetAI())
{
target->GetAI()->OnCalculatePeriodicTickReceived(damage, caster);
}
if (GetBase()->GetType() == DYNOBJ_AURA_TYPE)
damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetEffIndex(), 0.0f, GetBase()->GetStackAmount());
damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
@@ -7020,6 +7030,11 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, heal, GetSpellInfo());
sScriptMgr->ModifyHealReceived(target, caster, heal, GetSpellInfo());
if (target->GetAI())
{
target->GetAI()->OnCalculatePeriodicTickReceived(heal, caster);
}
HealInfo healInfo(caster, target, heal, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
Unit::CalcHealAbsorb(healInfo);
int32 gain = Unit::DealHeal(caster, target, healInfo.GetHeal());