AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
SpellProcTest.cpp File Reference
#include "ProcEventInfoHelper.h"
#include "SpellInfoTestHelper.h"
#include "SpellMgr.h"
#include "WorldMock.h"
#include "gtest/gtest.h"
#include "gmock/gmock.h"

Go to the source code of this file.

Classes

class  SpellProcTest
 Test fixture for SpellMgr proc tests. More...
 

Functions

 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_ProcFlagsMatch)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_ProcFlagsNoMatch)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_MultipleProcFlagsPartialMatch)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_KillEventAlwaysProcs)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_KilledEventAlwaysProcs)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_DeathEventAlwaysProcs)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_HitMaskCriticalMatch)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_HitMaskCriticalNoMatch)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_HitMaskDefaultForDone)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_HitMaskDefaultForTaken)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_HitMaskMissNoMatch)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_HitMaskDodge)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_HitMaskParry)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_HitMaskBlock)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_SpellTypeMaskDamage)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_SpellTypeMaskHeal)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_SpellTypeMaskNoMatch)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_SpellPhaseMaskCast)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_SpellPhaseMaskHit)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_SpellPhaseMaskNoMatch)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_CastPhaseWithExplicitHitMaskCrit)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_CastPhaseWithExplicitHitMaskNoCrit)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_CastPhaseWithDefaultHitMask)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_AllConditionsMatch)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_OneConditionFails)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_ZeroProcFlags)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_PeriodicDamage)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_TakenDamage)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_SpellFamilyNameMatch)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_SpellFamilyNameNoMatch)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_SpellFamilyFlagsMatch)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_SpellFamilyFlagsNoMatch)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_SpellFamilyNameZeroAcceptsAll)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_SpellFamilyFlagsZeroAcceptsAll)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_GenericFamilyIgnoresMask)
 
 TEST_F (SpellProcTest, SpellInfo_IsAffected_GenericBehavior)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_HotStreakScenario)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_IlluminationScenario)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_SecondWindScenario)
 
 TEST_F (SpellProcTest, CanSpellTriggerProcOnEvent_SwordAndBoardScenario)
 

Function Documentation

◆ TEST_F() [1/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_AllConditionsMatch   
)
517{
518 auto* spellInfo = CreateSpellInfo(1);
519 DamageInfo damageInfo(nullptr, nullptr, 100, spellInfo, SPELL_SCHOOL_MASK_FIRE, SPELL_DIRECT_DAMAGE);
520
521 auto procEntry = SpellProcEntryBuilder()
526 .Build();
527
528 auto eventInfo = ProcEventInfoBuilder()
533 .WithDamageInfo(&damageInfo)
534 .Build();
535
536 EXPECT_TRUE(sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo));
537}
@ SPELL_SCHOOL_MASK_FIRE
Definition SharedDefines.h:287
@ PROC_HIT_CRITICAL
Definition SpellMgr.h:258
#define sSpellMgr
Definition SpellMgr.h:836
@ PROC_SPELL_TYPE_DAMAGE
Definition SpellMgr.h:239
@ PROC_SPELL_PHASE_HIT
Definition SpellMgr.h:249
@ PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG
Definition SpellMgr.h:134
@ SPELL_DIRECT_DAMAGE
Definition Unit.h:255
Definition Unit.h:336
Builder class for creating ProcEventInfo test instances.
Definition ProcEventInfoHelper.h:31
ProcEventInfoBuilder & WithSpellPhaseMask(uint32 spellPhaseMask)
Definition ProcEventInfoHelper.h:69
ProcEventInfoBuilder & WithDamageInfo(DamageInfo *damageInfo)
Definition ProcEventInfoHelper.h:87
ProcEventInfoBuilder & WithTypeMask(uint32 typeMask)
Definition ProcEventInfoHelper.h:57
ProcEventInfoBuilder & WithHitMask(uint32 hitMask)
Definition ProcEventInfoHelper.h:75
ProcEventInfo Build()
Definition ProcEventInfoHelper.h:111
ProcEventInfoBuilder & WithSpellTypeMask(uint32 spellTypeMask)
Definition ProcEventInfoHelper.h:63
Builder class for creating SpellProcEntry test instances.
Definition ProcEventInfoHelper.h:141
SpellProcEntryBuilder & WithHitMask(uint32 hitMask)
Definition ProcEventInfoHelper.h:184
SpellProcEntry Build() const
Definition ProcEventInfoHelper.h:226
SpellProcEntryBuilder & WithSpellTypeMask(uint32 spellTypeMask)
Definition ProcEventInfoHelper.h:172
SpellProcEntryBuilder & WithProcFlags(uint32 procFlags)
Definition ProcEventInfoHelper.h:166
SpellProcEntryBuilder & WithSpellPhaseMask(uint32 spellPhaseMask)
Definition ProcEventInfoHelper.h:178

