AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
SpellScript::TargetHook Class Reference

#include "SpellScript.h"

Inheritance diagram for SpellScript::TargetHook:
_SpellScript::EffectHook SpellScript::DestinationTargetSelectHandler SpellScript::ObjectAreaTargetSelectHandler SpellScript::ObjectTargetSelectHandler

Public Member Functions

 TargetHook (uint8 _effectIndex, uint16 _targetType, bool _area, bool _dest)
 
bool CheckEffect (SpellInfo const *spellInfo, uint8 effIndex) override
 
std::string ToString ()
 
uint16 GetTarget () const
 
- Public Member Functions inherited from _SpellScript::EffectHook
 EffectHook (uint8 _effIndex)
 
virtual ~EffectHook ()
 
uint8 GetAffectedEffectsMask (SpellInfo const *spellInfo)
 
bool IsEffectAffected (SpellInfo const *spellInfo, uint8 effIndex)
 
virtual bool CheckEffect (SpellInfo const *spellInfo, uint8 effIndex)=0
 
std::string EffIndexToString ()
 

Protected Attributes

uint16 targetType
 
bool area
 
bool dest
 
- Protected Attributes inherited from _SpellScript::EffectHook
uint8 effIndex
 

Detailed Description

Constructor & Destructor Documentation

◆ TargetHook()

SpellScript::TargetHook::TargetHook ( uint8  _effectIndex,
uint16  _targetType,
bool  _area,
bool  _dest 
)
228 : _SpellScript::EffectHook(_effectIndex), targetType(_targetType), area(_area), dest(_dest) { }
Definition: SpellScript.h:72
bool dest
Definition: SpellScript.h:256
bool area
Definition: SpellScript.h:255
uint16 targetType
Definition: SpellScript.h:254

Member Function Documentation

◆ CheckEffect()

bool SpellScript::TargetHook::CheckEffect ( SpellInfo const *  spellInfo,
uint8  effIndex 
)
overridevirtual

Implements _SpellScript::EffectHook.

238{
239 if (!targetType)
240 return false;
241
242 if (spellInfo->Effects[effIndex].TargetA.GetTarget() != targetType &&
243 spellInfo->Effects[effIndex].TargetB.GetTarget() != targetType)
244 return false;
245
247 switch (targetInfo.GetSelectionCategory())
248 {
249 case TARGET_SELECT_CATEGORY_CHANNEL: // SINGLE
250 return !area;
252 return true;
253 case TARGET_SELECT_CATEGORY_CONE: // AREA
254 case TARGET_SELECT_CATEGORY_AREA: // AREA
255 return area;
257 switch (targetInfo.GetObjectType())
258 {
259 case TARGET_OBJECT_TYPE_SRC: // EMPTY
260 return false;
261 case TARGET_OBJECT_TYPE_DEST: // DEST
262 return dest;
263 default:
264 switch (targetInfo.GetReferenceType())
265 {
266 case TARGET_REFERENCE_TYPE_CASTER: // SINGLE
267 return !area;
268 case TARGET_REFERENCE_TYPE_TARGET: // BOTH
269 return true;
270 default:
271 break;
272 }
273 break;
274 }
275 break;
276 default:
277 break;
278 }
279
280 return false;
281}
@ TARGET_SELECT_CATEGORY_CONE
Definition: SpellInfo.h:81
@ TARGET_SELECT_CATEGORY_AREA
Definition: SpellInfo.h:82
@ TARGET_SELECT_CATEGORY_DEFAULT
Definition: SpellInfo.h:78
@ TARGET_SELECT_CATEGORY_NEARBY
Definition: SpellInfo.h:80
@ TARGET_SELECT_CATEGORY_CHANNEL
Definition: SpellInfo.h:79
@ TARGET_OBJECT_TYPE_DEST
Definition: SpellInfo.h:100
@ TARGET_OBJECT_TYPE_SRC
Definition: SpellInfo.h:99
@ TARGET_REFERENCE_TYPE_TARGET
Definition: SpellInfo.h:90
@ TARGET_REFERENCE_TYPE_CASTER
Definition: SpellInfo.h:89
Definition: SpellInfo.h:215
uint8 effIndex
Definition: SpellScript.h:82

References SpellInfo::Effects, SpellImplicitTargetInfo::GetObjectType(), SpellImplicitTargetInfo::GetReferenceType(), SpellImplicitTargetInfo::GetSelectionCategory(), TARGET_OBJECT_TYPE_DEST, TARGET_OBJECT_TYPE_SRC, TARGET_REFERENCE_TYPE_CASTER, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_AREA, TARGET_SELECT_CATEGORY_CHANNEL, TARGET_SELECT_CATEGORY_CONE, TARGET_SELECT_CATEGORY_DEFAULT, and TARGET_SELECT_CATEGORY_NEARBY.

◆ GetTarget()

uint16 SpellScript::TargetHook::GetTarget ( ) const
inline
252{ return targetType; }

References targetType.

◆ ToString()

std::string SpellScript::TargetHook::ToString ( )
231{
232 std::ostringstream oss;
233 oss << "Index: " << EffIndexToString() << " Target: " << targetType;
234 return oss.str();
235}
std::string EffIndexToString()
Definition: SpellScript.cpp:104

Member Data Documentation

◆ area

bool SpellScript::TargetHook::area
protected

◆ dest

bool SpellScript::TargetHook::dest
protected

◆ targetType

uint16 SpellScript::TargetHook::targetType
protected

Referenced by GetTarget().