TrinityCore
Loading...
Searching...
No Matches
SpellInfo Class Reference

#include <SpellInfo.h>

Classes

struct  ScalingInfo
 

Public Member Functions

 SpellInfo (SpellNameEntry const *spellName, ::Difficulty difficulty, SpellInfoLoadHelper const &data)
 
 SpellInfo (SpellNameEntry const *spellName, ::Difficulty difficulty, std::vector< SpellEffectEntry > const &effects)
 
 SpellInfo (SpellInfo const &)=delete
 
 SpellInfo (SpellInfo &&)=delete
 
 ~SpellInfo ()
 
SpellInfooperator= (SpellInfo const &)=delete
 
SpellInfooperator= (SpellInfo &&) noexcept=delete
 
uint32 GetCategory () const
 
bool HasEffect (SpellEffectName effect) const
 
bool HasAura (AuraType aura) const
 
bool HasAreaAuraEffect () const
 
bool HasOnlyDamageEffects () const
 
bool HasTargetType (::Targets target) const
 
bool HasAttribute (SpellAttr0 attribute) const
 
bool HasAttribute (SpellAttr1 attribute) const
 
bool HasAttribute (SpellAttr2 attribute) const
 
bool HasAttribute (SpellAttr3 attribute) const
 
bool HasAttribute (SpellAttr4 attribute) const
 
bool HasAttribute (SpellAttr5 attribute) const
 
bool HasAttribute (SpellAttr6 attribute) const
 
bool HasAttribute (SpellAttr7 attribute) const
 
bool HasAttribute (SpellAttr8 attribute) const
 
bool HasAttribute (SpellAttr9 attribute) const
 
bool HasAttribute (SpellAttr10 attribute) const
 
bool HasAttribute (SpellAttr11 attribute) const
 
bool HasAttribute (SpellAttr12 attribute) const
 
bool HasAttribute (SpellAttr13 attribute) const
 
bool HasAttribute (SpellAttr14 attribute) const
 
bool HasAttribute (SpellCustomAttributes customAttribute) const
 
bool CanBeInterrupted (WorldObject const *interruptCaster, Unit const *interruptTarget, bool ignoreImmunity=false) const
 
bool HasAnyAuraInterruptFlag () const
 
bool HasAuraInterruptFlag (SpellAuraInterruptFlags flag) const
 
bool HasAuraInterruptFlag (SpellAuraInterruptFlags2 flag) const
 
bool HasChannelInterruptFlag (SpellAuraInterruptFlags flag) const
 
bool HasChannelInterruptFlag (SpellAuraInterruptFlags2 flag) const
 
bool IsExplicitDiscovery () const
 
bool IsLootCrafting () const
 
bool IsProfession () const
 
bool IsPrimaryProfession () const
 
bool IsPrimaryProfessionFirstRank () const
 
bool IsAbilityOfSkillType (uint32 skillType) const
 
bool IsAffectingArea () const
 
bool IsTargetingArea () const
 
bool NeedsExplicitUnitTarget () const
 
bool NeedsToBeTriggeredByCaster (SpellInfo const *triggeringSpell) const
 
bool IsPassive () const
 
bool IsAutocastable () const
 
bool IsStackableWithRanks () const
 
bool IsPassiveStackableWithRanks () const
 
bool IsMultiSlotAura () const
 
bool IsStackableOnOneSlotWithDifferentCasters () const
 
bool IsCooldownStartedOnEvent () const
 
bool IsDeathPersistent () const
 
bool IsRequiringDeadTarget () const
 
bool IsAllowingDeadTarget () const
 
bool IsGroupBuff () const
 
bool CanBeUsedInCombat () const
 
bool IsPositive () const
 
bool IsPositiveEffect (uint8 effIndex) const
 
bool IsChanneled () const
 
bool IsMoveAllowedChannel () const
 
bool NeedsComboPoints () const
 
bool IsNextMeleeSwingSpell () const
 
bool IsRangedWeaponSpell () const
 
bool IsAutoRepeatRangedSpell () const
 
bool HasInitialAggro () const
 
bool HasHitDelay () const
 
WeaponAttackType GetAttackType () const
 
bool IsItemFitToSpellRequirements (Item const *item) const
 
bool IsAffected (uint32 familyName, flag128 const &familyFlags) const
 
bool IsAffectedBySpellMods () const
 
bool IsAffectedBySpellMod (SpellModifier const *mod) const
 
bool CanPierceImmuneAura (SpellInfo const *auraSpellInfo) const
 
bool CanDispelAura (SpellInfo const *auraSpellInfo) const
 
bool IsSingleTarget () const
 
bool IsAuraExclusiveBySpecificWith (SpellInfo const *spellInfo) const
 
bool IsAuraExclusiveBySpecificPerCasterWith (SpellInfo const *spellInfo) const
 
SpellCastResult CheckShapeshift (uint32 form) const
 
SpellCastResult CheckLocation (uint32 map_id, uint32 zone_id, uint32 area_id, Player const *player=nullptr) const
 
SpellCastResult CheckTarget (WorldObject const *caster, WorldObject const *target, bool implicit=true) const
 
SpellCastResult CheckExplicitTarget (WorldObject const *caster, WorldObject const *target, Item const *itemTarget=nullptr) const
 
SpellCastResult CheckVehicle (Unit const *caster) const
 
bool CheckTargetCreatureType (Unit const *target) const
 
SpellSchoolMask GetSchoolMask () const
 
uint64 GetAllEffectsMechanicMask () const
 
uint64 GetEffectMechanicMask (SpellEffIndex effIndex) const
 
uint64 GetSpellMechanicMaskByEffectMask (uint32 effectMask) const
 
Mechanics GetEffectMechanic (SpellEffIndex effIndex) const
 
uint32 GetDispelMask () const
 
uint32 GetExplicitTargetMask () const
 
AuraStateType GetAuraState () const
 
SpellSpecificType GetSpellSpecific () const
 
float GetMinRange (bool positive=false) const
 
float GetMaxRange (bool positive=false, WorldObject *caster=nullptr, Spell *spell=nullptr) const
 
int32 CalcDuration (WorldObject const *caster=nullptr) const
 
int32 GetDuration () const
 
int32 GetMaxDuration () const
 
uint32 GetMaxTicks () const
 
uint32 CalcCastTime (Spell *spell=nullptr) const
 
uint32 GetRecoveryTime () const
 
Optional< SpellPowerCostCalcPowerCost (Powers powerType, bool optionalCost, WorldObject const *caster, SpellSchoolMask schoolMask, Spell *spell=nullptr) const
 
Optional< SpellPowerCostCalcPowerCost (SpellPowerEntry const *power, bool optionalCost, WorldObject const *caster, SpellSchoolMask schoolMask, Spell *spell=nullptr) const
 
std::vector< SpellPowerCostCalcPowerCost (WorldObject const *caster, SpellSchoolMask schoolMask, Spell *spell=nullptr) const
 
float CalcProcPPM (Unit *caster, int32 itemLevel) const
 
bool IsRanked () const
 
uint8 GetRank () const
 
SpellInfo const * GetFirstRankSpell () const
 
SpellInfo const * GetLastRankSpell () const
 
SpellInfo const * GetNextRankSpell () const
 
SpellInfo const * GetPrevRankSpell () const
 
SpellInfo const * GetAuraRankForLevel (uint8 level) const
 
bool IsRankOf (SpellInfo const *spellInfo) const
 
bool IsDifferentRankOf (SpellInfo const *spellInfo) const
 
bool IsHighRankOf (SpellInfo const *spellInfo) const
 
uint32 GetSpellXSpellVisualId (WorldObject const *caster=nullptr, WorldObject const *viewer=nullptr) const
 
uint32 GetSpellVisual (WorldObject const *caster=nullptr, WorldObject const *viewer=nullptr) const
 
std::vector< SpellEffectInfo > const & GetEffects () const
 
SpellEffectInfo const & GetEffect (SpellEffIndex index) const
 
DiminishingGroup GetDiminishingReturnsGroupForSpell () const
 
DiminishingReturnsType GetDiminishingReturnsGroupType () const
 
DiminishingLevels GetDiminishingReturnsMaxLevel () const
 
int32 GetDiminishingReturnsLimitDuration () const
 
void ApplyAllSpellImmunitiesTo (Unit *target, SpellEffectInfo const &spellEffectInfo, bool apply) const
 
bool CanSpellProvideImmunityAgainstAura (SpellInfo const *auraSpellInfo) const
 
bool SpellCancelsAuraEffect (AuraEffect const *aurEff) const
 
uint64 GetAllowedMechanicMask () const
 
uint64 GetMechanicImmunityMask (Unit const *caster) const
 
bool MeetsFutureSpellPlayerCondition (Player const *player) const
 
bool HasLabel (uint32 labelId) const
 

Static Public Member Functions

static uint32 GetDispelMask (DispelType type)
 

Public Attributes

uint32 const Id = 0
 
::Difficulty const Difficulty = DIFFICULTY_NONE
 
uint32 CategoryId = 0
 
uint32 Dispel = 0
 
uint32 Mechanic = 0
 
uint32 Attributes = 0
 
uint32 AttributesEx = 0
 
uint32 AttributesEx2 = 0
 
uint32 AttributesEx3 = 0
 
uint32 AttributesEx4 = 0
 
uint32 AttributesEx5 = 0
 
uint32 AttributesEx6 = 0
 
uint32 AttributesEx7 = 0
 
uint32 AttributesEx8 = 0
 
uint32 AttributesEx9 = 0
 
uint32 AttributesEx10 = 0
 
uint32 AttributesEx11 = 0
 
uint32 AttributesEx12 = 0
 
uint32 AttributesEx13 = 0
 
uint32 AttributesEx14 = 0
 
uint32 AttributesCu = 0
 
std::bitset< MAX_SPELL_EFFECTSNegativeEffects
 
uint64 Stances = 0
 
uint64 StancesNot = 0
 
uint32 Targets = 0
 
uint32 TargetCreatureType = 0
 
uint32 RequiresSpellFocus = 0
 
uint32 FacingCasterFlags = 0
 
uint32 CasterAuraState = 0
 
uint32 TargetAuraState = 0
 
uint32 ExcludeCasterAuraState = 0
 
uint32 ExcludeTargetAuraState = 0
 
uint32 CasterAuraSpell = 0
 
uint32 TargetAuraSpell = 0
 
uint32 ExcludeCasterAuraSpell = 0
 
uint32 ExcludeTargetAuraSpell = 0
 
AuraType CasterAuraType = SPELL_AURA_NONE
 
AuraType TargetAuraType = SPELL_AURA_NONE
 
AuraType ExcludeCasterAuraType = SPELL_AURA_NONE
 
AuraType ExcludeTargetAuraType = SPELL_AURA_NONE
 
SpellCastTimesEntry const * CastTimeEntry = nullptr
 
uint32 RecoveryTime = 0
 
uint32 CategoryRecoveryTime = 0
 
uint32 StartRecoveryCategory = 0
 
uint32 StartRecoveryTime = 0
 
uint32 CooldownAuraSpellId = 0
 
EnumFlag< SpellInterruptFlagsInterruptFlags = SpellInterruptFlags::None
 
EnumFlag< SpellAuraInterruptFlagsAuraInterruptFlags = SpellAuraInterruptFlags::None
 
EnumFlag< SpellAuraInterruptFlags2AuraInterruptFlags2 = SpellAuraInterruptFlags2::None
 
EnumFlag< SpellAuraInterruptFlagsChannelInterruptFlags = SpellAuraInterruptFlags::None
 
EnumFlag< SpellAuraInterruptFlags2ChannelInterruptFlags2 = SpellAuraInterruptFlags2::None
 
ProcFlagsInit ProcFlags
 
uint32 ProcChance = 0
 
uint32 ProcCharges = 0
 
uint32 ProcCooldown = 0
 
float ProcBasePPM = 0.0f
 
std::vector< SpellProcsPerMinuteModEntry const * > ProcPPMMods
 
uint32 MaxLevel = 0
 
uint32 BaseLevel = 0
 
uint32 SpellLevel = 0
 
SpellDurationEntry const * DurationEntry = nullptr
 
std::array< SpellPowerEntry const *, MAX_POWERS_PER_SPELLPowerCosts = {}
 
SpellRangeEntry const * RangeEntry = nullptr
 
float Speed = 0.0f
 
float LaunchDelay = 0.0f
 
uint32 StackAmount = 0
 
std::array< int32, MAX_SPELL_TOTEMSTotem = {}
 
std::array< uint16, MAX_SPELL_TOTEMSTotemCategory = {}
 
std::array< int32, MAX_SPELL_REAGENTSReagent = {}
 
std::array< int16, MAX_SPELL_REAGENTSReagentCount = {}
 
std::vector< SpellReagentsCurrencyEntry const * > ReagentsCurrency
 
int32 EquippedItemClass = -1
 
int32 EquippedItemSubClassMask = 0
 
int32 EquippedItemInventoryTypeMask = 0
 
uint32 IconFileDataId = 0
 
uint32 ActiveIconFileDataId = 0
 
uint32 ContentTuningId = 0
 
uint32 ShowFutureSpellPlayerConditionID = 0
 
LocalizedString const * SpellName = nullptr
 
float ConeAngle = 0.0f
 
float Width = 0.0f
 
uint32 MaxTargetLevel = 0
 
uint32 MaxAffectedTargets = 0
 
uint32 SpellFamilyName = 0
 
flag128 SpellFamilyFlags
 
uint32 DmgClass = 0
 
uint32 PreventionType = 0
 
int32 RequiredAreasID = -1
 
uint32 SchoolMask = 0
 
uint32 ChargeCategoryId = 0
 
std::unordered_set< uint32Labels
 
struct SpellInfo::ScalingInfo Scaling
 
uint32 ExplicitTargetMask = 0
 
SpellChainNode const * ChainEntry = nullptr
 

Private Member Functions

void _InitializeExplicitTargetMask ()
 
void _InitializeSpellPositivity ()
 
void _LoadSpellSpecific ()
 
void _LoadAuraState ()
 
void _LoadSpellDiminishInfo ()
 
void _LoadImmunityInfo ()
 
void _UnloadImplicitTargetConditionLists ()
 

Private Attributes

std::vector< SpellEffectInfo_effects
 
SpellVisualVector _visuals
 
SpellSpecificType _spellSpecific = SPELL_SPECIFIC_NORMAL
 
AuraStateType _auraState = AURA_STATE_NONE
 
SpellDiminishInfo _diminishInfo
 
uint64 _allowedMechanicMask = 0
 

Friends

class SpellMgr
 

Constructor & Destructor Documentation

◆ SpellInfo() [1/4]