References ProcEventInfoBuilder::Build(), SpellProcEntryBuilder::Build(), PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG, PROC_HIT_CRITICAL, PROC_SPELL_PHASE_HIT, PROC_SPELL_TYPE_DAMAGE, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_FIRE, sSpellMgr, ProcEventInfoBuilder::WithDamageInfo(), ProcEventInfoBuilder::WithHitMask(), SpellProcEntryBuilder::WithHitMask(), SpellProcEntryBuilder::WithProcFlags(), ProcEventInfoBuilder::WithSpellPhaseMask(), SpellProcEntryBuilder::WithSpellPhaseMask(), ProcEventInfoBuilder::WithSpellTypeMask(), SpellProcEntryBuilder::WithSpellTypeMask(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [2/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_CastPhaseWithDefaultHitMask   
)
491{
492 // CAST phase + HitMask=0 should skip HitMask check (old behavior)
493 auto* spellInfo = CreateSpellInfo(1);
494 DamageInfo damageInfo(nullptr, nullptr, 100, spellInfo, SPELL_SCHOOL_MASK_NATURE, SPELL_DIRECT_DAMAGE);
495
496 auto procEntry = SpellProcEntryBuilder()
499 .WithHitMask(0) // Default - no explicit HitMask
500 .Build();
501
502 auto eventInfo = ProcEventInfoBuilder()
505 .WithHitMask(PROC_HIT_NORMAL) // Doesn't matter - HitMask check skipped
506 .WithDamageInfo(&damageInfo)
507 .Build();
508
509 EXPECT_TRUE(sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo));
510}
@ SPELL_SCHOOL_MASK_NATURE
Definition SharedDefines.h:288
@ PROC_HIT_NORMAL
Definition SpellMgr.h:257
@ PROC_SPELL_PHASE_CAST
Definition SpellMgr.h:248

References ProcEventInfoBuilder::Build(), SpellProcEntryBuilder::Build(), PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG, PROC_HIT_NORMAL, PROC_SPELL_PHASE_CAST, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NATURE, sSpellMgr, ProcEventInfoBuilder::WithDamageInfo(), ProcEventInfoBuilder::WithHitMask(), SpellProcEntryBuilder::WithHitMask(), SpellProcEntryBuilder::WithProcFlags(), ProcEventInfoBuilder::WithSpellPhaseMask(), SpellProcEntryBuilder::WithSpellPhaseMask(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [3/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_CastPhaseWithExplicitHitMaskCrit   
)

◆ TEST_F() [4/40]

◆ TEST_F() [5/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_DeathEventAlwaysProcs   
)
166{
167 auto procEntry = SpellProcEntryBuilder()
169 .Build();
170
171 auto eventInfo = ProcEventInfoBuilder()
173 .Build();
174
175 EXPECT_TRUE(sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo));
176}
@ PROC_FLAG_DEATH
Definition SpellMgr.h:146

References ProcEventInfoBuilder::Build(), SpellProcEntryBuilder::Build(), PROC_FLAG_DEATH, sSpellMgr, SpellProcEntryBuilder::WithProcFlags(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [6/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_GenericFamilyIgnoresMask   
)
794{
795 // Generic family (0) should bypass family mask checks entirely
796 auto* spellInfo = SpellInfoBuilder()
797 .WithId(101)
799 .WithSpellFamilyFlags(0x1, 0, 0) // some mage flag
800 .Build();
801 _spellInfos.push_back(spellInfo);
802
803 DamageInfo damageInfo(nullptr, nullptr, 100, spellInfo, SPELL_SCHOOL_MASK_FIRE, SPELL_DIRECT_DAMAGE);
804
805 auto procEntry = SpellProcEntryBuilder()
807 .WithSpellFamilyName(0) // generic family
808 .WithSpellFamilyMask(flag96(0x2, 0, 0)) // does NOT match the spell's flags
810 .Build();
811
812 auto eventInfo = ProcEventInfoBuilder()
816 .WithDamageInfo(&damageInfo)
817 .Build();
818
819 EXPECT_TRUE(sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo))
820 << "Generic family entries should ignore mask restrictions";
821}
@ SPELLFAMILY_MAGE
Definition SharedDefines.h:3789
Builder class for creating SpellInfo test instances.
Definition SpellInfoTestHelper.h:160
SpellInfoBuilder & WithId(uint32 id)
Definition SpellInfoTestHelper.h:164
SpellInfoBuilder & WithSpellFamilyFlags(uint32 flag0, uint32 flag1=0, uint32 flag2=0)
Definition SpellInfoTestHelper.h:176
SpellInfo * Build()
Definition SpellInfoTestHelper.h:250
SpellInfoBuilder & WithSpellFamilyName(uint32 familyName)
Definition SpellInfoTestHelper.h:170
SpellProcEntryBuilder & WithSpellFamilyMask(flag96 familyMask)
Definition ProcEventInfoHelper.h:160
SpellProcEntryBuilder & WithSpellFamilyName(uint32 familyName)
Definition ProcEventInfoHelper.h:154
Definition Util.h:442

