TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SpellScript::TargetHook Class Reference

#include <SpellScript.h>

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 ()
 
uint32 GetAffectedEffectsMask (SpellInfo const *spellInfo)
 
bool IsEffectAffected (SpellInfo const *spellInfo, uint8 effIndex)
 
std::string EffIndexToString ()
 

Protected Attributes

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

Constructor & Destructor Documentation

SpellScript::TargetHook::TargetHook ( uint8  _effectIndex,
uint16  _targetType,
bool  _area,
bool  _dest 
)
213  : _SpellScript::EffectHook(_effectIndex), targetType(_targetType), area(_area), dest(_dest) { }
uint16 targetType
Definition: SpellScript.h:214
bool area
Definition: SpellScript.h:215
Definition: SpellScript.h:71
bool dest
Definition: SpellScript.h:216

Member Function Documentation

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

Implements _SpellScript::EffectHook.

223 {
224  if (!targetType)
225  return false;
226 
227  SpellEffectInfo const* effect = spellEntry->GetEffect(effIndexToCheck);
228  if (!effect)
229  return false;
230 
231  if (effect->TargetA.GetTarget() != targetType &&
232  effect->TargetB.GetTarget() != targetType)
233  return false;
234 
236  switch (targetInfo.GetSelectionCategory())
237  {
238  case TARGET_SELECT_CATEGORY_CHANNEL: // SINGLE
239  return !area;
240  case TARGET_SELECT_CATEGORY_NEARBY: // BOTH
241  return true;
242  case TARGET_SELECT_CATEGORY_CONE: // AREA
243  case TARGET_SELECT_CATEGORY_AREA: // AREA
244  return area;
246  switch (targetInfo.GetObjectType())
247  {
248  case TARGET_OBJECT_TYPE_SRC: // EMPTY
249  return false;
250  case TARGET_OBJECT_TYPE_DEST: // DEST
251  return dest;
252  default:
253  switch (targetInfo.GetReferenceType())
254  {
255  case TARGET_REFERENCE_TYPE_CASTER: // SINGLE
256  return !area;
257  case TARGET_REFERENCE_TYPE_TARGET: // BOTH
258  return true;
259  default:
260  break;
261  }
262  break;
263  }
264  break;
265  default:
266  break;
267  }
268 
269  return false;
270 }
Definition: SpellInfo.h:96
SpellImplicitTargetInfo TargetA
Definition: SpellInfo.h:257
Targets GetTarget() const
Definition: SpellInfo.cpp:121
Definition: SpellInfo.h:95
uint16 targetType
Definition: SpellScript.h:214
bool area
Definition: SpellScript.h:215
Definition: SpellInfo.h:238
Definition: SpellInfo.h:88
Definition: SpellInfo.h:87
Definition: SpellInfo.h:85
bool dest
Definition: SpellScript.h:216
Definition: SpellInfo.h:207
Definition: SpellInfo.h:89
Definition: SpellInfo.h:86
Definition: SpellInfo.h:106
SpellImplicitTargetInfo TargetB
Definition: SpellInfo.h:258
Definition: SpellInfo.h:105

+ Here is the call graph for this function:

uint16 SpellScript::TargetHook::GetTarget ( ) const
inline
212 { return targetType; }
uint16 targetType
Definition: SpellScript.h:214
std::string SpellScript::TargetHook::ToString ( )
216 {
217  std::ostringstream oss;
218  oss << "Index: " << EffIndexToString() << " Target: " << targetType;
219  return oss.str();
220 }
std::string EffIndexToString()
Definition: SpellScript.cpp:93
uint16 targetType
Definition: SpellScript.h:214

Member Data Documentation

bool SpellScript::TargetHook::area
protected
bool SpellScript::TargetHook::dest
protected
uint16 SpellScript::TargetHook::targetType
protected

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