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

#include "SpellInfo.h"

Classes

struct  StaticData
 

Public Member Functions

 SpellImplicitTargetInfo ()
 
 SpellImplicitTargetInfo (uint32 target)
 
bool IsArea () const
 
SpellTargetSelectionCategories GetSelectionCategory () const
 
SpellTargetReferenceTypes GetReferenceType () const
 
SpellTargetObjectTypes GetObjectType () const
 
SpellTargetCheckTypes GetCheckType () const
 
SpellTargetDirectionTypes GetDirectionType () const
 
float CalcDirectionAngle () const
 
Targets GetTarget () const
 
uint32 GetExplicitTargetMask (bool &srcSet, bool &dstSet) const
 

Private Attributes

Targets _target
 

Static Private Attributes

static std::array< StaticData, TOTAL_SPELL_TARGETS_data
 

Detailed Description

Constructor & Destructor Documentation

◆ SpellImplicitTargetInfo() [1/2]

SpellImplicitTargetInfo::SpellImplicitTargetInfo ( )
inline
221: _target(Targets(0)) {}
Targets
Definition SharedDefines.h:1409
Targets _target
Definition SpellInfo.h:219

◆ SpellImplicitTargetInfo() [2/2]

SpellImplicitTargetInfo::SpellImplicitTargetInfo ( uint32  target)
61{
62 _target = Targets(target);
63}

References _target.

Member Function Documentation

◆ CalcDirectionAngle()

float SpellImplicitTargetInfo::CalcDirectionAngle ( ) const
96{
97 switch (GetDirectionType())
98 {
100 return 0.0f;
101 case TARGET_DIR_BACK:
102 return static_cast<float>(M_PI);
103 case TARGET_DIR_RIGHT:
104 return static_cast<float>(-M_PI / 2);
105 case TARGET_DIR_LEFT:
106 return static_cast<float>(M_PI / 2);
108 return static_cast<float>(-M_PI / 4);
110 return static_cast<float>(-3 * M_PI / 4);
112 return static_cast<float>(3 * M_PI / 4);
114 return static_cast<float>(M_PI / 4);
116 return float(rand_norm()) * static_cast<float>(2 * M_PI);
117 default:
118 return 0.0f;
119 }
120}
double rand_norm()
Definition Random.cpp:77
@ TARGET_DIR_FRONT_RIGHT
Definition SpellInfo.h:132
@ TARGET_DIR_BACK
Definition SpellInfo.h:129
@ TARGET_DIR_BACK_RIGHT
Definition SpellInfo.h:133
@ TARGET_DIR_RIGHT
Definition SpellInfo.h:130
@ TARGET_DIR_FRONT_LEFT
Definition SpellInfo.h:135
@ TARGET_DIR_FRONT
Definition SpellInfo.h:128
@ TARGET_DIR_LEFT
Definition SpellInfo.h:131
@ TARGET_DIR_BACK_LEFT
Definition SpellInfo.h:134
@ TARGET_DIR_RANDOM
Definition SpellInfo.h:136
SpellTargetDirectionTypes GetDirectionType() const
Definition SpellInfo.cpp:90

References GetDirectionType(), rand_norm(), TARGET_DIR_BACK, TARGET_DIR_BACK_LEFT, TARGET_DIR_BACK_RIGHT, TARGET_DIR_FRONT, TARGET_DIR_FRONT_LEFT, TARGET_DIR_FRONT_RIGHT, TARGET_DIR_LEFT, TARGET_DIR_RANDOM, and TARGET_DIR_RIGHT.

Referenced by Spell::SelectImplicitCasterDestTargets(), Spell::SelectImplicitDestDestTargets(), and Spell::SelectImplicitTargetDestTargets().

◆ GetCheckType()

SpellTargetCheckTypes SpellImplicitTargetInfo::GetCheckType ( ) const
86{
87 return _data[_target].SelectionCheckType;
88}
static std::array< StaticData, TOTAL_SPELL_TARGETS > _data
Definition SpellInfo.h:211

References _data, and _target.

Referenced by GetExplicitTargetMask(), Spell::SelectImplicitAreaTargets(), Spell::SelectImplicitChainTargets(), Spell::SelectImplicitConeTargets(), and Spell::SelectImplicitNearbyTargets().

◆ GetDirectionType()

SpellTargetDirectionTypes SpellImplicitTargetInfo::GetDirectionType ( ) const
91{
92 return _data[_target].DirectionType;
93}

