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

Helper class for testing specific proc scenarios. More...

#include "AuraScriptTestFramework.h"

Public Member Functions

 ProcScenarioBuilder ()
 
 ~ProcScenarioBuilder ()=default
 
ProcScenarioBuilder & OnMeleeAutoAttack ()
 
ProcScenarioBuilder & OnTakenMeleeAutoAttack ()
 
ProcScenarioBuilder & OnSpellDamage ()
 
ProcScenarioBuilder & OnTakenSpellDamage ()
 
ProcScenarioBuilder & OnHeal ()
 
ProcScenarioBuilder & OnTakenHeal ()
 
ProcScenarioBuilder & OnPeriodicDamage ()
 
ProcScenarioBuilder & OnPeriodicHeal ()
 
ProcScenarioBuilder & OnKill ()
 
ProcScenarioBuilder & OnDeath ()
 
ProcScenarioBuilder & WithCrit ()
 
ProcScenarioBuilder & WithNormalHit ()
 
ProcScenarioBuilder & WithMiss ()
 
ProcScenarioBuilder & WithDodge ()
 
ProcScenarioBuilder & WithParry ()
 
ProcScenarioBuilder & WithBlock ()
 
ProcScenarioBuilder & WithFullBlock ()
 
ProcScenarioBuilder & WithAbsorb ()
 
ProcScenarioBuilder & OnCast ()
 
ProcScenarioBuilder & OnHit ()
 
ProcScenarioBuilder & OnFinish ()
 
ProcEventInfo Build ()
 
uint32_t GetTypeMask () const
 
uint32_t GetHitMask () const
 
uint32_t GetSpellTypeMask () const
 
uint32_t GetSpellPhaseMask () const
 

Private Attributes

uint32_t _typeMask = 0
 
uint32_t _hitMask = PROC_HIT_NORMAL
 
uint32_t _spellTypeMask = PROC_SPELL_TYPE_MASK_ALL
 
uint32_t _spellPhaseMask = PROC_SPELL_PHASE_HIT
 
bool _needsSpellInfo = false
 
bool _usesDamageInfo = false
 
bool _usesHealInfo = false
 
std::shared_ptr< SpellInfo > _defaultSpellInfo
 
std::shared_ptr< DamageInfo > _damageInfo
 
std::shared_ptr< HealInfo > _healInfo
 

Detailed Description

Helper class for testing specific proc scenarios.

Uses shared_ptr for resource management to allow safe copying in fluent builder pattern usage.

Constructor & Destructor Documentation

◆ ProcScenarioBuilder()

ProcScenarioBuilder::ProcScenarioBuilder ( )
inline
248 {
249 // Create a default SpellInfo for spell-type procs using shared_ptr
250 _defaultSpellInfo = std::shared_ptr<SpellInfo>(
252 .WithId(99999)
253 .WithSpellFamilyName(0)
254 .Build()
255 );
256 }
ProcEventInfo Build()
Definition AuraScriptTestFramework.h:415
std::shared_ptr< SpellInfo > _defaultSpellInfo
Definition AuraScriptTestFramework.h:459
Builder class for creating SpellInfo test instances.
Definition SpellInfoTestHelper.h:180

References _defaultSpellInfo, and Build().

◆ ~ProcScenarioBuilder()

ProcScenarioBuilder::~ProcScenarioBuilder ( )
default

Member Function Documentation

◆ Build()

ProcEventInfo ProcScenarioBuilder::Build ( )
inline
416 {
417 auto builder = ProcEventInfoBuilder()
422
423 // Create DamageInfo or HealInfo with SpellInfo for spell-type procs
424 if (_needsSpellInfo)
425 {
426 if (_usesDamageInfo)
427 {
428 // Create new DamageInfo if needed
429 if (!_damageInfo)
430 _damageInfo = std::make_shared<DamageInfo>(nullptr, nullptr, 100, _defaultSpellInfo.get(), SPELL_SCHOOL_MASK_FIRE, SPELL_DIRECT_DAMAGE);
431 builder.WithDamageInfo(_damageInfo.get());
432 }
433 else if (_usesHealInfo)
434 {
435 // Create new HealInfo if needed
436 if (!_healInfo)
437 _healInfo = std::make_shared<HealInfo>(nullptr, nullptr, 100, _defaultSpellInfo.get(), SPELL_SCHOOL_MASK_HOLY);
438 builder.WithHealInfo(_healInfo.get());
439 }
440 }
441
442 return builder.Build();
443 }
@ SPELL_SCHOOL_MASK_HOLY
Definition SharedDefines.h:286
@ SPELL_SCHOOL_MASK_FIRE
Definition SharedDefines.h:287
@ SPELL_DIRECT_DAMAGE
Definition Unit.h:256
Builder class for creating ProcEventInfo test instances.
Definition ProcEventInfoHelper.h:31
ProcEventInfoBuilder & WithSpellPhaseMask(uint32 spellPhaseMask)
Definition ProcEventInfoHelper.h:69
ProcEventInfoBuilder & WithTypeMask(uint32 typeMask)
Definition ProcEventInfoHelper.h:57
ProcEventInfoBuilder & WithHitMask(uint32 hitMask)
Definition ProcEventInfoHelper.h:75
ProcEventInfoBuilder & WithSpellTypeMask(uint32 spellTypeMask)
Definition ProcEventInfoHelper.h:63
uint32_t _spellPhaseMask
Definition AuraScriptTestFramework.h:455
uint32_t _hitMask
Definition AuraScriptTestFramework.h:453
std::shared_ptr< DamageInfo > _damageInfo
Definition AuraScriptTestFramework.h:460
bool _usesDamageInfo
Definition AuraScriptTestFramework.h:457
uint32_t _typeMask
Definition AuraScriptTestFramework.h:452
uint32_t _spellTypeMask
Definition AuraScriptTestFramework.h:454
bool _usesHealInfo
Definition AuraScriptTestFramework.h:458
bool _needsSpellInfo
Definition AuraScriptTestFramework.h:456
std::shared_ptr< HealInfo > _healInfo
Definition AuraScriptTestFramework.h:461