SpellInfo::SpellInfo ( SpellNameEntry const *  spellName,
::Difficulty  difficulty,
SpellInfoLoadHelper const &  data 
)
explicit
1138 : Id(spellName->ID), Difficulty(difficulty)
1139{
1140 _effects.reserve(32);
1141 for (SpellEffectEntry const* spellEffect : data.Effects)
1142 {
1143 if (!spellEffect)
1144 continue;
1145
1147 }
1148
1149 // Correct EffectIndex for blank effects
1150 for (size_t i = 0; i < _effects.size(); ++i)
1151 _effects[i].EffectIndex = SpellEffIndex(i);
1152
1153 _effects.shrink_to_fit();
1154
1155 SpellName = &spellName->Name;
1156
1157 // SpellMiscEntry
1158 if (SpellMiscEntry const* _misc = data.Misc)
1159 {
1160 Attributes = _misc->Attributes[0];
1161 AttributesEx = _misc->Attributes[1];
1162 AttributesEx2 = _misc->Attributes[2];
1163 AttributesEx3 = _misc->Attributes[3];
1164 AttributesEx4 = _misc->Attributes[4];
1165 AttributesEx5 = _misc->Attributes[5];
1166 AttributesEx6 = _misc->Attributes[6];
1167 AttributesEx7 = _misc->Attributes[7];
1168 AttributesEx8 = _misc->Attributes[8];
1169 AttributesEx9 = _misc->Attributes[9];
1170 AttributesEx10 = _misc->Attributes[10];
1171 AttributesEx11 = _misc->Attributes[11];
1172 AttributesEx12 = _misc->Attributes[12];
1173 AttributesEx13 = _misc->Attributes[13];
1174 AttributesEx14 = _misc->Attributes[14];
1175 CastTimeEntry = sSpellCastTimesStore.LookupEntry(_misc->CastingTimeIndex);
1176 DurationEntry = sSpellDurationStore.LookupEntry(_misc->DurationIndex);
1177 RangeEntry = sSpellRangeStore.LookupEntry(_misc->RangeIndex);
1178 Speed = _misc->Speed;
1179 LaunchDelay = _misc->LaunchDelay;
1180 SchoolMask = _misc->SchoolMask;
1181 IconFileDataId = _misc->SpellIconFileDataID;
1182 ActiveIconFileDataId = _misc->ActiveIconFileDataID;
1183 ContentTuningId = _misc->ContentTuningID;
1184 ShowFutureSpellPlayerConditionID = _misc->ShowFutureSpellPlayerConditionID;
1185 }
1186
1187 // SpellScalingEntry
1188 if (SpellScalingEntry const* _scaling = data.Scaling)
1189 {
1190 Scaling.MinScalingLevel = _scaling->MinScalingLevel;
1191 Scaling.MaxScalingLevel = _scaling->MaxScalingLevel;
1192 Scaling.ScalesFromItemLevel = _scaling->ScalesFromItemLevel;
1193 }
1194
1195 // SpellAuraOptionsEntry
1196 if (SpellAuraOptionsEntry const* _options = data.AuraOptions)
1197 {
1198 ProcFlags = _options->ProcTypeMask;
1199 ProcChance = _options->ProcChance;
1200 ProcCharges = _options->ProcCharges;
1201 ProcCooldown = _options->ProcCategoryRecovery;
1202 StackAmount = _options->CumulativeAura;
1203 if (SpellProcsPerMinuteEntry const* _ppm = sSpellProcsPerMinuteStore.LookupEntry(_options->SpellProcsPerMinuteID))
1204 {
1205 ProcBasePPM = _ppm->BaseProcRate;
1206 ProcPPMMods = sDB2Manager.GetSpellProcsPerMinuteMods(_ppm->ID);
1207 }
1208 }
1209
1210 // SpellAuraRestrictionsEntry
1211 if (SpellAuraRestrictionsEntry const* _aura = data.AuraRestrictions)
1212 {
1213 CasterAuraState = _aura->CasterAuraState;
1214 TargetAuraState = _aura->TargetAuraState;
1215 ExcludeCasterAuraState = _aura->ExcludeCasterAuraState;
1216 ExcludeTargetAuraState = _aura->ExcludeTargetAuraState;
1217 CasterAuraSpell = _aura->CasterAuraSpell;
1218 TargetAuraSpell = _aura->TargetAuraSpell;
1219 ExcludeCasterAuraSpell = _aura->ExcludeCasterAuraSpell;
1220 ExcludeTargetAuraSpell = _aura->ExcludeTargetAuraSpell;
1221 CasterAuraType = AuraType(_aura->CasterAuraType);
1222 TargetAuraType = AuraType(_aura->TargetAuraType);
1223 ExcludeCasterAuraType = AuraType(_aura->ExcludeCasterAuraType);
1224 ExcludeTargetAuraType = AuraType(_aura->ExcludeTargetAuraType);
1225 }
1226
1227 // SpellCastingRequirementsEntry
1228 if (SpellCastingRequirementsEntry const* _castreq = data.CastingRequirements)
1229 {
1230 RequiresSpellFocus = _castreq->RequiresSpellFocus;
1231 FacingCasterFlags = _castreq->FacingCasterFlags;
1232 RequiredAreasID = _castreq->RequiredAreasID;
1233 }
1234
1235 // SpellCategoriesEntry
1236 if (SpellCategoriesEntry const* _categories = data.Categories)
1237 {
1238 CategoryId = _categories->Category;
1239 Dispel = _categories->DispelType;
1240 Mechanic = _categories->Mechanic;
1241 StartRecoveryCategory = _categories->StartRecoveryCategory;
1242 DmgClass = _categories->DefenseType;
1243 PreventionType = _categories->PreventionType;
1244 ChargeCategoryId = _categories->ChargeCategory;
1245 }
1246
1247 // SpellClassOptionsEntry
1248 if (SpellClassOptionsEntry const* _class = data.ClassOptions)
1249 {
1250 SpellFamilyName = _class->SpellClassSet;
1251 SpellFamilyFlags = _class->SpellClassMask;
1252 }
1253
1254 // SpellCooldownsEntry
1255 if (SpellCooldownsEntry const* _cooldowns = data.Cooldowns)
1256 {
1257 RecoveryTime = _cooldowns->RecoveryTime;
1258 CategoryRecoveryTime = _cooldowns->CategoryRecoveryTime;
1259 StartRecoveryTime = _cooldowns->StartRecoveryTime;
1260 CooldownAuraSpellId = _cooldowns->AuraSpellID;
1261 }
1262
1263 // SpellEquippedItemsEntry
1264 if (SpellEquippedItemsEntry const* _equipped = data.EquippedItems)
1265 {
1266 EquippedItemClass = _equipped->EquippedItemClass;
1267 EquippedItemSubClassMask = _equipped->EquippedItemSubclass;
1268 EquippedItemInventoryTypeMask = _equipped->EquippedItemInvTypes;
1269 }
1270
1271 // SpellInterruptsEntry
1272 if (SpellInterruptsEntry const* _interrupt = data.Interrupts)
1273 {
1274 InterruptFlags = SpellInterruptFlags(_interrupt->InterruptFlags);
1275 AuraInterruptFlags = SpellAuraInterruptFlags(_interrupt->AuraInterruptFlags[0]);
1276 AuraInterruptFlags2 = SpellAuraInterruptFlags2(_interrupt->AuraInterruptFlags[1]);
1277 ChannelInterruptFlags = SpellAuraInterruptFlags(_interrupt->ChannelInterruptFlags[0]);
1278 ChannelInterruptFlags2 = SpellAuraInterruptFlags2(_interrupt->ChannelInterruptFlags[1]);
1279 }
1280
1281 for (SpellLabelEntry const* label : data.Labels)
1282 Labels.insert(label->LabelID);
1283
1284 // SpellLevelsEntry
1285 if (SpellLevelsEntry const* _levels = data.Levels)
1286 {
1287 MaxLevel = _levels->MaxLevel;
1288 BaseLevel = _levels->BaseLevel;
1289 SpellLevel = _levels->SpellLevel;
1290 }
1291
1292 // SpellPowerEntry
1293 PowerCosts = data.Powers;
1294
1295 // SpellReagentsEntry
1296 if (SpellReagentsEntry const* _reagents = data.Reagents)
1297 {
1298 Reagent = _reagents->Reagent;
1299 ReagentCount = _reagents->ReagentCount;
1300 }
1301
1302 ReagentsCurrency = data.ReagentsCurrency;
1303
1304 // SpellShapeshiftEntry
1305 if (SpellShapeshiftEntry const* _shapeshift = data.Shapeshift)
1306 {
1307 Stances = MAKE_PAIR64(_shapeshift->ShapeshiftMask[0], _shapeshift->ShapeshiftMask[1]);
1308 StancesNot = MAKE_PAIR64(_shapeshift->ShapeshiftExclude[0], _shapeshift->ShapeshiftExclude[1]);
1309 }
1310
1311 // SpellTargetRestrictionsEntry
1312 if (SpellTargetRestrictionsEntry const* _target = data.TargetRestrictions)
1313 {
1314 ConeAngle = _target->ConeDegrees;
1315 Width = _target->Width;
1316 Targets = _target->Targets;
1317 TargetCreatureType = _target->TargetCreatureType;
1318 MaxAffectedTargets = _target->MaxTargets;
1319 MaxTargetLevel = _target->MaxTargetLevel;
1320 }
1321
1322 // SpellTotemsEntry
1323 if (SpellTotemsEntry const* _totem = data.Totems)
1324 {
1325 TotemCategory = _totem->RequiredTotemCategoryID;
1326 Totem = _totem->Totem;
1327 }
1328
1329 _visuals = data.Visuals;
1330}
DB2Storage< SpellRangeEntry > sSpellRangeStore("SpellRange.db2", &SpellRangeLoadInfo::Instance)
DB2Storage< SpellDurationEntry > sSpellDurationStore("SpellDuration.db2", &SpellDurationLoadInfo::Instance)
DB2Storage< SpellProcsPerMinuteEntry > sSpellProcsPerMinuteStore("SpellProcsPerMinute.db2", &SpellProcsPerMinuteLoadInfo::Instance)
DB2Storage< SpellCastTimesEntry > sSpellCastTimesStore("SpellCastTimes.db2", &SpellCastTimesLoadInfo::Instance)
#define sDB2Manager
Definition: DB2Stores.h:502
uint64 MAKE_PAIR64(uint32 l, uint32 h)
Definition: ObjectDefines.h:85
SpellEffIndex
Definition: SharedDefines.h:28
Targets
Definition: SharedDefines.h:2577
TotemCategory
Definition: SharedDefines.h:5732
AuraType
Definition: SpellAuraDefines.h:93
SpellInterruptFlags
Definition: SpellDefines.h:58
SpellAuraInterruptFlags2
Definition: SpellDefines.h:117
SpellAuraInterruptFlags
Definition: SpellDefines.h:76
ProcFlags
Definition: SpellMgr.h:132
Stances
Definition: boss_general_bjarngrim.cpp:117
Definition: SpellInfo.h:213
std::array< SpellPowerEntry const *, MAX_POWERS_PER_SPELL > PowerCosts
Definition: SpellInfo.h:387
uint32 RequiresSpellFocus
Definition: SpellInfo.h:352
uint32 BaseLevel
Definition: SpellInfo.h:384
uint32 MaxLevel
Definition: SpellInfo.h:383
uint32 SpellLevel
Definition: SpellInfo.h:385
uint32 AttributesEx13
Definition: SpellInfo.h:344
uint32 ActiveIconFileDataId
Definition: SpellInfo.h:401
uint32 TargetAuraState
Definition: SpellInfo.h:355
std::array< int32, MAX_SPELL_REAGENTS > Reagent
Definition: SpellInfo.h:394
uint32 ExcludeTargetAuraSpell
Definition: SpellInfo.h:361
uint32 PreventionType
Definition: SpellInfo.h:412
uint32 CasterAuraSpell
Definition: SpellInfo.h:358
float Width
Definition: SpellInfo.h:406
uint32 MaxTargetLevel
Definition: SpellInfo.h:407
std::unordered_set< uint32 > Labels
Definition: SpellInfo.h:416
uint32 const Id
Definition: SpellInfo.h:326
uint32 RecoveryTime
Definition: SpellInfo.h:367
EnumFlag< SpellAuraInterruptFlags2 > AuraInterruptFlags2
Definition: SpellInfo.h:374
uint32 AttributesEx8
Definition: SpellInfo.h:339
std::array< int16, MAX_SPELL_REAGENTS > ReagentCount
Definition: SpellInfo.h:395
SpellVisualVector _visuals
Definition: SpellInfo.h:610
EnumFlag< SpellAuraInterruptFlags > ChannelInterruptFlags
Definition: SpellInfo.h:375
uint32 StackAmount
Definition: SpellInfo.h:391
::Difficulty const Difficulty
Definition: SpellInfo.h:327
uint32 Mechanic
Definition: SpellInfo.h:330
SpellRangeEntry const * RangeEntry
Definition: SpellInfo.h:388
uint32 ProcCharges
Definition: SpellInfo.h:379
int32 RequiredAreasID
Definition: SpellInfo.h:413
uint32 ShowFutureSpellPlayerConditionID
Definition: SpellInfo.h:403
uint32 AttributesEx14
Definition: SpellInfo.h:345
uint32 Dispel
Definition: SpellInfo.h:329
std::vector< SpellProcsPerMinuteModEntry const * > ProcPPMMods
Definition: SpellInfo.h:382
uint32 ExcludeCasterAuraState
Definition: SpellInfo.h:356
float Speed
Definition: SpellInfo.h:389
uint32 CooldownAuraSpellId
Definition: SpellInfo.h:371
int32 EquippedItemClass
Definition: SpellInfo.h:397
std::vector< SpellEffectInfo > _effects
Definition: SpellInfo.h:609
struct SpellInfo::ScalingInfo Scaling
uint32 SchoolMask
Definition: SpellInfo.h:414
uint32 CasterAuraState
Definition: SpellInfo.h:354
float ProcBasePPM
Definition: SpellInfo.h:381
uint32 CategoryRecoveryTime
Definition: SpellInfo.h:368
uint64 StancesNot
Definition: SpellInfo.h:349
AuraType TargetAuraType
Definition: SpellInfo.h:363
EnumFlag< SpellInterruptFlags > InterruptFlags
Definition: SpellInfo.h:372
flag128 SpellFamilyFlags
Definition: SpellInfo.h:410
uint32 AttributesEx3
Definition: SpellInfo.h:334
float LaunchDelay
Definition: SpellInfo.h:390
std::vector< SpellReagentsCurrencyEntry const * > ReagentsCurrency
Definition: SpellInfo.h:396
SpellDurationEntry const * DurationEntry
Definition: SpellInfo.h:386
uint32 Attributes
Definition: SpellInfo.h:331
uint32 AttributesEx
Definition: SpellInfo.h:332
uint32 ChargeCategoryId
Definition: SpellInfo.h:415
uint32 IconFileDataId
Definition: SpellInfo.h:400
uint32 MaxAffectedTargets
Definition: SpellInfo.h:408
uint32 AttributesEx12
Definition: SpellInfo.h:343
uint32 AttributesEx6
Definition: SpellInfo.h:337
uint32 AttributesEx7
Definition: SpellInfo.h:338
int32 EquippedItemSubClassMask
Definition: SpellInfo.h:398
uint32 AttributesEx9
Definition: SpellInfo.h:340
uint32 FacingCasterFlags
Definition: SpellInfo.h:353
uint32 StartRecoveryTime
Definition: SpellInfo.h:370
uint32 ContentTuningId
Definition: SpellInfo.h:402
uint32 TargetAuraSpell
Definition: SpellInfo.h:359
AuraType ExcludeTargetAuraType
Definition: SpellInfo.h:365
uint32 AttributesEx10
Definition: SpellInfo.h:341
uint32 ProcCooldown
Definition: SpellInfo.h:380
LocalizedString const * SpellName
Definition: SpellInfo.h:404
SpellCastTimesEntry const * CastTimeEntry
Definition: SpellInfo.h:366
int32 EquippedItemInventoryTypeMask
Definition: SpellInfo.h:399
uint32 ExcludeTargetAuraState
Definition: SpellInfo.h:357
EnumFlag< SpellAuraInterruptFlags2 > ChannelInterruptFlags2
Definition: SpellInfo.h:376
AuraType ExcludeCasterAuraType
Definition: SpellInfo.h:364
uint32 TargetCreatureType
Definition: SpellInfo.h:351
uint32 ProcChance
Definition: SpellInfo.h:378
uint32 AttributesEx2
Definition: SpellInfo.h:333
uint32 DmgClass
Definition: SpellInfo.h:411
AuraType CasterAuraType
Definition: SpellInfo.h:362
uint32 AttributesEx5
Definition: SpellInfo.h:336
uint32 AttributesEx4
Definition: SpellInfo.h:335
EnumFlag< SpellAuraInterruptFlags > AuraInterruptFlags
Definition: SpellInfo.h:373
uint32 ExcludeCasterAuraSpell
Definition: SpellInfo.h:360
uint32 StartRecoveryCategory
Definition: SpellInfo.h:369
uint32 AttributesEx11
Definition: SpellInfo.h:342
uint32 CategoryId
Definition: SpellInfo.h:328
float ConeAngle
Definition: SpellInfo.h:405
uint32 SpellFamilyName
Definition: SpellInfo.h:409
Definition: Totem.h:31
Totem(SummonPropertiesEntry const *properties, Unit *owner)
Definition: Totem.cpp:29
decltype(auto) EnsureWritableVectorIndex(std::vector< T > &vec, typename std::vector< T >::size_type i)
Definition: Containers.h:292
Definition: DB2Structure.h:3332
Definition: DB2Structure.h:3345
Definition: DB2Structure.h:3371
Definition: DB2Structure.h:3383
Definition: DB2Structure.h:3408
Definition: DB2Structure.h:3417
Definition: DB2Structure.h:3435
int32 EffectIndex
Definition: DB2Structure.h:3439
Definition: DB2Structure.h:3471
uint32 MinScalingLevel
Definition: SpellInfo.h:421
uint32 ScalesFromItemLevel
Definition: SpellInfo.h:423
uint32 MaxScalingLevel
Definition: SpellInfo.h:422
Definition: DB2Structure.h:3486
Definition: DB2Structure.h:3548
uint32 LabelID
Definition: DB2Structure.h:3550
Definition: DB2Structure.h:3563
Definition: DB2Structure.h:3574
Definition: DB2Structure.h:3628
Definition: DB2Structure.h:3665
Definition: DB2Structure.h:3683
Definition: DB2Structure.h:3692
Definition: DB2Structure.h:3720
Definition: DB2Structure.h:3735
+ Here is the call graph for this function:

◆ SpellInfo() [2/4]

SpellInfo::SpellInfo ( SpellNameEntry const *  spellName,
::Difficulty  difficulty,
std::vector< SpellEffectEntry > const &  effects 
)
explicit
1333 : Id(spellName->ID), Difficulty(difficulty)
1334{
1335 SpellName = &spellName->Name;
1336
1337 _effects.reserve(32);
1338 for (SpellEffectEntry const& spellEffect : effects)
1339 Trinity::Containers::EnsureWritableVectorIndex(_effects, spellEffect.EffectIndex, SpellEffectInfo(this)) = SpellEffectInfo(this, spellEffect);
1340
1341 // Correct EffectIndex for blank effects
1342 for (size_t i = 0; i < _effects.size(); ++i)
1343 _effects[i].EffectIndex = SpellEffIndex(i);
1344
1345 _effects.shrink_to_fit();
1346}
+ Here is the call graph for this function:

◆ SpellInfo() [3/4]

SpellInfo::SpellInfo ( SpellInfo const &  )
delete

◆ SpellInfo() [4/4]

SpellInfo::SpellInfo ( SpellInfo &&  )
delete

◆ ~SpellInfo()

SpellInfo::~SpellInfo ( )
1349{
1351}
void _UnloadImplicitTargetConditionLists()
Definition: SpellInfo.cpp:4978
+ Here is the call graph for this function:

Member Function Documentation

◆ _InitializeExplicitTargetMask()

