AzeorthCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
_SpellScript::EffectHook Class Referenceabstract

#include "SpellScript.h"

Inheritance diagram for _SpellScript::EffectHook:
AuraScript::EffectBase SpellScript::EffectHandler SpellScript::TargetHook AuraScript::EffectAbsorbHandler AuraScript::EffectApplyHandler AuraScript::EffectCalcAmountHandler AuraScript::EffectCalcPeriodicHandler AuraScript::EffectCalcSpellModHandler AuraScript::EffectManaShieldHandler AuraScript::EffectPeriodicHandler AuraScript::EffectProcHandler AuraScript::EffectSplitHandler AuraScript::EffectUpdatePeriodicHandler SpellScript::DestinationTargetSelectHandler SpellScript::ObjectAreaTargetSelectHandler SpellScript::ObjectTargetSelectHandler

Public Member Functions

 EffectHook (uint8 _effIndex)
 
virtual ~EffectHook ()
 
uint8 GetAffectedEffectsMask (SpellInfo const *spellEntry)
 
bool IsEffectAffected (SpellInfo const *spellEntry, uint8 effIndex)
 
virtual bool CheckEffect (SpellInfo const *spellEntry, uint8 effIndex)=0
 
std::string EffIndexToString ()
 

Protected Attributes

uint8 effIndex
 

Detailed Description

Constructor & Destructor Documentation

◆ EffectHook()

_SpellScript::EffectHook::EffectHook ( uint8  _effIndex)
72{
73 // effect index must be in range <0;2>, allow use of special effindexes
74 ASSERT(_effIndex == EFFECT_ALL || _effIndex == EFFECT_FIRST_FOUND || _effIndex < MAX_SPELL_EFFECTS);
75 effIndex = _effIndex;
76}
#define ASSERT
Definition: Errors.h:68
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1596
#define EFFECT_FIRST_FOUND
Definition: SharedDefines.h:36
#define EFFECT_ALL
Definition: SharedDefines.h:37
uint8 effIndex
Definition: SpellScript.h:82

References ASSERT, EFFECT_ALL, EFFECT_FIRST_FOUND, effIndex, and MAX_SPELL_EFFECTS.

◆ ~EffectHook()

virtual _SpellScript::EffectHook::~EffectHook ( )
inlinevirtual
75{ }

Member Function Documentation

◆ CheckEffect()

virtual bool _SpellScript::EffectHook::CheckEffect ( SpellInfo const *  spellEntry,
uint8  effIndex 
)
pure virtual

◆ EffIndexToString()

std::string _SpellScript::EffectHook::EffIndexToString ( )
105{
106 switch (effIndex)
107 {
108 case EFFECT_ALL:
109 return "EFFECT_ALL";
111 return "EFFECT_FIRST_FOUND";
112 case EFFECT_0:
113 return "EFFECT_0";
114 case EFFECT_1:
115 return "EFFECT_1";
116 case EFFECT_2:
117 return "EFFECT_2";
118 }
119 return "Invalid Value";
120}
@ EFFECT_1
Definition: SharedDefines.h:31
@ EFFECT_0
Definition: SharedDefines.h:30
@ EFFECT_2
Definition: SharedDefines.h:32

References EFFECT_0, EFFECT_1, EFFECT_2, EFFECT_ALL, and EFFECT_FIRST_FOUND.

◆ GetAffectedEffectsMask()

uint8 _SpellScript::EffectHook::GetAffectedEffectsMask ( SpellInfo const *  spellEntry)
79{
80 uint8 mask = 0;
82 {
83 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
84 {
85 if ((effIndex == EFFECT_FIRST_FOUND) && mask)
86 return mask;
87 if (CheckEffect(spellEntry, i))
88 mask |= (uint8)1 << i;
89 }
90 }
91 else
92 {
93 if (CheckEffect(spellEntry, effIndex))
94 mask |= (uint8)1 << effIndex;
95 }
96 return mask;
97}
std::uint8_t uint8
Definition: Define.h:110
virtual bool CheckEffect(SpellInfo const *spellEntry, uint8 effIndex)=0

References EFFECT_ALL, EFFECT_FIRST_FOUND, and MAX_SPELL_EFFECTS.

◆ IsEffectAffected()

bool _SpellScript::EffectHook::IsEffectAffected ( SpellInfo const *  spellEntry,
uint8  effIndex 
)
100{
101 return GetAffectedEffectsMask(spellEntry) & 1 << effIndex;
102}
uint8 GetAffectedEffectsMask(SpellInfo const *spellEntry)
Definition: SpellScript.cpp:78

Member Data Documentation

◆ effIndex

uint8 _SpellScript::EffectHook::effIndex
protected

Referenced by EffectHook().