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

Helper class for testing proc chance calculations. More...

#include "ProcChanceTestHelper.h"

Classes

struct  CascadeProcConfig
 Configuration for simulating cascade proc suppression. More...
 
struct  ConditionsConfig
 Configuration for simulating conditions system. More...
 
struct  EquipmentConfig
 Configuration for simulating equipment requirements. More...
 
struct  ExtraAttackProcConfig
 Configuration for simulating extra attack chain-proc prevention. More...
 
struct  PPMModifierConfig
 PPM modifier configuration for testing SPELLMOD_PROC_PER_MINUTE. More...
 
struct  TakenAutoTriggerConfig
 Configuration for simulating the TAKEN auto-trigger logic from SpellMgr::LoadSpellProcs() auto-generation. More...
 
struct  TriggeredSpellConfig
 Configuration for simulating triggered spell filtering. More...
 

Static Public Member Functions

static float CalculatePPMChance (uint32 weaponSpeed, float ppm, float ppmModifier=0.0f)
 Calculate PPM proc chance Implements the formula: (WeaponSpeed * PPM) / 600.0f.
 
static float ApplyLevel60Reduction (float baseChance, uint32 actorLevel)
 Calculate level 60+ reduction Implements PROC_ATTR_REDUCE_PROC_60: 3.333% reduction per level above 60.
 
static float SimulateCalcProcChance (SpellProcEntry const &procEntry, uint32 actorLevel=80, uint32 weaponSpeed=2500, float chanceModifier=0.0f, float ppmModifier=0.0f, bool hasDamageInfo=true, bool hasHealInfo=false)
 Simulate CalcProcChance() from SpellAuras.cpp.
 
static bool SimulateConsumeProcCharges (AuraStub *aura, SpellProcEntry const &procEntry)
 Simulate charge consumption from ConsumeProcCharges()
 
static bool IsProcOnCooldown (AuraStub const *aura, std::chrono::steady_clock::time_point now)
 Check if proc is on cooldown.
 
static void ApplyProcCooldown (AuraStub *aura, std::chrono::steady_clock::time_point now, uint32 cooldownMs)
 Apply proc cooldown to aura.
 
static bool SpellHasManaCost (SpellInfo const *spellInfo)
 Check if spell has mana cost (for PROC_ATTR_REQ_MANA_COST)
 
static float CalculateEffectivePPM (float chancePerSwing, uint32 actualSwingSpeedMs)
 Simulate effective procs per minute.
 
static bool ShouldBlockTriggeredSpell (TriggeredSpellConfig const &config, SpellProcEntry const &procEntry, uint32 eventTypeMask)
 Simulate triggered spell filtering Implements the self-loop prevention and triggered spell blocking from SpellAuras.cpp.
 
static bool ShouldBlockExtraAttackChainProc (ExtraAttackProcConfig const &config)
 Simulate extra attack chain-proc prevention from CheckEffectProc Returns true if proc should be blocked.
 
static uint8 ApplyDisableEffectsMask (uint8 initialMask, uint32 disableEffectsMask)
 Apply DisableEffectsMask to get final proc effect mask.
 
static bool ShouldBlockDueToDisabledEffects (uint8 initialMask, uint32 disableEffectsMask)
 Check if proc should be blocked due to all effects being disabled.
 
static float CalculatePPMChanceWithModifiers (uint32 weaponSpeed, float basePPM, PPMModifierConfig const &modConfig)
 Calculate PPM chance with spell modifiers Simulates GetPPMProcChance() with SPELLMOD_PROC_PER_MINUTE.
 
static bool ShouldBlockDueToEquipment (EquipmentConfig const &config)
 Simulate equipment requirement check Returns true if proc should be blocked due to equipment requirements.
 
static uint8 GetWeaponSlotForAttackType (uint8 attackType)
 Get equipment slot for attack type.
 
static bool ShouldSuppressCascadingProc (CascadeProcConfig const &config)
 Returns true if cascading procs should be suppressed for this aura.
 
static bool ShouldAutoAddTriggeredCanProc (TakenAutoTriggerConfig const &config)
 Simulate the TAKEN auto-trigger logic from SpellMgr::LoadSpellProcs()
 