References _damageInfo, _defaultSpellInfo, _healInfo, _hitMask, _needsSpellInfo, _spellPhaseMask, _spellTypeMask, _typeMask, _usesDamageInfo, _usesHealInfo, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_FIRE, SPELL_SCHOOL_MASK_HOLY, ProcEventInfoBuilder::WithHitMask(), ProcEventInfoBuilder::WithSpellPhaseMask(), ProcEventInfoBuilder::WithSpellTypeMask(), and ProcEventInfoBuilder::WithTypeMask().

Referenced by ProcScenarioBuilder(), and TEST_F().

◆ GetHitMask()

uint32_t ProcScenarioBuilder::GetHitMask ( ) const
inline
447{ return _hitMask; }

References _hitMask.

◆ GetSpellPhaseMask()

uint32_t ProcScenarioBuilder::GetSpellPhaseMask ( ) const
inline
449{ return _spellPhaseMask; }

References _spellPhaseMask.

◆ GetSpellTypeMask()

uint32_t ProcScenarioBuilder::GetSpellTypeMask ( ) const
inline
448{ return _spellTypeMask; }

References _spellTypeMask.

◆ GetTypeMask()

uint32_t ProcScenarioBuilder::GetTypeMask ( ) const
inline
446{ return _typeMask; }

References _typeMask.

◆ OnCast()

ProcScenarioBuilder & ProcScenarioBuilder::OnCast ( )
inline
397 {
399 return *this;
400 }
@ PROC_SPELL_PHASE_CAST
Definition SpellMgr.h:248

References _spellPhaseMask, and PROC_SPELL_PHASE_CAST.

Referenced by TEST_F(), and TEST_F().

◆ OnDeath()

ProcScenarioBuilder & ProcScenarioBuilder::OnDeath ( )
inline
337 {
339 _needsSpellInfo = false;
340 return *this;
341 }
@ PROC_FLAG_DEATH
Definition SpellMgr.h:146

References _needsSpellInfo, _typeMask, and PROC_FLAG_DEATH.

Referenced by TEST_F().

◆ OnFinish()

ProcScenarioBuilder & ProcScenarioBuilder::OnFinish ( )
inline
409 {
411 return *this;
412 }
@ PROC_SPELL_PHASE_FINISH
Definition SpellMgr.h:250

References _spellPhaseMask, and PROC_SPELL_PHASE_FINISH.

Referenced by TEST_F().

◆ OnHeal()

ProcScenarioBuilder & ProcScenarioBuilder::OnHeal ( )
inline
294 {
297 _needsSpellInfo = true;
298 _usesHealInfo = true;
299 return *this;
300 }
@ PROC_SPELL_TYPE_HEAL
Definition SpellMgr.h:240
@ PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS
Definition SpellMgr.h:131

References _needsSpellInfo, _spellTypeMask, _typeMask, _usesHealInfo, PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS, and PROC_SPELL_TYPE_HEAL.

Referenced by TEST_F(), and TEST_F().

◆ OnHit()

ProcScenarioBuilder & ProcScenarioBuilder::OnHit ( )
inline
403 {
405 return *this;
406 }
@ PROC_SPELL_PHASE_HIT
Definition SpellMgr.h:249

References _spellPhaseMask, and PROC_SPELL_PHASE_HIT.

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

◆ OnKill()

ProcScenarioBuilder & ProcScenarioBuilder::OnKill ( )
inline
330 {
332 _needsSpellInfo = false;
333 return *this;
334 }
@ PROC_FLAG_KILL
Definition SpellMgr.h:111

References _needsSpellInfo, _typeMask, and PROC_FLAG_KILL.

Referenced by TEST_F().

◆ OnMeleeAutoAttack()

ProcScenarioBuilder & ProcScenarioBuilder::OnMeleeAutoAttack ( )
inline
262 {
264 _needsSpellInfo = false;
265 return *this;
266 }
@ PROC_FLAG_DONE_MELEE_AUTO_ATTACK
Definition SpellMgr.h:113

References _needsSpellInfo, _typeMask, and PROC_FLAG_DONE_MELEE_AUTO_ATTACK.

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

◆ OnPeriodicDamage()

