|
| 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.
|
| |
Helper class for testing proc chance calculations.
Provides standalone implementations of proc-related calculations that can be tested without requiring full game objects.
| static uint8 ProcChanceTestHelper::ApplyDisableEffectsMask |
( |
uint8 |
initialMask, |
|
|
uint32 |
disableEffectsMask |
|
) |
| |
|
inlinestatic |
Apply DisableEffectsMask to get final proc effect mask.
- Parameters
-
| initialMask | Initial effect mask (usually 0x07 for all 3 effects) |
| disableEffectsMask | Mask 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().
| 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
-
| chancePerSwing | Proc chance per swing (0-100+) |
| actualSwingSpeedMs | Actual 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().
| 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
-
| weaponSpeed | Weapon attack speed in milliseconds |
| ppm | Procs per minute value |
| ppmModifier | Additional 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().
| 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
392 if (modConfig.hasSpellProto && modConfig.hasSpellModOwner)
393 {
394
395 ppm += modConfig.flatModifier;
396
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().
| static bool ProcChanceTestHelper::IsProcOnCooldown |
( |
AuraStub const * |
aura, |
|
|
std::chrono::steady_clock::time_point |
now |
|
) |
| |
|
inlinestatic |
Check if proc is on cooldown.
- Parameters
-
| aura | The aura stub |
| now | Current 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().
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
-
| config | Configuration describing the aura |
- Returns
- true if addTriggerFlag should be set
556 {
557
558 if (config.isAlwaysTriggeredAura)
559 return true;
560
561
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().
| static bool ProcChanceTestHelper::ShouldBlockDueToConditions |
( |
ConditionsConfig const & |
config | ) |
|
|
inlinestatic |
Simulate conditions check Returns true if proc should be blocked due to conditions.
- Parameters
-
| config | Conditions configuration |
- Returns
- true if proc should be blocked
599 {
600
601 if (!config.hasConditions)
602 return false;
603
604
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().
| static bool ProcChanceTestHelper::ShouldBlockDueToEquipment |
( |
EquipmentConfig const & |
config | ) |
|
|
inlinestatic |
Simulate equipment requirement check Returns true if proc should be blocked due to equipment requirements.
- Parameters
-
| config | Equipment configuration |
- Returns
- true if proc should be blocked
446 {
447
448 if (!config.isPassive || !config.isPlayer || config.equippedItemClass ==
ITEM_CLASS_ANY)
449 return false;
450
451
452 if (config.hasNoEquipRequirementAttr)
453 return false;
454
455
457 return true;
458
459
460 if (!config.hasEquippedItem)
461 return true;
462
463
464 if (config.itemIsBroken)
465 return true;
466
467
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().
| static bool ProcChanceTestHelper::ShouldBlockExtraAttackChainProc |
( |
ExtraAttackProcConfig const & |
config | ) |
|
|
inlinestatic |
Simulate triggered spell filtering Implements the self-loop prevention and triggered spell blocking from SpellAuras.cpp.
- Parameters
-
| config | Configuration for the triggered spell |
| procEntry | The proc entry being checked |
| eventTypeMask | The event type mask from ProcEventInfo |
- Returns
- true if proc should be blocked (return 0), false if allowed
260 {
261
262
263 if (config.triggeredByAuraSpellId != 0 &&
264 config.triggeredByAuraSpellId == config.procAuraSpellId)
265 {
266 return true;
267 }
268
269
270
271 static constexpr uint32 KILL_DEATH_PROC_FLAG_MASK =
273
274 if (!config.auraHasCanProcFromProcs &&
277 !(eventTypeMask & KILL_DEATH_PROC_FLAG_MASK))
278 {
279
280 if (config.isTriggered && !config.spellHasNotAProc)
281 {
282 return true;
283 }
284 }
285
286 return false;
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().
| 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
-
| procEntry | The proc configuration |
| actorLevel | Actor's level (for PROC_ATTR_REDUCE_PROC_60) |
| weaponSpeed | Weapon speed (for PPM calculation) |
| chanceModifier | Talent/aura modifier to chance |
| ppmModifier | Talent/aura modifier to PPM |
| hasDamageInfo | Whether a DamageInfo is present (enables PPM) |
| hasHealInfo | Whether a HealInfo is present (also enables PPM) |
- Returns
- Calculated proc chance
93 {
94 float chance = procEntry.Chance;
95
96
97 if ((hasDamageInfo || hasHealInfo) && procEntry.ProcsPerMinute > 0.0f)
98 {
100 }
101
102
103 chance += chanceModifier;
104
105
107 {
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().
| static bool ProcChanceTestHelper::SimulateConsumeProcCharges |
( |
AuraStub * |
aura, |
|
|
SpellProcEntry const & |
procEntry |
|
) |
| |
|
inlinestatic |
Simulate charge consumption from ConsumeProcCharges()
- Parameters
-
| aura | The aura stub to modify |
| procEntry | The proc configuration |
- Returns
- true if aura was removed (charges/stacks exhausted)
122 {
123 if (!aura)
124 return false;
125
127 {
129 }
131 {
134 {
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().