static bool ShouldBlockDueToConditions (ConditionsConfig const &config)
 Simulate conditions check Returns true if proc should be blocked due to conditions.
 

Static Public Attributes

static constexpr uint32 WEAPON_SPEED_FAST_DAGGER = 1400
 Get common weapon speeds for testing.
 
static constexpr uint32 WEAPON_SPEED_NORMAL_SWORD = 2500
 
static constexpr uint32 WEAPON_SPEED_SLOW_2H = 3300
 
static constexpr uint32 WEAPON_SPEED_VERY_SLOW = 3800
 
static constexpr uint32 WEAPON_SPEED_STAFF = 3600
 
static constexpr uint32 FORM_SPEED_CAT = 1000
 Shapeshift form base attack speeds (from SpellShapeshiftForm.dbc)
 
static constexpr uint32 FORM_SPEED_BEAR = 2500
 
static constexpr float PPM_OMEN_OF_CLARITY = 6.0f
 Common PPM values from spell_proc database.
 
static constexpr float PPM_JUDGEMENT_OF_LIGHT = 15.0f
 
static constexpr float PPM_WINDFURY_WEAPON = 2.0f
 
static constexpr uint32 AUTO_ATTACK_PROC_FLAG_MASK
 Auto-attack proc flag mask (hunter auto-shot, wands exception) These triggered spells are allowed to proc without TRIGGERED_CAN_PROC.
 
static constexpr int32 ITEM_CLASS_WEAPON = 2
 Item classes for equipment requirement checking.
 
static constexpr int32 ITEM_CLASS_ARMOR = 4
 
static constexpr int32 ITEM_CLASS_ANY = -1
 
static constexpr uint8 BASE_ATTACK = 0
 Attack types for weapon slot mapping.
 
static constexpr uint8 OFF_ATTACK = 1
 
static constexpr uint8 RANGED_ATTACK = 2
 

Detailed Description

Helper class for testing proc chance calculations.

Provides standalone implementations of proc-related calculations that can be tested without requiring full game objects.

Member Function Documentation

◆ ApplyDisableEffectsMask()

static uint8 ProcChanceTestHelper::ApplyDisableEffectsMask ( uint8  initialMask,
uint32  disableEffectsMask 
)
inlinestatic

Apply DisableEffectsMask to get final proc effect mask.

Parameters
initialMaskInitial effect mask (usually 0x07 for all 3 effects)
disableEffectsMaskMask of effects to disable
Returns
Resulting effect mask after applying disable mask
340 {
341 uint8 result = initialMask;
342 for (uint8 i = 0; i < 3; ++i)
343 {
344 if (disableEffectsMask & (1u << i))
345 result &= ~(1 << i);
346 }
347 return result;
348 }
std::uint8_t uint8
Definition Define.h:109

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

◆ ApplyLevel60Reduction()

static float ProcChanceTestHelper::ApplyLevel60Reduction ( float  baseChance,
uint32  actorLevel 
)
inlinestatic

Calculate level 60+ reduction Implements PROC_ATTR_REDUCE_PROC_60: 3.333% reduction per level above 60.

Parameters
baseChanceBase proc chance
actorLevelActor's level
Returns
Reduced proc chance
64 {
65 if (actorLevel <= 60)
66 return baseChance;
67
68 // Reduction = (level - 60) / 30, capped at 1.0
69 float reduction = static_cast<float>(actorLevel - 60) / 30.0f;
70 return std::max(0.0f, (1.0f - reduction) * baseChance);
71 }

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

◆ ApplyProcCooldown()

static void ProcChanceTestHelper::ApplyProcCooldown ( AuraStub aura,
std::chrono::steady_clock::time_point  now,
uint32  cooldownMs 
)
inlinestatic

Apply proc cooldown to aura.

Parameters
auraThe aura stub
nowCurrent time point
cooldownMsCooldown duration in milliseconds
164 {
165 if (!aura || cooldownMs == 0)
166 return;
167 aura->AddProcCooldown(now + std::chrono::milliseconds(cooldownMs));
168 }
void AddProcCooldown(TimePoint cooldownEnd)
Definition AuraStub.h:191