References ProcEventInfoBuilder::Build(), SpellInfoBuilder::Build(), SpellProcEntryBuilder::Build(), PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG, PROC_HIT_NORMAL, PROC_SPELL_PHASE_HIT, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_FIRE, SPELLFAMILY_MAGE, sSpellMgr, ProcEventInfoBuilder::WithDamageInfo(), ProcEventInfoBuilder::WithHitMask(), SpellInfoBuilder::WithId(), SpellProcEntryBuilder::WithProcFlags(), SpellInfoBuilder::WithSpellFamilyFlags(), SpellProcEntryBuilder::WithSpellFamilyMask(), SpellProcEntryBuilder::WithSpellFamilyName(), SpellInfoBuilder::WithSpellFamilyName(), ProcEventInfoBuilder::WithSpellPhaseMask(), SpellProcEntryBuilder::WithSpellPhaseMask(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [7/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_HitMaskBlock   
)

◆ TEST_F() [8/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_HitMaskCriticalMatch   
)

◆ TEST_F() [9/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_HitMaskCriticalNoMatch   
)

◆ TEST_F() [10/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_HitMaskDefaultForDone   
)
215{
216 // When HitMask is 0, default for DONE procs is NORMAL | CRITICAL | ABSORB
217 auto procEntry = SpellProcEntryBuilder()
219 .WithHitMask(0) // Default
220 .Build();
221
222 // Normal hit should work with default mask
223 auto eventInfo = ProcEventInfoBuilder()
226 .Build();
227
228 EXPECT_TRUE(sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo));
229}

References ProcEventInfoBuilder::Build(), SpellProcEntryBuilder::Build(), PROC_FLAG_DONE_MELEE_AUTO_ATTACK, PROC_HIT_NORMAL, sSpellMgr, ProcEventInfoBuilder::WithHitMask(), SpellProcEntryBuilder::WithHitMask(), SpellProcEntryBuilder::WithProcFlags(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [11/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_HitMaskDefaultForTaken   
)
232{
233 // When HitMask is 0, default for TAKEN procs is NORMAL | CRITICAL
234 auto procEntry = SpellProcEntryBuilder()
236 .WithHitMask(0) // Default
237 .Build();
238
239 auto eventInfo = ProcEventInfoBuilder()
242 .Build();
243
244 EXPECT_TRUE(sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo));
245}

References ProcEventInfoBuilder::Build(), SpellProcEntryBuilder::Build(), PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK, PROC_HIT_CRITICAL, sSpellMgr, ProcEventInfoBuilder::WithHitMask(), SpellProcEntryBuilder::WithHitMask(), SpellProcEntryBuilder::WithProcFlags(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [12/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_HitMaskDodge   
)

◆ TEST_F() [13/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_HitMaskMissNoMatch   
)
248{
249 // Miss should not trigger default hit mask
250 auto procEntry = SpellProcEntryBuilder()
252 .WithHitMask(0) // Default allows NORMAL | CRITICAL | ABSORB
253 .Build();
254
255 auto eventInfo = ProcEventInfoBuilder()
258 .Build();
259
260 EXPECT_FALSE(sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo));
261}
@ PROC_HIT_MISS
Definition SpellMgr.h:259