References _data, and _target.

Referenced by CalcDirectionAngle().

◆ GetExplicitTargetMask()

uint32 SpellImplicitTargetInfo::GetExplicitTargetMask ( bool &  srcSet,
bool &  dstSet 
) const
128{
129 uint32 targetMask = 0;
131 {
132 if (!srcSet)
133 targetMask = TARGET_FLAG_SOURCE_LOCATION;
134 if (!dstSet)
135 targetMask |= TARGET_FLAG_DEST_LOCATION;
136 }
137 else
138 {
139 switch (GetReferenceType())
140 {
142 if (srcSet)
143 break;
144 targetMask = TARGET_FLAG_SOURCE_LOCATION;
145 break;
147 if (dstSet)
148 break;
149 targetMask = TARGET_FLAG_DEST_LOCATION;
150 break;
152 switch (GetObjectType())
153 {
155 targetMask = TARGET_FLAG_GAMEOBJECT;
156 break;
158 targetMask = TARGET_FLAG_GAMEOBJECT_ITEM;
159 break;
163 switch (GetCheckType())
164 {
166 targetMask = TARGET_FLAG_UNIT_ENEMY;
167 break;
169 targetMask = TARGET_FLAG_UNIT_ALLY;
170 break;
172 targetMask = TARGET_FLAG_UNIT_PARTY;
173 break;
175 targetMask = TARGET_FLAG_UNIT_RAID;
176 break;
178 targetMask = TARGET_FLAG_UNIT_PASSENGER;
179 break;
181 [[fallthrough]];
182 default:
183 targetMask = TARGET_FLAG_UNIT;
184 break;
185 }
186 break;
187 default:
188 break;
189 }
190 break;
191 default:
192 break;
193 }
194 }
195
196 switch (GetObjectType())
197 {
199 srcSet = true;
200 break;
203 dstSet = true;
204 break;
205 default:
206 break;
207 }
208 return targetMask;
209}
std::uint32_t uint32
Definition Define.h:107
@ TARGET_DEST_TRAJ
Definition SharedDefines.h:1493
@ TARGET_CHECK_PASSENGER
Definition SpellInfo.h:121
@ TARGET_CHECK_PARTY
Definition SpellInfo.h:118
@ TARGET_CHECK_ENEMY
Definition SpellInfo.h:116
@ TARGET_CHECK_RAID_CLASS
Definition SpellInfo.h:120
@ TARGET_CHECK_ALLY
Definition SpellInfo.h:117
@ TARGET_CHECK_RAID
Definition SpellInfo.h:119
@ TARGET_FLAG_GAMEOBJECT
Definition SpellInfo.h:57
@ TARGET_FLAG_UNIT_RAID
Definition SpellInfo.h:48
@ TARGET_FLAG_UNIT_ENEMY
Definition SpellInfo.h:53
@ TARGET_FLAG_UNIT_PASSENGER
Definition SpellInfo.h:66
@ TARGET_FLAG_GAMEOBJECT_ITEM
Definition SpellInfo.h:60
@ TARGET_FLAG_DEST_LOCATION
Definition SpellInfo.h:52
@ TARGET_FLAG_UNIT_ALLY
Definition SpellInfo.h:54
@ TARGET_FLAG_SOURCE_LOCATION
Definition SpellInfo.h:51
@ TARGET_FLAG_UNIT
Definition SpellInfo.h:47
@ TARGET_FLAG_UNIT_PARTY
Definition SpellInfo.h:49
@ TARGET_OBJECT_TYPE_UNIT
Definition SpellInfo.h:101
@ TARGET_OBJECT_TYPE_UNIT_AND_DEST
Definition SpellInfo.h:102
@ TARGET_OBJECT_TYPE_DEST
Definition SpellInfo.h:100
@ TARGET_OBJECT_TYPE_GOBJ
Definition SpellInfo.h:103
@ TARGET_OBJECT_TYPE_GOBJ_ITEM
Definition SpellInfo.h:104
@ TARGET_OBJECT_TYPE_SRC
Definition SpellInfo.h:99
@ TARGET_REFERENCE_TYPE_SRC
Definition SpellInfo.h:92
@ TARGET_REFERENCE_TYPE_TARGET
Definition SpellInfo.h:90
@ TARGET_REFERENCE_TYPE_DEST
Definition SpellInfo.h:93
SpellTargetCheckTypes GetCheckType() const
Definition SpellInfo.cpp:85
SpellTargetReferenceTypes GetReferenceType() const
Definition SpellInfo.cpp:75
SpellTargetObjectTypes GetObjectType() const
Definition SpellInfo.cpp:80
Targets GetTarget() const
Definition SpellInfo.cpp:122

