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

Tests for SpellTypeMask calculation based on proc phase. More...

Inheritance diagram for SpellProcSpellTypeMaskTest:
AuraScriptProcTestFixture

Protected Member Functions

void SetUp () override
 
- Protected Member Functions inherited from AuraScriptProcTestFixture
void SetUp () override
 
void TearDown () override
 
ProcTestContextContext ()
 
SpellInfoCreateSpellInfo (uint32_t id, uint32_t familyName=0, uint32_t familyFlags0=0, uint32_t familyFlags1=0, uint32_t familyFlags2=0)
 
SpellProcEntry CreateProcEntry ()
 
ProcEventInfo CreateEventInfo (uint32_t typeMask, uint32_t hitMask, uint32_t spellTypeMask=PROC_SPELL_TYPE_MASK_ALL, uint32_t spellPhaseMask=PROC_SPELL_PHASE_HIT)
 
bool TestCanProc (SpellProcEntry const &procEntry, uint32_t typeMask, uint32_t hitMask, SpellInfo const *triggerSpell=nullptr)
 
bool TestSpellFamilyMatch (uint32_t procFamilyName, flag96 const &procFamilyMask, SpellInfo const *triggerSpell)
 

Static Protected Member Functions

static uint32 CalculateSpellTypeMask (uint32 procPhase, DamageInfo *damageInfo, HealInfo *healInfo, bool hasSpellInfo)
 Calculate spellTypeMask the same way ProcSkillsAndAuras does.
 

Detailed Description

Tests for SpellTypeMask calculation based on proc phase.

These tests verify that the proc system correctly calculates SpellTypeMask for different proc phases. This is critical because:

  • CAST phase: No damage/heal has occurred yet
  • HIT phase: Damage/heal info is available
  • FINISH phase: damageInfo may be null even for damage spells

Regression test for: FINISH phase was incorrectly using NO_DMG_HEAL when damageInfo was null, breaking procs like Killing Machine (51124) that require SpellTypeMask=DAMAGE and SpellPhaseMask=FINISH.

Member Function Documentation

◆ CalculateSpellTypeMask()

static uint32 SpellProcSpellTypeMaskTest::CalculateSpellTypeMask ( uint32  procPhase,
DamageInfo damageInfo,
HealInfo healInfo,
bool  hasSpellInfo 
)
inlinestaticprotected

Calculate spellTypeMask the same way ProcSkillsAndAuras does.

This mirrors the logic in Unit::ProcSkillsAndAuras to allow unit testing of the spellTypeMask calculation without needing full Unit objects.

50 {
52 if (procPhase == PROC_SPELL_PHASE_CAST || procPhase == PROC_SPELL_PHASE_FINISH)
53 {
54 // At CAST phase, no damage/heal has occurred yet - use MASK_ALL
55 // At FINISH phase, damageInfo may be null but spell did do damage - use MASK_ALL
57 }
58 else if (healInfo && healInfo->GetHeal())
60 else if (damageInfo && damageInfo->GetDamage())
62 else if (hasSpellInfo)
64
65 return spellTypeMask;
66 }
std::uint32_t uint32
Definition Define.h:107
static uint32 spellTypeMask[TOTAL_AURAS]
Definition SpellMgr.cpp:1819
@ PROC_SPELL_TYPE_HEAL
Definition SpellMgr.h:240
@ PROC_SPELL_TYPE_MASK_ALL
Definition SpellMgr.h:242
@ PROC_SPELL_TYPE_DAMAGE
Definition SpellMgr.h:239
@ PROC_SPELL_TYPE_NO_DMG_HEAL
Definition SpellMgr.h:241
@ PROC_SPELL_PHASE_FINISH
Definition SpellMgr.h:250
@ PROC_SPELL_PHASE_CAST
Definition SpellMgr.h:248
uint32 GetDamage() const
Definition Unit.h:372
uint32 GetHeal() const
Definition Unit.h:429

References DamageInfo::GetDamage(), HealInfo::GetHeal(), PROC_SPELL_PHASE_CAST, PROC_SPELL_PHASE_FINISH, PROC_SPELL_TYPE_DAMAGE, PROC_SPELL_TYPE_HEAL, PROC_SPELL_TYPE_MASK_ALL, PROC_SPELL_TYPE_NO_DMG_HEAL, and spellTypeMask.

◆ SetUp()

void SpellProcSpellTypeMaskTest::SetUp ( )
inlineoverrideprotected
39 {
41 }
void SetUp() override
Definition AuraScriptTestFramework.h:145

References AuraScriptProcTestFixture::SetUp().


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