AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
ProcChainGuardSimulator Class Reference

Simulates the proc chain guard logic from Unit::TriggerAurasProcOnEvent. More...

#include "ProcChanceTestHelper.h"

Classes

struct  AuraConfig
 
struct  ProcRecord
 

Public Member Functions

 ProcChainGuardSimulator ()
 
void SimulateTriggerAurasProc (bool triggeringSpellHasDisallowProcEvents, std::vector< AuraConfig > const &auras)
 Simulate Unit::TriggerAurasProcOnEvent.
 
std::vector< ProcRecord > const & GetRecords () const
 
int32 GetProcDeep () const
 
bool CanProc () const
 

Private Member Functions

void SetCantProc (bool apply)
 

Private Attributes

int32 _procDeep
 
std::vector< ProcRecord_records
 

Detailed Description

Simulates the proc chain guard logic from Unit::TriggerAurasProcOnEvent.

Tracks the m_procDeep counter to verify that:

  • TRIGGERED_DISALLOW_PROC_EVENTS on the triggering spell disables procs for all auras in the container
  • SPELL_ATTR3_INSTANT_TARGET_PROCS on individual auras disables procs only during that specific aura's TriggerProcOnEvent call
  • The counter is properly balanced (returns to 0 after function exits)

Constructor & Destructor Documentation

◆ ProcChainGuardSimulator()

ProcChainGuardSimulator::ProcChainGuardSimulator ( )
inline
719: _procDeep(0) {}
int32 _procDeep
Definition ProcChanceTestHelper.h:778

Member Function Documentation

◆ CanProc()

bool ProcChainGuardSimulator::CanProc ( ) const
inline
767{ return _procDeep == 0; }

References _procDeep.

Referenced by SimulateTriggerAurasProc().

◆ GetProcDeep()

int32 ProcChainGuardSimulator::GetProcDeep ( ) const
inline
766{ return _procDeep; }

References _procDeep.

◆ GetRecords()

std::vector< ProcRecord > const & ProcChainGuardSimulator::GetRecords ( ) const
inline
762 {
763 return _records;
764 }
std::vector< ProcRecord > _records
Definition ProcChanceTestHelper.h:779

References _records.

◆ SetCantProc()

void ProcChainGuardSimulator::SetCantProc ( bool  apply)
inlineprivate
771 {
772 if (apply)
773 ++_procDeep;
774 else
775 --_procDeep;
776 }

References _procDeep.

Referenced by SimulateTriggerAurasProc().

◆ SimulateTriggerAurasProc()

void ProcChainGuardSimulator::SimulateTriggerAurasProc ( bool  triggeringSpellHasDisallowProcEvents,
std::vector< AuraConfig > const &  auras 
)
inline

Simulate Unit::TriggerAurasProcOnEvent.

Parameters
triggeringSpellHasDisallowProcEventsWhether the triggering spell has TRIGGERED_DISALLOW_PROC_EVENTS cast flag
aurasList of auras in the proc container
731 {
732 _records.clear();
733
734 bool const disableProcs = triggeringSpellHasDisallowProcEvents;
735 if (disableProcs)
736 SetCantProc(true);
737
738 for (auto const& aura : auras)
739 {
740 if (aura.isRemoved)
741 continue;
742
743 if (aura.hasInstantTargetProcs)
744 SetCantProc(true);
745
746 // Record CanProc() state during TriggerProcOnEvent
747 _records.push_back({
748 aura.spellId,
749 CanProc(),
751 });
752
753 if (aura.hasInstantTargetProcs)
754 SetCantProc(false);
755 }
756
757 if (disableProcs)
758 SetCantProc(false);
759 }
bool CanProc() const
Definition ProcChanceTestHelper.h:767
void SetCantProc(bool apply)
Definition ProcChanceTestHelper.h:770

References _procDeep, _records, CanProc(), and SetCantProc().

Referenced by TEST_F().

Member Data Documentation

◆ _procDeep

int32 ProcChainGuardSimulator::_procDeep
private

◆ _records

std::vector<ProcRecord> ProcChainGuardSimulator::_records
private

The documentation for this class was generated from the following file: