AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
ExtraAttackChainProcTest.cpp File Reference

Unit tests for extra attack chain-proc prevention. More...

#include "ProcChanceTestHelper.h"
#include "gtest/gtest.h"

Go to the source code of this file.

Classes

class  ExtraAttackChainProcTest
 

Functions

 TEST_F (ExtraAttackChainProcTest, NormalProc_AllowedWhenNoExtraAttackInProgress)
 
 TEST_F (ExtraAttackChainProcTest, SelfChain_BlockedWhenSameSpell)
 
 TEST_F (ExtraAttackChainProcTest, CrossChain_BlockedBySwordSpecialization)
 
 TEST_F (ExtraAttackChainProcTest, CrossChain_BlockedByHackAndSlash)
 
 TEST_F (ExtraAttackChainProcTest, DifferentExtraAttack_AllowedWhenNotBlacklisted)
 
 TEST_F (ExtraAttackChainProcTest, NonExtraAttackProc_UnaffectedByExtraAttackState)
 
 TEST_F (ExtraAttackChainProcTest, Reckoning_SelfChainBlocked)
 
 TEST_F (ExtraAttackChainProcTest, Reckoning_AllowedDuringHandOfJustice)
 

Variables

constexpr uint32 SPELL_RECKONING = 32746
 
constexpr uint32 SPELL_HAND_OF_JUSTICE = 15601
 

Detailed Description

Unit tests for extra attack chain-proc prevention.

Tests the logic from SpellAuraEffects.cpp:1245-1261 (CheckEffectProc):

  • Self-chain prevention (same extra attack spell can't proc itself)
  • Cross-chain prevention (Sword Specialization / Hack and Slash block all extra attack procs)
  • Non-blacklisted extra attack spells allow cross-proccing
  • Non-extra-attack procs are unaffected by the guard

Definition in file ExtraAttackChainProcTest.cpp.

Function Documentation

◆ TEST_F() [1/8]

TEST_F ( ExtraAttackChainProcTest  ,
CrossChain_BlockedByHackAndSlash   
)
92{
93 // Reckoning trying to proc during Hack and Slash extra attack
94 auto config = MakeConfig(true, SPELL_RECKONING, SPELL_HACK_AND_SLASH);
95
97 << "Hack and Slash extra attack should block all other extra attack procs";
98}
constexpr uint32 SPELL_RECKONING
Definition ExtraAttackChainProcTest.cpp:35
@ SPELL_HACK_AND_SLASH
Definition Unit.h:298
static bool ShouldBlockExtraAttackChainProc(ExtraAttackProcConfig const &config)
Simulate extra attack chain-proc prevention from CheckEffectProc Returns true if proc should be block...
Definition ProcChanceTestHelper.h:310

References ProcChanceTestHelper::ShouldBlockExtraAttackChainProc(), SPELL_HACK_AND_SLASH, and SPELL_RECKONING.

◆ TEST_F() [2/8]

TEST_F ( ExtraAttackChainProcTest  ,
CrossChain_BlockedBySwordSpecialization   
)
83{
84 // Reckoning trying to proc during Sword Spec extra attack
85 auto config = MakeConfig(true, SPELL_RECKONING, SPELL_SWORD_SPECIALIZATION);
86
88 << "Sword Specialization extra attack should block all other extra attack procs";
89}
@ SPELL_SWORD_SPECIALIZATION
Definition Unit.h:297

References ProcChanceTestHelper::ShouldBlockExtraAttackChainProc(), SPELL_RECKONING, and SPELL_SWORD_SPECIALIZATION.

◆ TEST_F() [3/8]

TEST_F ( ExtraAttackChainProcTest  ,
DifferentExtraAttack_AllowedWhenNotBlacklisted   
)
105{
106 // Sword Spec trying to proc during Hand of Justice extra attack
107 // Hand of Justice (15601) is not blacklisted, so cross-proc is allowed
108 auto config = MakeConfig(true, SPELL_SWORD_SPECIALIZATION, SPELL_HAND_OF_JUSTICE);
109
111 << "Non-blacklisted extra attack spells should allow cross-proccing";
112}
constexpr uint32 SPELL_HAND_OF_JUSTICE
Definition ExtraAttackChainProcTest.cpp:36

References ProcChanceTestHelper::ShouldBlockExtraAttackChainProc(), SPELL_HAND_OF_JUSTICE, and SPELL_SWORD_SPECIALIZATION.

◆ TEST_F() [4/8]

TEST_F ( ExtraAttackChainProcTest  ,
NonExtraAttackProc_UnaffectedByExtraAttackState   
)
119{
120 // A proc that does NOT grant extra attacks should never be blocked,
121 // even during Sword Spec extra attack
122 auto config = MakeConfig(false, 12345, SPELL_SWORD_SPECIALIZATION);
123
125 << "Non-extra-attack procs should be unaffected by extra attack state";
126}

References ProcChanceTestHelper::ShouldBlockExtraAttackChainProc(), and SPELL_SWORD_SPECIALIZATION.

◆ TEST_F() [5/8]

TEST_F ( ExtraAttackChainProcTest  ,
NormalProc_AllowedWhenNoExtraAttackInProgress   
)
57{
58 // lastExtraAttackSpell == 0 means no extra attack is executing
59 auto config = MakeConfig(true, SPELL_SWORD_SPECIALIZATION, 0);
60
62 << "Extra attack proc should be allowed when no extra attack is in progress";
63}

References ProcChanceTestHelper::ShouldBlockExtraAttackChainProc(), and SPELL_SWORD_SPECIALIZATION.

◆ TEST_F() [6/8]

TEST_F ( ExtraAttackChainProcTest  ,
Reckoning_AllowedDuringHandOfJustice   
)
142{
143 // Reckoning trying to proc during Hand of Justice extra attack
144 // Hand of Justice is not blacklisted, so Reckoning is allowed
145 auto config = MakeConfig(true, SPELL_RECKONING, SPELL_HAND_OF_JUSTICE);
146
148 << "Reckoning should be allowed during Hand of Justice extra attack";
149}

References ProcChanceTestHelper::ShouldBlockExtraAttackChainProc(), SPELL_HAND_OF_JUSTICE, and SPELL_RECKONING.

◆ TEST_F() [7/8]

TEST_F ( ExtraAttackChainProcTest  ,
Reckoning_SelfChainBlocked   
)
133{
134 // Reckoning (32746) trying to proc during its own extra attack
135 auto config = MakeConfig(true, SPELL_RECKONING, SPELL_RECKONING);
136
138 << "Reckoning should not chain-proc itself";
139}

References ProcChanceTestHelper::ShouldBlockExtraAttackChainProc(), and SPELL_RECKONING.

◆ TEST_F() [8/8]

TEST_F ( ExtraAttackChainProcTest  ,
SelfChain_BlockedWhenSameSpell   
)
70{
71 // Sword Spec trying to proc during its own extra attack
72 auto config = MakeConfig(true, SPELL_SWORD_SPECIALIZATION, SPELL_SWORD_SPECIALIZATION);
73
75 << "Extra attack spell should not chain-proc itself";
76}

References ProcChanceTestHelper::ShouldBlockExtraAttackChainProc(), and SPELL_SWORD_SPECIALIZATION.

Variable Documentation

◆ SPELL_HAND_OF_JUSTICE

constexpr uint32 SPELL_HAND_OF_JUSTICE = 15601
constexpr

Referenced by TEST_F(), and TEST_F().

◆ SPELL_RECKONING

constexpr uint32 SPELL_RECKONING = 32746
constexpr

Referenced by TEST_F(), TEST_F(), TEST_F(), and TEST_F().