References ProcEventInfoBuilder::Build(), SpellProcEntryBuilder::Build(), PROC_FLAG_DONE_MELEE_AUTO_ATTACK, PROC_HIT_MISS, sSpellMgr, ProcEventInfoBuilder::WithHitMask(), SpellProcEntryBuilder::WithHitMask(), SpellProcEntryBuilder::WithProcFlags(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [14/40]

◆ TEST_F() [15/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_HotStreakScenario   
)
844{
845 // Hot Streak: Proc on critical damage spell from Mage
846 auto* fireballSpell = SpellInfoBuilder()
847 .WithId(133)
849 .WithSpellFamilyFlags(0x00000001, 0, 0) // Fireball flag
850 .Build();
851 _spellInfos.push_back(fireballSpell);
852
853 DamageInfo damageInfo(nullptr, nullptr, 1000, fireballSpell, SPELL_SCHOOL_MASK_FIRE, SPELL_DIRECT_DAMAGE);
854
855 // Hot Streak proc entry - triggers on fire spell crits
856 auto procEntry = SpellProcEntryBuilder()
862 .Build();
863
864 auto eventInfo = ProcEventInfoBuilder()
869 .WithDamageInfo(&damageInfo)
870 .Build();
871
872 EXPECT_TRUE(sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo));
873}

References ProcEventInfoBuilder::Build(), SpellInfoBuilder::Build(), SpellProcEntryBuilder::Build(), PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG, PROC_HIT_CRITICAL, PROC_SPELL_PHASE_HIT, PROC_SPELL_TYPE_DAMAGE, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_FIRE, SPELLFAMILY_MAGE, sSpellMgr, ProcEventInfoBuilder::WithDamageInfo(), ProcEventInfoBuilder::WithHitMask(), SpellProcEntryBuilder::WithHitMask(), SpellInfoBuilder::WithId(), SpellProcEntryBuilder::WithProcFlags(), SpellInfoBuilder::WithSpellFamilyFlags(), SpellProcEntryBuilder::WithSpellFamilyName(), SpellInfoBuilder::WithSpellFamilyName(), ProcEventInfoBuilder::WithSpellPhaseMask(), SpellProcEntryBuilder::WithSpellPhaseMask(), ProcEventInfoBuilder::WithSpellTypeMask(), SpellProcEntryBuilder::WithSpellTypeMask(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [16/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_IlluminationScenario   
)
876{
877 // Illumination: Proc on critical heals from Paladin
878 auto* holyLightSpell = SpellInfoBuilder()
879 .WithId(635)
881 .WithSpellFamilyFlags(0x80000000, 0, 0)
882 .Build();
883 _spellInfos.push_back(holyLightSpell);
884
885 HealInfo healInfo(nullptr, nullptr, 2000, holyLightSpell, SPELL_SCHOOL_MASK_HOLY);
886
887 auto procEntry = SpellProcEntryBuilder()
893 .Build();
894
895 auto eventInfo = ProcEventInfoBuilder()
900 .WithHealInfo(&healInfo)
901 .Build();
902
903 EXPECT_TRUE(sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo));
904}
@ SPELLFAMILY_PALADIN
Definition SharedDefines.h:3796
@ SPELL_SCHOOL_MASK_HOLY
Definition SharedDefines.h:286
@ PROC_SPELL_TYPE_HEAL
Definition SpellMgr.h:240
@ PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS
Definition SpellMgr.h:131
Definition Unit.h:383
ProcEventInfoBuilder & WithHealInfo(HealInfo *healInfo)
Definition ProcEventInfoHelper.h:93

References ProcEventInfoBuilder::Build(), SpellInfoBuilder::Build(), SpellProcEntryBuilder::Build(), PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS, PROC_HIT_CRITICAL, PROC_SPELL_PHASE_HIT, PROC_SPELL_TYPE_HEAL, SPELL_SCHOOL_MASK_HOLY, SPELLFAMILY_PALADIN, sSpellMgr, ProcEventInfoBuilder::WithHealInfo(), ProcEventInfoBuilder::WithHitMask(), SpellProcEntryBuilder::WithHitMask(), SpellInfoBuilder::WithId(), SpellProcEntryBuilder::WithProcFlags(), SpellInfoBuilder::WithSpellFamilyFlags(), SpellProcEntryBuilder::WithSpellFamilyName(), SpellInfoBuilder::WithSpellFamilyName(), ProcEventInfoBuilder::WithSpellPhaseMask(), SpellProcEntryBuilder::WithSpellPhaseMask(), ProcEventInfoBuilder::WithSpellTypeMask(), SpellProcEntryBuilder::WithSpellTypeMask(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [17/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_KilledEventAlwaysProcs   
)
153{
154 auto procEntry = SpellProcEntryBuilder()
156 .Build();
157
158 auto eventInfo = ProcEventInfoBuilder()
160 .Build();
161
162 EXPECT_TRUE(sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo));
163}
@ PROC_FLAG_KILLED
Definition SpellMgr.h:110

