Skip to content

Commit

Permalink
Spell/Unit: Make PROC_EX_ABSORB tagged hits also proc on full absorb
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Nov 17, 2023
1 parent 4c2c7fa commit b6e0b19
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
13 changes: 8 additions & 5 deletions src/game/Spells/SpellAuras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ bool Aura::isAffectedOnSpell(SpellEntry const* spellProto) const
return spellProto->IsFitToFamilyMask(mask);
}

bool Aura::CanProcFrom(SpellEntry const* spell, uint32 EventProcEx, uint32 procEx, bool active, bool useClassMask) const
bool Aura::CanProcFrom(SpellEntry const* spell, uint32 EventProcEx, uint32 procEx, bool damaging, bool absorbing, bool useClassMask) const
{
// Check EffectClassMask
ClassFamilyMask mask = GetAuraSpellClassMask();
Expand All @@ -750,18 +750,21 @@ bool Aura::CanProcFrom(SpellEntry const* spell, uint32 EventProcEx, uint32 procE
// 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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/Spells/SpellAuras.h
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ class Aura
// more limited that used in future versions (spell_affect table based only), so need be careful with backporting uses
ClassFamilyMask GetAuraSpellClassMask() const;
bool isAffectedOnSpell(SpellEntry const* spell) const;
bool CanProcFrom(SpellEntry const* spell, uint32 EventProcEx, uint32 procEx, bool active, bool useClassMask) const;
bool CanProcFrom(SpellEntry const* spell, uint32 EventProcEx, uint32 procEx, bool damaging, bool absorbing, bool useClassMask) const;

SpellAuraHolder* GetHolder() { return m_spellAuraHolder; }
SpellAuraHolder const* GetHolder() const { return m_spellAuraHolder; }
Expand Down
4 changes: 2 additions & 2 deletions src/game/Spells/SpellMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1172,8 +1172,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)
Expand Down
10 changes: 5 additions & 5 deletions src/game/Spells/SpellMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -2059,15 +2059,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_RESERVED1 = 0x0002000,
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
Expand Down
4 changes: 2 additions & 2 deletions src/game/Spells/UnitAuraProcHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,10 +495,10 @@ void Unit::ProcDamageAndSpellFor(ProcSystemArguments& argData, bool isVictim)
continue;
}
// don't check dbc FamilyFlags if schoolMask exists
else if (!execData.triggeredByAura->CanProcFrom(execData.spellInfo, spellProcEvent->procEx, execData.procExtra, execData.damage != 0, !spellProcEvent->schoolMask))
else if (!execData.triggeredByAura->CanProcFrom(execData.spellInfo, spellProcEvent->procEx, execData.procExtra, execData.damage != 0, execData.absorb != 0, !spellProcEvent->schoolMask))
continue;
}
else if (!execData.triggeredByAura->CanProcFrom(execData.spellInfo, PROC_EX_NONE, execData.procExtra, execData.damage != 0, true))
else if (!execData.triggeredByAura->CanProcFrom(execData.spellInfo, PROC_EX_NONE, execData.procExtra, execData.damage != 0, execData.absorb != 0, true))
continue;
}

Expand Down

0 comments on commit b6e0b19

Please sign in to comment.