diff options
author | Shauren <shauren.trinity@gmail.com> | 2023-08-26 15:37:57 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2023-08-26 15:37:57 +0200 |
commit | 7b9493eec7c937642243c5ab0367f5ac8643879e (patch) | |
tree | cba23ae30a42a01a3d139ddbad7d1fd7542adf3c /src | |
parent | 0ede6c155605da602b3bafaa3a1212d9f924759b (diff) |
Core/Auras: Allow effects of SPELL_AURA_SCHOOL_ABSORB_OVERKILL to be prevented by setting absorb value to 0 in script
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 67d62eeb8de..713d33eb30d 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -944,11 +944,8 @@ bool Unit::HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel) cons if (damageTaken >= victim->CountPctFromMaxHealth(100 + absorbAurEff->GetMiscValueB())) continue; - // get amount which can be still absorbed by the aura - int32 currentAbsorb = absorbAurEff->GetAmount(); - // aura with infinite absorb amount - let the scripts handle absorbtion amount, set here to 0 for safety - if (currentAbsorb < 0) - currentAbsorb = 0; + // absorb all damage by default + uint32 currentAbsorb = damageInfo.GetDamage(); uint32 tempAbsorb = uint32(currentAbsorb); @@ -957,10 +954,14 @@ bool Unit::HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel) cons bool deathFullyPrevented = false; absorbAurEff->GetBase()->CallScriptEffectAbsorbHandlers(absorbAurEff, aurApp, damageInfo, tempAbsorb, deathFullyPrevented); - currentAbsorb = tempAbsorb; // absorb must be smaller than the damage itself - currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(damageInfo.GetDamage())); + currentAbsorb = std::min(currentAbsorb, damageInfo.GetDamage()); + + // if nothing is absorbed (for example because of a scripted cooldown) then skip this aura and proceed with dying + if (!currentAbsorb) + continue; + damageInfo.AbsorbDamage(currentAbsorb); if (deathFullyPrevented) |