void SpellInfo::_InitializeExplicitTargetMask ( )
private
4454{
4455 bool srcSet = false;
4456 bool dstSet = false;
4457 uint32 targetMask = Targets;
4458 // prepare target mask using effect target entries
4459 for (SpellEffectInfo const& effect : GetEffects())
4460 {
4461 if (!effect.IsEffect())
4462 continue;
4463
4464 targetMask |= effect.TargetA.GetExplicitTargetMask(srcSet, dstSet);
4465 targetMask |= effect.TargetB.GetExplicitTargetMask(srcSet, dstSet);
4466
4467 // add explicit target flags based on spell effects which have EFFECT_IMPLICIT_TARGET_EXPLICIT and no valid target provided
4468 if (effect.GetImplicitTargetType() != EFFECT_IMPLICIT_TARGET_EXPLICIT)
4469 continue;
4470
4471 // extend explicit target mask only if valid targets for effect could not be provided by target types
4472 uint32 effectTargetMask = effect.GetMissingTargetMask(srcSet, dstSet, targetMask);
4473
4474 // don't add explicit object/dest flags when spell has no max range
4475 if (GetMaxRange(true) == 0.0f && GetMaxRange(false) == 0.0f)
4477
4478 targetMask |= effectTargetMask;
4479 }
4480
4481 ExplicitTargetMask = targetMask;
4482}
uint32_t uint32
Definition: Define.h:143
@ TARGET_FLAG_GAMEOBJECT
Definition: SpellDefines.h:284
@ TARGET_FLAG_DEST_LOCATION
Definition: SpellDefines.h:279
@ TARGET_FLAG_UNIT_MASK
Definition: SpellDefines.h:300
@ TARGET_FLAG_CORPSE_MASK
Definition: SpellDefines.h:303
@ EFFECT_IMPLICIT_TARGET_EXPLICIT
Definition: SpellInfo.h:113
float GetMaxRange(bool positive=false, WorldObject *caster=nullptr, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:3814
uint32 ExplicitTargetMask
Definition: SpellInfo.h:426
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:573
uint32 Targets
Definition: SpellInfo.h:350
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _InitializeSpellPositivity()

void SpellInfo::_InitializeSpellPositivity ( )
private
4940{
4941 std::unordered_set<std::pair<SpellInfo const*, SpellEffIndex /*effIndex*/>> visited;
4942
4943 for (SpellEffectInfo const& effect : GetEffects())
4944 if (!_isPositiveEffectImpl(this, effect, visited))
4945 NegativeEffects[effect.EffectIndex] = true;
4946
4947 // additional checks after effects marked
4948 for (SpellEffectInfo const& effect : GetEffects())
4949 {
4950 if (!effect.IsEffect() || !IsPositiveEffect(effect.EffectIndex))
4951 continue;
4952
4953 switch (effect.ApplyAuraName)
4954 {
4955 // has other non positive effect?
4956 // then it should be marked negative if has same target as negative effect (ex 8510, 8511, 8893, 10267)
4957 case SPELL_AURA_DUMMY:
4964 {
4965 for (size_t j = effect.EffectIndex + 1; j < GetEffects().size(); ++j)
4966 if (!IsPositiveEffect(j)
4967 && effect.TargetA.GetTarget() == GetEffect(SpellEffIndex(j)).TargetA.GetTarget()
4968 && effect.TargetB.GetTarget() == GetEffect(SpellEffIndex(j)).TargetB.GetTarget())
4969 NegativeEffects[effect.EffectIndex] = true;
4970 break;
4971 }
4972 default:
4973 break;
4974 }
4975 }
4976}
@ SPELL_AURA_MOD_ATTACKSPEED
Definition: SpellAuraDefines.h:103
@ SPELL_AURA_MOD_FEAR
Definition: SpellAuraDefines.h:101
@ SPELL_AURA_DUMMY
Definition: SpellAuraDefines.h:98
@ SPELL_AURA_MOD_TAUNT
Definition: SpellAuraDefines.h:105
@ SPELL_AURA_MOD_DECREASE_SPEED
Definition: SpellAuraDefines.h:127
@ SPELL_AURA_TRANSFORM
Definition: SpellAuraDefines.h:150
@ SPELL_AURA_MOD_STUN
Definition: SpellAuraDefines.h:106
bool _isPositiveEffectImpl(SpellInfo const *spellInfo, SpellEffectInfo const &effect, std::unordered_set< std::pair< SpellInfo const *, SpellEffIndex > > &visited)
Definition: SpellInfo.cpp:4493
SpellImplicitTargetInfo TargetB
Definition: SpellInfo.h:232
Targets GetTarget() const
Definition: SpellInfo.cpp:132
Definition: SpellInfo.h:322
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition: SpellInfo.h:574
std::bitset< MAX_SPELL_EFFECTS > NegativeEffects
Definition: SpellInfo.h:347
bool IsPositiveEffect(uint8 effIndex) const
Definition: SpellInfo.cpp:1680
constexpr std::size_t size()
Definition: UpdateField.h:786
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _LoadAuraState()

void SpellInfo::_LoadAuraState ( )
private
2483{
2484 _auraState = [this]()->AuraStateType
2485 {
2486 // Faerie Fire (Feral)
2487 if (GetCategory() == 1133)
2489
2490 // Swiftmend state on Regrowth, Rejuvenation, Wild Growth
2491 if (SpellFamilyName == SPELLFAMILY_DRUID && (SpellFamilyFlags[0] & 0x50 || SpellFamilyFlags[1] & 0x4000000))
2493
2494 // Deadly poison aura state
2495 if (SpellFamilyName == SPELLFAMILY_ROGUE && SpellFamilyFlags[0] & 0x10000)
2497
2498 // Enrage aura state
2499 if (Dispel == DISPEL_ENRAGE)
2500 return AURA_STATE_ENRAGED;
2501
2502 // Bleeding aura state
2504 return AURA_STATE_BLEED;
2505
2507 for (SpellEffectInfo const& effect : GetEffects())
2508 if (effect.IsAura(SPELL_AURA_MOD_STUN) || effect.IsAura(SPELL_AURA_MOD_ROOT) || effect.IsAura(SPELL_AURA_MOD_ROOT_2))
2509 return AURA_STATE_FROZEN;
2510
2511 switch (Id)
2512 {
2513 case 1064: // Dazed
2514 return AURA_STATE_DAZED;
2515 case 32216: // Victorious
2516 return AURA_STATE_VICTORIOUS;
2517 case 71465: // Divine Surge
2518 case 50241: // Evasive Charges
2520 case 6950: // Faerie Fire
2521 case 9806: // Phantom Strike
2522 case 9991: // Touch of Zanzil
2523 case 13424: // Faerie Fire
2524 case 13752: // Faerie Fire
2525 case 16432: // Plague Mist
2526 case 20656: // Faerie Fire
2527 case 25602: // Faerie Fire
2528 case 32129: // Faerie Fire
2529 case 35325: // Glowing Blood
2530 case 35328: // Lambent Blood
2531 case 35329: // Vibrant Blood
2532 case 35331: // Black Blood
2533 case 49163: // Perpetual Instability
2534 case 65863: // Faerie Fire
2535 case 79559: // Luxscale Light
2536 case 82855: // Dazzling
2537 case 102953: // In the Rumpus
2538 case 127907: // Phosphorescence
2539 case 127913: // Phosphorescence
2540 case 129007: // Zijin Sting
2541 case 130159: // Fae Touch
2542 case 142537: // Spotter Smoke
2543 case 168455: // Spotted!
2544 case 176905: // Super Sticky Glitter Bomb
2545 case 189502: // Marked
2546 case 201785: // Intruder Alert!
2547 case 201786: // Intruder Alert!
2548 case 201935: // Spotted!
2549 case 239233: // Smoke Bomb
2550 case 319400: // Glitter Burst
2551 case 321470: // Dimensional Shifter Mishap
2552 case 331134: // Spotted
2554 default:
2555 break;
2556 }
2557
2558 return AURA_STATE_NONE;
2559 }();
2560}
@ SPELL_SCHOOL_MASK_FROST
Definition: SharedDefines.h:324
@ MECHANIC_BLEED
Definition: SharedDefines.h:2504
AuraStateType
Definition: SharedDefines.h:2453
@ AURA_STATE_NONE
Definition: SharedDefines.h:2455
@ AURA_STATE_BLEED
Definition: SharedDefines.h:2473
@ AURA_STATE_FROZEN
Definition: SharedDefines.h:2459
@ AURA_STATE_VICTORIOUS
Definition: SharedDefines.h:2465
@ AURA_STATE_FAERIE_FIRE
Definition: SharedDefines.h:2467
@ AURA_STATE_ENRAGED
Definition: SharedDefines.h:2472
@ AURA_STATE_DAZED
Definition: SharedDefines.h:2464
@ AURA_STATE_DRUID_PERIODIC_HEAL
Definition: SharedDefines.h:2470
@ AURA_STATE_RAID_ENCOUNTER
Definition: SharedDefines.h:2477
@ AURA_STATE_ROGUE_POISONED
Definition: SharedDefines.h:2471
@ SPELLFAMILY_ROGUE
Definition: SharedDefines.h:6378
@ SPELLFAMILY_DRUID
Definition: SharedDefines.h:6377
@ DISPEL_ENRAGE
Definition: SharedDefines.h:2550
@ SPELL_AURA_MOD_ROOT_2
Definition: SpellAuraDefines.h:549
@ SPELL_AURA_MOD_ROOT
Definition: SpellAuraDefines.h:120
uint32 GetCategory() const
Definition: SpellInfo.cpp:1353
uint64 GetAllEffectsMechanicMask() const
Definition: SpellInfo.cpp:2409
AuraStateType _auraState
Definition: SpellInfo.h:612
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:2404
+ Here is the call graph for this function:

◆ _LoadImmunityInfo()

void SpellInfo::_LoadImmunityInfo ( )
private
3247{
3248 std::unique_ptr<SpellEffectInfo::ImmunityInfo> workBuffer = std::make_unique<SpellEffectInfo::ImmunityInfo>();
3249
3250 for (SpellEffectInfo& effect : _effects)
3251 {
3252 uint32 schoolImmunityMask = 0;
3253 uint32 applyHarmfulAuraImmunityMask = 0;
3254 uint64 mechanicImmunityMask = 0;
3255 uint32 dispelImmunity = 0;
3256 uint32 damageImmunityMask = 0;
3257
3258 int32 miscVal = effect.MiscValue;
3259 int32 amount = effect.CalcValue();
3260
3261 SpellEffectInfo::ImmunityInfo& immuneInfo = *workBuffer;
3262
3263 switch (effect.ApplyAuraName)
3264 {
3266 {
3267 switch (miscVal)
3268 {
3269 case 96: // Free Friend, Uncontrollable Frenzy, Warlord's Presence
3270 {
3272
3279 break;
3280 }
3281 case 1615: // Incite Rage, Wolf Spirit, Overload, Lightning Tendrils
3282 {
3283 switch (Id)
3284 {
3285 case 43292: // Incite Rage
3286 case 49172: // Wolf Spirit
3288
3295 [[fallthrough]];
3296 case 61869: // Overload
3297 case 63481:
3298 case 61887: // Lightning Tendrils
3299 case 63486:
3300 mechanicImmunityMask |= (1 << MECHANIC_INTERRUPT) | (1 << MECHANIC_SILENCE);
3301
3304 break;
3305 default:
3306 break;
3307 }
3308 break;
3309 }
3310 case 679: // Mind Control, Avenging Fury
3311 {
3312 if (Id == 57742) // Avenging Fury
3313 {
3315
3322 }
3323 break;
3324 }
3325 case 1557: // Startling Roar, Warlord Roar, Break Bonds, Stormshield
3326 {
3327 if (Id == 64187) // Stormshield
3328 {
3329 mechanicImmunityMask |= (1 << MECHANIC_STUN);
3331 }
3332 else
3333 {
3335
3342 }
3343 break;
3344 }
3345 case 1614: // Fixate
3346 case 1694: // Fixated, Lightning Tendrils
3347 {
3350 break;
3351 }
3352 case 1630: // Fervor, Berserk
3353 {
3354 if (Id == 64112) // Berserk
3355 {
3358 }
3359 else
3360 {
3362
3369 }
3370 break;
3371 }
3372 case 477: // Bladestorm
3373 case 1733: // Bladestorm, Killing Spree
3374 {
3375 if (!amount)
3376 {
3378
3381
3388 }
3389 break;
3390 }
3391 case 878: // Whirlwind, Fog of Corruption, Determination
3392 {
3393 if (Id == 66092) // Determination
3394 {
3395 mechanicImmunityMask |= (1 << MECHANIC_SNARE) | (1 << MECHANIC_STUN)
3396 | (1 << MECHANIC_DISORIENTED) | (1 << MECHANIC_FREEZE);
3397
3400 }
3401 break;
3402 }
3403 default:
3404 break;
3405 }
3406
3407 if (immuneInfo.AuraTypeImmune.empty())
3408 {
3409 if (miscVal & (1 << 10))
3411 if (miscVal & (1 << 1))
3413
3414 // These flag can be recognized wrong:
3415 if (miscVal & (1 << 6))
3417 if (miscVal & (1 << 0))
3418 {
3421 }
3422 if (miscVal & (1 << 2))
3424 if (miscVal & (1 << 9))
3426 if (miscVal & (1 << 7))
3428 }
3429 break;
3430 }
3432 {
3433 switch (Id)
3434 {
3435 case 42292: // PvP trinket
3436 case 59752: // Every Man for Himself
3439 break;
3440 case 34471: // The Beast Within
3441 case 19574: // Bestial Wrath
3442 case 46227: // Medallion of Immunity
3443 case 53490: // Bullheaded
3444 case 65547: // PvP Trinket
3445 case 134946: // Supremacy of the Alliance
3446 case 134956: // Supremacy of the Horde
3447 case 195710: // Honorable Medallion
3448 case 208683: // Gladiator's Medallion
3450 break;
3451 case 54508: // Demonic Empowerment
3452 mechanicImmunityMask |= (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT) | (1 << MECHANIC_STUN);
3453 break;
3454 default:
3455 if (miscVal < 1)
3456 break;
3457
3458 mechanicImmunityMask |= UI64LIT(1) << miscVal;
3459 break;
3460 }
3461 break;
3462 }
3464 {
3465 immuneInfo.SpellEffectImmune.insert(static_cast<SpellEffectName>(miscVal));
3466 break;
3467 }
3469 {
3470 immuneInfo.AuraTypeImmune.insert(static_cast<AuraType>(miscVal));
3471 break;
3472 }
3474 {
3475 schoolImmunityMask |= uint32(miscVal);
3476 break;
3477 }
3479 {
3480 applyHarmfulAuraImmunityMask |= uint32(miscVal);
3481 break;
3482 }
3484 {
3485 damageImmunityMask |= uint32(miscVal);
3486 break;
3487 }
3489 {
3490 dispelImmunity = uint32(miscVal);
3491 break;
3492 }
3493 default:
3494 break;
3495 }
3496
3497 immuneInfo.SchoolImmuneMask = schoolImmunityMask;
3498 immuneInfo.ApplyHarmfulAuraImmuneMask = applyHarmfulAuraImmunityMask;
3499 immuneInfo.MechanicImmuneMask = mechanicImmunityMask;
3500 immuneInfo.DispelImmune = dispelImmunity;
3501 immuneInfo.DamageSchoolMask = damageImmunityMask;
3502
3503 immuneInfo.AuraTypeImmune.shrink_to_fit();
3504 immuneInfo.SpellEffectImmune.shrink_to_fit();
3505
3506 if (immuneInfo.SchoolImmuneMask
3507 || immuneInfo.ApplyHarmfulAuraImmuneMask
3508 || immuneInfo.MechanicImmuneMask
3509 || immuneInfo.DispelImmune
3510 || immuneInfo.DamageSchoolMask
3511 || !immuneInfo.AuraTypeImmune.empty()
3512 || !immuneInfo.SpellEffectImmune.empty())
3513 {
3514 effect._immunityInfo = workBuffer.release();
3515 workBuffer = std::make_unique<SpellEffectInfo::ImmunityInfo>();
3516 }
3517
3519 }
3520
3522 {
3523 switch (Id)
3524 {
3525 case 22812: // Barkskin
3526 case 47585: // Dispersion
3528 (1 << MECHANIC_STUN) |
3529 (1 << MECHANIC_FREEZE) |
3530 (1 << MECHANIC_KNOCKOUT) |
3531 (1 << MECHANIC_SLEEP);
3532 break;
3533 case 49039: // Lichborne, don't allow normal stuns
3534 break;
3535 default:
3537 break;
3538 }
3539 }
3540
3543
3545 {
3546 switch (Id)
3547 {
3548 case 22812: // Barkskin
3549 case 47585: // Dispersion
3551 break;
3552 default:
3554 break;
3555 }
3556 }
3557}
int32_t int32
Definition: Define.h:139
uint64_t uint64
Definition: Define.h:142
#define UI64LIT(N)
Definition: Define.h:128
@ SPELL_ATTR5_ALLOW_WHILE_STUNNED
Definition: SharedDefines.h:602
@ SPELL_ATTR5_ALLOW_WHILE_FLEEING
Definition: SharedDefines.h:616
@ SPELL_ATTR5_ALLOW_WHILE_CONFUSED
Definition: SharedDefines.h:617
SpellEffectName
Definition: SharedDefines.h:1128
@ SPELL_EFFECT_ATTACK_ME
Definition: SharedDefines.h:1243
@ SPELL_EFFECT_KNOCK_BACK_DEST
Definition: SharedDefines.h:1273
@ SPELL_EFFECT_KNOCK_BACK
Definition: SharedDefines.h:1227
@ MECHANIC_FEAR
Definition: SharedDefines.h:2494
@ MECHANIC_DISORIENTED
Definition: SharedDefines.h:2491
@ MECHANIC_KNOCKOUT
Definition: SharedDefines.h:2503
@ MECHANIC_STUN
Definition: SharedDefines.h:2501
@ MECHANIC_FREEZE
Definition: SharedDefines.h:2502
@ MECHANIC_INTERRUPT
Definition: SharedDefines.h:2515
@ MECHANIC_ROOT
Definition: SharedDefines.h:2496
@ MECHANIC_SLEEP
Definition: SharedDefines.h:2499
@ MECHANIC_SNARE
Definition: SharedDefines.h:2500
@ MECHANIC_SILENCE
Definition: SharedDefines.h:2498
@ MECHANIC_HORROR
Definition: SharedDefines.h:2513
#define IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK
Definition: SharedDefines.h:2530
@ SPELL_AURA_DISPEL_IMMUNITY
Definition: SpellAuraDefines.h:135
@ SPELL_AURA_MOD_DISARM
Definition: SpellAuraDefines.h:161
@ SPELL_AURA_SCHOOL_IMMUNITY
Definition: SpellAuraDefines.h:133
@ SPELL_AURA_MECHANIC_IMMUNITY
Definition: SpellAuraDefines.h:171
@ SPELL_AURA_EFFECT_IMMUNITY
Definition: SpellAuraDefines.h:131
@ SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL
Definition: SpellAuraDefines.h:361
@ SPELL_AURA_DAMAGE_IMMUNITY
Definition: SpellAuraDefines.h:134
@ SPELL_AURA_MOD_CONFUSE
Definition: SpellAuraDefines.h:99
@ SPELL_AURA_STATE_IMMUNITY
Definition: SpellAuraDefines.h:132
@ SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED
Definition: SpellAuraDefines.h:285
@ SPELL_AURA_MECHANIC_IMMUNITY_MASK
Definition: SpellAuraDefines.h:241
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:445
uint64 _allowedMechanicMask
Definition: SpellInfo.h:615
bool empty() const
Definition: FlatSet.h:32
void shrink_to_fit()
Definition: FlatSet.h:88
std::pair< iterator, bool > insert(Key const &key)
Definition: FlatSet.h:73
Definition: SpellInfo.cpp:222
uint32 DamageSchoolMask
Definition: SpellInfo.cpp:235
uint32 ApplyHarmfulAuraImmuneMask
Definition: SpellInfo.cpp:232
Trinity::Containers::FlatSet< AuraType > AuraTypeImmune
Definition: SpellInfo.cpp:237
uint32 DispelImmune
Definition: SpellInfo.cpp:234
uint64 MechanicImmuneMask
Definition: SpellInfo.cpp:233
Trinity::Containers::FlatSet< SpellEffectName > SpellEffectImmune
Definition: SpellInfo.cpp:238
uint32 SchoolImmuneMask
Definition: SpellInfo.cpp:231
+ Here is the call graph for this function:

◆ _LoadSpellDiminishInfo()

void SpellInfo::_LoadSpellDiminishInfo ( )
private
2756{
2757 auto diminishingGroupCompute = [this]() -> DiminishingGroup
2758 {
2759 if (IsPositive())
2760 return DIMINISHING_NONE;
2761
2763 return DIMINISHING_TAUNT;
2764
2765 switch (Id)
2766 {
2767 case 20549: // War Stomp (Racial - Tauren)
2768 case 24394: // Intimidation
2769 case 118345: // Pulverize (Primal Earth Elemental)
2770 case 118905: // Static Charge (Capacitor Totem)
2771 return DIMINISHING_STUN;
2772 case 107079: // Quaking Palm
2774 case 155145: // Arcane Torrent (Racial - Blood Elf)
2775 return DIMINISHING_SILENCE;
2776 case 108199: // Gorefiend's Grasp
2777 case 191244: // Sticky Bomb
2779 default:
2780 break;
2781 }
2782
2783 // Explicit Diminishing Groups
2784 switch (SpellFamilyName)
2785 {
2787 // Frost Tomb
2788 if (Id == 48400)
2789 return DIMINISHING_NONE;
2790 // Gnaw
2791 else if (Id == 47481)
2792 return DIMINISHING_STUN;
2793 // ToC Icehowl Arctic Breath
2794 else if (Id == 66689)
2795 return DIMINISHING_NONE;
2796 // Black Plague
2797 else if (Id == 64155)
2798 return DIMINISHING_NONE;
2799 // Screams of the Dead (King Ymiron)
2800 else if (Id == 51750)
2801 return DIMINISHING_NONE;
2802 // Crystallize (Keristrasza heroic)
2803 else if (Id == 48179)
2804 return DIMINISHING_NONE;
2805 break;
2806 case SPELLFAMILY_MAGE:
2807 {
2808 // Frost Nova -- 122
2809 if (SpellFamilyFlags[0] & 0x40)
2810 return DIMINISHING_ROOT;
2811 // Freeze (Water Elemental) -- 33395
2812 if (SpellFamilyFlags[2] & 0x200)
2813 return DIMINISHING_ROOT;
2814
2815 // Dragon's Breath -- 31661
2816 if (SpellFamilyFlags[0] & 0x800000)
2818 // Polymorph -- 118
2819 if (SpellFamilyFlags[0] & 0x1000000)
2821 // Ring of Frost -- 82691
2822 if (SpellFamilyFlags[2] & 0x40)
2824 // Ice Nova -- 157997
2825 if (SpellFamilyFlags[2] & 0x800000)
2827 break;
2828 }
2830 {
2831 // Shockwave -- 132168
2832 if (SpellFamilyFlags[1] & 0x8000)
2833 return DIMINISHING_STUN;
2834 // Storm Bolt -- 132169
2835 if (SpellFamilyFlags[2] & 0x1000)
2836 return DIMINISHING_STUN;
2837
2838 // Intimidating Shout -- 5246
2839 if (SpellFamilyFlags[0] & 0x40000)
2840 return DIMINISHING_DISORIENT;
2841 break;
2842 }
2844 {
2845 // Mortal Coil -- 6789
2846 if (SpellFamilyFlags[0] & 0x80000)
2848 // Banish -- 710
2849 if (SpellFamilyFlags[1] & 0x8000000)
2851
2852 // Fear -- 118699
2853 if (SpellFamilyFlags[1] & 0x400)
2854 return DIMINISHING_DISORIENT;
2855 // Howl of Terror -- 5484
2856 if (SpellFamilyFlags[1] & 0x8)
2857 return DIMINISHING_DISORIENT;
2858
2859 // Shadowfury -- 30283
2860 if (SpellFamilyFlags[1] & 0x1000)
2861 return DIMINISHING_STUN;
2862 // Summon Infernal -- 22703
2863 if (SpellFamilyFlags[0] & 0x1000)
2864 return DIMINISHING_STUN;
2865
2866 // 170995 -- Cripple
2867 if (Id == 170995)
2868 return DIMINISHING_LIMITONLY;
2869 break;
2870 }
2872 {
2873 // Fellash -- 115770
2874 // Whiplash -- 6360
2875 if (SpellFamilyFlags[0] & 0x8000000)
2877
2878 // Mesmerize (Shivarra pet) -- 115268
2879 // Seduction (Succubus pet) -- 6358
2880 if (SpellFamilyFlags[0] & 0x2000000)
2881 return DIMINISHING_DISORIENT;
2882
2883 // Axe Toss (Felguard pet) -- 89766
2884 if (SpellFamilyFlags[1] & 0x4)
2885 return DIMINISHING_STUN;
2886 break;
2887 }
2888 case SPELLFAMILY_DRUID:
2889 {
2890 // Maim -- 22570
2891 if (SpellFamilyFlags[1] & 0x80)
2892 return DIMINISHING_STUN;
2893 // Mighty Bash -- 5211
2894 if (SpellFamilyFlags[0] & 0x2000)
2895 return DIMINISHING_STUN;
2896 // Rake -- 163505 -- no flags on the stun
2897 if (Id == 163505)
2898 return DIMINISHING_STUN;
2899
2900 // Incapacitating Roar -- 99, no flags on the stun, 14
2901 if (SpellFamilyFlags[1] & 0x1)
2903
2904 // Cyclone -- 33786
2905 if (SpellFamilyFlags[1] & 0x20)
2906 return DIMINISHING_DISORIENT;
2907
2908 // Solar Beam -- 81261
2909 if (Id == 81261)
2910 return DIMINISHING_SILENCE;
2911
2912 // Typhoon -- 61391
2913 if (SpellFamilyFlags[1] & 0x1000000)
2915 // Ursol's Vortex -- 118283, no family flags
2916 if (Id == 118283)
2918
2919 // Entangling Roots -- 339
2920 if (SpellFamilyFlags[0] & 0x200)
2921 return DIMINISHING_ROOT;
2922 // Mass Entanglement -- 102359
2923 if (SpellFamilyFlags[2] & 0x4)
2924 return DIMINISHING_ROOT;
2925 break;
2926 }
2927 case SPELLFAMILY_ROGUE:
2928 {
2929 // Between the Eyes -- 199804
2930 if (SpellFamilyFlags[0] & 0x800000)
2931 return DIMINISHING_STUN;
2932 // Cheap Shot -- 1833
2933 if (SpellFamilyFlags[0] & 0x400)
2934 return DIMINISHING_STUN;
2935 // Kidney Shot -- 408
2936 if (SpellFamilyFlags[0] & 0x200000)
2937 return DIMINISHING_STUN;
2938
2939 // Gouge -- 1776
2940 if (SpellFamilyFlags[0] & 0x8)
2942 // Sap -- 6770
2943 if (SpellFamilyFlags[0] & 0x80)
2945
2946 // Blind -- 2094
2947 if (SpellFamilyFlags[0] & 0x1000000)
2948 return DIMINISHING_DISORIENT;
2949
2950 // Garrote -- 1330
2951 if (SpellFamilyFlags[1] & 0x20000000)
2952 return DIMINISHING_SILENCE;
2953 break;
2954 }
2955 case SPELLFAMILY_HUNTER:
2956 {
2957 // Charge (Tenacity pet) -- 53148, no flags
2958 if (Id == 53148)
2959 return DIMINISHING_ROOT;
2960 // Ranger's Net -- 200108
2961 // Tracker's Net -- 212638
2962 if (Id == 200108 || Id == 212638)
2963 return DIMINISHING_ROOT;
2964
2965 // Binding Shot -- 117526, no flags
2966 if (Id == 117526)
2967 return DIMINISHING_STUN;
2968
2969 // Freezing Trap -- 3355
2970 if (SpellFamilyFlags[0] & 0x8)
2972 // Wyvern Sting -- 19386
2973 if (SpellFamilyFlags[1] & 0x1000)
2975
2976 // Bursting Shot -- 224729
2977 if (SpellFamilyFlags[2] & 0x40)
2978 return DIMINISHING_DISORIENT;
2979 // Scatter Shot -- 213691
2980 if (SpellFamilyFlags[2] & 0x8000)
2981 return DIMINISHING_DISORIENT;
2982
2983 // Spider Sting -- 202933
2984 if (Id == 202933)
2985 return DIMINISHING_SILENCE;
2986 break;
2987 }
2989 {
2990 // Repentance -- 20066
2991 if (SpellFamilyFlags[0] & 0x4)
2993
2994 // Blinding Light -- 105421
2995 if (Id == 105421)
2996 return DIMINISHING_DISORIENT;
2997
2998 // Avenger's Shield -- 31935
2999 if (SpellFamilyFlags[0] & 0x4000)
3000 return DIMINISHING_SILENCE;
3001
3002 // Hammer of Justice -- 853
3003 if (SpellFamilyFlags[0] & 0x800)
3004 return DIMINISHING_STUN;
3005 break;
3006 }
3007 case SPELLFAMILY_SHAMAN:
3008 {
3009 // Hex -- 51514
3010 // Hex -- 196942 (Voodoo Totem)
3011 if (SpellFamilyFlags[1] & 0x8000)
3013
3014 // Thunderstorm -- 51490
3015 if (SpellFamilyFlags[1] & 0x2000)
3017
3018 // Earthgrab Totem -- 64695
3019 if (SpellFamilyFlags[2] & 0x4000)
3020 return DIMINISHING_ROOT;
3021
3022 // Lightning Lasso -- 204437
3023 if (SpellFamilyFlags[3] & 0x2000000)
3024 return DIMINISHING_STUN;
3025 break;
3026 }
3028 {
3029 // Chains of Ice -- 96294
3030 if (Id == 96294)
3031 return DIMINISHING_ROOT;
3032
3033 // Blinding Sleet -- 207167
3034 if (Id == 207167)
3035 return DIMINISHING_DISORIENT;
3036
3037 // Strangulate -- 47476
3038 if (SpellFamilyFlags[0] & 0x200)
3039 return DIMINISHING_SILENCE;
3040
3041 // Asphyxiate -- 108194
3042 if (SpellFamilyFlags[2] & 0x100000)
3043 return DIMINISHING_STUN;
3044 // Gnaw (Ghoul) -- 91800, no flags
3045 if (Id == 91800)
3046 return DIMINISHING_STUN;
3047 // Monstrous Blow (Ghoul w/ Dark Transformation active) -- 91797
3048 if (Id == 91797)
3049 return DIMINISHING_STUN;
3050 // Winter is Coming -- 207171
3051 if (Id == 207171)
3052 return DIMINISHING_STUN;
3053 break;
3054 }
3055 case SPELLFAMILY_PRIEST:
3056 {
3057 // Holy Word: Chastise -- 200200
3058 if (SpellFamilyFlags[2] & 0x20 && GetSpellVisual() == 52021)
3059 return DIMINISHING_STUN;
3060 // Mind Bomb -- 226943
3061 if (Id == 226943)
3062 return DIMINISHING_STUN;
3063
3064 // Mind Control -- 605
3065 if (SpellFamilyFlags[0] & 0x20000 && GetSpellVisual() == 39068)
3067 // Holy Word: Chastise -- 200196
3068 if (SpellFamilyFlags[2] & 0x20 && GetSpellVisual() == 52019)
3070
3071 // Psychic Scream -- 8122
3072 if (SpellFamilyFlags[0] & 0x10000)
3073 return DIMINISHING_DISORIENT;
3074
3075 // Silence -- 15487
3076 if (SpellFamilyFlags[1] & 0x200000 && GetSpellVisual() == 39025)
3077 return DIMINISHING_SILENCE;
3078
3079 // Shining Force -- 204263
3080 if (Id == 204263)
3082 break;
3083 }
3084 case SPELLFAMILY_MONK:
3085 {
3086 // Disable -- 116706, no flags
3087 if (Id == 116706)
3088 return DIMINISHING_ROOT;
3089
3090 // Fists of Fury -- 120086
3091 if (SpellFamilyFlags[1] & 0x800000 && !(SpellFamilyFlags[2] & 0x8))
3092 return DIMINISHING_STUN;
3093 // Leg Sweep -- 119381
3094 if (SpellFamilyFlags[1] & 0x200)
3095 return DIMINISHING_STUN;
3096
3097 // Incendiary Breath (honor talent) -- 202274, no flags
3098 if (Id == 202274)
3100 // Paralysis -- 115078
3101 if (SpellFamilyFlags[2] & 0x800000)
3103
3104 // Song of Chi-Ji -- 198909
3105 if (Id == 198909)
3106 return DIMINISHING_DISORIENT;
3107 break;
3108 }
3110 {
3111 switch (Id)
3112 {
3113 case 179057: // Chaos Nova
3114 case 211881: // Fel Eruption
3115 case 200166: // Metamorphosis
3116 case 205630: // Illidan's Grasp
3117 return DIMINISHING_STUN;
3118 case 217832: // Imprison
3119 case 221527: // Imprison
3121 default:
3122 break;
3123 }
3124 break;
3125 }
3126 default:
3127 break;
3128 }
3129
3130 return DIMINISHING_NONE;
3131 };
3132
3133 auto diminishingTypeCompute = [](DiminishingGroup group) -> DiminishingReturnsType
3134 {
3135 switch (group)
3136 {
3137 case DIMINISHING_TAUNT:
3138 case DIMINISHING_STUN:
3139 return DRTYPE_ALL;
3141 case DIMINISHING_NONE:
3142 return DRTYPE_NONE;
3143 default:
3144 return DRTYPE_PLAYER;
3145 }
3146 };
3147
3148 auto diminishingMaxLevelCompute = [](DiminishingGroup group) -> DiminishingLevels
3149 {
3150 switch (group)
3151 {
3152 case DIMINISHING_TAUNT:
3155 return DIMINISHING_LEVEL_2;
3156 default:
3158 }
3159 };
3160
3161 auto diminishingLimitDurationCompute = [this]() -> int32
3162 {
3163 // Explicit diminishing duration
3164 switch (SpellFamilyName)
3165 {
3166 case SPELLFAMILY_MAGE:
3167 {
3168 // Dragon's Breath - 3 seconds in PvP
3169 if (SpellFamilyFlags[0] & 0x800000)
3170 return 3 * IN_MILLISECONDS;
3171 break;
3172 }
3174 {
3175 // Cripple - 4 seconds in PvP
3176 if (Id == 170995)
3177 return 4 * IN_MILLISECONDS;
3178 break;
3179 }
3180 case SPELLFAMILY_HUNTER:
3181 {
3182 // Binding Shot - 3 seconds in PvP
3183 if (Id == 117526)
3184 return 3 * IN_MILLISECONDS;
3185
3186 // Wyvern Sting - 6 seconds in PvP
3187 if (SpellFamilyFlags[1] & 0x1000)
3188 return 6 * IN_MILLISECONDS;
3189 break;
3190 }
3191 case SPELLFAMILY_MONK:
3192 {
3193 // Paralysis - 4 seconds in PvP regardless of if they are facing you
3194 if (SpellFamilyFlags[2] & 0x800000)
3195 return 4 * IN_MILLISECONDS;
3196 break;
3197 }
3199 {
3200 switch (Id)
3201 {
3202 case 217832: // Imprison
3203 case 221527: // Imprison
3204 return 4 * IN_MILLISECONDS;
3205 default:
3206 break;
3207 }
3208 break;
3209 }
3210 default:
3211 break;
3212 }
3213
3214 return 8 * IN_MILLISECONDS;
3215 };
3216
3217 SpellDiminishInfo diminishInfo;
3218 diminishInfo.DiminishGroup = diminishingGroupCompute();
3219 diminishInfo.DiminishReturnType = diminishingTypeCompute(diminishInfo.DiminishGroup);
3220 diminishInfo.DiminishMaxLevel = diminishingMaxLevelCompute(diminishInfo.DiminishGroup);
3221 diminishInfo.DiminishDurationLimit = diminishingLimitDurationCompute();
3222
3223 _diminishInfo = diminishInfo;
3224}
@ IN_MILLISECONDS
Definition: Common.h:51
DiminishingLevels
Definition: SharedDefines.h:6776
@ DIMINISHING_LEVEL_IMMUNE
Definition: SharedDefines.h:6780
@ DIMINISHING_LEVEL_TAUNT_IMMUNE
Definition: SharedDefines.h:6782
@ DIMINISHING_LEVEL_2
Definition: SharedDefines.h:6778
DiminishingGroup
Definition: SharedDefines.h:5961
@ DIMINISHING_AOE_KNOCKBACK
Definition: SharedDefines.h:5968
@ DIMINISHING_NONE
Definition: SharedDefines.h:5962
@ DIMINISHING_STUN
Definition: SharedDefines.h:5964
@ DIMINISHING_LIMITONLY
Definition: SharedDefines.h:5970
@ DIMINISHING_DISORIENT
Definition: SharedDefines.h:5966
@ DIMINISHING_ROOT
Definition: SharedDefines.h:5963
@ DIMINISHING_TAUNT
Definition: SharedDefines.h:5969
@ DIMINISHING_SILENCE
Definition: SharedDefines.h:5967
@ DIMINISHING_INCAPACITATE
Definition: SharedDefines.h:5965
DiminishingReturnsType
Definition: SharedDefines.h:5953
@ DRTYPE_NONE
Definition: SharedDefines.h:5954
@ DRTYPE_PLAYER
Definition: SharedDefines.h:5955
@ DRTYPE_ALL
Definition: SharedDefines.h:5956
@ SPELLFAMILY_PRIEST
Definition: SharedDefines.h:6376
@ SPELLFAMILY_WARLOCK_PET
Definition: SharedDefines.h:6390
@ SPELLFAMILY_WARLOCK
Definition: SharedDefines.h:6375
@ SPELLFAMILY_MAGE
Definition: SharedDefines.h:6373
@ SPELLFAMILY_GENERIC
Definition: SharedDefines.h:6370
@ SPELLFAMILY_WARRIOR
Definition: SharedDefines.h:6374
@ SPELLFAMILY_PALADIN
Definition: SharedDefines.h:6380
@ SPELLFAMILY_HUNTER
Definition: SharedDefines.h:6379
@ SPELLFAMILY_DEMON_HUNTER
Definition: SharedDefines.h:6396
@ SPELLFAMILY_SHAMAN
Definition: SharedDefines.h:6381
@ SPELLFAMILY_DEATHKNIGHT
Definition: SharedDefines.h:6385
@ SPELLFAMILY_MONK
Definition: SharedDefines.h:6389
uint32 GetSpellVisual(WorldObject const *caster=nullptr, WorldObject const *viewer=nullptr) const
Definition: SpellInfo.cpp:4440
SpellDiminishInfo _diminishInfo
Definition: SpellInfo.h:614
bool IsPositive() const
Definition: SpellInfo.cpp:1675
Definition: SpellInfo.h:308
int32 DiminishDurationLimit
Definition: SpellInfo.h:312
DiminishingReturnsType DiminishReturnType
Definition: SpellInfo.h:310
DiminishingLevels DiminishMaxLevel
Definition: SpellInfo.h:311
DiminishingGroup DiminishGroup
Definition: SpellInfo.h:309
+ Here is the call graph for this function:

◆ _LoadSpellSpecific()

void SpellInfo::_LoadSpellSpecific ( )
private

@workaround For non-stacking tracking spells (We need generic solution)

2568{
2570 {
2571 switch (SpellFamilyName)
2572 {
2574 {
2575 // Food / Drinks (mostly)
2576 if (HasAuraInterruptFlag(SpellAuraInterruptFlags::Standing))
2577 {
2578 bool food = false;
2579 bool drink = false;
2580 for (SpellEffectInfo const& effect : GetEffects())
2581 {
2582 if (!effect.IsAura())
2583 continue;
2584 switch (effect.ApplyAuraName)
2585 {
2586 // Food
2589 food = true;
2590 break;
2591 // Drink
2594 drink = true;
2595 break;
2596 default:
2597 break;
2598 }
2599 }
2600
2601 if (food && drink)
2603 else if (food)
2604 return SPELL_SPECIFIC_FOOD;
2605 else if (drink)
2606 return SPELL_SPECIFIC_DRINK;
2607 }
2608 // scrolls effects
2609 else
2610 {
2611 SpellInfo const* firstRankSpellInfo = GetFirstRankSpell();
2612 switch (firstRankSpellInfo->Id)
2613 {
2614 case 8118: // Strength
2615 case 8099: // Stamina
2616 case 8112: // Spirit
2617 case 8096: // Intellect
2618 case 8115: // Agility
2619 case 8091: // Armor
2620 return SPELL_SPECIFIC_SCROLL;
2621 default:
2622 break;
2623 }
2624 }
2625 break;
2626 }
2627 case SPELLFAMILY_MAGE:
2628 {
2629 // family flags 18(Molten), 25(Frost/Ice), 28(Mage)
2630 if (SpellFamilyFlags[0] & 0x12040000)
2632
2633 // Arcane brillance and Arcane intelect (normal check fails because of flags difference)
2634 if (SpellFamilyFlags[0] & 0x400)
2636
2637 if ((SpellFamilyFlags[0] & 0x1000000) && GetEffect(EFFECT_0).IsAura(SPELL_AURA_MOD_CONFUSE))
2639
2640 break;
2641 }
2643 {
2644 if (Id == 12292) // Death Wish
2646
2647 break;
2648 }
2650 {
2651 // Warlock (Bane of Doom | Bane of Agony | Bane of Havoc)
2652 if (Id == 603 || Id == 980 || Id == 80240)
2653 return SPELL_SPECIFIC_BANE;
2654
2655 // only warlock curses have this
2656 if (Dispel == DISPEL_CURSE)
2657 return SPELL_SPECIFIC_CURSE;
2658
2659 // Warlock (Demon Armor | Demon Skin | Fel Armor)
2660 if (SpellFamilyFlags[1] & 0x20000020 || SpellFamilyFlags[2] & 0x00000010)
2662
2663 //seed of corruption and corruption
2664 if (SpellFamilyFlags[1] & 0x10 || SpellFamilyFlags[0] & 0x2)
2666 break;
2667 }
2668 case SPELLFAMILY_PRIEST:
2669 {
2670 // Divine Spirit and Prayer of Spirit
2671 if (SpellFamilyFlags[0] & 0x20)
2673
2674 break;
2675 }
2676 case SPELLFAMILY_HUNTER:
2677 {
2678 // only hunter stings have this
2679 if (Dispel == DISPEL_POISON)
2680 return SPELL_SPECIFIC_STING;
2681
2682 // only hunter aspects have this (but not all aspects in hunter family)
2683 if (SpellFamilyFlags & flag128(0x00200000, 0x00000000, 0x00001010, 0x00000000))
2684 return SPELL_SPECIFIC_ASPECT;
2685
2686 break;
2687 }
2689 {
2690 // Collection of all the seal family flags. No other paladin spell has any of those.
2691 if (SpellFamilyFlags[1] & 0xA2000800)
2692 return SPELL_SPECIFIC_SEAL;
2693
2694 if (SpellFamilyFlags[0] & 0x00002190)
2695 return SPELL_SPECIFIC_HAND;
2696
2697 // only paladin auras have this (for palaldin class family)
2698 switch (Id)
2699 {
2700 case 465: // Devotion Aura
2701 case 32223: // Crusader Aura
2702 case 183435: // Retribution Aura
2703 case 317920: // Concentration Aura
2704 return SPELL_SPECIFIC_AURA;
2705 default:
2706 break;
2707 }
2708
2709 break;
2710 }
2711 case SPELLFAMILY_SHAMAN:
2712 {
2713 // family flags 10 (Lightning), 42 (Earth), 37 (Water), proc shield from T2 8 pieces bonus
2714 if (SpellFamilyFlags[1] & 0x420
2715 || SpellFamilyFlags[0] & 0x00000400
2716 || Id == 23552)
2718
2719 break;
2720 }
2722 if (Id == 48266 || Id == 48263 || Id == 48265)
2724 break;
2725 }
2726
2727 for (SpellEffectInfo const& effect : GetEffects())
2728 {
2729 if (effect.IsEffect(SPELL_EFFECT_APPLY_AURA))
2730 {
2731 switch (effect.ApplyAuraName)
2732 {
2737 return SPELL_SPECIFIC_CHARM;
2740 if (Id == 30645) // Gas Cloud Tracking
2741 return SPELL_SPECIFIC_NORMAL;
2742 [[fallthrough]];
2746 default:
2747 break;
2748 }
2749 }
2750 }
2751 return SPELL_SPECIFIC_NORMAL;
2752 }();
2753}
@ EFFECT_0
Definition: SharedDefines.h:29
@ SPELL_EFFECT_APPLY_AURA
Definition: SharedDefines.h:1135
@ DISPEL_POISON
Definition: SharedDefines.h:2545
@ DISPEL_CURSE
Definition: SharedDefines.h:2543
@ SPELL_AURA_TRACK_RESOURCES
Definition: SpellAuraDefines.h:139
@ SPELL_AURA_OBS_MOD_HEALTH
Definition: SpellAuraDefines.h:114
@ SPELL_AURA_MOD_POSSESS_PET
Definition: SpellAuraDefines.h:472
@ SPELL_AURA_MOD_POWER_REGEN
Definition: SpellAuraDefines.h:179
@ SPELL_AURA_OBS_MOD_POWER
Definition: SpellAuraDefines.h:115
@ SPELL_AURA_TRACK_STEALTHED
Definition: SpellAuraDefines.h:245
@ SPELL_AURA_MOD_CHARM
Definition: SpellAuraDefines.h:100
@ SPELL_AURA_AOE_CHARM
Definition: SpellAuraDefines.h:271
@ SPELL_AURA_TRACK_CREATURES
Definition: SpellAuraDefines.h:138
@ SPELL_AURA_MOD_POSSESS
Definition: SpellAuraDefines.h:96
@ SPELL_AURA_MOD_REGEN
Definition: SpellAuraDefines.h:178
SpellSpecificType
Definition: SpellInfo.h:119
@ SPELL_SPECIFIC_FOOD
Definition: SpellInfo.h:132
@ SPELL_SPECIFIC_MAGE_ARMOR
Definition: SpellInfo.h:128
@ SPELL_SPECIFIC_NORMAL
Definition: SpellInfo.h:120
@ SPELL_SPECIFIC_STING
Definition: SpellInfo.h:123
@ SPELL_SPECIFIC_MAGE_ARCANE_BRILLANCE
Definition: SpellInfo.h:138
@ SPELL_SPECIFIC_ASPECT
Definition: SpellInfo.h:125
@ SPELL_SPECIFIC_PRIEST_DIVINE_SPIRIT
Definition: SpellInfo.h:140
@ SPELL_SPECIFIC_ELEMENTAL_SHIELD
Definition: SpellInfo.h:129
@ SPELL_SPECIFIC_WARLOCK_CORRUPTION
Definition: SpellInfo.h:131
@ SPELL_SPECIFIC_BANE
Definition: SpellInfo.h:143
@ SPELL_SPECIFIC_PRESENCE
Definition: SpellInfo.h:135
@ SPELL_SPECIFIC_CURSE
Definition: SpellInfo.h:124
@ SPELL_SPECIFIC_DRINK
Definition: SpellInfo.h:133
@ SPELL_SPECIFIC_HAND
Definition: SpellInfo.h:141
@ SPELL_SPECIFIC_AURA
Definition: SpellInfo.h:122
@ SPELL_SPECIFIC_WARRIOR_ENRAGE
Definition: SpellInfo.h:139
@ SPELL_SPECIFIC_WARLOCK_ARMOR
Definition: SpellInfo.h:127
@ SPELL_SPECIFIC_SCROLL
Definition: SpellInfo.h:137
@ SPELL_SPECIFIC_MAGE_POLYMORPH
Definition: SpellInfo.h:130
@ SPELL_SPECIFIC_TRACKER
Definition: SpellInfo.h:126
@ SPELL_SPECIFIC_SEAL
Definition: SpellInfo.h:121
@ SPELL_SPECIFIC_FOOD_AND_DRINK
Definition: SpellInfo.h:134
@ SPELL_SPECIFIC_CHARM
Definition: SpellInfo.h:136
SpellInfo const * GetFirstRankSpell() const
Definition: SpellInfo.cpp:4331
SpellSpecificType _spellSpecific
Definition: SpellInfo.h:611
bool HasAuraInterruptFlag(SpellAuraInterruptFlags flag) const
Definition: SpellInfo.h:465
Definition: FlagsArray.h:117
+ Here is the call graph for this function:

◆ _UnloadImplicitTargetConditionLists()

void SpellInfo::_UnloadImplicitTargetConditionLists ( )
private
4979{
4980 // find the same instances of ConditionList and delete them.
4981 for (SpellEffectInfo const& effect : _effects)
4982 {
4983 ConditionContainer* cur = effect.ImplicitTargetConditions;
4984 if (!cur)
4985 continue;
4986
4987 for (size_t j = effect.EffectIndex; j < _effects.size(); ++j)
4988 if (_effects[j].ImplicitTargetConditions == cur)
4989 _effects[j].ImplicitTargetConditions = nullptr;
4990
4991 delete cur;
4992 }
4993}
std::vector< Condition * > ConditionContainer
Definition: ConditionMgr.h:266
+ Here is the caller graph for this function:

◆ ApplyAllSpellImmunitiesTo()

void SpellInfo::ApplyAllSpellImmunitiesTo ( Unit target,
SpellEffectInfo const &  spellEffectInfo,
bool  apply 
) const
3560{
3561 SpellEffectInfo::ImmunityInfo const* immuneInfo = spellEffectInfo.GetImmunityInfo();
3562 if (!immuneInfo)
3563 return;
3564
3565 if (uint32 schoolImmunity = immuneInfo->SchoolImmuneMask)
3566 {
3567 target->ApplySpellImmune(Id, IMMUNITY_SCHOOL, schoolImmunity, apply);
3568
3570 {
3571 target->RemoveAppliedAuras([this, schoolImmunity](AuraApplication const* aurApp) -> bool
3572 {
3573 SpellInfo const* auraSpellInfo = aurApp->GetBase()->GetSpellInfo();
3574 return ((auraSpellInfo->GetSchoolMask() & schoolImmunity) != 0 && // Check for school mask
3575 CanDispelAura(auraSpellInfo) &&
3576 (IsPositive() != aurApp->IsPositive()) && // Check spell vs aura possitivity
3577 !auraSpellInfo->IsPassive() && // Don't remove passive auras
3578 auraSpellInfo->Id != Id); // Don't remove self
3579 });
3580 }
3581
3582 if (apply && schoolImmunity & SPELL_SCHOOL_MASK_NORMAL)
3583 target->RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags::InvulnerabilityBuff);
3584 }
3585
3586 if (uint64 mechanicImmunity = immuneInfo->MechanicImmuneMask)
3587 {
3588 for (uint32 i = 0; i < MAX_MECHANIC; ++i)
3589 if (mechanicImmunity & (UI64LIT(1) << i))
3590 target->ApplySpellImmune(Id, IMMUNITY_MECHANIC, i, apply);
3591
3593 {
3594 if (apply)
3595 target->RemoveAurasWithMechanic(mechanicImmunity, AURA_REMOVE_BY_DEFAULT, Id);
3596 else
3597 {
3598 std::vector<Aura*> aurasToUpdateTargets;
3599 target->RemoveAppliedAuras([mechanicImmunity, &aurasToUpdateTargets](AuraApplication const* aurApp)
3600 {
3601 Aura* aura = aurApp->GetBase();
3602 if (aura->GetSpellInfo()->GetAllEffectsMechanicMask() & mechanicImmunity)
3603 aurasToUpdateTargets.push_back(aura);
3604
3605 // only update targets, don't remove anything
3606 return false;
3607 });
3608
3609 for (Aura* aura : aurasToUpdateTargets)
3610 aura->UpdateTargetMap(aura->GetCaster());
3611 }
3612 }
3613 }
3614
3615 if (uint32 dispelImmunity = immuneInfo->DispelImmune)
3616 {
3617 target->ApplySpellImmune(Id, IMMUNITY_DISPEL, dispelImmunity, apply);
3618
3620 {
3621 target->RemoveAppliedAuras([dispelImmunity](AuraApplication const* aurApp) -> bool
3622 {
3623 SpellInfo const* spellInfo = aurApp->GetBase()->GetSpellInfo();
3624 if (spellInfo->Dispel == dispelImmunity)
3625 return true;
3626
3627 return false;
3628 });
3629 }
3630 }
3631
3632 if (uint32 damageImmunity = immuneInfo->DamageSchoolMask)
3633 {
3634 target->ApplySpellImmune(Id, IMMUNITY_DAMAGE, damageImmunity, apply);
3635
3636 if (apply && damageImmunity & SPELL_SCHOOL_MASK_NORMAL)
3637 target->RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags::InvulnerabilityBuff);
3638 }
3639
3640 for (AuraType auraType : immuneInfo->AuraTypeImmune)
3641 {
3642 target->ApplySpellImmune(Id, IMMUNITY_STATE, auraType, apply);
3644 target->RemoveAurasByType(auraType, [](AuraApplication const* aurApp) -> bool
3645 {
3646 // if the aura has SPELL_ATTR0_NO_IMMUNITIES, then it cannot be removed by immunity
3647 return !aurApp->GetBase()->GetSpellInfo()->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES);
3648 });
3649 }
3650
3651 for (SpellEffectName effectType : immuneInfo->SpellEffectImmune)
3652 target->ApplySpellImmune(Id, IMMUNITY_EFFECT, effectType, apply);
3653}
@ SPELL_SCHOOL_MASK_NORMAL
Definition: SharedDefines.h:320
@ SPELL_ATTR1_IMMUNITY_PURGES_EFFECT
Definition: SharedDefines.h:466
@ MAX_MECHANIC
Definition: SharedDefines.h:2526
@ IMMUNITY_STATE
Definition: SharedDefines.h:2564
@ IMMUNITY_EFFECT
Definition: SharedDefines.h:2563
@ IMMUNITY_DAMAGE
Definition: SharedDefines.h:2566
@ IMMUNITY_MECHANIC
Definition: SharedDefines.h:2568
@ IMMUNITY_SCHOOL
Definition: SharedDefines.h:2565
@ IMMUNITY_DISPEL
Definition: SharedDefines.h:2567
@ SPELL_ATTR0_NO_IMMUNITIES
Definition: SharedDefines.h:443
@ AURA_REMOVE_BY_DEFAULT
Definition: SpellAuraDefines.h:65
Definition: SpellAuras.h:56
bool IsPositive() const
Definition: SpellAuras.h:83
Aura * GetBase() const
Definition: SpellAuras.h:77
Definition: SpellAuras.h:123
Unit * GetCaster() const
Definition: SpellAuras.cpp:511
void UpdateTargetMap(Unit *caster, bool apply=true)
Definition: SpellAuras.cpp:610
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:138
bool CanDispelAura(SpellInfo const *auraSpellInfo) const
Definition: SpellInfo.cpp:1839
bool IsPassive() const
Definition: SpellInfo.cpp:1559
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3692
void RemoveAurasWithInterruptFlags(InterruptFlags flag, SpellInfo const *source=nullptr)
Definition: Unit.cpp:3981
void RemoveAppliedAuras(std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3638
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition: Unit.cpp:7642
void RemoveAurasWithMechanic(uint64 mechanicMaskToRemove, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT, uint32 exceptSpellId=0, bool withEffectMechanics=false)
Definition: Unit.cpp:4042
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalcCastTime()

uint32 SpellInfo::CalcCastTime ( Spell spell = nullptr) const
3852{
3853 int32 castTime = 0;
3854 if (CastTimeEntry)
3855 castTime = std::max(CastTimeEntry->Base, CastTimeEntry->Minimum);
3856
3857 if (castTime <= 0)
3858 return 0;
3859
3860 if (spell)
3861 spell->GetCaster()->ModSpellCastTime(this, castTime, spell);
3862
3864 castTime += 500;
3865
3866 return (castTime > 0) ? uint32(castTime) : 0;
3867}
@ SPELL_ATTR9_AIMED_SHOT
Definition: SharedDefines.h:755
@ SPELL_ATTR0_USES_RANGED_SLOT
Definition: SharedDefines.h:415
bool IsAutoRepeatRangedSpell() const
Definition: SpellInfo.cpp:1712
WorldObject * GetCaster() const
Definition: Spell.h:623
void ModSpellCastTime(SpellInfo const *spellInfo, int32 &castTime, Spell *spell=nullptr) const
Definition: Object.cpp:2404
int32 Base
Definition: DB2Structure.h:3366
int32 Minimum
Definition: DB2Structure.h:3367
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalcDuration()

int32 SpellInfo::CalcDuration ( WorldObject const *  caster = nullptr) const
3827{
3828 int32 duration = GetDuration();
3829
3830 if (caster)
3831 if (Player* modOwner = caster->GetSpellModOwner())
3832 modOwner->ApplySpellMod(this, SpellModOp::Duration, duration);
3833
3834 return duration;
3835}
Definition: Player.h:1125
int32 GetDuration() const
Definition: SpellInfo.cpp:3837
Player * GetSpellModOwner() const
Definition: Object.cpp:2227
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalcPowerCost() [1/3]

Optional< SpellPowerCost > SpellInfo::CalcPowerCost ( Powers  powerType,
bool  optionalCost,
WorldObject const *  caster,
SpellSchoolMask  schoolMask,
Spell spell = nullptr 
) const
3917{
3918 // gameobject casts don't use power
3919 Unit const* unitCaster = caster->ToUnit();
3920 if (!unitCaster)
3921 return {};
3922
3923 auto itr = std::find_if(PowerCosts.cbegin(), PowerCosts.cend(), [powerType](SpellPowerEntry const* spellPowerEntry)
3924 {
3925 return spellPowerEntry && spellPowerEntry->PowerType == powerType;
3926 });
3927 if (itr == PowerCosts.cend())
3928 return {};
3929
3930 return CalcPowerCost(*itr, optionalCost, caster, schoolMask, spell);
3931}
static Unit * ToUnit(Object *o)
Definition: Object.h:211
Optional< SpellPowerCost > CalcPowerCost(Powers powerType, bool optionalCost, WorldObject const *caster, SpellSchoolMask schoolMask, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:3916
Definition: Unit.h:739
Definition: DB2Structure.h:3601
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalcPowerCost() [2/3]

Optional< SpellPowerCost > SpellInfo::CalcPowerCost ( SpellPowerEntry const *  power,
bool  optionalCost,
WorldObject const *  caster,
SpellSchoolMask  schoolMask,
Spell spell = nullptr 
) const
3934{
3935 // gameobject casts don't use power
3936 Unit const* unitCaster = caster->ToUnit();
3937 if (!unitCaster)
3938 return {};
3939
3940 if (power->RequiredAuraSpellID && !unitCaster->HasAura(power->RequiredAuraSpellID))
3941 return {};
3942
3943 // Spell drain all exist power on cast (Only paladin lay of Hands)
3945 {
3946 // If power type - health drain all
3947 if (power->PowerType == POWER_HEALTH)
3948 {
3949 SpellPowerCost cost;
3950 cost.Power = POWER_HEALTH;
3951 cost.Amount = unitCaster->GetHealth();
3952 return cost;
3953 }
3954 // Else drain all power
3955 if (power->PowerType < MAX_POWERS)
3956 {
3957 SpellPowerCost cost;
3958 cost.Power = Powers(power->PowerType);
3959 cost.Amount = unitCaster->GetPower(cost.Power);
3960 return cost;
3961 }
3962
3963 TC_LOG_ERROR("spells", "SpellInfo::CalcPowerCost: Unknown power type '{}' in spell {}", power->PowerType, Id);
3964 return {};
3965 }
3966
3967 // Base powerCost
3968 int32 powerCost = 0;
3969 if (!optionalCost)
3970 {
3971 powerCost = power->ManaCost;
3972 // PCT cost from total amount
3973 if (power->PowerCostPct)
3974 {
3975 switch (power->PowerType)
3976 {
3977 // health as power used
3978 case POWER_HEALTH:
3979 if (G3D::fuzzyEq(power->PowerCostPct, 0.0f))
3980 powerCost += int32(CalculatePct(unitCaster->GetMaxHealth(), power->PowerCostMaxPct));
3981 else
3982 powerCost += int32(CalculatePct(unitCaster->GetMaxHealth(), power->PowerCostPct));
3983 break;
3984 case POWER_MANA:
3985 powerCost += int32(CalculatePct(unitCaster->GetCreateMana(), power->PowerCostPct));
3986 break;
3988 TC_LOG_ERROR("spells", "SpellInfo::CalcPowerCost: Unknown power type POWER_ALTERNATE_POWER in spell {}", Id);
3989 return {};
3990 default:
3991 {
3992 if (PowerTypeEntry const* powerTypeEntry = sDB2Manager.GetPowerTypeEntry(Powers(power->PowerType)))
3993 {
3994 powerCost += int32(CalculatePct(powerTypeEntry->MaxBasePower, power->PowerCostPct));
3995 break;
3996 }
3997
3998 TC_LOG_ERROR("spells", "SpellInfo::CalcPowerCost: Unknown power type '{}' in spell {}", power->PowerType, Id);
3999 return {};
4000 }
4001 }
4002 }
4003 }
4004 else
4005 {
4006 powerCost = int32(power->OptionalCost);
4007
4008 if (power->OptionalCostPct)
4009 {
4010 switch (power->PowerType)
4011 {
4012 // health as power used
4013 case POWER_HEALTH:
4014 powerCost += int32(CalculatePct(unitCaster->GetMaxHealth(), power->OptionalCostPct));
4015 break;
4016 case POWER_MANA:
4017 powerCost += int32(CalculatePct(unitCaster->GetCreateMana(), power->OptionalCostPct));
4018 break;
4020 TC_LOG_ERROR("spells", "SpellInfo::CalcPowerCost: Unsupported power type POWER_ALTERNATE_POWER in spell {} for optional cost percent", Id);
4021 return {};
4022 default:
4023 {
4024 if (PowerTypeEntry const* powerTypeEntry = sDB2Manager.GetPowerTypeEntry(Powers(power->PowerType)))
4025 {
4026 powerCost += int32(CalculatePct(powerTypeEntry->MaxBasePower, power->OptionalCostPct));
4027 break;
4028 }
4029
4030 TC_LOG_ERROR("spells", "SpellInfo::CalcPowerCost: Unknown power type '{}' in spell {} for optional cost percent", power->PowerType, Id);
4031 return {};
4032 }
4033 }
4034 }
4035
4036 powerCost += unitCaster->GetTotalAuraModifier(SPELL_AURA_MOD_ADDITIONAL_POWER_COST, [this, power](AuraEffect const* aurEff) -> bool
4037 {
4038 return aurEff->GetMiscValue() == power->PowerType
4039 && aurEff->IsAffectingSpell(this);
4040 });
4041 }
4042
4043 bool initiallyNegative = powerCost < 0;
4044
4045 // Shiv - costs 20 + weaponSpeed*10 energy (apply only to non-triggered spell with energy cost)
4047 {
4048 uint32 speed = 0;
4049 if (SpellShapeshiftFormEntry const* ss = sSpellShapeshiftFormStore.LookupEntry(unitCaster->GetShapeshiftForm()))
4050 speed = ss->CombatRoundTime;
4051 else
4052 {
4055 slot = OFF_ATTACK;
4056
4057 speed = unitCaster->GetBaseAttackTime(slot);
4058 }
4059
4060 powerCost += speed / 100;
4061 }
4062
4063 if (power->PowerType != POWER_HEALTH)
4064 {
4065 if (!optionalCost)
4066 {
4067 // Flat mod from caster auras by spell school and power type
4069 {
4070 if (!(aura->GetMiscValue() & schoolMask))
4071 continue;
4072
4073 if (!(aura->GetMiscValueB() & (1 << power->PowerType)))
4074 continue;
4075
4076 powerCost += aura->GetAmount();
4077 }
4078 }
4079
4080 // PCT mod from user auras by spell school and power type
4081 for (auto schoolCostPct : unitCaster->GetAuraEffectsByType(SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT))
4082 {
4083 if (!(schoolCostPct->GetMiscValue() & schoolMask))
4084 continue;
4085
4086 if (!(schoolCostPct->GetMiscValueB() & (1 << power->PowerType)))
4087 continue;
4088
4089 powerCost += CalculatePct(powerCost, schoolCostPct->GetAmount());
4090 }
4091 }
4092
4093 // Apply cost mod by spell
4094 if (Player* modOwner = unitCaster->GetSpellModOwner())
4095 {
4097 switch (power->OrderIndex)
4098 {
4099 case 0:
4100 mod = SpellModOp::PowerCost0;
4101 break;
4102 case 1:
4103 mod = SpellModOp::PowerCost1;
4104 break;
4105 case 2:
4106 mod = SpellModOp::PowerCost2;
4107 break;
4108 default:
4109 break;
4110 }
4111
4112 if (mod)
4113 {
4114 if (!optionalCost)
4115 modOwner->ApplySpellMod(this, *mod, powerCost, spell);
4116 else
4117 {
4118 // optional cost ignores flat modifiers
4119 int32 flatMod = 0;
4120 float pctMod = 1.0f;
4121 modOwner->GetSpellModValues(this, *mod, spell, powerCost, &flatMod, &pctMod);
4122 powerCost = int32(powerCost * pctMod);
4123 }
4124 }
4125 }
4126
4127 if (!unitCaster->IsControlledByPlayer() && G3D::fuzzyEq(power->PowerCostPct, 0.0f) && SpellLevel && power->PowerType == POWER_MANA)
4128 {
4130 {
4132 GtNpcManaCostScalerEntry const* casterScaler = sNpcManaCostScalerGameTable.GetRow(unitCaster->GetLevel());
4133 if (spellScaler && casterScaler)
4134 powerCost *= casterScaler->Scaler / spellScaler->Scaler;
4135 }
4136 }
4137
4138 if (power->PowerType == POWER_MANA)
4139 powerCost = float(powerCost) * (1.0f + unitCaster->m_unitData->ManaCostMultiplier);
4140
4141 // power cost cannot become negative if initially positive
4142 if (initiallyNegative != (powerCost < 0))
4143 powerCost = 0;
4144
4145 SpellPowerCost cost;
4146 cost.Power = Powers(power->PowerType);
4147 cost.Amount = powerCost;
4148 return cost;
4149}
DB2Storage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore("SpellShapeshiftForm.db2", &SpellShapeshiftFormLoadInfo::Instance)
GameTable< GtNpcManaCostScalerEntry > sNpcManaCostScalerGameTable
Definition: GameTables.cpp:36
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:165
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
@ SPELL_ATTR1_USE_ALL_MANA
Definition: SharedDefines.h:452
@ SPELL_ATTR3_REQUIRES_MAIN_HAND_WEAPON
Definition: SharedDefines.h:535
@ SPELL_ATTR3_REQUIRES_OFF_HAND_WEAPON
Definition: SharedDefines.h:549
WeaponAttackType
Definition: SharedDefines.h:6786
@ OFF_ATTACK
Definition: SharedDefines.h:6788
@ BASE_ATTACK
Definition: SharedDefines.h:6787
Powers
Definition: SharedDefines.h:276
@ MAX_POWERS
Definition: SharedDefines.h:298
@ POWER_ALTERNATE_POWER
Definition: SharedDefines.h:288
@ POWER_HEALTH
Definition: SharedDefines.h:277
@ POWER_MANA
Definition: SharedDefines.h:278
@ SPELL_ATTR0_SCALES_WITH_CREATURE_LEVEL
Definition: SharedDefines.h:433
@ SPELL_ATTR4_WEAPON_SPEED_COST_SCALING
Definition: SharedDefines.h:572
@ SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
Definition: SpellAuraDefines.h:166
@ SPELL_AURA_MOD_POWER_COST_SCHOOL
Definition: SpellAuraDefines.h:167
@ SPELL_AURA_MOD_ADDITIONAL_POWER_COST
Definition: SpellAuraDefines.h:157
T CalculatePct(T base, U pct)
Definition: Util.h:69
Definition: SpellAuraEffects.h:29
bool IsAffectingSpell(SpellInfo const *spell) const
Definition: SpellAuraEffects.cpp:1071
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:56
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1408
UF::UpdateField< UF::UnitData, 0, TYPEID_UNIT > m_unitData
Definition: Unit.h:1900
ShapeshiftForm GetShapeshiftForm() const
Definition: Unit.h:1550
uint32 GetBaseAttackTime(WeaponAttackType att) const
Definition: Unit.cpp:10329
uint64 GetMaxHealth() const
Definition: Unit.h:886
uint64 GetHealth() const
Definition: Unit.h:885
int32 GetTotalAuraModifier(AuraType auraType) const
Definition: Unit.cpp:4809
int32 GetPower(Powers power) const
Definition: Unit.cpp:9152
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4544
bool IsControlledByPlayer() const
Definition: Unit.h:1280
uint32 GetCreateMana() const
Definition: Unit.h:1483
uint8 GetLevel() const
Definition: Unit.h:855
Definition: GameTables.h:122
float Scaler
Definition: GameTables.h:123
Definition: DB2Structure.h:2969
Definition: SpellInfo.h:316
int32 Amount
Definition: SpellInfo.h:318
Powers Power
Definition: SpellInfo.h:317
Definition: DB2Structure.h:3703
+ Here is the call graph for this function:

◆ CalcPowerCost() [3/3]

std::vector< SpellPowerCost > SpellInfo::CalcPowerCost ( WorldObject const *  caster,
SpellSchoolMask  schoolMask,
Spell spell = nullptr 
) const
4152{
4153 std::vector<SpellPowerCost> costs;
4154 if (caster->IsUnit())
4155 {
4156 costs.reserve(MAX_POWERS_PER_SPELL);
4157
4158 auto getOrCreatePowerCost = [&](Powers powerType) -> SpellPowerCost&
4159 {
4160 auto itr = std::find_if(costs.begin(), costs.end(), [powerType](SpellPowerCost const& cost)
4161 {
4162 return cost.Power == powerType;
4163 });
4164 if (itr != costs.end())
4165 return *itr;
4166
4167 SpellPowerCost cost;
4168 cost.Power = powerType;
4169 cost.Amount = 0;
4170 costs.push_back(cost);
4171 return costs.back();
4172 };
4173
4174 for (SpellPowerEntry const* power : PowerCosts)
4175 {
4176 if (!power)
4177 continue;
4178
4179 if (Optional<SpellPowerCost> cost = CalcPowerCost(power, false, caster, schoolMask, spell))
4180 getOrCreatePowerCost(cost->Power).Amount += cost->Amount;
4181
4182 if (Optional<SpellPowerCost> optionalCost = CalcPowerCost(power, true, caster, schoolMask, spell))
4183 {
4184 SpellPowerCost& cost = getOrCreatePowerCost(optionalCost->Power);
4185 int32 remainingPower = caster->ToUnit()->GetPower(optionalCost->Power) - cost.Amount;
4186 if (remainingPower > 0)
4187 cost.Amount += std::min(optionalCost->Amount, remainingPower);
4188 }
4189 }
4190 }
4191
4192 return costs;
4193}
constexpr std::size_t MAX_POWERS_PER_SPELL
Definition: DBCEnums.h:1784
+ Here is the call graph for this function:

◆ CalcProcPPM()

float SpellInfo::CalcProcPPM ( Unit caster,
int32  itemLevel 
) const
4262{
4263 float ppm = ProcBasePPM;
4264 if (!caster)
4265 return ppm;
4266
4267 for (SpellProcsPerMinuteModEntry const* mod : ProcPPMMods)
4268 {
4269 switch (mod->Type)
4270 {
4272 {
4273 ppm *= 1.0f + CalcPPMHasteMod(mod, caster);
4274 break;
4275 }
4276 case SPELL_PPM_MOD_CRIT:
4277 {
4278 ppm *= 1.0f + CalcPPMCritMod(mod, caster);
4279 break;
4280 }
4282 {
4283 if (caster->GetClassMask() & mod->Param)
4284 ppm *= 1.0f + mod->Coeff;
4285 break;
4286 }
4287 case SPELL_PPM_MOD_SPEC:
4288 {
4289 if (Player* plrCaster = caster->ToPlayer())
4290 if (plrCaster->GetPrimarySpecialization() == uint32(mod->Param))
4291 ppm *= 1.0f + mod->Coeff;
4292 break;
4293 }
4294 case SPELL_PPM_MOD_RACE:
4295 {
4296 if (caster->GetRaceMask() & mod->Param)
4297 ppm *= 1.0f + mod->Coeff;
4298 break;
4299 }
4301 {
4302 ppm *= 1.0f + CalcPPMItemLevelMod(mod, itemLevel);
4303 break;
4304 }
4306 {
4307 if (caster->GetMap()->IsBattlegroundOrArena())
4308 ppm *= 1.0f + mod->Coeff;
4309 break;
4310 }
4311 default:
4312 break;
4313 }
4314 }
4315
4316 return ppm;
4317}
@ SPELL_PPM_MOD_CRIT
Definition: DBCEnums.h:1776
@ SPELL_PPM_MOD_ITEM_LEVEL
Definition: DBCEnums.h:1780
@ SPELL_PPM_MOD_CLASS
Definition: DBCEnums.h:1777
@ SPELL_PPM_MOD_SPEC
Definition: DBCEnums.h:1778
@ SPELL_PPM_MOD_RACE
Definition: DBCEnums.h:1779
@ SPELL_PPM_MOD_HASTE
Definition: DBCEnums.h:1775
@ SPELL_PPM_MOD_BATTLEGROUND
Definition: DBCEnums.h:1781
float CalcPPMHasteMod(SpellProcsPerMinuteModEntry const *mod, Unit *caster)
Definition: SpellInfo.cpp:4195
float CalcPPMCritMod(SpellProcsPerMinuteModEntry const *mod, Unit *caster)
Definition: SpellInfo.cpp:4221
float CalcPPMItemLevelMod(SpellProcsPerMinuteModEntry const *mod, int32 itemLevel)
Definition: SpellInfo.cpp:4248
bool IsBattlegroundOrArena() const
Definition: Map.cpp:3232
static Player * ToPlayer(Object *o)
Definition: Object.h:199
uint32 GetClassMask() const
Definition: Unit.h:863
uint64 GetRaceMask() const
Definition: Unit.h:860
Map * GetMap() const
Definition: Object.h:611
Definition: DB2Structure.h:3635
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanBeInterrupted()

bool SpellInfo::CanBeInterrupted ( WorldObject const *  interruptCaster,
Unit const *  interruptTarget,
bool  ignoreImmunity = false 
) const
1421{
1423 || HasChannelInterruptFlag(SpellAuraInterruptFlags::Damage | SpellAuraInterruptFlags::EnteringCombat)
1424 || (interruptTarget->IsPlayer() && InterruptFlags.HasFlag(SpellInterruptFlags::DamageCancelsPlayerOnly))
1425 || InterruptFlags.HasFlag(SpellInterruptFlags::DamageCancels)
1426 || (interruptCaster && interruptCaster->IsUnit() && interruptCaster->ToUnit()->HasAuraTypeWithMiscvalue(SPELL_AURA_ALLOW_INTERRUPT_SPELL, Id))
1427 || ((!(interruptTarget->GetMechanicImmunityMask() & (1 << MECHANIC_INTERRUPT)) || ignoreImmunity)
1428 && !interruptTarget->HasAuraTypeWithAffectMask(SPELL_AURA_PREVENT_INTERRUPT, this)
1430}
@ SPELL_ATTR7_CAN_ALWAYS_BE_INTERRUPTED
Definition: SharedDefines.h:686
@ SPELL_PREVENTION_TYPE_SILENCE
Definition: SharedDefines.h:2769
@ SPELL_AURA_PREVENT_INTERRUPT
Definition: SpellAuraDefines.h:297
@ SPELL_AURA_ALLOW_INTERRUPT_SPELL
Definition: SpellAuraDefines.h:578
constexpr bool HasFlag(T flag) const
Definition: EnumFlag.h:106
bool HasChannelInterruptFlag(SpellAuraInterruptFlags flag) const
Definition: SpellInfo.h:468
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanBeUsedInCombat()

bool SpellInfo::CanBeUsedInCombat ( ) const
1671{
1673}
@ SPELL_ATTR0_NOT_IN_COMBAT_ONLY_PEACEFUL
Definition: SharedDefines.h:442
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanDispelAura()

bool SpellInfo::CanDispelAura ( SpellInfo const *  auraSpellInfo) const
1840{
1841 // These auras (like Divine Shield) can't be dispelled
1842 if (auraSpellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES))
1843 return false;
1844
1845 // These spells (like Mass Dispel) can dispel all auras
1847 return true;
1848
1849 // These auras (Cyclone for example) are not dispelable
1850 if ((auraSpellInfo->HasAttribute(SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS) && auraSpellInfo->Mechanic != MECHANIC_NONE)
1851 || auraSpellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES))
1852 return false;
1853
1854 return true;
1855}
@ SPELL_ATTR2_NO_SCHOOL_IMMUNITIES
Definition: SharedDefines.h:514
@ SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS
Definition: SharedDefines.h:467
@ MECHANIC_NONE
Definition: SharedDefines.h:2489
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanPierceImmuneAura()

bool SpellInfo::CanPierceImmuneAura ( SpellInfo const *  auraSpellInfo) const
1813{
1814 // aura can't be pierced
1815 if (!auraSpellInfo || auraSpellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES))
1816 return false;
1817
1818 // these spells pierce all available spells (Resurrection Sickness for example)
1820 return true;
1821
1822 // these spells (Cyclone for example) can pierce all...
1824 {
1825 // ...but not these (Divine shield, Ice block, Cyclone and Banish for example)
1826 if (auraSpellInfo->Mechanic != MECHANIC_IMMUNE_SHIELD &&
1827 auraSpellInfo->Mechanic != MECHANIC_INVULNERABILITY &&
1828 (auraSpellInfo->Mechanic != MECHANIC_BANISH || (IsRankOf(auraSpellInfo) && auraSpellInfo->Dispel != DISPEL_NONE))) // Banish shouldn't be immune to itself, but Cyclone should
1829 return true;
1830 }
1831
1832 // Dispels other auras on immunity, check if this spell makes the unit immune to aura
1834 return true;
1835
1836 return false;
1837}
@ MECHANIC_INVULNERABILITY
Definition: SharedDefines.h:2514
@ MECHANIC_BANISH
Definition: SharedDefines.h:2507
@ MECHANIC_IMMUNE_SHIELD
Definition: SharedDefines.h:2518
@ DISPEL_NONE
Definition: SharedDefines.h:2541
bool IsRankOf(SpellInfo const *spellInfo) const
Definition: SpellInfo.cpp:4400
bool CanSpellProvideImmunityAgainstAura(SpellInfo const *auraSpellInfo) const
Definition: SpellInfo.cpp:3655
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanSpellProvideImmunityAgainstAura()

bool SpellInfo::CanSpellProvideImmunityAgainstAura ( SpellInfo const *  auraSpellInfo) const
3656{
3657 if (!auraSpellInfo)
3658 return false;
3659
3660 for (SpellEffectInfo const& effectInfo : _effects)
3661 {
3662 if (!effectInfo.IsEffect())
3663 continue;
3664
3665 SpellEffectInfo::ImmunityInfo const* immuneInfo = effectInfo.GetImmunityInfo();
3666 if (!immuneInfo)
3667 continue;
3668
3669 if (!auraSpellInfo->HasAttribute(SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS) && !auraSpellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES))
3670 {
3671 if (uint32 schoolImmunity = immuneInfo->SchoolImmuneMask)
3672 if ((auraSpellInfo->SchoolMask & schoolImmunity) != 0)
3673 return true;
3674 }
3675
3676 if (uint64 mechanicImmunity = immuneInfo->MechanicImmuneMask)
3677 if ((mechanicImmunity & (UI64LIT(1) << auraSpellInfo->Mechanic)) != 0)
3678 return true;
3679
3680 if (uint32 dispelImmunity = immuneInfo->DispelImmune)
3681 if (auraSpellInfo->Dispel == dispelImmunity)
3682 return true;
3683
3684 bool immuneToAllEffects = true;
3685 for (SpellEffectInfo const& auraSpellEffectInfo : auraSpellInfo->GetEffects())
3686 {
3687 if (!auraSpellEffectInfo.IsEffect())
3688 continue;
3689
3690 auto spellImmuneItr = immuneInfo->SpellEffectImmune.find(auraSpellEffectInfo.Effect);
3691 if (spellImmuneItr == immuneInfo->SpellEffectImmune.end())
3692 {
3693 immuneToAllEffects = false;
3694 break;
3695 }
3696
3697 if (uint32 mechanic = auraSpellEffectInfo.Mechanic)
3698 {
3699 if (!(immuneInfo->MechanicImmuneMask & (UI64LIT(1) << mechanic)))
3700 {
3701 immuneToAllEffects = false;
3702 break;
3703 }
3704 }
3705
3706 if (!auraSpellInfo->HasAttribute(SPELL_ATTR3_ALWAYS_HIT))
3707 {
3708 if (AuraType auraName = auraSpellEffectInfo.ApplyAuraName)
3709 {
3710 bool isImmuneToAuraEffectApply = false;
3711 auto auraImmuneItr = immuneInfo->AuraTypeImmune.find(auraName);
3712 if (auraImmuneItr != immuneInfo->AuraTypeImmune.end())
3713 isImmuneToAuraEffectApply = true;
3714
3715 if (!isImmuneToAuraEffectApply && !auraSpellInfo->IsPositiveEffect(auraSpellEffectInfo.EffectIndex) && !auraSpellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES))
3716 {
3717 if (uint32 applyHarmfulAuraImmunityMask = immuneInfo->ApplyHarmfulAuraImmuneMask)
3718 if ((auraSpellInfo->GetSchoolMask() & applyHarmfulAuraImmunityMask) != 0)
3719 isImmuneToAuraEffectApply = true;
3720 }
3721
3722 if (!isImmuneToAuraEffectApply)
3723 {
3724 immuneToAllEffects = false;
3725 break;
3726 }
3727 }
3728 }
3729 }
3730
3731 if (immuneToAllEffects)
3732 return true;
3733 }
3734
3735 return false;
3736}
@ SPELL_ATTR3_ALWAYS_HIT
Definition: SharedDefines.h:543
auto end()
Definition: FlatSet.h:38
auto find(Key const &value) const
Definition: FlatSet.h:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckExplicitTarget()

