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

@@ -1308,6 +1308,11 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama
// Script Hook For CalculateSpellDamageTaken -- Allow scripts to change the Damage post class mitigation calculations
sScriptMgr->ModifySpellDamageTaken(damageInfo->target, damageInfo->attacker, damage, spellInfo);
if (victim->GetAI())
{
victim->GetAI()->OnCalculateSpellDamageReceived(damage, this);
}
int32 cleanDamage = 0;
if (Unit::IsDamageReducedByArmor(damageSchoolMask, spellInfo))
{
@@ -1558,6 +1563,11 @@ void Unit::CalculateMeleeDamage(Unit* victim, CalcDamageInfo* damageInfo, Weapon
// Script Hook For CalculateMeleeDamage -- Allow scripts to change the Damage pre class mitigation calculations
sScriptMgr->ModifyMeleeDamage(damageInfo->target, damageInfo->attacker, damage);
if (victim->GetAI())
{
victim->GetAI()->OnCalculateMeleeDamageReceived(damage, this);
}
// Calculate armor reduction
if (IsDamageReducedByArmor((SpellSchoolMask)(damageInfo->damages[i].damageSchoolMask)))
{