References ProcEventInfoBuilder::Build(), SpellProcEntryBuilder::Build(), PROC_FLAG_KILLED, sSpellMgr, SpellProcEntryBuilder::WithProcFlags(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [18/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_KillEventAlwaysProcs   
)
138{
139 // Setup: Create a proc entry for kill events
140 auto procEntry = SpellProcEntryBuilder()
142 .Build();
143
144 auto eventInfo = ProcEventInfoBuilder()
146 .Build();
147
148 // Kill events should always trigger
149 EXPECT_TRUE(sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo));
150}
@ PROC_FLAG_KILL
Definition SpellMgr.h:111

References ProcEventInfoBuilder::Build(), SpellProcEntryBuilder::Build(), PROC_FLAG_KILL, sSpellMgr, SpellProcEntryBuilder::WithProcFlags(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [19/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_MultipleProcFlagsPartialMatch   
)
117{
118 // Setup: Create a proc entry that triggers on melee OR ranged
119 auto procEntry = SpellProcEntryBuilder()
121 .Build();
122
123 // Create ProcEventInfo with only melee
124 auto eventInfo = ProcEventInfoBuilder()
127 .Build();
128
129 // Should match (partial match is OK - it's an OR relationship)
130 EXPECT_TRUE(sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo));
131}
@ PROC_FLAG_DONE_RANGED_AUTO_ATTACK
Definition SpellMgr.h:119

References ProcEventInfoBuilder::Build(), SpellProcEntryBuilder::Build(), PROC_FLAG_DONE_MELEE_AUTO_ATTACK, PROC_FLAG_DONE_RANGED_AUTO_ATTACK, PROC_HIT_NORMAL, sSpellMgr, ProcEventInfoBuilder::WithHitMask(), SpellProcEntryBuilder::WithProcFlags(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [20/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_OneConditionFails   
)

◆ TEST_F() [21/40]

◆ TEST_F() [22/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_ProcFlagsMatch   
)
83{
84 // Setup: Create a proc entry that triggers on melee auto attacks
85 auto procEntry = SpellProcEntryBuilder()
87 .Build();
88
89 // Create ProcEventInfo with matching type mask
90 auto eventInfo = ProcEventInfoBuilder()
93 .Build();
94
95 // Should match
96 EXPECT_TRUE(sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo));
97}

References ProcEventInfoBuilder::Build(), SpellProcEntryBuilder::Build(), PROC_FLAG_DONE_MELEE_AUTO_ATTACK, PROC_HIT_NORMAL, sSpellMgr, ProcEventInfoBuilder::WithHitMask(), SpellProcEntryBuilder::WithProcFlags(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [23/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_ProcFlagsNoMatch   
)
100{
101 // Setup: Create a proc entry that triggers on melee auto attacks
102 auto procEntry = SpellProcEntryBuilder()
104 .Build();
105
106 // Create ProcEventInfo with different type mask (ranged instead of melee)
107 auto eventInfo = ProcEventInfoBuilder()
110 .Build();
111
112 // Should not match
113 EXPECT_FALSE(sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo));
114}

References ProcEventInfoBuilder::Build(), SpellProcEntryBuilder::Build(), PROC_FLAG_DONE_MELEE_AUTO_ATTACK, PROC_FLAG_DONE_RANGED_AUTO_ATTACK, PROC_HIT_NORMAL, sSpellMgr, ProcEventInfoBuilder::WithHitMask(), SpellProcEntryBuilder::WithProcFlags(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [24/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_SecondWindScenario   
)

◆ TEST_F() [25/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_SpellFamilyFlagsMatch   
)
678{
679 // Create a Paladin Holy Light spell with specific family flags
680 auto* spellInfo = SpellInfoBuilder()
681 .WithId(635) // Holy Light
683 .WithSpellFamilyFlags(0x80000000, 0, 0) // Example flag for Holy Light
684 .Build();
685 _spellInfos.push_back(spellInfo);
686
687 HealInfo healInfo(nullptr, nullptr, 500, spellInfo, SPELL_SCHOOL_MASK_HOLY);
688
689 // Proc entry requires specific Paladin family flag
690 auto procEntry = SpellProcEntryBuilder()
693 .WithSpellFamilyMask(flag96(0x80000000, 0, 0))
695 .Build();
696
697 auto eventInfo = ProcEventInfoBuilder()
701 .WithHealInfo(&healInfo)
702 .Build();
703
704 EXPECT_TRUE(sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo));
705}

