From 4e8b096e9d46ee62704dbf90a2b320ac5ad7fe37 Mon Sep 17 00:00:00 2001 From: killerwife Date: Fri, 17 Nov 2023 16:10:09 +0100 Subject: [PATCH] Spell/Unit: Make PROC_EX_ABSORB tagged hits also proc on full absorb --- src/game/Spells/SpellAuras.cpp | 13 ++++++++----- src/game/Spells/SpellAuras.h | 2 +- src/game/Spells/SpellMgr.cpp | 4 ++-- src/game/Spells/SpellMgr.h | 10 +++++----- src/game/Spells/UnitAuraProcHandler.cpp | 4 ++-- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/game/Spells/SpellAuras.cpp b/src/game/Spells/SpellAuras.cpp index 4095c59b03d..3de01404a1b 100755 --- a/src/game/Spells/SpellAuras.cpp +++ b/src/game/Spells/SpellAuras.cpp @@ -953,7 +953,7 @@ bool Aura::isAffectedOnSpell(SpellEntry const* spellProto) const return spellProto->IsFitToFamily(SpellFamily(GetSpellProto()->SpellFamilyName), GetAuraSpellClassMask()); } -bool Aura::CanProcFrom(SpellEntry const* spell, uint32 /*procFlag*/, uint32 EventProcEx, uint32 procEx, bool active, bool useClassMask) const +bool Aura::CanProcFrom(SpellEntry const* spell, uint32 /*procFlag*/, uint32 EventProcEx, uint32 procEx, bool damaging, bool absorbing, bool useClassMask) const { // Check EffectClassMask ClassFamilyMask const& mask = GetAuraSpellClassMask(); @@ -973,18 +973,21 @@ bool Aura::CanProcFrom(SpellEntry const* spell, uint32 /*procFlag*/, uint32 Even // if no class mask defined, or spell_proc_event has SpellFamilyName=0 - allow proc if (!useClassMask || !mask) { - if (!(EventProcEx & PROC_EX_EX_TRIGGER_ALWAYS)) + if (!(EventProcEx & PROC_EX_EX_TRIGGER_ON_NO_DAMAGE)) { // Check for extra req (if none) and hit/crit if (EventProcEx == PROC_EX_NONE) { + if ((procEx & PROC_EX_ABSORB) && absorbing) // trigger ex absorb procs even if no damage is dealt + return true; + // No extra req, so can trigger only for active (damage/healing present) and hit/crit - return ((procEx & (PROC_EX_NORMAL_HIT | PROC_EX_CRITICAL_HIT)) && active) || procEx == PROC_EX_CAST_END; + return ((procEx & (PROC_EX_NORMAL_HIT | PROC_EX_CRITICAL_HIT)) && damaging) || (procEx & PROC_EX_CAST_END) != 0; } // Passive spells hits here only if resist/reflect/immune/evade // Passive spells can`t trigger if need hit (exclude cases when procExtra include non-active flags) - if ((EventProcEx & (PROC_EX_NORMAL_HIT | PROC_EX_CRITICAL_HIT) & procEx) && !active) - return false; + if ((EventProcEx & (PROC_EX_NORMAL_HIT | PROC_EX_CRITICAL_HIT) & procEx) && !damaging) + return (EventProcEx & (PROC_EX_ABSORB) & procEx) && !absorbing; // but allow full absorb case when specified } return true; } diff --git a/src/game/Spells/SpellAuras.h b/src/game/Spells/SpellAuras.h index fae8e83f6ab..dde4e6e2dbc 100644 --- a/src/game/Spells/SpellAuras.h +++ b/src/game/Spells/SpellAuras.h @@ -523,7 +523,7 @@ class Aura ClassFamilyMask const& GetAuraSpellClassMask() const { return m_spellAuraHolder->GetSpellProto()->GetEffectSpellClassMask(m_effIndex); } bool isAffectedOnSpell(SpellEntry const* spell) const; - bool CanProcFrom(SpellEntry const* spell, uint32 procFlag, uint32 EventProcEx, uint32 procEx, bool active, bool useClassMask) const; + bool CanProcFrom(SpellEntry const* spell, uint32 procFlag, uint32 EventProcEx, uint32 procEx, bool damaging, bool absorbing, bool useClassMask) const; SpellAuraHolder* GetHolder() { return m_spellAuraHolder; } SpellAuraHolder const* GetHolder() const { return m_spellAuraHolder; } diff --git a/src/game/Spells/SpellMgr.cpp b/src/game/Spells/SpellMgr.cpp index c3532cedb1b..01108d4b0fb 100644 --- a/src/game/Spells/SpellMgr.cpp +++ b/src/game/Spells/SpellMgr.cpp @@ -1234,8 +1234,8 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr } else // all spells hits here only if resist/reflect/immune/evade { - // Exist req for PROC_EX_EX_TRIGGER_ALWAYS - if (procEvent_procEx & PROC_EX_EX_TRIGGER_ALWAYS) + // Exist req for PROC_EX_EX_TRIGGER_ON_NO_DAMAGE + if (procEvent_procEx & PROC_EX_EX_TRIGGER_ON_NO_DAMAGE) return true; // Check Extra Requirement like (hit/crit/miss/resist/parry/dodge/block/immune/reflect/absorb and other) if (procEvent_procEx & procExtra) diff --git a/src/game/Spells/SpellMgr.h b/src/game/Spells/SpellMgr.h index 50a9ebb4647..1ef77ad75dc 100644 --- a/src/game/Spells/SpellMgr.h +++ b/src/game/Spells/SpellMgr.h @@ -2511,15 +2511,15 @@ enum ProcFlagsEx PROC_EX_DEFLECT = 0x0000200, PROC_EX_ABSORB = 0x0000400, PROC_EX_REFLECT = 0x0000800, - PROC_EX_INTERRUPT = 0x0001000, // Melee hit result can be Interrupt (not used) + PROC_EX_INTERRUPT = 0x0001000, // melee hit result can be Interrupt (not used) PROC_EX_FULL_BLOCK = 0x0002000, // block al attack damage PROC_EX_RESERVED2 = 0x0004000, PROC_EX_RESERVED3 = 0x0008000, - PROC_EX_EX_TRIGGER_ALWAYS = 0x0010000, // If set trigger always ( no matter another flags) used for drop charges - PROC_EX_EX_ONE_TIME_TRIGGER = 0x0020000, // If set trigger always but only one time (not used) - PROC_EX_PERIODIC_POSITIVE = 0x0040000, // For periodic heal + PROC_EX_EX_TRIGGER_ON_NO_DAMAGE = 0x0010000, // if set, hits trigger even if no damage/healing is dealt + PROC_EX_EX_ONE_TIME_TRIGGER = 0x0020000, // if set trigger always but only one time (not used) + PROC_EX_PERIODIC_POSITIVE = 0x0040000, // for periodic heal PROC_EX_CAST_END = 0x0080000, // procs on end of cast - PROC_EX_MAGNET = 0x0100000, // For grounding totem hit + PROC_EX_MAGNET = 0x0100000, // for grounding totem hit // Flags for internal use - do not use these in db! PROC_EX_INTERNAL_HOT = 0x2000000 diff --git a/src/game/Spells/UnitAuraProcHandler.cpp b/src/game/Spells/UnitAuraProcHandler.cpp index 18d7ab6f22a..88af530a049 100644 --- a/src/game/Spells/UnitAuraProcHandler.cpp +++ b/src/game/Spells/UnitAuraProcHandler.cpp @@ -620,10 +620,10 @@ void Unit::ProcDamageAndSpellFor(ProcSystemArguments& argData, bool isVictim) continue; } // don't check dbc FamilyFlags if schoolMask exists - else if (!execData.triggeredByAura->CanProcFrom(execData.spellInfo, execData.procFlags, spellProcEvent->procEx, execData.procExtra, execData.damage != 0, !spellProcEvent->schoolMask)) + else if (!execData.triggeredByAura->CanProcFrom(execData.spellInfo, execData.procFlags, spellProcEvent->procEx, execData.procExtra, execData.damage != 0, execData.absorb != 0, !spellProcEvent->schoolMask)) continue; } - else if (!execData.triggeredByAura->CanProcFrom(execData.spellInfo, execData.procFlags, PROC_EX_NONE, execData.procExtra, execData.damage != 0, true)) + else if (!execData.triggeredByAura->CanProcFrom(execData.spellInfo, execData.procFlags, PROC_EX_NONE, execData.procExtra, execData.damage != 0, execData.absorb != 0, true)) continue; }