SpellCastResult SpellInfo::CheckExplicitTarget ( WorldObject const *  caster,
WorldObject const *  target,
Item const *  itemTarget = nullptr 
) const
2299{
2300 uint32 neededTargets = GetExplicitTargetMask();
2301 if (!target)
2302 {
2304 if (!(neededTargets & TARGET_FLAG_GAMEOBJECT_ITEM) || !itemTarget)
2306 return SPELL_CAST_OK;
2307 }
2308
2309 if (Unit const* unitTarget = target->ToUnit())
2310 {
2312 {
2313 Unit const* unitCaster = caster->ToUnit();
2314 if (neededTargets & TARGET_FLAG_UNIT_ENEMY)
2315 if (caster->IsValidAttackTarget(unitTarget, this))
2316 return SPELL_CAST_OK;
2317 if ((neededTargets & TARGET_FLAG_UNIT_ALLY)
2318 || ((neededTargets & TARGET_FLAG_UNIT_PARTY) && unitCaster && unitCaster->IsInPartyWith(unitTarget))
2319 || ((neededTargets & TARGET_FLAG_UNIT_RAID) && unitCaster && unitCaster->IsInRaidWith(unitTarget)))
2320 if (caster->IsValidAssistTarget(unitTarget, this))
2321 return SPELL_CAST_OK;
2322 if ((neededTargets & TARGET_FLAG_UNIT_MINIPET) && unitCaster)
2323 if (unitTarget->GetGUID() == unitCaster->GetCritterGUID())
2324 return SPELL_CAST_OK;
2325 if ((neededTargets & TARGET_FLAG_UNIT_PASSENGER) && unitCaster)
2326 if (unitTarget->IsOnVehicle(unitCaster))
2327 return SPELL_CAST_OK;
2329 }
2330 }
2331 return SPELL_CAST_OK;
2332}
@ SPELL_FAILED_BAD_TARGETS
Definition: SharedDefines.h:1453
@ SPELL_CAST_OK
Definition: SharedDefines.h:1762
@ TARGET_FLAG_UNIT_RAID
Definition: SpellDefines.h:275
@ TARGET_FLAG_UNIT_ENEMY
Definition: SpellDefines.h:280
@ TARGET_FLAG_UNIT_MINIPET
Definition: SpellDefines.h:289
@ TARGET_FLAG_UNIT_PASSENGER
Definition: SpellDefines.h:293
@ TARGET_FLAG_GAMEOBJECT_ITEM
Definition: SpellDefines.h:287
@ TARGET_FLAG_UNIT_ALLY
Definition: SpellDefines.h:281
@ TARGET_FLAG_GAMEOBJECT_MASK
Definition: SpellDefines.h:302
@ TARGET_FLAG_UNIT_PARTY
Definition: SpellDefines.h:276
uint32 GetExplicitTargetMask() const
Definition: SpellInfo.cpp:2472
ObjectGuid GetCritterGUID() const
Definition: Unit.h:1267
bool IsInRaidWith(Unit const *unit) const
Definition: Unit.cpp:11557
bool IsInPartyWith(Unit const *unit) const
Definition: Unit.cpp:11538
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckLocation()