References ProcEventInfoBuilder::Build(), SpellInfoBuilder::Build(), SpellProcEntryBuilder::Build(), PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS, PROC_HIT_NORMAL, PROC_SPELL_PHASE_HIT, SPELL_SCHOOL_MASK_HOLY, SPELLFAMILY_PALADIN, sSpellMgr, ProcEventInfoBuilder::WithHealInfo(), ProcEventInfoBuilder::WithHitMask(), SpellInfoBuilder::WithId(), SpellProcEntryBuilder::WithProcFlags(), SpellInfoBuilder::WithSpellFamilyFlags(), SpellProcEntryBuilder::WithSpellFamilyMask(), SpellProcEntryBuilder::WithSpellFamilyName(), SpellInfoBuilder::WithSpellFamilyName(), ProcEventInfoBuilder::WithSpellPhaseMask(), SpellProcEntryBuilder::WithSpellPhaseMask(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [26/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_SpellFamilyFlagsNoMatch   
)
708{
709 // Create a Paladin spell with different family flags
710 auto* spellInfo = SpellInfoBuilder()
711 .WithId(19750) // Flash of Light
713 .WithSpellFamilyFlags(0x40000000, 0, 0) // Different flag
714 .Build();
715 _spellInfos.push_back(spellInfo);
716
717 HealInfo healInfo(nullptr, nullptr, 300, spellInfo, SPELL_SCHOOL_MASK_HOLY);
718
719 // Proc entry requires different family flag
720 auto procEntry = SpellProcEntryBuilder()
723 .WithSpellFamilyMask(flag96(0x80000000, 0, 0)) // Wants Holy Light flag
725 .Build();
726
727 auto eventInfo = ProcEventInfoBuilder()
731 .WithHealInfo(&healInfo)
732 .Build();
733
734 EXPECT_FALSE(sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo));
735}

References ProcEventInfoBuilder::Build(), SpellInfoBuilder::Build(), SpellProcEntryBuilder::Build(), PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS, PROC_HIT_NORMAL, PROC_SPELL_PHASE_HIT, SPELL_SCHOOL_MASK_HOLY, SPELLFAMILY_PALADIN, sSpellMgr, ProcEventInfoBuilder::WithHealInfo(), ProcEventInfoBuilder::WithHitMask(), SpellInfoBuilder::WithId(), SpellProcEntryBuilder::WithProcFlags(), SpellInfoBuilder::WithSpellFamilyFlags(), SpellProcEntryBuilder::WithSpellFamilyMask(), SpellProcEntryBuilder::WithSpellFamilyName(), SpellInfoBuilder::WithSpellFamilyName(), ProcEventInfoBuilder::WithSpellPhaseMask(), SpellProcEntryBuilder::WithSpellPhaseMask(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [27/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_SpellFamilyFlagsZeroAcceptsAll   
)
765{
766 // When SpellFamilyMask is 0, it should accept any flags within the family
767 auto* spellInfo = SpellInfoBuilder()
768 .WithId(100)
770 .WithSpellFamilyFlags(0x12345678, 0xABCDEF01, 0x87654321) // Any flags
771 .Build();
772 _spellInfos.push_back(spellInfo);
773
774 HealInfo healInfo(nullptr, nullptr, 200, spellInfo, SPELL_SCHOOL_MASK_HOLY);
775
776 auto procEntry = SpellProcEntryBuilder()
779 .WithSpellFamilyMask(flag96(0, 0, 0)) // Accept any flags
781 .Build();
782
783 auto eventInfo = ProcEventInfoBuilder()
787 .WithHealInfo(&healInfo)
788 .Build();
789
790 EXPECT_TRUE(sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo));
791}
@ SPELLFAMILY_PRIEST
Definition SharedDefines.h:3792

References ProcEventInfoBuilder::Build(), SpellInfoBuilder::Build(), SpellProcEntryBuilder::Build(), PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS, PROC_HIT_NORMAL, PROC_SPELL_PHASE_HIT, SPELL_SCHOOL_MASK_HOLY, SPELLFAMILY_PRIEST, sSpellMgr, ProcEventInfoBuilder::WithHealInfo(), ProcEventInfoBuilder::WithHitMask(), SpellInfoBuilder::WithId(), SpellProcEntryBuilder::WithProcFlags(), SpellInfoBuilder::WithSpellFamilyFlags(), SpellProcEntryBuilder::WithSpellFamilyMask(), SpellProcEntryBuilder::WithSpellFamilyName(), SpellInfoBuilder::WithSpellFamilyName(), ProcEventInfoBuilder::WithSpellPhaseMask(), SpellProcEntryBuilder::WithSpellPhaseMask(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [28/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_SpellFamilyNameMatch   
)
622{
623 // Create a Mage spell (SpellFamilyName = SPELLFAMILY_MAGE = 3)
624 auto* spellInfo = SpellInfoBuilder()
625 .WithId(133) // Fireball
627 .Build();
628 _spellInfos.push_back(spellInfo);
629
630 DamageInfo damageInfo(nullptr, nullptr, 100, spellInfo, SPELL_SCHOOL_MASK_FIRE, SPELL_DIRECT_DAMAGE);
631
632 // Proc entry requires Mage spells
633 auto procEntry = SpellProcEntryBuilder()
637 .Build();
638
639 auto eventInfo = ProcEventInfoBuilder()
643 .WithDamageInfo(&damageInfo)
644 .Build();
645
646 EXPECT_TRUE(sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo));
647}