References GetCheckType(), GetObjectType(), GetReferenceType(), GetTarget(), TARGET_CHECK_ALLY, TARGET_CHECK_ENEMY, TARGET_CHECK_PARTY, TARGET_CHECK_PASSENGER, TARGET_CHECK_RAID, TARGET_CHECK_RAID_CLASS, TARGET_DEST_TRAJ, TARGET_FLAG_DEST_LOCATION, TARGET_FLAG_GAMEOBJECT, TARGET_FLAG_GAMEOBJECT_ITEM, TARGET_FLAG_SOURCE_LOCATION, TARGET_FLAG_UNIT, TARGET_FLAG_UNIT_ALLY, TARGET_FLAG_UNIT_ENEMY, TARGET_FLAG_UNIT_PARTY, TARGET_FLAG_UNIT_PASSENGER, TARGET_FLAG_UNIT_RAID, TARGET_OBJECT_TYPE_DEST, TARGET_OBJECT_TYPE_GOBJ, TARGET_OBJECT_TYPE_GOBJ_ITEM, TARGET_OBJECT_TYPE_SRC, TARGET_OBJECT_TYPE_UNIT, TARGET_OBJECT_TYPE_UNIT_AND_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_REFERENCE_TYPE_SRC, and TARGET_REFERENCE_TYPE_TARGET.

◆ GetObjectType()

◆ GetReferenceType()

◆ GetSelectionCategory()

SpellTargetSelectionCategories SpellImplicitTargetInfo::GetSelectionCategory ( ) const

◆ GetTarget()

◆ IsArea()

bool SpellImplicitTargetInfo::IsArea ( ) const
66{
68}
@ TARGET_SELECT_CATEGORY_CONE
Definition SpellInfo.h:81
@ TARGET_SELECT_CATEGORY_AREA
Definition SpellInfo.h:82
SpellTargetSelectionCategories GetSelectionCategory() const
Definition SpellInfo.cpp:70

References GetSelectionCategory(), TARGET_SELECT_CATEGORY_AREA, and TARGET_SELECT_CATEGORY_CONE.

Referenced by SpellEffectInfo::IsTargetingArea().

Member Data Documentation

◆ _data