SpellCastResult SpellInfo::CheckLocation ( uint32  map_id,
uint32  zone_id,
uint32  area_id,
Player const *  player = nullptr 
) const
1967{
1968 // normal case
1969 if (RequiredAreasID > 0)
1970 {
1971 bool found = false;
1972 std::vector<uint32> areaGroupMembers = sDB2Manager.GetAreasForGroup(RequiredAreasID);
1973 for (uint32 areaId : areaGroupMembers)
1974 {
1975 if (areaId == zone_id || areaId == area_id)
1976 {
1977 found = true;
1978 break;
1979 }
1980 }
1981
1982 if (!found)
1984 }
1985
1986 // continent limitation (virtual continent)
1988 {
1989 uint32 mountFlags = 0;
1990 if (player && player->HasAuraType(SPELL_AURA_MOUNT_RESTRICTIONS))
1991 {
1992 for (AuraEffect const* auraEffect : player->GetAuraEffectsByType(SPELL_AURA_MOUNT_RESTRICTIONS))
1993 mountFlags |= auraEffect->GetMiscValue();
1994 }
1995 else if (AreaTableEntry const* areaTable = sAreaTableStore.LookupEntry(area_id))
1996 mountFlags = areaTable->MountFlags;
1997
1998 if (!(mountFlags & AREA_MOUNT_FLAG_FLYING_ALLOWED))
2000
2001 if (player)
2002 {
2003 uint32 mapToCheck = map_id;
2004 if (MapEntry const* mapEntry = sMapStore.LookupEntry(map_id))
2005 mapToCheck = mapEntry->CosmeticParentMapID;
2006
2007 if ((mapToCheck == 1116 || mapToCheck == 1464) && !player->HasSpell(191645)) // Draenor Pathfinder
2009 else if (mapToCheck == 1220 && !player->HasSpell(233368)) // Broken Isles Pathfinder
2011 else if ((mapToCheck == 1642 || mapToCheck == 1643) && !player->HasSpell(278833)) // Battle for Azeroth Pathfinder
2013 }
2014 }
2015
2016 // raid instance limitation
2018 {
2019 MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
2020 if (!mapEntry || mapEntry->IsRaid())
2022 }
2023
2024 // DB base check (if non empty then must fit at least single for allow)
2025 SpellAreaMapBounds saBounds = sSpellMgr->GetSpellAreaMapBounds(Id);
2026 if (saBounds.first != saBounds.second)
2027 {
2028 for (SpellAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
2029 {
2030 if (itr->second.IsFitToRequirements(player, zone_id, area_id))
2031 return SPELL_CAST_OK;
2032 }
2034 }
2035
2036 // bg spell checks
2037 switch (Id)
2038 {
2039 case 23333: // Warsong Flag
2040 case 23335: // Silverwing Flag
2041 return map_id == 489 && player && player->InBattleground() ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
2042 case 34976: // Netherstorm Flag
2043 return map_id == 566 && player && player->InBattleground() ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
2044 case 2584: // Waiting to Resurrect
2045 case 22011: // Spirit Heal Channel
2046 case 22012: // Spirit Heal
2047 case 42792: // Recently Dropped Flag
2048 case 43681: // Inactive
2049 case 44535: // Spirit Heal (mana)
2050 {
2051 MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
2052 if (!mapEntry)
2054
2055 return zone_id == AREA_WINTERGRASP || (mapEntry->IsBattleground() && player && player->InBattleground()) ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
2056 }
2057 case 44521: // Preparation
2058 {
2059 if (!player)
2061
2062 MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
2063 if (!mapEntry)
2065
2066 if (!mapEntry->IsBattleground())
2068
2069 Battleground* bg = player->GetBattleground();
2071 }
2072 case 32724: // Gold Team (Alliance)
2073 case 32725: // Green Team (Alliance)
2074 case 35774: // Gold Team (Horde)
2075 case 35775: // Green Team (Horde)
2076 {
2077 MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
2078 if (!mapEntry)
2080
2081 return mapEntry->IsBattleArena() && player && player->InBattleground() ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
2082 }
2083 case 32727: // Arena Preparation
2084 {
2085 if (!player)
2087
2088 MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
2089 if (!mapEntry)
2091
2092 if (!mapEntry->IsBattleArena())
2094
2095 Battleground* bg = player->GetBattleground();
2097 }
2098 }
2099
2100 // aura limitations
2101 if (player)
2102 {
2103 for (SpellEffectInfo const& effect : GetEffects())
2104 {
2105 if (!effect.IsAura())
2106 continue;
2107
2108 switch (effect.ApplyAuraName)
2109 {
2111 {
2112 if (SpellShapeshiftFormEntry const* spellShapeshiftForm = sSpellShapeshiftFormStore.LookupEntry(effect.MiscValue))
2113 if (uint32 mountType = spellShapeshiftForm->MountTypeID)
2114 if (!player->GetMountCapability(mountType))
2115 return SPELL_FAILED_NOT_HERE;
2116 break;
2117 }
2118 case SPELL_AURA_MOUNTED:
2119 {
2120 uint32 mountType = effect.MiscValueB;
2121 if (MountEntry const* mountEntry = sDB2Manager.GetMount(Id))
2122 mountType = mountEntry->MountTypeID;
2123 if (mountType && !player->GetMountCapability(mountType))
2124 return SPELL_FAILED_NOT_HERE;
2125 break;
2126 }
2127 default:
2128 break;
2129 }
2130 }
2131 }
2132
2133 return SPELL_CAST_OK;
2134}
@ STATUS_WAIT_JOIN
Definition: Battleground.h:159
DB2Storage< MapEntry > sMapStore("Map.db2", &MapLoadInfo::Instance)
DB2Storage< AreaTableEntry > sAreaTableStore("AreaTable.db2", &AreaTableLoadInfo::Instance)
@ AREA_MOUNT_FLAG_FLYING_ALLOWED
Definition: DBCEnums.h:152
@ AREA_WINTERGRASP
Definition: SharedDefines.h:8012
@ SPELL_ATTR4_ONLY_FLYING_AREAS
Definition: SharedDefines.h:588
@ SPELL_ATTR6_NOT_IN_RAID_INSTANCES
Definition: SharedDefines.h:647
@ SPELL_FAILED_NOT_HERE
Definition: SharedDefines.h:1524
@ SPELL_FAILED_INCORRECT_AREA
Definition: SharedDefines.h:1502
@ SPELL_FAILED_NOT_IN_RAID_INSTANCE
Definition: SharedDefines.h:1649
@ SPELL_FAILED_REQUIRES_AREA
Definition: SharedDefines.h:1562
@ SPELL_AURA_MOD_SHAPESHIFT
Definition: SpellAuraDefines.h:130
@ SPELL_AURA_MOUNTED
Definition: SpellAuraDefines.h:172
@ SPELL_AURA_MOUNT_RESTRICTIONS
Definition: SpellAuraDefines.h:430
std::pair< SpellAreaMap::const_iterator, SpellAreaMap::const_iterator > SpellAreaMapBounds
Definition: SpellMgr.h:551
#define sSpellMgr
Definition: SpellMgr.h:824
Definition: Battleground.h:256
BattlegroundStatus GetStatus() const
Definition: Battleground.h:285
Definition: DB2Structure.h:126
Definition: DB2Structure.h:2591
bool IsBattleground() const
Definition: DB2Structure.h:2625
bool IsRaid() const
Definition: DB2Structure.h:2624
bool IsBattleArena() const
Definition: DB2Structure.h:2626
Definition: DB2Structure.h:2743
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckShapeshift()

SpellCastResult SpellInfo::CheckShapeshift ( uint32  form) const
1918{
1919 // talents that learn spells can have stance requirements that need ignore
1920 // (this requirement only for client-side stance show in talent description)
1921 /* TODO: 6.x fix this in proper way (probably spell flags/attributes?)
1922 if (GetTalentSpellCost(Id) > 0 && HasEffect(SPELL_EFFECT_LEARN_SPELL))
1923 return SPELL_CAST_OK;*/
1924
1925 //if (HasAttribute(SPELL_ATTR13_ACTIVATES_REQUIRED_SHAPESHIFT))
1926 // return SPELL_CAST_OK;
1927
1928 uint64 stanceMask = (form ? UI64LIT(1) << (form - 1) : 0);
1929
1930 if (stanceMask & StancesNot) // can explicitly not be cast in this stance
1932
1933 if (stanceMask & Stances) // can explicitly be cast in this stance
1934 return SPELL_CAST_OK;
1935
1936 bool actAsShifted = false;
1937 SpellShapeshiftFormEntry const* shapeInfo = nullptr;
1938 if (form > 0)
1939 {
1940 shapeInfo = sSpellShapeshiftFormStore.LookupEntry(form);
1941 if (!shapeInfo)
1942 {
1943 TC_LOG_ERROR("spells", "GetErrorAtShapeshiftedCast: unknown shapeshift {}", form);
1944 return SPELL_CAST_OK;
1945 }
1946 actAsShifted = !shapeInfo->GetFlags().HasFlag(SpellShapeshiftFormFlags::Stance);
1947 }
1948
1949 if (actAsShifted)
1950 {
1951 if (HasAttribute(SPELL_ATTR0_NOT_SHAPESHIFTED) || (shapeInfo && shapeInfo->GetFlags().HasFlag(SpellShapeshiftFormFlags::CanOnlyCastShapeshiftSpells))) // not while shapeshifted
1953 else if (Stances != 0) // needs other shapeshift
1955 }
1956 else
1957 {
1958 // needs shapeshift
1961 }
1962
1963 return SPELL_CAST_OK;
1964}
@ SPELL_ATTR2_ALLOW_WHILE_NOT_SHAPESHIFTED_CASTER_FORM
Definition: SharedDefines.h:507
@ SPELL_ATTR0_NOT_SHAPESHIFTED
Definition: SharedDefines.h:430
@ SPELL_FAILED_ONLY_SHAPESHIFT
Definition: SharedDefines.h:1555
@ SPELL_FAILED_NOT_SHAPESHIFT
Definition: SharedDefines.h:1532
EnumFlag< SpellShapeshiftFormFlags > GetFlags() const
Definition: DB2Structure.h:3716
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckTarget()

SpellCastResult SpellInfo::CheckTarget ( WorldObject const *  caster,
WorldObject const *  target,
bool  implicit = true 
) const
2137{
2138 if (HasAttribute(SPELL_ATTR1_EXCLUDE_CASTER) && caster == target)
2140
2141 // check visibility - ignore invisibility/stealth for implicit (area) targets
2142 if (!HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT) && !caster->CanSeeOrDetect(target, implicit))
2144
2145 Unit const* unitTarget = target->ToUnit();
2146
2147 // creature/player specific target checks
2148 if (unitTarget)
2149 {
2150 // spells cannot be cast if target has a pet in combat either
2153
2154 // only spells with SPELL_ATTR3_ONLY_TARGET_GHOSTS can target ghosts
2156 {
2159 else
2161 }
2162
2163 if (caster != unitTarget)
2164 {
2165 if (caster->GetTypeId() == TYPEID_PLAYER)
2166 {
2167 // Do not allow these spells to target creatures not tapped by us (Banish, Polymorph, many quest spells)
2169 if (Creature const* targetCreature = unitTarget->ToCreature())
2170 if (targetCreature->hasLootRecipient() && !targetCreature->isTappedBy(caster->ToPlayer()))
2172
2174 {
2175 Creature const* targetCreature = unitTarget->ToCreature();
2176 if (!targetCreature)
2178
2179 if (!targetCreature->CanHaveLoot() || !LootTemplates_Pickpocketing.HaveLootFor(targetCreature->GetCreatureTemplate()->pickpocketLootId))
2181 }
2182
2183 // Not allow disarm unarmed player
2185 {
2186 if (unitTarget->GetTypeId() == TYPEID_PLAYER)
2187 {
2188 Player const* player = unitTarget->ToPlayer();
2189 if (!player->GetWeaponForAttack(BASE_ATTACK) || !player->IsUseEquipedWeapon(true))
2191 }
2192 else if (!unitTarget->GetVirtualItemId(0))
2194 }
2195 }
2196 }
2197 }
2198 // corpse specific target checks
2199 else if (Corpse const* corpseTarget = target->ToCorpse())
2200 {
2201 // cannot target bare bones
2202 if (corpseTarget->GetType() == CORPSE_BONES)
2204 // we have to use owner for some checks (aura preventing resurrection for example)
2205 if (Player* owner = ObjectAccessor::FindPlayer(corpseTarget->GetOwnerGUID()))
2206 unitTarget = owner;
2207 // we're not interested in corpses without owner
2208 else
2210 }
2211 // other types of objects - always valid
2212 else return SPELL_CAST_OK;
2213
2214 // corpseOwner and unit specific target checks
2215 if (!unitTarget->IsPlayer())
2216 {
2219
2222 }
2225
2226 if (!IsAllowingDeadTarget() && !unitTarget->IsAlive())
2228
2229 // check this flag only for implicit targets (chain and area), allow to explicitly target units for spells like Shield of Righteousness
2232
2233 // checked in Unit::IsValidAttack/AssistTarget, shouldn't be checked for ENTRY targets
2234 //if (!HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNINTERACTIBLE))
2235 // return SPELL_FAILED_BAD_TARGETS;
2236
2237 if (!CheckTargetCreatureType(unitTarget))
2238 {
2239 if (target->GetTypeId() == TYPEID_PLAYER)
2241 else
2243 }
2244
2245 // check GM mode and GM invisibility - only for player casts (npc casts are controlled by AI) and negative spells
2246 if (unitTarget != caster && (caster->GetAffectingPlayer() || !IsPositive()) && unitTarget->GetTypeId() == TYPEID_PLAYER)
2247 {
2248 if (!unitTarget->ToPlayer()->IsVisible())
2250
2251 if (unitTarget->ToPlayer()->IsGameMaster())
2253 }
2254
2255 // not allow casting on flying player
2258
2259 /* TARGET_UNIT_MASTER gets blocked here for passengers, because the whole idea of this check is to
2260 not allow passengers to be implicitly hit by spells, however this target type should be an exception,
2261 if this is left it kills spells that award kill credit from vehicle to master (few spells),
2262 the use of these 2 covers passenger target check, logically, if vehicle cast this to master it should always hit
2263 him, because it would be it's passenger, there's no such case where this gets to fail legitimacy, this problem
2264 cannot be solved from within the check in other way since target type cannot be called for the spell currently
2265 Spell examples: [ID - 52864 Devour Water, ID - 52862 Devour Wind, ID - 49370 Wyrmrest Defender: Destabilize Azure Dragonshrine Effect] */
2266 if (Unit const* unitCaster = caster->ToUnit())
2267 {
2268 if (!unitCaster->IsVehicle() && !(unitCaster->GetCharmerOrOwner() == target))
2269 {
2270 if (TargetAuraState && !unitTarget->HasAuraState(AuraStateType(TargetAuraState), this, unitCaster))
2272
2273 if (ExcludeTargetAuraState && unitTarget->HasAuraState(AuraStateType(ExcludeTargetAuraState), this, unitCaster))
2275 }
2276 }
2277
2278 if (TargetAuraSpell && !unitTarget->HasAura(TargetAuraSpell))
2280
2283
2287
2289 if (Map* map = caster->GetMap())
2290 if (InstanceMap* iMap = map->ToInstanceMap())
2291 if (InstanceScript* instance = iMap->GetInstanceScript())
2292 if (instance->GetCombatResurrectionCharges() == 0 && instance->IsEncounterInProgress())
2294
2295 return SPELL_CAST_OK;
2296}
@ CORPSE_BONES
Definition: Corpse.h:31
LootStore LootTemplates_Pickpocketing("pickpocketing_loot_template", "creature pickpocket lootid", true)
@ TYPEID_PLAYER
Definition: ObjectGuid.h:39
@ SPELL_ATTR7_BYPASS_NO_RESURRECT_AURA
Definition: SharedDefines.h:700
@ SPELL_ATTR5_NOT_ON_PLAYER_CONTROLLED_NPC
Definition: SharedDefines.h:607
@ SPELL_ATTR5_NOT_ON_PLAYER
Definition: SharedDefines.h:606
@ SPELL_ATTR2_CANNOT_CAST_ON_TAPPED
Definition: SharedDefines.h:494
@ SPELL_ATTR1_EXCLUDE_CASTER
Definition: SharedDefines.h:470
@ SPELL_ATTR1_ONLY_PEACEFUL_TARGETS
Definition: SharedDefines.h:459
@ SPELL_ATTR3_ONLY_ON_GHOSTS
Definition: SharedDefines.h:537
@ SPELL_ATTR3_ONLY_ON_PLAYER
Definition: SharedDefines.h:533
@ SPELL_EFFECT_SELF_RESURRECT
Definition: SharedDefines.h:1223
@ SPELL_EFFECT_RESURRECT
Definition: SharedDefines.h:1147
@ MECHANIC_DISARM
Definition: SharedDefines.h:2492
@ SPELL_ATTR8_BATTLE_RESURRECTION
Definition: SharedDefines.h:733
@ SPELL_ATTR6_DO_NOT_CHAIN_TO_CROWD_CONTROLLED_TARGETS
Definition: SharedDefines.h:644
@ SPELL_ATTR6_IGNORE_PHASE_SHIFT
Definition: SharedDefines.h:649
@ SPELL_FAILED_TARGET_NOT_PLAYER
Definition: SharedDefines.h:1584
@ SPELL_FAILED_TARGET_NO_POCKETS
Definition: SharedDefines.h:1585
@ SPELL_FAILED_TARGET_IS_PLAYER
Definition: SharedDefines.h:1579
@ SPELL_FAILED_CANT_CAST_ON_TAPPED
Definition: SharedDefines.h:1461
@ SPELL_FAILED_TARGET_AURASTATE
Definition: SharedDefines.h:1572
@ SPELL_FAILED_BM_OR_INVISGOD
Definition: SharedDefines.h:1624
@ SPELL_FAILED_TARGET_IS_PLAYER_CONTROLLED
Definition: SharedDefines.h:1580
@ SPELL_FAILED_TARGETS_DEAD
Definition: SharedDefines.h:1570
@ SPELL_FAILED_TARGET_NOT_GHOST
Definition: SharedDefines.h:1607
@ SPELL_FAILED_TARGET_CANNOT_BE_RESURRECTED
Definition: SharedDefines.h:1672
@ SPELL_FAILED_TARGET_NO_WEAPONS
Definition: SharedDefines.h:1586
@ SPELL_FAILED_TARGET_AFFECTING_COMBAT
Definition: SharedDefines.h:1571
@ SPELL_AURA_PREVENT_RESURRECTION
Definition: SpellAuraDefines.h:408
@ SPELL_AURA_GHOST
Definition: SpellAuraDefines.h:189
@ SPELL_ATTR0_CU_ALLOW_INFLIGHT_TARGET
Definition: SpellInfo.h:166
@ SPELL_ATTR0_CU_PICKPOCKET
Definition: SpellInfo.h:158
@ UNIT_FLAG_PET_IN_COMBAT
Definition: UnitDefines.h:150
@ UNIT_STATE_IN_FLIGHT
Definition: Unit.h:252
Definition: Corpse.h:53
Definition: Creature.h:70
bool CanHaveLoot() const
Definition: Creature.h:236
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:214
Definition: Map.h:819
Definition: InstanceScript.h:186
bool HaveLootFor(uint32 loot_id) const
Definition: LootMgr.h:82
Definition: Map.h:185
InstanceMap * ToInstanceMap()
Definition: Map.h:430
static Creature * ToCreature(Object *o)
Definition: Object.h:205
bool IsPlayer() const
Definition: Object.h:198
TypeID GetTypeId() const
Definition: Object.h:171
static Corpse * ToCorpse(Object *o)
Definition: Object.h:223
bool IsGameMaster() const
Definition: Player.h:1194
Item * GetWeaponForAttack(WeaponAttackType attackType, bool useable=false) const
Definition: Player.cpp:9546
bool IsUseEquipedWeapon(bool mainhand) const
Definition: Player.cpp:13213
bool HasEffect(SpellEffectName effect) const
Definition: SpellInfo.cpp:1358
bool CheckTargetCreatureType(Unit const *target) const
Definition: SpellInfo.cpp:2384
bool IsAllowingDeadTarget() const
Definition: SpellInfo.cpp:1635
bool HasUnitFlag(UnitFlags flags) const
Definition: Unit.h:940
bool CanFreeMove() const
Definition: Unit.cpp:9074
bool IsAlive() const
Definition: Unit.h:1253
uint32 GetVirtualItemId(uint32 slot) const
Definition: Unit.cpp:13550
bool HasAuraState(AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
Definition: Unit.cpp:5825
bool IsVisible() const
Definition: Unit.cpp:8143
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4554
bool HasUnitState(const uint32 f) const
Definition: Unit.h:842
bool IsInCombat() const
Definition: Unit.h:1143
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:252
uint32 pickpocketLootId
Definition: CreatureData.h:510
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckTargetCreatureType()

bool SpellInfo::CheckTargetCreatureType ( Unit const *  target) const
2385{
2386 // Curse of Doom & Exorcism: not find another way to fix spell target check :/
2388 {
2389 // not allow cast at player
2390 if (target->GetTypeId() == TYPEID_PLAYER)
2391 return false;
2392 else
2393 return true;
2394 }
2395
2396 // if target is magnet (i.e Grounding Totem) the check is skipped
2397 if (target->IsMagnet())
2398 return true;
2399
2400 uint32 creatureType = target->GetCreatureTypeMask();
2401 return !TargetCreatureType || !creatureType || (creatureType & TargetCreatureType);
2402}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckVehicle()

SpellCastResult SpellInfo::CheckVehicle ( Unit const *  caster) const
2335{
2336 // All creatures should be able to cast as passengers freely, restriction and attribute are only for players
2337 if (caster->GetTypeId() != TYPEID_PLAYER)
2338 return SPELL_CAST_OK;
2339
2340 Vehicle* vehicle = caster->GetVehicle();
2341 if (vehicle)
2342 {
2343 uint16 checkMask = 0;
2344 for (SpellEffectInfo const& effect : GetEffects())
2345 {
2346 if (effect.IsAura(SPELL_AURA_MOD_SHAPESHIFT))
2347 {
2348 SpellShapeshiftFormEntry const* shapeShiftFromEntry = sSpellShapeshiftFormStore.LookupEntry(effect.MiscValue);
2349 if (shapeShiftFromEntry && (shapeShiftFromEntry->Flags & 1) == 0) // unk flag
2350 checkMask |= VEHICLE_SEAT_FLAG_UNCONTROLLED;
2351 break;
2352 }
2353 }
2354
2357
2358 if (!checkMask)
2359 checkMask = VEHICLE_SEAT_FLAG_CAN_ATTACK;
2360
2361 VehicleSeatEntry const* vehicleSeat = vehicle->GetSeatForPassenger(caster);
2363 && (vehicleSeat->Flags & checkMask) != checkMask)
2365
2366 // Can only summon uncontrolled minions/guardians when on controlled vehicle
2368 {
2369 for (SpellEffectInfo const& effect : GetEffects())
2370 {
2371 if (!effect.IsEffect(SPELL_EFFECT_SUMMON))
2372 continue;
2373
2374 SummonPropertiesEntry const* props = sSummonPropertiesStore.LookupEntry(effect.MiscValueB);
2375 if (props && props->Control != SUMMON_CATEGORY_WILD)
2377 }
2378 }
2379 }
2380
2381 return SPELL_CAST_OK;
2382}
DB2Storage< SummonPropertiesEntry > sSummonPropertiesStore("SummonProperties.db2", &SummonPropertiesLoadInfo::Instance)
@ VEHICLE_SEAT_FLAG_UNK2
Definition: DBCEnums.h:2239
@ VEHICLE_SEAT_FLAG_CAN_CAST_MOUNT_SPELL
Definition: DBCEnums.h:2221
@ VEHICLE_SEAT_FLAG_CAN_CONTROL
Definition: DBCEnums.h:2220
@ VEHICLE_SEAT_FLAG_UNCONTROLLED
Definition: DBCEnums.h:2222
@ VEHICLE_SEAT_FLAG_CAN_ATTACK
Definition: DBCEnums.h:2223
uint16_t uint16
Definition: Define.h:144
@ SPELL_EFFECT_SUMMON
Definition: SharedDefines.h:1157
@ SPELL_ATTR0_ALLOW_WHILE_MOUNTED
Definition: SharedDefines.h:438
@ SUMMON_CATEGORY_WILD
Definition: SharedDefines.h:5977
@ SPELL_ATTR6_ALLOW_WHILE_RIDING_VEHICLE
Definition: SharedDefines.h:648
@ SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW
Definition: SharedDefines.h:1655
Definition: Vehicle.h:31
VehicleSeatEntry const * GetSeatForPassenger(Unit const *passenger) const
Returns information on the seat of specified passenger, represented by the format in VehicleSeat....
Definition: Vehicle.cpp:646
int32 Flags
Definition: DB2Structure.h:3707
Definition: DB2Structure.h:3833
int32 Control
Definition: DB2Structure.h:3835
Definition: DB2Structure.h:4341
int32 Flags
Definition: DB2Structure.h:4345
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAllEffectsMechanicMask()