References ProcEventInfoBuilder::Build(), SpellInfoBuilder::Build(), SpellProcEntryBuilder::Build(), PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG, PROC_HIT_NORMAL, PROC_SPELL_PHASE_HIT, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_FIRE, SPELLFAMILY_MAGE, sSpellMgr, ProcEventInfoBuilder::WithDamageInfo(), ProcEventInfoBuilder::WithHitMask(), SpellInfoBuilder::WithId(), SpellProcEntryBuilder::WithProcFlags(), SpellProcEntryBuilder::WithSpellFamilyName(), SpellInfoBuilder::WithSpellFamilyName(), ProcEventInfoBuilder::WithSpellPhaseMask(), SpellProcEntryBuilder::WithSpellPhaseMask(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [29/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_SpellFamilyNameNoMatch   
)
650{
651 // Create a Warlock spell but proc requires Mage
652 auto* spellInfo = SpellInfoBuilder()
653 .WithId(686) // Shadow Bolt
655 .Build();
656 _spellInfos.push_back(spellInfo);
657
658 DamageInfo damageInfo(nullptr, nullptr, 100, spellInfo, SPELL_SCHOOL_MASK_SHADOW, SPELL_DIRECT_DAMAGE);
659
660 // Proc entry requires Mage spells
661 auto procEntry = SpellProcEntryBuilder()
665 .Build();
666
667 auto eventInfo = ProcEventInfoBuilder()
671 .WithDamageInfo(&damageInfo)
672 .Build();
673
674 EXPECT_FALSE(sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo));
675}
@ SPELLFAMILY_WARLOCK
Definition SharedDefines.h:3791

References ProcEventInfoBuilder::Build(), SpellInfoBuilder::Build(), SpellProcEntryBuilder::Build(), PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG, PROC_HIT_NORMAL, PROC_SPELL_PHASE_HIT, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_SHADOW, SPELLFAMILY_MAGE, SPELLFAMILY_WARLOCK, sSpellMgr, ProcEventInfoBuilder::WithDamageInfo(), ProcEventInfoBuilder::WithHitMask(), SpellInfoBuilder::WithId(), SpellProcEntryBuilder::WithProcFlags(), SpellProcEntryBuilder::WithSpellFamilyName(), SpellInfoBuilder::WithSpellFamilyName(), ProcEventInfoBuilder::WithSpellPhaseMask(), SpellProcEntryBuilder::WithSpellPhaseMask(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [30/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_SpellFamilyNameZeroAcceptsAll   
)
738{
739 // When SpellFamilyName is 0, it should accept any spell family
740 auto* spellInfo = SpellInfoBuilder()
741 .WithId(100)
743 .Build();
744 _spellInfos.push_back(spellInfo);
745
746 DamageInfo damageInfo(nullptr, nullptr, 100, spellInfo, SPELL_SCHOOL_MASK_NATURE, SPELL_DIRECT_DAMAGE);
747
748 auto procEntry = SpellProcEntryBuilder()
750 .WithSpellFamilyName(0) // Accept any family
752 .Build();
753
754 auto eventInfo = ProcEventInfoBuilder()
758 .WithDamageInfo(&damageInfo)
759 .Build();
760
761 EXPECT_TRUE(sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo));
762}
@ SPELLFAMILY_DRUID
Definition SharedDefines.h:3793