References AuraStub::AddProcCooldown().

Referenced by ProcTestScenario::SimulateProc(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ CalculateEffectivePPM()

static float ProcChanceTestHelper::CalculateEffectivePPM ( float  chancePerSwing,
uint32  actualSwingSpeedMs 
)
inlinestatic

Simulate effective procs per minute.

Given a per-swing chance and the actual swing interval, calculate how many procs occur per minute on average.

Parameters
chancePerSwingProc chance per swing (0-100+)
actualSwingSpeedMsActual time between swings in milliseconds
Returns
Average procs per minute
209 {
210 if (actualSwingSpeedMs == 0)
211 return 0.0f;
212 float swingsPerMinute = 60000.0f / static_cast<float>(actualSwingSpeedMs);
213 return swingsPerMinute * (chancePerSwing / 100.0f);
214 }

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

◆ CalculatePPMChance()

static float ProcChanceTestHelper::CalculatePPMChance ( uint32  weaponSpeed,
float  ppm,
float  ppmModifier = 0.0f 
)
inlinestatic

Calculate PPM proc chance Implements the formula: (WeaponSpeed * PPM) / 600.0f.

Parameters
weaponSpeedWeapon attack speed in milliseconds
ppmProcs per minute value
ppmModifierAdditional PPM modifier (from talents/auras)
Returns
Proc chance as percentage (0-100+)
47 {
48 if (ppm <= 0.0f)
49 return 0.0f;
50
51 float modifiedPPM = ppm + ppmModifier;
52 return (static_cast<float>(weaponSpeed) * modifiedPPM) / 600.0f;
53 }

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

◆ CalculatePPMChanceWithModifiers()

static float ProcChanceTestHelper::CalculatePPMChanceWithModifiers ( uint32  weaponSpeed,
float  basePPM,
PPMModifierConfig const &  modConfig 
)
inlinestatic

Calculate PPM chance with spell modifiers Simulates GetPPMProcChance() with SPELLMOD_PROC_PER_MINUTE.

385 {
386 if (basePPM <= 0.0f)
387 return 0.0f;
388
389 float ppm = basePPM;
390
391 // Apply modifiers only if we have spell proto and spell mod owner
392 if (modConfig.hasSpellProto && modConfig.hasSpellModOwner)
393 {
394 // Apply flat modifier first (SPELLMOD_FLAT)
395 ppm += modConfig.flatModifier;
396 // Apply percent modifier (SPELLMOD_PCT)
397 ppm *= modConfig.pctModifier;
398 }
399
400 return (static_cast<float>(weaponSpeed) * ppm) / 600.0f;
401 }

References ProcChanceTestHelper::PPMModifierConfig::flatModifier, ProcChanceTestHelper::PPMModifierConfig::hasSpellModOwner, ProcChanceTestHelper::PPMModifierConfig::hasSpellProto, and ProcChanceTestHelper::PPMModifierConfig::pctModifier.

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

◆ GetWeaponSlotForAttackType()

static uint8 ProcChanceTestHelper::GetWeaponSlotForAttackType ( uint8  attackType)
inlinestatic

Get equipment slot for attack type.

Parameters
attackTypeAttack type (BASE_ATTACK, OFF_ATTACK, RANGED_ATTACK)
Returns
Equipment slot index (simulated)
481 {
482 switch (attackType)
483 {
484 case BASE_ATTACK:
485 return 15; // EQUIPMENT_SLOT_MAINHAND
486 case OFF_ATTACK:
487 return 16; // EQUIPMENT_SLOT_OFFHAND
488 case RANGED_ATTACK:
489 return 17; // EQUIPMENT_SLOT_RANGED
490 default:
491 return 15;
492 }
493 }
static constexpr uint8 RANGED_ATTACK
Definition ProcChanceTestHelper.h:419
static constexpr uint8 OFF_ATTACK
Definition ProcChanceTestHelper.h:418
static constexpr uint8 BASE_ATTACK
Attack types for weapon slot mapping.
Definition ProcChanceTestHelper.h:417

References BASE_ATTACK, OFF_ATTACK, and RANGED_ATTACK.

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

◆ IsProcOnCooldown()

static bool ProcChanceTestHelper::IsProcOnCooldown ( AuraStub const *  aura,
std::chrono::steady_clock::time_point  now 
)
inlinestatic

Check if proc is on cooldown.

Parameters
auraThe aura stub
nowCurrent time point
Returns
true if proc is blocked by cooldown
150 {
151 if (!aura)
152 return false;
153 return aura->IsProcOnCooldown(now);
154 }

References AuraStub::IsProcOnCooldown().

Referenced by ProcTestScenario::SimulateProc(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ ShouldAutoAddTriggeredCanProc()

static bool ProcChanceTestHelper::ShouldAutoAddTriggeredCanProc ( TakenAutoTriggerConfig const &  config)
inlinestatic

Simulate the TAKEN auto-trigger logic from SpellMgr::LoadSpellProcs()

During auto-generation of proc entries, TAKEN-proc auras with SPELL_AURA_PROC_TRIGGER_SPELL or SPELL_AURA_PROC_TRIGGER_DAMAGE should get PROC_ATTR_TRIGGERED_CAN_PROC set automatically.

Parameters
configConfiguration describing the aura
Returns
true if addTriggerFlag should be set
556 {
557 // If already marked as always-triggered, keep it
558 if (config.isAlwaysTriggeredAura)
559 return true;
560
561 // TAKEN auto-trigger: TAKEN proc flags + PROC_TRIGGER_SPELL/DAMAGE
562 if (config.procFlags & TAKEN_HIT_PROC_FLAG_MASK)
563 {
564 switch (config.auraName)
565 {
568 return true;
569 default:
570 break;
571 }
572 }
573
574 return false;
575 }
@ SPELL_AURA_PROC_TRIGGER_SPELL
Definition SpellAuraDefines.h:105
@ SPELL_AURA_PROC_TRIGGER_DAMAGE
Definition SpellAuraDefines.h:106
@ TAKEN_HIT_PROC_FLAG_MASK
Definition SpellMgr.h:178

References ProcChanceTestHelper::TakenAutoTriggerConfig::auraName, ProcChanceTestHelper::TakenAutoTriggerConfig::isAlwaysTriggeredAura, ProcChanceTestHelper::TakenAutoTriggerConfig::procFlags, SPELL_AURA_PROC_TRIGGER_DAMAGE, SPELL_AURA_PROC_TRIGGER_SPELL, and TAKEN_HIT_PROC_FLAG_MASK.

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

◆ ShouldBlockDueToConditions()

static bool ProcChanceTestHelper::ShouldBlockDueToConditions ( ConditionsConfig const &  config)
inlinestatic

Simulate conditions check Returns true if proc should be blocked due to conditions.

Parameters
configConditions configuration
Returns
true if proc should be blocked
599 {
600 // No conditions configured - allow proc
601 if (!config.hasConditions)
602 return false;
603
604 // Check if conditions are met
605 return !config.conditionsMet;
606 }

References ProcChanceTestHelper::ConditionsConfig::conditionsMet, and ProcChanceTestHelper::ConditionsConfig::hasConditions.

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

◆ ShouldBlockDueToDisabledEffects()

static bool ProcChanceTestHelper::ShouldBlockDueToDisabledEffects ( uint8  initialMask,
uint32  disableEffectsMask 
)
inlinestatic

Check if proc should be blocked due to all effects being disabled.

Parameters
initialMaskInitial effect mask
disableEffectsMaskMask of effects to disable
Returns
true if all effects disabled (proc blocked), false otherwise
358 {
359 return ApplyDisableEffectsMask(initialMask, disableEffectsMask) == 0;
360 }
static uint8 ApplyDisableEffectsMask(uint8 initialMask, uint32 disableEffectsMask)
Apply DisableEffectsMask to get final proc effect mask.
Definition ProcChanceTestHelper.h:339

References ApplyDisableEffectsMask().

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

◆ ShouldBlockDueToEquipment()

static bool ProcChanceTestHelper::ShouldBlockDueToEquipment ( EquipmentConfig const &  config)
inlinestatic

Simulate equipment requirement check Returns true if proc should be blocked due to equipment requirements.

Parameters
configEquipment configuration
Returns
true if proc should be blocked
446 {
447 // Only check for passive player auras with equipment requirements
448 if (!config.isPassive || !config.isPlayer || config.equippedItemClass == ITEM_CLASS_ANY)
449 return false;
450
451 // SPELL_ATTR3_NO_PROC_EQUIP_REQUIREMENT bypasses check
452 if (config.hasNoEquipRequirementAttr)
453 return false;
454
455 // Feral form blocks weapon procs
456 if (config.equippedItemClass == ITEM_CLASS_WEAPON && config.isInFeralForm)
457 return true;
458
459 // No item equipped in the required slot
460 if (!config.hasEquippedItem)
461 return true;
462
463 // Item is broken
464 if (config.itemIsBroken)
465 return true;
466
467 // Item doesn't fit spell requirements (wrong subclass, etc.)
468 if (!config.itemFitsRequirements)
469 return true;
470
471 return false;
472 }
static constexpr int32 ITEM_CLASS_WEAPON
Item classes for equipment requirement checking.
Definition ProcChanceTestHelper.h:410
static constexpr int32 ITEM_CLASS_ANY
Definition ProcChanceTestHelper.h:412

References ProcChanceTestHelper::EquipmentConfig::equippedItemClass, ProcChanceTestHelper::EquipmentConfig::hasEquippedItem, ProcChanceTestHelper::EquipmentConfig::hasNoEquipRequirementAttr, ProcChanceTestHelper::EquipmentConfig::isInFeralForm, ProcChanceTestHelper::EquipmentConfig::isPassive, ProcChanceTestHelper::EquipmentConfig::isPlayer, ITEM_CLASS_ANY, ITEM_CLASS_WEAPON, ProcChanceTestHelper::EquipmentConfig::itemFitsRequirements, and ProcChanceTestHelper::EquipmentConfig::itemIsBroken.

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

◆ ShouldBlockExtraAttackChainProc()

static bool ProcChanceTestHelper::ShouldBlockExtraAttackChainProc ( ExtraAttackProcConfig const &  config)
inlinestatic

Simulate extra attack chain-proc prevention from CheckEffectProc Returns true if proc should be blocked.

Parameters
configExtra attack proc configuration
Returns
true if proc should be blocked
311 {
312 // Only applies when the triggered spell grants extra attacks
313 if (!config.triggeredSpellHasExtraAttacks)
314 return false;
315
316 // Patch 1.12.0(?) extra attack abilities can no longer chain proc themselves
317 if (config.lastExtraAttackSpell == config.triggerSpellId)
318 return true;
319
320 // Patch 2.2.0 Sword Specialization (Warrior, Rogue) extra attack can no longer proc additional extra attacks
321 // 3.3.5 Sword Specialization (Warrior), Hack and Slash (Rogue)
322 if (config.lastExtraAttackSpell == 16459 || config.lastExtraAttackSpell == 66923)
323 return true;
324
325 return false;
326 }

References ProcChanceTestHelper::ExtraAttackProcConfig::lastExtraAttackSpell, ProcChanceTestHelper::ExtraAttackProcConfig::triggeredSpellHasExtraAttacks, and ProcChanceTestHelper::ExtraAttackProcConfig::triggerSpellId.

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

◆ ShouldBlockTriggeredSpell()

static bool ProcChanceTestHelper::ShouldBlockTriggeredSpell ( TriggeredSpellConfig const &  config,
SpellProcEntry const &  procEntry,
uint32  eventTypeMask 
)
inlinestatic

Simulate triggered spell filtering Implements the self-loop prevention and triggered spell blocking from SpellAuras.cpp.

Parameters
configConfiguration for the triggered spell
procEntryThe proc entry being checked
eventTypeMaskThe event type mask from ProcEventInfo
Returns
true if proc should be blocked (return 0), false if allowed
260 {
261 // Self-loop prevention: block if triggered by the same aura
262 // SpellAuras.cpp:2191-2192
263 if (config.triggeredByAuraSpellId != 0 &&
264 config.triggeredByAuraSpellId == config.procAuraSpellId)
265 {
266 return true; // Block: self-loop detected
267 }
268
269 // Check if triggered spell filtering applies
270 // SpellAuras.cpp:2195-2208
271 static constexpr uint32 KILL_DEATH_PROC_FLAG_MASK =
273
274 if (!config.auraHasCanProcFromProcs &&
275 !(procEntry.AttributesMask & PROC_ATTR_TRIGGERED_CAN_PROC) &&
276 !(eventTypeMask & AUTO_ATTACK_PROC_FLAG_MASK) &&
277 !(eventTypeMask & KILL_DEATH_PROC_FLAG_MASK))
278 {
279 // Filter triggered spells unless they have NOT_A_PROC
280 if (config.isTriggered && !config.spellHasNotAProc)
281 {
282 return true; // Block: triggered spell without exceptions
283 }
284 }
285
286 return false; // Allow proc
287 }
std::uint32_t uint32
Definition Define.h:107
@ PROC_ATTR_TRIGGERED_CAN_PROC
Definition SpellMgr.h:277
@ PROC_FLAG_KILLED
Definition SpellMgr.h:110
@ PROC_FLAG_DEATH
Definition SpellMgr.h:146
@ PROC_FLAG_KILL
Definition SpellMgr.h:111
static constexpr uint32 AUTO_ATTACK_PROC_FLAG_MASK
Auto-attack proc flag mask (hunter auto-shot, wands exception) These triggered spells are allowed to ...
Definition ProcChanceTestHelper.h:231

References SpellProcEntry::AttributesMask, ProcChanceTestHelper::TriggeredSpellConfig::auraHasCanProcFromProcs, AUTO_ATTACK_PROC_FLAG_MASK, ProcChanceTestHelper::TriggeredSpellConfig::isTriggered, PROC_ATTR_TRIGGERED_CAN_PROC, PROC_FLAG_DEATH, PROC_FLAG_KILL, PROC_FLAG_KILLED, ProcChanceTestHelper::TriggeredSpellConfig::procAuraSpellId, ProcChanceTestHelper::TriggeredSpellConfig::spellHasNotAProc, and ProcChanceTestHelper::TriggeredSpellConfig::triggeredByAuraSpellId.

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

◆ ShouldSuppressCascadingProc()

static bool ProcChanceTestHelper::ShouldSuppressCascadingProc ( CascadeProcConfig const &  config)
inlinestatic

Returns true if cascading procs should be suppressed for this aura.

Parameters
configCascade proc configuration
Returns
true if SetCantProc(true) would be active during this aura's proc
519 {
520 // Outer check: triggering spell disables all cascading procs
521 if (config.triggeringSpellIsProcDisabled)
522 return true;
523 // Per-aura check: aura itself suppresses cascading
524 if (config.auraHasDisableProcAttr)
525 return true;
526
527 return false;
528 }

References ProcChanceTestHelper::CascadeProcConfig::auraHasDisableProcAttr, and ProcChanceTestHelper::CascadeProcConfig::triggeringSpellIsProcDisabled.

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

◆ SimulateCalcProcChance()

static float ProcChanceTestHelper::SimulateCalcProcChance ( SpellProcEntry const &  procEntry,
uint32  actorLevel = 80,
uint32  weaponSpeed = 2500,
float  chanceModifier = 0.0f,
float  ppmModifier = 0.0f,
bool  hasDamageInfo = true,
bool  hasHealInfo = false 
)
inlinestatic

Simulate CalcProcChance() from SpellAuras.cpp.

Parameters
procEntryThe proc configuration
actorLevelActor's level (for PROC_ATTR_REDUCE_PROC_60)
weaponSpeedWeapon speed (for PPM calculation)
chanceModifierTalent/aura modifier to chance
ppmModifierTalent/aura modifier to PPM
hasDamageInfoWhether a DamageInfo is present (enables PPM)
hasHealInfoWhether a HealInfo is present (also enables PPM)
Returns
Calculated proc chance
93 {
94 float chance = procEntry.Chance;
95
96 // PPM calculation overrides base chance if PPM > 0 and we have DamageInfo or HealInfo
97 if ((hasDamageInfo || hasHealInfo) && procEntry.ProcsPerMinute > 0.0f)
98 {
99 chance = CalculatePPMChance(weaponSpeed, procEntry.ProcsPerMinute, ppmModifier);
100 }
101
102 // Apply chance modifier (SPELLMOD_CHANCE_OF_SUCCESS)
103 chance += chanceModifier;
104
105 // Apply level 60+ reduction if attribute is set
106 if (procEntry.AttributesMask & PROC_ATTR_REDUCE_PROC_60)
107 {
108 chance = ApplyLevel60Reduction(chance, actorLevel);
109 }
110
111 return chance;
112 }
@ PROC_ATTR_REDUCE_PROC_60
Definition SpellMgr.h:281
static float ApplyLevel60Reduction(float baseChance, uint32 actorLevel)
Calculate level 60+ reduction Implements PROC_ATTR_REDUCE_PROC_60: 3.333% reduction per level above 6...
Definition ProcChanceTestHelper.h:63
static float CalculatePPMChance(uint32 weaponSpeed, float ppm, float ppmModifier=0.0f)
Calculate PPM proc chance Implements the formula: (WeaponSpeed * PPM) / 600.0f.
Definition ProcChanceTestHelper.h:46

References ApplyLevel60Reduction(), SpellProcEntry::AttributesMask, CalculatePPMChance(), SpellProcEntry::Chance, PROC_ATTR_REDUCE_PROC_60, and SpellProcEntry::ProcsPerMinute.

Referenced by ProcTestScenario::SimulateProc(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_P().

◆ SimulateConsumeProcCharges()

static bool ProcChanceTestHelper::SimulateConsumeProcCharges ( AuraStub aura,
SpellProcEntry const &  procEntry 
)
inlinestatic

Simulate charge consumption from ConsumeProcCharges()

Parameters
auraThe aura stub to modify
procEntryThe proc configuration
Returns
true if aura was removed (charges/stacks exhausted)
122 {
123 if (!aura)
124 return false;
125
126 if (procEntry.AttributesMask & PROC_ATTR_USE_STACKS_FOR_CHARGES)
127 {
128 return aura->ModStackAmount(-1);
129 }
130 else if (aura->IsUsingCharges())
131 {
132 aura->DropCharge();
133 if (aura->GetCharges() == 0)
134 {
135 aura->Remove();
136 return true;
137 }
138 }
139 return false;
140 }
@ PROC_ATTR_USE_STACKS_FOR_CHARGES
Definition SpellMgr.h:280
virtual void Remove()
Mark aura as removed (for charge exhaustion) Mimics Aura::Remove()
Definition AuraStub.h:233
uint8_t GetCharges() const
Definition AuraStub.h:155
bool IsUsingCharges() const
Definition AuraStub.h:156
virtual bool DropCharge()
Definition AuraStub.h:161
virtual bool ModStackAmount(int32_t amount, bool=true)
Modify stack amount (for PROC_ATTR_USE_STACKS_FOR_CHARGES) Mimics Aura::ModStackAmount() - removes au...
Definition AuraStub.h:209

References SpellProcEntry::AttributesMask, AuraStub::DropCharge(), AuraStub::GetCharges(), AuraStub::IsUsingCharges(), AuraStub::ModStackAmount(), PROC_ATTR_USE_STACKS_FOR_CHARGES, and AuraStub::Remove().

Referenced by ProcTestScenario::SimulateProc(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_P().

◆ SpellHasManaCost()

static bool ProcChanceTestHelper::SpellHasManaCost ( SpellInfo const *  spellInfo)
inlinestatic

Check if spell has mana cost (for PROC_ATTR_REQ_MANA_COST)

Parameters
spellInfoThe spell info to check
Returns
true if spell has mana cost > 0
177 {
178 if (!spellInfo)
179 return false;
180 return spellInfo->ManaCost > 0 || spellInfo->ManaCostPercentage > 0;
181 }

References SpellInfo::ManaCost, and SpellInfo::ManaCostPercentage.

Referenced by TEST_F(), and TEST_F().

Member Data Documentation

◆ AUTO_ATTACK_PROC_FLAG_MASK

constexpr uint32 ProcChanceTestHelper::AUTO_ATTACK_PROC_FLAG_MASK
staticconstexpr
Initial value:
=
@ PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK
Definition SpellMgr.h:120
@ PROC_FLAG_DONE_MELEE_AUTO_ATTACK
Definition SpellMgr.h:113
@ PROC_FLAG_DONE_RANGED_AUTO_ATTACK
Definition SpellMgr.h:119
@ PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK
Definition SpellMgr.h:114

Auto-attack proc flag mask (hunter auto-shot, wands exception) These triggered spells are allowed to proc without TRIGGERED_CAN_PROC.

Referenced by ShouldBlockTriggeredSpell().

◆ BASE_ATTACK

constexpr uint8 ProcChanceTestHelper::BASE_ATTACK = 0
staticconstexpr

Attack types for weapon slot mapping.

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

◆ FORM_SPEED_BEAR

constexpr uint32 ProcChanceTestHelper::FORM_SPEED_BEAR = 2500
staticconstexpr

Referenced by TEST_F(), and TEST_F().

◆ FORM_SPEED_CAT

constexpr uint32 ProcChanceTestHelper::FORM_SPEED_CAT = 1000
staticconstexpr

Shapeshift form base attack speeds (from SpellShapeshiftForm.dbc)

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

◆ ITEM_CLASS_ANY

constexpr int32 ProcChanceTestHelper::ITEM_CLASS_ANY = -1
staticconstexpr

◆ ITEM_CLASS_ARMOR

constexpr int32 ProcChanceTestHelper::ITEM_CLASS_ARMOR = 4
staticconstexpr

◆ ITEM_CLASS_WEAPON

constexpr int32 ProcChanceTestHelper::ITEM_CLASS_WEAPON = 2
staticconstexpr

Item classes for equipment requirement checking.

Referenced by SpellProcEquipmentTest::CreateWeaponProcConfig(), ShouldBlockDueToEquipment(), TEST_F(), and TEST_F().

◆ OFF_ATTACK

constexpr uint8 ProcChanceTestHelper::OFF_ATTACK = 1
staticconstexpr

◆ PPM_JUDGEMENT_OF_LIGHT

constexpr float ProcChanceTestHelper::PPM_JUDGEMENT_OF_LIGHT = 15.0f
staticconstexpr

◆ PPM_OMEN_OF_CLARITY

constexpr float ProcChanceTestHelper::PPM_OMEN_OF_CLARITY = 6.0f
staticconstexpr

Common PPM values from spell_proc database.

◆ PPM_WINDFURY_WEAPON

constexpr float ProcChanceTestHelper::PPM_WINDFURY_WEAPON = 2.0f
staticconstexpr

◆ RANGED_ATTACK

constexpr uint8 ProcChanceTestHelper::RANGED_ATTACK = 2
staticconstexpr

◆ WEAPON_SPEED_FAST_DAGGER

constexpr uint32 ProcChanceTestHelper::WEAPON_SPEED_FAST_DAGGER = 1400
staticconstexpr

Get common weapon speeds for testing.

◆ WEAPON_SPEED_NORMAL_SWORD

constexpr uint32 ProcChanceTestHelper::WEAPON_SPEED_NORMAL_SWORD = 2500
staticconstexpr

◆ WEAPON_SPEED_SLOW_2H

constexpr uint32 ProcChanceTestHelper::WEAPON_SPEED_SLOW_2H = 3300
staticconstexpr

◆ WEAPON_SPEED_STAFF

constexpr uint32 ProcChanceTestHelper::WEAPON_SPEED_STAFF = 3600
staticconstexpr

◆ WEAPON_SPEED_VERY_SLOW

constexpr uint32 ProcChanceTestHelper::WEAPON_SPEED_VERY_SLOW = 3800
staticconstexpr

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