uint64 SpellInfo::GetAllEffectsMechanicMask ( ) const
2410{
2411 uint64 mask = 0;
2412 if (Mechanic)
2413 mask |= UI64LIT(1) << Mechanic;
2414
2415 for (SpellEffectInfo const& effect : GetEffects())
2416 if (effect.IsEffect() && effect.Mechanic)
2417 mask |= UI64LIT(1) << effect.Mechanic;
2418
2419 return mask;
2420}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAllowedMechanicMask()

uint64 SpellInfo::GetAllowedMechanicMask ( ) const
3786{
3787 return _allowedMechanicMask;
3788}
+ Here is the caller graph for this function:

◆ GetAttackType()

WeaponAttackType SpellInfo::GetAttackType ( ) const
1728{
1729 WeaponAttackType result;
1730 switch (DmgClass)
1731 {
1734 result = OFF_ATTACK;
1735 else
1736 result = BASE_ATTACK;
1737 break;
1740 break;
1741 default:
1742 // Wands
1744 result = RANGED_ATTACK;
1745 else
1746 result = BASE_ATTACK;
1747 break;
1748 }
1749
1750 return result;
1751}
@ SPELL_DAMAGE_CLASS_RANGED
Definition: SharedDefines.h:2762
@ SPELL_DAMAGE_CLASS_MELEE
Definition: SharedDefines.h:2761
@ RANGED_ATTACK
Definition: SharedDefines.h:6789
bool IsRangedWeaponSpell() const
Definition: SpellInfo.cpp:1705
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAuraRankForLevel()

SpellInfo const * SpellInfo::GetAuraRankForLevel ( uint8  level) const
4360{
4361 // ignore passive spells
4362 if (IsPassive())
4363 return this;
4364
4365 // Client ignores spell with these attributes (sub_53D9D0)
4367 return this;
4368
4369 bool needRankSelection = false;
4370 for (SpellEffectInfo const& effect : GetEffects())
4371 {
4372 if (IsPositiveEffect(effect.EffectIndex) &&
4373 (effect.Effect == SPELL_EFFECT_APPLY_AURA ||
4374 effect.Effect == SPELL_EFFECT_APPLY_AREA_AURA_PARTY ||
4375 effect.Effect == SPELL_EFFECT_APPLY_AREA_AURA_RAID) &&
4376 !effect.Scaling.Coefficient)
4377 {
4378 needRankSelection = true;
4379 break;
4380 }
4381 }
4382
4383 // not required
4384 if (!needRankSelection)
4385 return this;
4386
4387 for (SpellInfo const* nextSpellInfo = this; nextSpellInfo != nullptr; nextSpellInfo = nextSpellInfo->GetPrevRankSpell())
4388 {
4389 // if found appropriate level
4390 if (uint32(level + 10) >= nextSpellInfo->SpellLevel)
4391 return nextSpellInfo;
4392
4393 // one rank less then
4394 }
4395
4396 // not found
4397 return nullptr;
4398}
@ SPELL_ATTR2_ALLOW_LOW_LEVEL_BUFF
Definition: SharedDefines.h:491
@ SPELL_ATTR3_ONLY_PROC_ON_CASTER
Definition: SharedDefines.h:552
@ SPELL_EFFECT_APPLY_AREA_AURA_PARTY
Definition: SharedDefines.h:1164
@ SPELL_EFFECT_APPLY_AREA_AURA_RAID
Definition: SharedDefines.h:1194
@ SPELL_ATTR0_AURA_IS_DEBUFF
Definition: SharedDefines.h:440
SpellInfo const * GetPrevRankSpell() const
Definition: SpellInfo.cpp:4352
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAuraState()

AuraStateType SpellInfo::GetAuraState ( ) const
2478{
2479 return _auraState;
2480}
+ Here is the caller graph for this function:

◆ GetCategory()

uint32 SpellInfo::GetCategory ( ) const
1354{
1355 return CategoryId;
1356}
+ Here is the caller graph for this function:

◆ GetDiminishingReturnsGroupForSpell()

DiminishingGroup SpellInfo::GetDiminishingReturnsGroupForSpell ( ) const
3227{
3229}
+ Here is the caller graph for this function:

◆ GetDiminishingReturnsGroupType()

DiminishingReturnsType SpellInfo::GetDiminishingReturnsGroupType ( ) const
3232{
3234}
+ Here is the caller graph for this function:

◆ GetDiminishingReturnsLimitDuration()

int32 SpellInfo::GetDiminishingReturnsLimitDuration ( ) const
3242{
3244}
+ Here is the caller graph for this function:

◆ GetDiminishingReturnsMaxLevel()

DiminishingLevels SpellInfo::GetDiminishingReturnsMaxLevel ( ) const
3237{
3239}
+ Here is the caller graph for this function:

◆ GetDispelMask() [1/2]

uint32 SpellInfo::GetDispelMask ( ) const
2459{
2461}
DispelType
Definition: SharedDefines.h:2540
uint32 GetDispelMask() const
Definition: SpellInfo.cpp:2458
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDispelMask() [2/2]

uint32 SpellInfo::GetDispelMask ( DispelType  type)
static
2464{
2465 // If dispel all
2466 if (type == DISPEL_ALL)
2467 return DISPEL_ALL_MASK;
2468 else
2469 return uint32(1 << type);
2470}
#define DISPEL_ALL_MASK
Definition: SharedDefines.h:2555
@ DISPEL_ALL
Definition: SharedDefines.h:2548

◆ GetDuration()

int32 SpellInfo::GetDuration ( ) const
3838{
3839 if (!DurationEntry)
3840 return IsPassive() ? -1 : 0;
3841 return (DurationEntry->Duration == -1) ? -1 : abs(DurationEntry->Duration);
3842}
int32 Duration
Definition: DB2Structure.h:3430
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetEffect()

SpellEffectInfo const & SpellInfo::GetEffect ( SpellEffIndex  index) const
inline
574{ ASSERT(index < _effects.size()); return _effects[index]; }
#define ASSERT
Definition: Errors.h:68
+ Here is the caller graph for this function:

◆ GetEffectMechanic()

Mechanics SpellInfo::GetEffectMechanic ( SpellEffIndex  effIndex) const
2448{
2449 if (GetEffect(effIndex).IsEffect() && GetEffect(effIndex).Mechanic)
2450 return GetEffect(effIndex).Mechanic;
2451
2452 if (Mechanic)
2453 return Mechanics(Mechanic);
2454
2455 return MECHANIC_NONE;
2456}
Mechanics
Definition: SharedDefines.h:2488
Mechanics Mechanic
Definition: SpellInfo.h:229
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetEffectMechanicMask()

uint64 SpellInfo::GetEffectMechanicMask ( SpellEffIndex  effIndex) const
2423{
2424 uint64 mask = 0;
2425 if (Mechanic)
2426 mask |= UI64LIT(1) << Mechanic;
2427
2428 if (GetEffect(effIndex).IsEffect() && GetEffect(effIndex).Mechanic)
2429 mask |= UI64LIT(1) << GetEffect(effIndex).Mechanic;
2430
2431 return mask;
2432}
+ Here is the call graph for this function:

◆ GetEffects()

std::vector< SpellEffectInfo > const & SpellInfo::GetEffects ( ) const
inline
573{ return _effects; }

◆ GetExplicitTargetMask()

uint32 SpellInfo::GetExplicitTargetMask ( ) const
2473{
2474 return ExplicitTargetMask;
2475}
+ Here is the caller graph for this function:

◆ GetFirstRankSpell()

SpellInfo const * SpellInfo::GetFirstRankSpell ( ) const
4332{
4333 if (!ChainEntry)
4334 return this;
4335 return ChainEntry->first;
4336}
SpellChainNode const * ChainEntry
Definition: SpellInfo.h:427
SpellInfo const * first
Definition: SpellMgr.h:561
+ Here is the caller graph for this function:

◆ GetLastRankSpell()

SpellInfo const * SpellInfo::GetLastRankSpell ( ) const
4339{
4340 if (!ChainEntry)
4341 return nullptr;
4342 return ChainEntry->last;
4343}
SpellInfo const * last
Definition: SpellMgr.h:562

◆ GetMaxDuration()

int32 SpellInfo::GetMaxDuration ( ) const
3845{
3846 if (!DurationEntry)
3847 return IsPassive() ? -1 : 0;
3848 return (DurationEntry->MaxDuration == -1) ? -1 : abs(DurationEntry->MaxDuration);
3849}
int32 MaxDuration
Definition: DB2Structure.h:3431
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMaxRange()

float SpellInfo::GetMaxRange ( bool  positive = false,
WorldObject caster = nullptr,
Spell spell = nullptr 
) const
3815{
3816 if (!RangeEntry)
3817 return 0.0f;
3818 float range = RangeEntry->RangeMax[positive ? 1 : 0];
3819 if (caster)
3820 if (Player* modOwner = caster->GetSpellModOwner())
3821 modOwner->ApplySpellMod(this, SpellModOp::Range, range, spell);
3822
3823 return range;
3824}
std::array< float, 2 > RangeMax
Definition: DB2Structure.h:3659
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMaxTicks()

uint32 SpellInfo::GetMaxTicks ( ) const
3870{
3871 uint32 totalTicks = 0;
3872 int32 DotDuration = GetDuration();
3873
3874 for (SpellEffectInfo const& effect : GetEffects())
3875 {
3876 if (effect.IsEffect(SPELL_EFFECT_APPLY_AURA))
3877 {
3878 switch (effect.ApplyAuraName)
3879 {
3894 // skip infinite periodics
3895 if (effect.ApplyAuraPeriod > 0 && DotDuration > 0)
3896 {
3897 totalTicks = static_cast<uint32>(DotDuration) / effect.ApplyAuraPeriod;
3899 ++totalTicks;
3900 }
3901 break;
3902 default:
3903 break;
3904 }
3905 }
3906 }
3907
3908 return totalTicks;
3909}
@ SPELL_ATTR5_EXTRA_INITIAL_PERIOD
Definition: SharedDefines.h:608
@ SPELL_AURA_PERIODIC_DAMAGE
Definition: SpellAuraDefines.h:97
@ SPELL_AURA_PERIODIC_HEALTH_FUNNEL
Definition: SpellAuraDefines.h:156
@ SPELL_AURA_PERIODIC_MANA_LEECH
Definition: SpellAuraDefines.h:158
@ SPELL_AURA_PERIODIC_HEAL
Definition: SpellAuraDefines.h:102
@ SPELL_AURA_PERIODIC_DAMAGE_PERCENT
Definition: SpellAuraDefines.h:183
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE
Definition: SpellAuraDefines.h:321
@ SPELL_AURA_PERIODIC_ENERGIZE
Definition: SpellAuraDefines.h:118
@ SPELL_AURA_PERIODIC_LEECH
Definition: SpellAuraDefines.h:147
@ SPELL_AURA_POWER_BURN
Definition: SpellAuraDefines.h:256
@ SPELL_AURA_PERIODIC_DUMMY
Definition: SpellAuraDefines.h:320
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL_FROM_CLIENT
Definition: SpellAuraDefines.h:142
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
Definition: SpellAuraDefines.h:117
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMechanicImmunityMask()

