Core/Auras: Allow effects of SPELL_AURA_SCHOOL_ABSORB_OVERKILL to be prevented by setting absorb value to 0 in script
Port From (https://github.com/TrinityCore/TrinityCore/commit/7b9493eec7c937642243c5ab0367f5ac8643879e)
This commit is contained in:
@@ -2752,24 +2752,23 @@ namespace Game.Entities
|
|||||||
if (damageTaken >= victim.CountPctFromMaxHealth(100 + absorbAurEff.GetMiscValueB()))
|
if (damageTaken >= victim.CountPctFromMaxHealth(100 + absorbAurEff.GetMiscValueB()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// get amount which can be still absorbed by the aura
|
// absorb all damage by default
|
||||||
int currentAbsorb = absorbAurEff.GetAmount();
|
uint currentAbsorb = damageInfo.GetDamage();
|
||||||
// aura with infinite absorb amount - let the scripts handle absorbtion amount, set here to 0 for safety
|
|
||||||
if (currentAbsorb < 0)
|
|
||||||
currentAbsorb = 0;
|
|
||||||
|
|
||||||
uint tempAbsorb = (uint)currentAbsorb;
|
|
||||||
|
|
||||||
// This aura type is used both by Spirit of Redemption (death not really prevented, must grant all credit immediately) and Cheat Death (death prevented)
|
// This aura type is used both by Spirit of Redemption (death not really prevented, must grant all credit immediately) and Cheat Death (death prevented)
|
||||||
// repurpose PreventDefaultAction for this
|
// repurpose PreventDefaultAction for this
|
||||||
bool deathFullyPrevented = false;
|
bool deathFullyPrevented = false;
|
||||||
|
|
||||||
absorbAurEff.GetBase().CallScriptEffectAbsorbHandlers(absorbAurEff, aurApp, damageInfo, ref tempAbsorb, ref deathFullyPrevented);
|
absorbAurEff.GetBase().CallScriptEffectAbsorbHandlers(absorbAurEff, aurApp, damageInfo, ref currentAbsorb, ref deathFullyPrevented);
|
||||||
currentAbsorb = (int)tempAbsorb;
|
|
||||||
|
|
||||||
// absorb must be smaller than the damage itself
|
// absorb must be smaller than the damage itself
|
||||||
currentAbsorb = MathFunctions.RoundToInterval(ref currentAbsorb, 0, (int)damageInfo.GetDamage());
|
currentAbsorb = Math.Min(currentAbsorb, damageInfo.GetDamage());
|
||||||
damageInfo.AbsorbDamage((uint)currentAbsorb);
|
|
||||||
|
// if nothing is absorbed (for example because of a scripted cooldown) then skip this aura and proceed with dying
|
||||||
|
if (currentAbsorb == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
damageInfo.AbsorbDamage(currentAbsorb);
|
||||||
|
|
||||||
if (deathFullyPrevented)
|
if (deathFullyPrevented)
|
||||||
killed = false;
|
killed = false;
|
||||||
@@ -2784,7 +2783,7 @@ namespace Game.Entities
|
|||||||
absorbLog.Caster = baseAura.GetCasterGUID();
|
absorbLog.Caster = baseAura.GetCasterGUID();
|
||||||
absorbLog.AbsorbedSpellID = spellProto != null ? spellProto.Id : 0;
|
absorbLog.AbsorbedSpellID = spellProto != null ? spellProto.Id : 0;
|
||||||
absorbLog.AbsorbSpellID = baseAura.GetId();
|
absorbLog.AbsorbSpellID = baseAura.GetId();
|
||||||
absorbLog.Absorbed = currentAbsorb;
|
absorbLog.Absorbed = (int)currentAbsorb;
|
||||||
absorbLog.OriginalDamage = damageInfo.GetOriginalDamage();
|
absorbLog.OriginalDamage = damageInfo.GetOriginalDamage();
|
||||||
absorbLog.LogData.Initialize(victim);
|
absorbLog.LogData.Initialize(victim);
|
||||||
victim.SendCombatLogMessage(absorbLog);
|
victim.SendCombatLogMessage(absorbLog);
|
||||||
|
|||||||
@@ -1573,8 +1573,6 @@ namespace Scripts.Spells.Priest
|
|||||||
Unit target = GetTarget();
|
Unit target = GetTarget();
|
||||||
target.CastSpell(target, SpellIds.SpiritOfRedemption, new CastSpellExtraArgs(aurEff));
|
target.CastSpell(target, SpellIds.SpiritOfRedemption, new CastSpellExtraArgs(aurEff));
|
||||||
target.SetFullHealth();
|
target.SetFullHealth();
|
||||||
|
|
||||||
absorbAmount = dmgInfo.GetDamage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Register()
|
public override void Register()
|
||||||
|
|||||||
Reference in New Issue
Block a user