mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-21 12:47:07 +00:00
fix(core/scripting) Calculate percent-based damage before ModifyPeriodicDamageAurasTick hook (#17387)
Moved damage calculation for `SPELL_AURA_PERIODIC_DAMAGE_PERCENT` to before the hook. Co-authored-by: KJack <kjack@electricnightowl.com>
This commit is contained in:
@@ -6298,6 +6298,13 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
|
||||
// ignore non positive values (can be result apply spellmods to aura damage
|
||||
uint32 damage = std::max(GetAmount(), 0);
|
||||
|
||||
// If the damage is percent-max-health based, calculate damage before the Modify hook
|
||||
if (GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE_PERCENT)
|
||||
{
|
||||
// xinef: ceil obtained value, it may happen that 10 ticks for 10% damage may not kill owner
|
||||
damage = uint32(std::ceil(CalculatePct<float, float>(target->GetMaxHealth(), damage)));
|
||||
}
|
||||
|
||||
// Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
|
||||
sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage, GetSpellInfo());
|
||||
|
||||
@@ -6329,8 +6336,6 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
|
||||
// 5..8 ticks have normal tick damage
|
||||
}
|
||||
}
|
||||
else // xinef: ceil obtained value, it may happen that 10 ticks for 10% damage may not kill owner
|
||||
damage = uint32(std::ceil(CalculatePct<float, float>(target->GetMaxHealth(), damage)));
|
||||
|
||||
// calculate crit chance
|
||||
bool crit = false;
|
||||
|
||||
Reference in New Issue
Block a user