ProcScenarioBuilder & ProcScenarioBuilder::OnPeriodicDamage ( )
inline
312 {
315 _needsSpellInfo = true;
316 _usesDamageInfo = true;
317 return *this;
318 }
@ PROC_SPELL_TYPE_DAMAGE
Definition SpellMgr.h:239
@ PROC_FLAG_DONE_PERIODIC
Definition SpellMgr.h:137

References _needsSpellInfo, _spellTypeMask, _typeMask, _usesDamageInfo, PROC_FLAG_DONE_PERIODIC, and PROC_SPELL_TYPE_DAMAGE.

Referenced by TEST_F().

◆ OnPeriodicHeal()

ProcScenarioBuilder & ProcScenarioBuilder::OnPeriodicHeal ( )
inline

◆ OnSpellDamage()

ProcScenarioBuilder & ProcScenarioBuilder::OnSpellDamage ( )
inline

◆ OnTakenHeal()

ProcScenarioBuilder & ProcScenarioBuilder::OnTakenHeal ( )
inline

◆ OnTakenMeleeAutoAttack()

ProcScenarioBuilder & ProcScenarioBuilder::OnTakenMeleeAutoAttack ( )
inline
269 {
271 _needsSpellInfo = false;
272 return *this;
273 }
@ PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK
Definition SpellMgr.h:114

References _needsSpellInfo, _typeMask, and PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK.

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

◆ OnTakenSpellDamage()

ProcScenarioBuilder & ProcScenarioBuilder::OnTakenSpellDamage ( )
inline

◆ WithAbsorb()

ProcScenarioBuilder & ProcScenarioBuilder::WithAbsorb ( )
inline
387 {
389 return *this;
390 }
@ PROC_HIT_ABSORB
Definition SpellMgr.h:267

References _hitMask, and PROC_HIT_ABSORB.

Referenced by TEST_F().

◆ WithBlock()

ProcScenarioBuilder & ProcScenarioBuilder::WithBlock ( )
inline
375 {
377 return *this;
378 }
@ PROC_HIT_BLOCK
Definition SpellMgr.h:263

References _hitMask, and PROC_HIT_BLOCK.

Referenced by TEST_F().

◆ WithCrit()

ProcScenarioBuilder & ProcScenarioBuilder::WithCrit ( )
inline
345 {
347 return *this;
348 }
@ PROC_HIT_CRITICAL
Definition SpellMgr.h:258

References _hitMask, and PROC_HIT_CRITICAL.

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

◆ WithDodge()

ProcScenarioBuilder & ProcScenarioBuilder::WithDodge ( )
inline
363 {
365 return *this;
366 }
@ PROC_HIT_DODGE
Definition SpellMgr.h:261

References _hitMask, and PROC_HIT_DODGE.

Referenced by TEST_F().

◆ WithFullBlock()

ProcScenarioBuilder & ProcScenarioBuilder::WithFullBlock ( )
inline
381 {
383 return *this;
384 }
@ PROC_HIT_FULL_BLOCK
Definition SpellMgr.h:270

References _hitMask, and PROC_HIT_FULL_BLOCK.

Referenced by TEST_F().

◆ WithMiss()

ProcScenarioBuilder & ProcScenarioBuilder::WithMiss ( )
inline
357 {
359 return *this;
360 }
@ PROC_HIT_MISS
Definition SpellMgr.h:259

References _hitMask, and PROC_HIT_MISS.

Referenced by TEST_F(), and TEST_F().

◆ WithNormalHit()

ProcScenarioBuilder & ProcScenarioBuilder::WithNormalHit ( )
inline
351 {
353 return *this;
354 }
@ PROC_HIT_NORMAL
Definition SpellMgr.h:257

References _hitMask, and PROC_HIT_NORMAL.

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

◆ WithParry()

ProcScenarioBuilder & ProcScenarioBuilder::WithParry ( )
inline
369 {
371 return *this;
372 }
@ PROC_HIT_PARRY
Definition SpellMgr.h:262

References _hitMask, and PROC_HIT_PARRY.

Referenced by TEST_F().

Member Data Documentation

◆ _damageInfo

std::shared_ptr<DamageInfo> ProcScenarioBuilder::_damageInfo
private

Referenced by Build().

◆ _defaultSpellInfo

std::shared_ptr<SpellInfo> ProcScenarioBuilder::_defaultSpellInfo
private

Referenced by Build(), and ProcScenarioBuilder().

◆ _healInfo

std::shared_ptr<HealInfo> ProcScenarioBuilder::_healInfo
private

Referenced by Build().

◆ _hitMask

uint32_t ProcScenarioBuilder::_hitMask = PROC_HIT_NORMAL
private

◆ _needsSpellInfo

◆ _spellPhaseMask

uint32_t ProcScenarioBuilder::_spellPhaseMask = PROC_SPELL_PHASE_HIT
private

◆ _spellTypeMask

◆ _typeMask

◆ _usesDamageInfo

bool ProcScenarioBuilder::_usesDamageInfo = false
private

◆ _usesHealInfo

bool ProcScenarioBuilder::_usesHealInfo = false
private

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