std::array< SpellImplicitTargetInfo::StaticData, TOTAL_SPELL_TARGETS > SpellImplicitTargetInfo::_data
staticprivate
217{
218private:
220public:
223
224 bool IsArea() const;
230 float CalcDirectionAngle() const;
231
232 Targets GetTarget() const;
233 uint32 GetExplicitTargetMask(bool& srcSet, bool& dstSet) const;
234
235private:
236 struct StaticData
237 {
238 SpellTargetObjectTypes ObjectType; // type of object returned by target type
239 SpellTargetReferenceTypes ReferenceType; // defines which object is used as a reference when selecting target
241 SpellTargetCheckTypes SelectionCheckType; // defines selection criteria
242 SpellTargetDirectionTypes DirectionType; // direction for cone and dest targets
243 };
244
245 static std::array<StaticData, TOTAL_SPELL_TARGETS> _data;
246};
247
248class SpellEffectInfo
249{
250 SpellInfo const* _spellInfo;
251 uint8 _effIndex;
252public:
253 uint32 Effect;
254 uint32 ApplyAuraName;
255 uint32 Amplitude;
256 int32 DieSides;
257 float RealPointsPerLevel;
258 int32 BasePoints;
259 float PointsPerComboPoint;
260 float ValueMultiplier;
261 float DamageMultiplier;
262 float BonusMultiplier;
263 int32 MiscValue;
264 int32 MiscValueB;
265 Mechanics Mechanic;
268 SpellRadiusEntry const* RadiusEntry;
269 uint32 ChainTarget;
270 uint32 ItemType;
271 uint32 TriggerSpell;
272 flag96 SpellClassMask;
273 std::list<Condition*>* ImplicitTargetConditions;
274
275 SpellEffectInfo() : _spellInfo(nullptr), _effIndex(0), Effect(0), ApplyAuraName(0), Amplitude(0), DieSides(0),
276 RealPointsPerLevel(0), BasePoints(0), PointsPerComboPoint(0), ValueMultiplier(0), DamageMultiplier(0),
277 BonusMultiplier(0), MiscValue(0), MiscValueB(0), Mechanic(MECHANIC_NONE), RadiusEntry(nullptr), ChainTarget(0),
278 ItemType(0), TriggerSpell(0), ImplicitTargetConditions(nullptr) {}
279 SpellEffectInfo(SpellEntry const* spellEntry, SpellInfo const* spellInfo, uint8 effIndex);
280
281 bool IsEffect() const;
282 bool IsEffect(SpellEffects effectName) const;
283 bool IsAura() const;
284 bool IsAura(AuraType aura) const;
285 bool IsTargetingArea() const;
286 bool IsAreaAuraEffect() const;
287 bool IsFarUnitTargetEffect() const;
288 bool IsFarDestTargetEffect() const;
289 bool IsUnitOwnedAuraEffect() const;
290
291 int32 CalcValue(Unit const* caster = nullptr, int32 const* basePoints = nullptr, Unit const* target = nullptr) const;
292 int32 CalcBaseValue(int32 value) const;
293 float CalcValueMultiplier(Unit* caster, Spell* spell = nullptr) const;
294 float CalcDamageMultiplier(Unit* caster, Spell* spell = nullptr) const;
295
296 bool HasRadius() const;
297 float CalcRadius(Unit* caster = nullptr, Spell* = nullptr) const;
298
299 uint32 GetProvidedTargetMask() const;
300 uint32 GetMissingTargetMask(bool srcSet = false, bool destSet = false, uint32 mask = 0) const;
301
302 SpellEffectImplicitTargetTypes GetImplicitTargetType() const;
303 SpellTargetObjectTypes GetUsedTargetObjectType() const;
304
305private:
306 struct StaticData
307 {
308 SpellEffectImplicitTargetTypes ImplicitTargetType; // defines what target can be added to effect target list if there's no valid target type provided for effect
309 SpellTargetObjectTypes UsedTargetObjectType; // defines valid target object type for spell effect
310 };
311
312 static std::array<StaticData, TOTAL_SPELL_EFFECTS> _data;
313};
314
316{
317friend class SpellMgr;
318
319public:
320 uint32 Id;
321 SpellCategoryEntry const* CategoryEntry;
322 uint32 Dispel;
323 uint32 Mechanic;
324 uint32 Attributes;
#define AC_GAME_API
Definition Define.h:94
std::int32_t int32
Definition Define.h:103
std::uint8_t uint8
Definition Define.h:109
SpellEffects
Definition SharedDefines.h:778
Mechanics
Definition SharedDefines.h:1324
@ MECHANIC_NONE
Definition SharedDefines.h:1325
AuraType
Definition SpellAuraDefines.h:62
SpellEffectImplicitTargetTypes
Definition SpellInfo.h:141
SpellTargetSelectionCategories
Definition SpellInfo.h:76
SpellTargetCheckTypes
Definition SpellInfo.h:113
SpellTargetDirectionTypes
Definition SpellInfo.h:126
SpellTargetObjectTypes
Definition SpellInfo.h:97
SpellTargetReferenceTypes
Definition SpellInfo.h:87
Definition SpellInfo.h:249
Definition SpellInfo.h:217
bool IsArea() const
Definition SpellInfo.cpp:65
SpellImplicitTargetInfo()
Definition SpellInfo.h:221
float CalcDirectionAngle() const
Definition SpellInfo.cpp:95
uint32 GetExplicitTargetMask(bool &srcSet, bool &dstSet) const
Definition SpellInfo.cpp:127
Definition SpellInfo.h:316
Definition SpellMgr.h:640
Definition Spell.h:287
Definition Unit.h:636
Definition Util.h:451
Definition DBCStructure.h:1765
Definition DBCStructure.h:1641
SpellTargetObjectTypes ObjectType
Definition SpellInfo.h:238
SpellTargetCheckTypes SelectionCheckType
Definition SpellInfo.h:241
SpellTargetReferenceTypes ReferenceType
Definition SpellInfo.h:239
SpellTargetSelectionCategories SelectionCategory
Definition SpellInfo.h:240
SpellTargetDirectionTypes DirectionType
Definition SpellInfo.h:242
Definition DBCStructure.h:1784

Referenced by GetCheckType(), GetDirectionType(), GetObjectType(), GetReferenceType(), and GetSelectionCategory().

◆ _target


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