uint64 SpellInfo::GetMechanicImmunityMask ( Unit const *  caster) const
3791{
3792 uint64 casterMechanicImmunityMask = caster->GetMechanicImmunityMask();
3793 uint64 mechanicImmunityMask = 0;
3794
3795 if (CanBeInterrupted(nullptr, caster, true))
3796 {
3797 if (casterMechanicImmunityMask & (1 << MECHANIC_SILENCE))
3798 mechanicImmunityMask |= (1 << MECHANIC_SILENCE);
3799
3800 if (casterMechanicImmunityMask & (1 << MECHANIC_INTERRUPT))
3801 mechanicImmunityMask |= (1 << MECHANIC_INTERRUPT);
3802 }
3803
3804 return mechanicImmunityMask;
3805}
bool CanBeInterrupted(WorldObject const *interruptCaster, Unit const *interruptTarget, bool ignoreImmunity=false) const
Definition: SpellInfo.cpp:1420
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMinRange()

float SpellInfo::GetMinRange ( bool  positive = false) const
3808{
3809 if (!RangeEntry)
3810 return 0.0f;
3811 return RangeEntry->RangeMin[positive ? 1 : 0];
3812}
std::array< float, 2 > RangeMin
Definition: DB2Structure.h:3658
+ Here is the caller graph for this function:

◆ GetNextRankSpell()

SpellInfo const * SpellInfo::GetNextRankSpell ( ) const
4346{
4347 if (!ChainEntry)
4348 return nullptr;
4349 return ChainEntry->next;
4350}
SpellInfo const * next
Definition: SpellMgr.h:560
+ Here is the caller graph for this function:

◆ GetPrevRankSpell()

SpellInfo const * SpellInfo::GetPrevRankSpell ( ) const
4353{
4354 if (!ChainEntry)
4355 return nullptr;
4356 return ChainEntry->prev;
4357}
SpellInfo const * prev
Definition: SpellMgr.h:559
+ Here is the caller graph for this function:

◆ GetRank()

uint8 SpellInfo::GetRank ( ) const
4325{
4326 if (!ChainEntry)
4327 return 1;
4328 return ChainEntry->rank;
4329}
uint8 rank
Definition: SpellMgr.h:563
+ Here is the caller graph for this function:

◆ GetRecoveryTime()

uint32 SpellInfo::GetRecoveryTime ( ) const
+ Here is the caller graph for this function:

◆ GetSchoolMask()

SpellSchoolMask SpellInfo::GetSchoolMask ( ) const
2405{
2407}
SpellSchoolMask
Definition: SharedDefines.h:318
+ Here is the caller graph for this function:

◆ GetSpellMechanicMaskByEffectMask()

uint64 SpellInfo::GetSpellMechanicMaskByEffectMask ( uint32  effectMask) const
2435{
2436 uint64 mask = 0;
2437 if (Mechanic)
2438 mask |= UI64LIT(1) << Mechanic;
2439
2440 for (SpellEffectInfo const& effect : GetEffects())
2441 if ((effectMask & (1 << effect.EffectIndex)) && effect.Mechanic)
2442 mask |= UI64LIT(1) << effect.Mechanic;
2443
2444 return mask;
2445}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSpellSpecific()

SpellSpecificType SpellInfo::GetSpellSpecific ( ) const
2563{
2564 return _spellSpecific;
2565};
+ Here is the caller graph for this function:

◆ GetSpellVisual()

uint32 SpellInfo::GetSpellVisual ( WorldObject const *  caster = nullptr,
WorldObject const *  viewer = nullptr 
) const
4441{
4442 if (SpellXSpellVisualEntry const* visual = sSpellXSpellVisualStore.LookupEntry(GetSpellXSpellVisualId(caster, viewer)))
4443 {
4444 //if (visual->LowViolenceSpellVisualID && forPlayer->GetViolenceLevel() operator 2)
4445 // return visual->LowViolenceSpellVisualID;
4446
4447 return visual->SpellVisualID;
4448 }
4449
4450 return 0;
4451}
DB2Storage< SpellXSpellVisualEntry > sSpellXSpellVisualStore("SpellXSpellVisual.db2", &SpellXSpellVisualLoadInfo::Instance)
uint32 GetSpellXSpellVisualId(WorldObject const *caster=nullptr, WorldObject const *viewer=nullptr) const
Definition: SpellInfo.cpp:4422
Definition: DB2Structure.h:3816
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSpellXSpellVisualId()

uint32 SpellInfo::GetSpellXSpellVisualId ( WorldObject const *  caster = nullptr,
WorldObject const *  viewer = nullptr 
) const
4423{
4424 for (SpellXSpellVisualEntry const* visual : _visuals)
4425 {
4426 if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(visual->CasterPlayerConditionID))
4427 if (!caster || !caster->IsPlayer() || !ConditionMgr::IsPlayerMeetingCondition(caster->ToPlayer(), playerCondition))
4428 continue;
4429
4430 if (UnitConditionEntry const* unitCondition = sUnitConditionStore.LookupEntry(visual->CasterUnitConditionID))
4431 if (!caster || !caster->IsUnit() || !ConditionMgr::IsUnitMeetingCondition(caster->ToUnit(), Object::ToUnit(viewer), unitCondition))
4432 continue;
4433
4434 return visual->ID;
4435 }
4436
4437 return 0;
4438}
DB2Storage< UnitConditionEntry > sUnitConditionStore("UnitCondition.db2", &UnitConditionLoadInfo::Instance)
DB2Storage< PlayerConditionEntry > sPlayerConditionStore("PlayerCondition.db2", &PlayerConditionLoadInfo::Instance)
static bool IsPlayerMeetingCondition(Player const *player, PlayerConditionEntry const *condition)
Definition: ConditionMgr.cpp:2932
static bool IsUnitMeetingCondition(Unit const *unit, Unit const *otherUnit, UnitConditionEntry const *condition)
Definition: ConditionMgr.cpp:4049
Unit * ToUnit()
Definition: Object.h:213
Definition: DB2Structure.h:2870
Definition: DB2Structure.h:4284
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasAnyAuraInterruptFlag()

bool SpellInfo::HasAnyAuraInterruptFlag ( ) const
1433{
1434 return AuraInterruptFlags != SpellAuraInterruptFlags::None || AuraInterruptFlags2 != SpellAuraInterruptFlags2::None;
1435}
+ Here is the caller graph for this function:

◆ HasAreaAuraEffect()

bool SpellInfo::HasAreaAuraEffect ( ) const
1377{
1378 for (SpellEffectInfo const& effect : GetEffects())
1379 if (effect.IsAreaAuraEffect())
1380 return true;
1381
1382 return false;
1383}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasAttribute() [1/16]

bool SpellInfo::HasAttribute ( SpellAttr0  attribute) const
inline
445{ return !!(Attributes & attribute); }

◆ HasAttribute() [2/16]

bool SpellInfo::HasAttribute ( SpellAttr1  attribute) const
inline
446{ return !!(AttributesEx & attribute); }

◆ HasAttribute() [3/16]

bool SpellInfo::HasAttribute ( SpellAttr10  attribute) const
inline
455{ return !!(AttributesEx10 & attribute); }

◆ HasAttribute() [4/16]

bool SpellInfo::HasAttribute ( SpellAttr11  attribute) const
inline
456{ return !!(AttributesEx11 & attribute); }

◆ HasAttribute() [5/16]

bool SpellInfo::HasAttribute ( SpellAttr12  attribute) const
inline
457{ return !!(AttributesEx12 & attribute); }

◆ HasAttribute() [6/16]

bool SpellInfo::HasAttribute ( SpellAttr13  attribute) const
inline
458{ return !!(AttributesEx13 & attribute); }

◆ HasAttribute() [7/16]

bool SpellInfo::HasAttribute ( SpellAttr14  attribute) const
inline
459{ return !!(AttributesEx14 & attribute); }

◆ HasAttribute() [8/16]

bool SpellInfo::HasAttribute ( SpellAttr2  attribute) const
inline
447{ return !!(AttributesEx2 & attribute); }

◆ HasAttribute() [9/16]

bool SpellInfo::HasAttribute ( SpellAttr3  attribute) const
inline
448{ return !!(AttributesEx3 & attribute); }

◆ HasAttribute() [10/16]

bool SpellInfo::HasAttribute ( SpellAttr4  attribute) const
inline
449{ return !!(AttributesEx4 & attribute); }

◆ HasAttribute() [11/16]

bool SpellInfo::HasAttribute ( SpellAttr5  attribute) const
inline
450{ return !!(AttributesEx5 & attribute); }

◆ HasAttribute() [12/16]

bool SpellInfo::HasAttribute ( SpellAttr6  attribute) const
inline
451{ return !!(AttributesEx6 & attribute); }

◆ HasAttribute() [13/16]

bool SpellInfo::HasAttribute ( SpellAttr7  attribute) const
inline
452{ return !!(AttributesEx7 & attribute); }

◆ HasAttribute() [14/16]

bool SpellInfo::HasAttribute ( SpellAttr8  attribute) const
inline
453{ return !!(AttributesEx8 & attribute); }

◆ HasAttribute() [15/16]

bool SpellInfo::HasAttribute ( SpellAttr9  attribute) const
inline
454{ return !!(AttributesEx9 & attribute); }

◆ HasAttribute() [16/16]

bool SpellInfo::HasAttribute ( SpellCustomAttributes  customAttribute) const
inline
460{ return !!(AttributesCu & customAttribute); }
uint32 AttributesCu
Definition: SpellInfo.h:346

◆ HasAura()

bool SpellInfo::HasAura ( AuraType  aura) const
1368{
1369 for (SpellEffectInfo const& effect : GetEffects())
1370 if (effect.IsAura(aura))
1371 return true;
1372
1373 return false;
1374}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasAuraInterruptFlag() [1/2]

bool SpellInfo::HasAuraInterruptFlag ( SpellAuraInterruptFlags  flag) const
inline
465{ return AuraInterruptFlags.HasFlag(flag); }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasAuraInterruptFlag() [2/2]

bool SpellInfo::HasAuraInterruptFlag ( SpellAuraInterruptFlags2  flag) const
inline
466{ return AuraInterruptFlags2.HasFlag(flag); }
+ Here is the call graph for this function:

◆ HasChannelInterruptFlag() [1/2]

bool SpellInfo::HasChannelInterruptFlag ( SpellAuraInterruptFlags  flag) const
inline
468{ return ChannelInterruptFlags.HasFlag(flag); }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasChannelInterruptFlag() [2/2]

bool SpellInfo::HasChannelInterruptFlag ( SpellAuraInterruptFlags2  flag) const
inline
469{ return ChannelInterruptFlags2.HasFlag(flag); }
+ Here is the call graph for this function:

◆ HasEffect()

bool SpellInfo::HasEffect ( SpellEffectName  effect) const
1359{
1360 for (SpellEffectInfo const& eff : GetEffects())
1361 if (eff.IsEffect(effect))
1362 return true;
1363
1364 return false;
1365}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasHitDelay()

bool SpellInfo::HasHitDelay ( ) const
1723{
1724 return Speed > 0.0f || LaunchDelay > 0.0f;
1725}
+ Here is the caller graph for this function:

◆ HasInitialAggro()

bool SpellInfo::HasInitialAggro ( ) const
1718{
1720}
@ SPELL_ATTR2_NO_INITIAL_THREAT
Definition: SharedDefines.h:510
@ SPELL_ATTR1_NO_THREAT
Definition: SharedDefines.h:461
@ SPELL_ATTR4_NO_HARMFUL_THREAT
Definition: SharedDefines.h:566
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasLabel()

bool SpellInfo::HasLabel ( uint32  labelId) const
5005{
5006 return Labels.find(labelId) != Labels.end();
5007}
+ Here is the caller graph for this function:

◆ HasOnlyDamageEffects()

bool SpellInfo::HasOnlyDamageEffects ( ) const
1386{
1387 for (SpellEffectInfo const& effect : GetEffects())
1388 {
1389 if (effect.IsEffect())
1390 {
1391 switch (effect.Effect)
1392 {
1401 continue;
1402 default:
1403 return false;
1404 }
1405 }
1406 }
1407
1408 return true;
1409}
@ SPELL_EFFECT_HEALTH_LEECH
Definition: SharedDefines.h:1138
@ SPELL_EFFECT_WEAPON_DAMAGE
Definition: SharedDefines.h:1187
@ SPELL_EFFECT_NORMALIZED_WEAPON_DMG
Definition: SharedDefines.h:1250
@ SPELL_EFFECT_DAMAGE_FROM_MAX_HEALTH_PCT
Definition: SharedDefines.h:1294
@ SPELL_EFFECT_WEAPON_PERCENT_DAMAGE
Definition: SharedDefines.h:1160
@ SPELL_EFFECT_ENVIRONMENTAL_DAMAGE
Definition: SharedDefines.h:1136
@ SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL
Definition: SharedDefines.h:1146
@ SPELL_EFFECT_SCHOOL_DAMAGE
Definition: SharedDefines.h:1131
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasTargetType()

bool SpellInfo::HasTargetType ( ::Targets  target) const
1412{
1413 for (SpellEffectInfo const& effect : GetEffects())
1414 if (effect.TargetA.GetTarget() == target || effect.TargetB.GetTarget() == target)
1415 return true;
1416
1417 return false;
1418}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsAbilityOfSkillType()

bool SpellInfo::IsAbilityOfSkillType ( uint32  skillType) const
1489{
1490 SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(Id);
1491
1492 for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
1493 if (_spell_idx->second->SkillLine == int32(skillType))
1494 return true;
1495
1496 return false;
1497}
std::pair< SkillLineAbilityMap::const_iterator, SkillLineAbilityMap::const_iterator > SkillLineAbilityMapBounds
Definition: SpellMgr.h:599

◆ IsAffected()

bool SpellInfo::IsAffected ( uint32  familyName,
flag128 const &  familyFlags 
) const
1767{
1768 if (!familyName)
1769 return true;
1770
1771 if (familyName != SpellFamilyName)
1772 return false;
1773
1774 if (familyFlags && !(familyFlags & SpellFamilyFlags))
1775 return false;
1776
1777 return true;
1778}
+ Here is the caller graph for this function:

◆ IsAffectedBySpellMod()

bool SpellInfo::IsAffectedBySpellMod ( SpellModifier const *  mod) const
1786{
1787 if (!IsAffectedBySpellMods())
1788 return false;
1789
1790 SpellInfo const* affectSpell = sSpellMgr->GetSpellInfo(mod->spellId, Difficulty);
1791 if (!affectSpell)
1792 return false;
1793
1794 switch (mod->type)
1795 {
1796 case SPELLMOD_FLAT:
1797 case SPELLMOD_PCT:
1798 // TEMP: dont use IsAffected - !familyName and !familyFlags are not valid options for spell mods
1799 // TODO: investigate if the !familyName and !familyFlags conditions are even valid for all other (nonmod) uses of SpellInfo::IsAffected
1800 return affectSpell->SpellFamilyName == SpellFamilyName && static_cast<SpellModifierByClassMask const*>(mod)->mask & SpellFamilyFlags;
1802 return HasLabel(static_cast<SpellFlatModifierByLabel const*>(mod)->value.LabelID);
1803 case SPELLMOD_LABEL_PCT:
1804 return HasLabel(static_cast<SpellPctModifierByLabel const*>(mod)->value.LabelID);
1805 default:
1806 break;
1807 }
1808
1809 return false;
1810}
Difficulty
Definition: DBCEnums.h:732
@ SPELLMOD_LABEL_PCT
Definition: Player.h:152
@ SPELLMOD_FLAT
Definition: Player.h:149
@ SPELLMOD_PCT
Definition: Player.h:150
@ SPELLMOD_LABEL_FLAT
Definition: Player.h:151
bool IsAffectedBySpellMods() const
Definition: SpellInfo.cpp:1780
bool HasLabel(uint32 labelId) const
Definition: SpellInfo.cpp:5004
Definition: Player.h:268
Definition: Player.h:277
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsAffectedBySpellMods()

bool SpellInfo::IsAffectedBySpellMods ( ) const
1781{
1783}
@ SPELL_ATTR3_IGNORE_CASTER_MODIFIERS
Definition: SharedDefines.h:554
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsAffectingArea()

bool SpellInfo::IsAffectingArea ( ) const
1500{
1501 for (SpellEffectInfo const& effect : GetEffects())
1502 if (effect.IsEffect() && (effect.IsTargetingArea() || effect.IsEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA) || effect.IsAreaAuraEffect()))
1503 return true;
1504
1505 return false;
1506}
@ SPELL_EFFECT_PERSISTENT_AREA_AURA
Definition: SharedDefines.h:1156
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsAllowingDeadTarget()

bool SpellInfo::IsAllowingDeadTarget ( ) const
1636{
1638 return true;
1639
1640 for (SpellEffectInfo const& effect : GetEffects())
1641 {
1642 if (!effect.IsEffect())
1643 continue;
1644
1645 if (effect.TargetA.GetObjectType() == TARGET_OBJECT_TYPE_CORPSE || effect.TargetB.GetObjectType() == TARGET_OBJECT_TYPE_CORPSE)
1646 return true;
1647 }
1648
1649 return false;
1650}
@ SPELL_ATTR2_ALLOW_DEAD_TARGET
Definition: SharedDefines.h:488
@ TARGET_FLAG_CORPSE_ALLY
Definition: SpellDefines.h:288
@ TARGET_FLAG_UNIT_DEAD
Definition: SpellDefines.h:283
@ TARGET_FLAG_CORPSE_ENEMY
Definition: SpellDefines.h:282
@ TARGET_OBJECT_TYPE_CORPSE
Definition: SpellInfo.h:74
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsAuraExclusiveBySpecificPerCasterWith()

bool SpellInfo::IsAuraExclusiveBySpecificPerCasterWith ( SpellInfo const *  spellInfo) const
1899{
1900 SpellSpecificType spellSpec = GetSpellSpecific();
1901 switch (spellSpec)
1902 {
1911 return spellSpec == spellInfo->GetSpellSpecific();
1912 default:
1913 return false;
1914 }
1915}
SpellSpecificType GetSpellSpecific() const
Definition: SpellInfo.cpp:2562
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsAuraExclusiveBySpecificWith()

bool SpellInfo::IsAuraExclusiveBySpecificWith ( SpellInfo const *  spellInfo) const
1867{
1868 SpellSpecificType spellSpec1 = GetSpellSpecific();
1869 SpellSpecificType spellSpec2 = spellInfo->GetSpellSpecific();
1870 switch (spellSpec1)
1871 {
1882 return spellSpec1 == spellSpec2;
1884 return spellSpec2 == SPELL_SPECIFIC_FOOD
1885 || spellSpec2 == SPELL_SPECIFIC_FOOD_AND_DRINK;
1887 return spellSpec2 == SPELL_SPECIFIC_DRINK
1888 || spellSpec2 == SPELL_SPECIFIC_FOOD_AND_DRINK;
1890 return spellSpec2 == SPELL_SPECIFIC_FOOD
1891 || spellSpec2 == SPELL_SPECIFIC_DRINK
1892 || spellSpec2 == SPELL_SPECIFIC_FOOD_AND_DRINK;
1893 default:
1894 return false;
1895 }
1896}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsAutocastable()

bool SpellInfo::IsAutocastable ( ) const
1565{
1566 if (IsPassive())
1567 return false;
1569 return false;
1570 return true;
1571}
@ SPELL_ATTR1_NO_AUTOCAST_AI
Definition: SharedDefines.h:468
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsAutoRepeatRangedSpell()

bool SpellInfo::IsAutoRepeatRangedSpell ( ) const
1713{
1715}
@ SPELL_ATTR2_AUTO_REPEAT
Definition: SharedDefines.h:493
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsChanneled()

bool SpellInfo::IsChanneled ( ) const
1686{
1688}
SpellAttr1
Definition: SharedDefines.h:450
@ SPELL_ATTR1_IS_SELF_CHANNELLED
Definition: SharedDefines.h:457
@ SPELL_ATTR1_IS_CHANNELLED
Definition: SharedDefines.h:453
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsCooldownStartedOnEvent()

bool SpellInfo::IsCooldownStartedOnEvent ( ) const
1617{
1619 return true;
1620
1621 SpellCategoryEntry const* category = sSpellCategoryStore.LookupEntry(CategoryId);
1622 return category && category->Flags & SPELL_CATEGORY_FLAG_COOLDOWN_STARTS_ON_EVENT;
1623}
DB2Storage< SpellCategoryEntry > sSpellCategoryStore("SpellCategory.db2", &SpellCategoryLoadInfo::Instance)
@ SPELL_CATEGORY_FLAG_COOLDOWN_STARTS_ON_EVENT
Definition: DBCEnums.h:1735
@ SPELL_ATTR0_COOLDOWN_ON_EVENT
Definition: SharedDefines.h:439
Definition: DB2Structure.h:3397
int8 Flags
Definition: DB2Structure.h:3400
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsDeathPersistent()

bool SpellInfo::IsDeathPersistent ( ) const
1626{
1628}
@ SPELL_ATTR3_ALLOW_AURA_WHILE_DEAD
Definition: SharedDefines.h:545
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsDifferentRankOf()

bool SpellInfo::IsDifferentRankOf ( SpellInfo const *  spellInfo) const
4406{
4407 if (Id == spellInfo->Id)
4408 return false;
4409 return IsRankOf(spellInfo);
4410}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsExplicitDiscovery()

bool SpellInfo::IsExplicitDiscovery ( ) const
1438{
1439 if (GetEffects().size() < 2)
1440 return