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
242: _target(Targets(0)) {}
Targets
Definition SharedDefines.h:1415
Targets _target
Definition SpellInfo.h:240

◆ 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:85
@ TARGET_DIR_FRONT_RIGHT
Definition SpellInfo.h:133
@ TARGET_DIR_BACK
Definition SpellInfo.h:130
@ TARGET_DIR_BACK_RIGHT
Definition SpellInfo.h:134
@ TARGET_DIR_RIGHT
Definition SpellInfo.h:131
@ TARGET_DIR_FRONT_LEFT
Definition SpellInfo.h:136
@ TARGET_DIR_FRONT
Definition SpellInfo.h:129
@ TARGET_DIR_LEFT
Definition SpellInfo.h:132
@ TARGET_DIR_BACK_LEFT
Definition SpellInfo.h:135
@ TARGET_DIR_RANDOM
Definition SpellInfo.h:137
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(), Spell::SelectImplicitNearbyTargets(), and Spell::SelectImplicitTrajTargets().

◆ 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:1499
@ TARGET_CHECK_PASSENGER
Definition SpellInfo.h:122
@ TARGET_CHECK_PARTY
Definition SpellInfo.h:119
@ TARGET_CHECK_ENEMY
Definition SpellInfo.h:117
@ TARGET_CHECK_RAID_CLASS
Definition SpellInfo.h:121
@ TARGET_CHECK_ALLY
Definition SpellInfo.h:118
@ TARGET_CHECK_RAID
Definition SpellInfo.h:120
@ TARGET_FLAG_GAMEOBJECT
Definition SpellInfo.h:58
@ TARGET_FLAG_UNIT_RAID
Definition SpellInfo.h:49
@ TARGET_FLAG_UNIT_ENEMY
Definition SpellInfo.h:54
@ TARGET_FLAG_UNIT_PASSENGER
Definition SpellInfo.h:67
@ TARGET_FLAG_GAMEOBJECT_ITEM
Definition SpellInfo.h:61
@ TARGET_FLAG_DEST_LOCATION
Definition SpellInfo.h:53
@ TARGET_FLAG_UNIT_ALLY
Definition SpellInfo.h:55
@ TARGET_FLAG_SOURCE_LOCATION
Definition SpellInfo.h:52
@ TARGET_FLAG_UNIT
Definition SpellInfo.h:48
@ TARGET_FLAG_UNIT_PARTY
Definition SpellInfo.h:50
@ TARGET_OBJECT_TYPE_UNIT
Definition SpellInfo.h:102
@ TARGET_OBJECT_TYPE_UNIT_AND_DEST
Definition SpellInfo.h:103
@ TARGET_OBJECT_TYPE_DEST
Definition SpellInfo.h:101
@ TARGET_OBJECT_TYPE_GOBJ
Definition SpellInfo.h:104
@ TARGET_OBJECT_TYPE_GOBJ_ITEM
Definition SpellInfo.h:105
@ TARGET_OBJECT_TYPE_SRC
Definition SpellInfo.h:100
@ TARGET_REFERENCE_TYPE_SRC
Definition SpellInfo.h:93
@ TARGET_REFERENCE_TYPE_TARGET
Definition SpellInfo.h:91
@ TARGET_REFERENCE_TYPE_DEST
Definition SpellInfo.h:94
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:82
@ TARGET_SELECT_CATEGORY_AREA
Definition SpellInfo.h:83
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
218{
219 DiminishingGroup DiminishGroup = DIMINISHING_NONE;
220 DiminishingReturnsType DiminishReturnType = DRTYPE_NONE;
221 int32 DiminishMaxLevel = 3; // DIMINISHING_LEVEL_IMMUNE
222 int32 DiminishDurationLimit = 0;
223};
224
226{
227 uint32 SchoolImmuneMask = 0;
228 uint32 ApplyHarmfulAuraImmuneMask = 0;
229 uint64 MechanicImmuneMask = 0;
230 uint32 DispelImmuneMask = 0;
231 uint32 DamageSchoolMask = 0;
232
233 boost::container::flat_set<AuraType> AuraTypeImmune;
234 boost::container::flat_set<SpellEffects> SpellEffectImmune;
235};
236
238{
239private:
241public:
244
245 bool IsArea() const;
251 float CalcDirectionAngle() const;
252
253 Targets GetTarget() const;
254 uint32 GetExplicitTargetMask(bool& srcSet, bool& dstSet) const;
255
256private:
257 struct StaticData
258 {
259 SpellTargetObjectTypes ObjectType; // type of object returned by target type
260 SpellTargetReferenceTypes ReferenceType; // defines which object is used as a reference when selecting target
262 SpellTargetCheckTypes SelectionCheckType; // defines selection criteria
263 SpellTargetDirectionTypes DirectionType; // direction for cone and dest targets
264 };
265
266 static std::array<StaticData, TOTAL_SPELL_TARGETS> _data;
267};
268
269class SpellEffectInfo
270{
271 SpellInfo const* _spellInfo;
272public:
273 uint8 EffectIndex;
274 uint32 Effect;
275 AuraType ApplyAuraName;
276 uint32 Amplitude;
277 int32 DieSides;
278 float RealPointsPerLevel;
279 int32 BasePoints;
280 float PointsPerComboPoint;
281 float ValueMultiplier;
282 float DamageMultiplier;
283 float BonusMultiplier;
284 int32 MiscValue;
285 int32 MiscValueB;
286 Mechanics Mechanic;
289 SpellRadiusEntry const* RadiusEntry;
290 uint32 ChainTarget;
291 uint32 ItemType;
292 uint32 TriggerSpell;
293 flag96 SpellClassMask;
294 std::list<Condition*>* ImplicitTargetConditions;
295
296 SpellEffectInfo() : _spellInfo(nullptr), EffectIndex(0), Effect(0), ApplyAuraName(SPELL_AURA_NONE), Amplitude(0), DieSides(0),
297 RealPointsPerLevel(0), BasePoints(0), PointsPerComboPoint(0), ValueMultiplier(0), DamageMultiplier(0),
298 BonusMultiplier(0), MiscValue(0), MiscValueB(0), Mechanic(MECHANIC_NONE), RadiusEntry(nullptr), ChainTarget(0),
299 ItemType(0), TriggerSpell(0), ImplicitTargetConditions(nullptr) {}
300 SpellEffectInfo(SpellEntry const* spellEntry, SpellInfo const* spellInfo, uint8 effIndex);
301
302 bool IsEffect() const;
303 bool IsEffect(SpellEffects effectName) const;
304 bool IsAura() const;
305 bool IsAura(AuraType aura) const;
306 bool IsTargetingArea() const;
307 bool IsAreaAuraEffect() const;
308 bool IsFarUnitTargetEffect() const;
309 bool IsFarDestTargetEffect() const;
310 bool IsUnitOwnedAuraEffect() const;
311
312 int32 CalcValue(Unit const* caster = nullptr, int32 const* basePoints = nullptr, Unit const* target = nullptr) const;
313 int32 CalcBaseValue(int32 value) const;
314 float CalcValueMultiplier(Unit* caster, Spell* spell = nullptr) const;
315 float CalcDamageMultiplier(Unit* caster, Spell* spell = nullptr) const;
316
317 bool HasRadius() const;
318 float CalcRadius(Unit* caster = nullptr, Spell* = nullptr) const;
319
320 uint32 GetProvidedTargetMask() const;
321 uint32 GetMissingTargetMask(bool srcSet = false, bool destSet = false, uint32 mask = 0) const;
322
323 SpellEffectImplicitTargetTypes GetImplicitTargetType() const;
324 SpellTargetObjectTypes GetUsedTargetObjectType() const;
#define AC_GAME_API
Definition Define.h:94
std::int32_t int32
Definition Define.h:103
std::uint8_t uint8
Definition Define.h:109
std::uint64_t uint64
Definition Define.h:106
DiminishingGroup
Definition SharedDefines.h:3492
@ DIMINISHING_NONE
Definition SharedDefines.h:3493
SpellEffects
Definition SharedDefines.h:766
Mechanics
Definition SharedDefines.h:1312
@ MECHANIC_NONE
Definition SharedDefines.h:1313
DiminishingReturnsType
Definition SharedDefines.h:3484
@ DRTYPE_NONE
Definition SharedDefines.h:3485
AuraType
Definition SpellAuraDefines.h:62
@ SPELL_AURA_NONE
Definition SpellAuraDefines.h:63
SpellEffectImplicitTargetTypes
Definition SpellInfo.h:142
SpellTargetSelectionCategories
Definition SpellInfo.h:77
SpellTargetCheckTypes
Definition SpellInfo.h:114
SpellTargetDirectionTypes
Definition SpellInfo.h:127
SpellTargetObjectTypes
Definition SpellInfo.h:98
SpellTargetReferenceTypes
Definition SpellInfo.h:88
Definition SpellInfo.h:270
Definition SpellInfo.h:238
bool IsArea() const
Definition SpellInfo.cpp:65
SpellImplicitTargetInfo()
Definition SpellInfo.h:242
float CalcDirectionAngle() const
Definition SpellInfo.cpp:95
uint32 GetExplicitTargetMask(bool &srcSet, bool &dstSet) const
Definition SpellInfo.cpp:127
Definition SpellInfo.h:340
Definition Spell.h:298
Definition Unit.h:664
Definition Util.h:442
Definition SpellInfo.h:226
Definition DBCStructure.h:1642
SpellTargetObjectTypes ObjectType
Definition SpellInfo.h:259
SpellTargetCheckTypes SelectionCheckType
Definition SpellInfo.h:262
SpellTargetReferenceTypes ReferenceType
Definition SpellInfo.h:260
SpellTargetSelectionCategories SelectionCategory
Definition SpellInfo.h:261
SpellTargetDirectionTypes DirectionType
Definition SpellInfo.h:263
Definition DBCStructure.h:1785

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

◆ _target


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