References ProcEventInfoBuilder::Build(), SpellInfoBuilder::Build(), SpellProcEntryBuilder::Build(), PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG, PROC_HIT_NORMAL, PROC_SPELL_PHASE_HIT, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NATURE, SPELLFAMILY_DRUID, sSpellMgr, ProcEventInfoBuilder::WithDamageInfo(), ProcEventInfoBuilder::WithHitMask(), SpellInfoBuilder::WithId(), SpellProcEntryBuilder::WithProcFlags(), SpellProcEntryBuilder::WithSpellFamilyName(), SpellInfoBuilder::WithSpellFamilyName(), ProcEventInfoBuilder::WithSpellPhaseMask(), SpellProcEntryBuilder::WithSpellPhaseMask(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [31/40]

◆ TEST_F() [32/40]

◆ TEST_F() [33/40]

◆ TEST_F() [34/40]

◆ TEST_F() [35/40]

◆ TEST_F() [36/40]

◆ TEST_F() [37/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_SwordAndBoardScenario   
)
923{
924 // Sword and Board: Proc on Devastate/Revenge (block effects)
925 auto* devastateSpell = SpellInfoBuilder()
926 .WithId(20243) // Devastate
928 .WithSpellFamilyFlags(0x00000000, 0x00000000, 0x00000100) // Devastate flag
929 .Build();
930 _spellInfos.push_back(devastateSpell);
931
932 DamageInfo damageInfo(nullptr, nullptr, 500, devastateSpell, SPELL_SCHOOL_MASK_NORMAL, SPELL_DIRECT_DAMAGE);
933
934 auto procEntry = SpellProcEntryBuilder()
937 .WithSpellFamilyMask(flag96(0, 0, 0x100)) // Devastate flag
939 .Build();
940
941 auto eventInfo = ProcEventInfoBuilder()
945 .WithDamageInfo(&damageInfo)
946 .Build();
947
948 EXPECT_TRUE(sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo));
949}
@ SPELLFAMILY_WARRIOR
Definition SharedDefines.h:3790
@ SPELL_SCHOOL_MASK_NORMAL
Definition SharedDefines.h:285
@ PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS
Definition SpellMgr.h:116

References ProcEventInfoBuilder::Build(), SpellInfoBuilder::Build(), SpellProcEntryBuilder::Build(), PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS, PROC_HIT_NORMAL, PROC_SPELL_PHASE_HIT, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, SPELLFAMILY_WARRIOR, sSpellMgr, ProcEventInfoBuilder::WithDamageInfo(), ProcEventInfoBuilder::WithHitMask(), SpellInfoBuilder::WithId(), SpellProcEntryBuilder::WithProcFlags(), SpellInfoBuilder::WithSpellFamilyFlags(), SpellProcEntryBuilder::WithSpellFamilyMask(), SpellProcEntryBuilder::WithSpellFamilyName(), SpellInfoBuilder::WithSpellFamilyName(), ProcEventInfoBuilder::WithSpellPhaseMask(), SpellProcEntryBuilder::WithSpellPhaseMask(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [38/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_TakenDamage   
)

◆ TEST_F() [39/40]

TEST_F ( SpellProcTest  ,
CanSpellTriggerProcOnEvent_ZeroProcFlags   
)
567{
568 // Zero proc flags should never match anything
569 auto procEntry = SpellProcEntryBuilder()
570 .WithProcFlags(0)
571 .Build();
572
573 auto eventInfo = ProcEventInfoBuilder()
576 .Build();
577
578 EXPECT_FALSE(sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo));
579}

References ProcEventInfoBuilder::Build(), SpellProcEntryBuilder::Build(), PROC_FLAG_DONE_MELEE_AUTO_ATTACK, PROC_HIT_NORMAL, sSpellMgr, ProcEventInfoBuilder::WithHitMask(), SpellProcEntryBuilder::WithProcFlags(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [40/40]

TEST_F ( SpellProcTest  ,
SpellInfo_IsAffected_GenericBehavior   
)
824{
825 auto* spellInfo = SpellInfoBuilder()
826 .WithId(102)
828 .WithSpellFamilyFlags(0x4, 0, 0)
829 .Build();
830 _spellInfos.push_back(spellInfo);
831
832 // generic family should return true regardless of mask
833 EXPECT_TRUE(spellInfo->IsAffected(0, flag96(0x4, 0, 0)));
834 EXPECT_TRUE(spellInfo->IsAffected(0, flag96(0x8, 0, 0)));
835 // a non-generic family still respects mask
836 EXPECT_FALSE(spellInfo->IsAffected(SPELLFAMILY_PALADIN, flag96(0x4, 0, 0)));
837}

References SpellInfoBuilder::Build(), SPELLFAMILY_PALADIN, SPELLFAMILY_WARLOCK, SpellInfoBuilder::WithId(), SpellInfoBuilder::WithSpellFamilyFlags(), and SpellInfoBuilder::WithSpellFamilyName().