TrinityCore
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
 
uint32 GetAllEffectsMechanicMask () const
 
uint32 GetEffectMechanicMask (SpellEffIndex effIndex) const
 
uint32 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
 
uint32 GetAllowedMechanicMask () const
 
uint32 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
 
SpellCastTimesEntry const * CastTimeEntry = nullptr
 
uint32 RecoveryTime = 0
 
uint32 CategoryRecoveryTime = 0
 
uint32 StartRecoveryCategory = 0
 
uint32 StartRecoveryTime = 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
 
uint32 _allowedMechanicMask = 0
 

Friends

class SpellMgr
 

Constructor & Destructor Documentation

◆ SpellInfo() [1/4]

SpellInfo::SpellInfo ( SpellNameEntry const *  spellName,
::Difficulty  difficulty,
SpellInfoLoadHelper const &  data 
)
explicit
1103  : Id(spellName->ID), Difficulty(difficulty)
1104 {
1105  _effects.reserve(32);
1106  for (SpellEffectEntry const* spellEffect : data.Effects)
1107  {
1108  if (!spellEffect)
1109  continue;
1110 
1112  }
1113 
1114  // Correct EffectIndex for blank effects
1115  for (size_t i = 0; i < _effects.size(); ++i)
1116  _effects[i].EffectIndex = SpellEffIndex(i);
1117 
1118  _effects.shrink_to_fit();
1119 
1120  SpellName = &spellName->Name;
1121 
1122  // SpellMiscEntry
1123  if (SpellMiscEntry const* _misc = data.Misc)
1124  {
1125  Attributes = _misc->Attributes[0];
1126  AttributesEx = _misc->Attributes[1];
1127  AttributesEx2 = _misc->Attributes[2];
1128  AttributesEx3 = _misc->Attributes[3];
1129  AttributesEx4 = _misc->Attributes[4];
1130  AttributesEx5 = _misc->Attributes[5];
1131  AttributesEx6 = _misc->Attributes[6];
1132  AttributesEx7 = _misc->Attributes[7];
1133  AttributesEx8 = _misc->Attributes[8];
1134  AttributesEx9 = _misc->Attributes[9];
1135  AttributesEx10 = _misc->Attributes[10];
1136  AttributesEx11 = _misc->Attributes[11];
1137  AttributesEx12 = _misc->Attributes[12];
1138  AttributesEx13 = _misc->Attributes[13];
1139  AttributesEx14 = _misc->Attributes[14];
1140  CastTimeEntry = sSpellCastTimesStore.LookupEntry(_misc->CastingTimeIndex);
1141  DurationEntry = sSpellDurationStore.LookupEntry(_misc->DurationIndex);
1142  RangeEntry = sSpellRangeStore.LookupEntry(_misc->RangeIndex);
1143  Speed = _misc->Speed;
1144  LaunchDelay = _misc->LaunchDelay;
1145  SchoolMask = _misc->SchoolMask;
1146  IconFileDataId = _misc->SpellIconFileDataID;
1147  ActiveIconFileDataId = _misc->ActiveIconFileDataID;
1148  ContentTuningId = _misc->ContentTuningID;
1149  ShowFutureSpellPlayerConditionID = _misc->ShowFutureSpellPlayerConditionID;
1150  }
1151 
1152  // SpellScalingEntry
1153  if (SpellScalingEntry const* _scaling = data.Scaling)
1154  {
1155  Scaling.MinScalingLevel = _scaling->MinScalingLevel;
1156  Scaling.MaxScalingLevel = _scaling->MaxScalingLevel;
1157  Scaling.ScalesFromItemLevel = _scaling->ScalesFromItemLevel;
1158  }
1159 
1160  // SpellAuraOptionsEntry
1161  if (SpellAuraOptionsEntry const* _options = data.AuraOptions)
1162  {
1163  ProcFlags = _options->ProcTypeMask;
1164  ProcChance = _options->ProcChance;
1165  ProcCharges = _options->ProcCharges;
1166  ProcCooldown = _options->ProcCategoryRecovery;
1167  StackAmount = _options->CumulativeAura;
1168  if (SpellProcsPerMinuteEntry const* _ppm = sSpellProcsPerMinuteStore.LookupEntry(_options->SpellProcsPerMinuteID))
1169  {
1170  ProcBasePPM = _ppm->BaseProcRate;
1171  ProcPPMMods = sDB2Manager.GetSpellProcsPerMinuteMods(_ppm->ID);
1172  }
1173  }
1174 
1175  // SpellAuraRestrictionsEntry
1176  if (SpellAuraRestrictionsEntry const* _aura = data.AuraRestrictions)
1177  {
1178  CasterAuraState = _aura->CasterAuraState;
1179  TargetAuraState = _aura->TargetAuraState;
1180  ExcludeCasterAuraState = _aura->ExcludeCasterAuraState;
1181  ExcludeTargetAuraState = _aura->ExcludeTargetAuraState;
1182  CasterAuraSpell = _aura->CasterAuraSpell;
1183  TargetAuraSpell = _aura->TargetAuraSpell;
1184  ExcludeCasterAuraSpell = _aura->ExcludeCasterAuraSpell;
1185  ExcludeTargetAuraSpell = _aura->ExcludeTargetAuraSpell;
1186  }
1187 
1188  // SpellCastingRequirementsEntry
1189  if (SpellCastingRequirementsEntry const* _castreq = data.CastingRequirements)
1190  {
1191  RequiresSpellFocus = _castreq->RequiresSpellFocus;
1192  FacingCasterFlags = _castreq->FacingCasterFlags;
1193  RequiredAreasID = _castreq->RequiredAreasID;
1194  }
1195 
1196  // SpellCategoriesEntry
1197  if (SpellCategoriesEntry const* _categories = data.Categories)
1198  {
1199  CategoryId = _categories->Category;
1200  Dispel = _categories->DispelType;
1201  Mechanic = _categories->Mechanic;
1202  StartRecoveryCategory = _categories->StartRecoveryCategory;
1203  DmgClass = _categories->DefenseType;
1204  PreventionType = _categories->PreventionType;
1205  ChargeCategoryId = _categories->ChargeCategory;
1206  }
1207 
1208  // SpellClassOptionsEntry
1209  if (SpellClassOptionsEntry const* _class = data.ClassOptions)
1210  {
1211  SpellFamilyName = _class->SpellClassSet;
1212  SpellFamilyFlags = _class->SpellClassMask;
1213  }
1214 
1215  // SpellCooldownsEntry
1216  if (SpellCooldownsEntry const* _cooldowns = data.Cooldowns)
1217  {
1218  RecoveryTime = _cooldowns->RecoveryTime;
1219  CategoryRecoveryTime = _cooldowns->CategoryRecoveryTime;
1220  StartRecoveryTime = _cooldowns->StartRecoveryTime;
1221  }
1222 
1223  // SpellEquippedItemsEntry
1224  if (SpellEquippedItemsEntry const* _equipped = data.EquippedItems)
1225  {
1226  EquippedItemClass = _equipped->EquippedItemClass;
1227  EquippedItemSubClassMask = _equipped->EquippedItemSubclass;
1228  EquippedItemInventoryTypeMask = _equipped->EquippedItemInvTypes;
1229  }
1230 
1231  // SpellInterruptsEntry
1232  if (SpellInterruptsEntry const* _interrupt = data.Interrupts)
1233  {
1234  InterruptFlags = SpellInterruptFlags(_interrupt->InterruptFlags);
1235  AuraInterruptFlags = SpellAuraInterruptFlags(_interrupt->AuraInterruptFlags[0]);
1236  AuraInterruptFlags2 = SpellAuraInterruptFlags2(_interrupt->AuraInterruptFlags[1]);
1237  ChannelInterruptFlags = SpellAuraInterruptFlags(_interrupt->ChannelInterruptFlags[0]);
1238  ChannelInterruptFlags2 = SpellAuraInterruptFlags2(_interrupt->ChannelInterruptFlags[1]);
1239  }
1240 
1241  for (SpellLabelEntry const* label : data.Labels)
1242  Labels.insert(label->LabelID);
1243 
1244  // SpellLevelsEntry
1245  if (SpellLevelsEntry const* _levels = data.Levels)
1246  {
1247  MaxLevel = _levels->MaxLevel;
1248  BaseLevel = _levels->BaseLevel;
1249  SpellLevel = _levels->SpellLevel;
1250  }
1251 
1252  // SpellPowerEntry
1253  PowerCosts = data.Powers;
1254 
1255  // SpellReagentsEntry
1256  if (SpellReagentsEntry const* _reagents = data.Reagents)
1257  {
1258  Reagent = _reagents->Reagent;
1259  ReagentCount = _reagents->ReagentCount;
1260  }
1261 
1262  ReagentsCurrency = data.ReagentsCurrency;
1263 
1264  // SpellShapeshiftEntry
1265  if (SpellShapeshiftEntry const* _shapeshift = data.Shapeshift)
1266  {
1267  Stances = MAKE_PAIR64(_shapeshift->ShapeshiftMask[0], _shapeshift->ShapeshiftMask[1]);
1268  StancesNot = MAKE_PAIR64(_shapeshift->ShapeshiftExclude[0], _shapeshift->ShapeshiftExclude[1]);
1269  }
1270 
1271  // SpellTargetRestrictionsEntry
1272  if (SpellTargetRestrictionsEntry const* _target = data.TargetRestrictions)
1273  {
1274  ConeAngle = _target->ConeDegrees;
1275  Width = _target->Width;
1276  Targets = _target->Targets;
1277  TargetCreatureType = _target->TargetCreatureType;
1278  MaxAffectedTargets = _target->MaxTargets;
1279  MaxTargetLevel = _target->MaxTargetLevel;
1280  }
1281 
1282  // SpellTotemsEntry
1283  if (SpellTotemsEntry const* _totem = data.Totems)
1284  {
1285  TotemCategory = _totem->RequiredTotemCategoryID;
1286  Totem = _totem->Totem;
1287  }
1288 
1289  _visuals = data.Visuals;
1290 }
ProcFlags
Definition: SpellMgr.h:132
Definition: DB2Structure.h:3565
Targets
Definition: SharedDefines.h:2532
#define sDB2Manager
Definition: DB2Stores.h:479
Definition: DB2Structure.h:3522
int32 EquippedItemClass
Definition: SpellInfo.h:413
uint32 AttributesEx11
Definition: SpellInfo.h:363
uint32 ActiveIconFileDataId
Definition: SpellInfo.h:417
DB2Storage< SpellCastTimesEntry > sSpellCastTimesStore("SpellCastTimes.db2", SpellCastTimesLoadInfo::Instance())
decltype(auto) EnsureWritableVectorIndex(std::vector< T > &vec, typename std::vector< T >::size_type i)
Definition: Containers.h:314
Definition: DB2Structure.h:3314
uint32 AttributesEx12
Definition: SpellInfo.h:364
int32 EffectIndex
Definition: DB2Structure.h:3283
uint32 ProcCooldown
Definition: SpellInfo.h:396
struct SpellInfo::ScalingInfo Scaling
std::array< int16, MAX_SPELL_REAGENTS > ReagentCount
Definition: SpellInfo.h:411
uint32 IconFileDataId
Definition: SpellInfo.h:416
float Width
Definition: SpellInfo.h:422
uint32 TargetAuraState
Definition: SpellInfo.h:376
uint32 DmgClass
Definition: SpellInfo.h:427
Definition: DB2Structure.h:3215
uint32 MaxLevel
Definition: SpellInfo.h:399
uint32 SpellLevel
Definition: SpellInfo.h:401
uint32 AttributesEx
Definition: SpellInfo.h:353
uint32 ProcCharges
Definition: SpellInfo.h:395
int32 EquippedItemSubClassMask
Definition: SpellInfo.h:414
uint32 AttributesEx8
Definition: SpellInfo.h:360
Definition: DB2Structure.h:3396
uint32 AttributesEx10
Definition: SpellInfo.h:362
flag128 SpellFamilyFlags
Definition: SpellInfo.h:426
uint32 ExcludeCasterAuraSpell
Definition: SpellInfo.h:381
uint32 SchoolMask
Definition: SpellInfo.h:430
uint32 Dispel
Definition: SpellInfo.h:350
uint32 ExcludeTargetAuraSpell
Definition: SpellInfo.h:382
uint32 RequiresSpellFocus
Definition: SpellInfo.h:373
LocalizedString const * SpellName
Definition: SpellInfo.h:420
uint32 StartRecoveryCategory
Definition: SpellInfo.h:386
std::array< int32, MAX_SPELL_REAGENTS > Reagent
Definition: SpellInfo.h:410
EnumFlag< SpellAuraInterruptFlags2 > ChannelInterruptFlags2
Definition: SpellInfo.h:392
Definition: DB2Structure.h:3261
uint32 Mechanic
Definition: SpellInfo.h:351
Definition: DB2Structure.h:3278
uint32 AttributesEx14
Definition: SpellInfo.h:366
uint32 Attributes
Definition: SpellInfo.h:352
uint32 MaxTargetLevel
Definition: SpellInfo.h:423
Definition: DB2Structure.h:3497
uint32 ChargeCategoryId
Definition: SpellInfo.h:431
Definition: DB2Structure.h:3460
Definition: DB2Structure.h:3329
uint64 MAKE_PAIR64(uint32 l, uint32 h)
Definition: ObjectDefines.h:85
int32 EquippedItemInventoryTypeMask
Definition: SpellInfo.h:415
TotemCategory
Definition: SharedDefines.h:5611
std::vector< SpellEffectInfo > _effects
Definition: SpellInfo.h:625
uint32 AttributesEx3
Definition: SpellInfo.h:355
std::vector< SpellReagentsCurrencyEntry const * > ReagentsCurrency
Definition: SpellInfo.h:412
uint64 StancesNot
Definition: SpellInfo.h:370
SpellInterruptFlags
Definition: SpellDefines.h:56
SpellEffIndex
Definition: SharedDefines.h:27
uint32 CategoryId
Definition: SpellInfo.h:349
Totem(SummonPropertiesEntry const *properties, Unit *owner)
Definition: Totem.cpp:29
EnumFlag< SpellAuraInterruptFlags > AuraInterruptFlags
Definition: SpellInfo.h:389
SpellCastTimesEntry const * CastTimeEntry
Definition: SpellInfo.h:383
float LaunchDelay
Definition: SpellInfo.h:406
Definition: Totem.h:30
uint32 const Id
Definition: SpellInfo.h:347
uint32 AttributesEx7
Definition: SpellInfo.h:359
uint32 ScalesFromItemLevel
Definition: SpellInfo.h:439
uint32 AttributesEx9
Definition: SpellInfo.h:361
std::vector< SpellProcsPerMinuteModEntry const * > ProcPPMMods
Definition: SpellInfo.h:398
Definition: DB2Structure.h:3227
SpellRangeEntry const * RangeEntry
Definition: SpellInfo.h:404
uint32 RecoveryTime
Definition: SpellInfo.h:384
uint32 ContentTuningId
Definition: SpellInfo.h:418
uint32 AttributesEx2
Definition: SpellInfo.h:354
uint32 ExcludeCasterAuraState
Definition: SpellInfo.h:377
SpellVisualVector _visuals
Definition: SpellInfo.h:626
uint32 SpellFamilyName
Definition: SpellInfo.h:425
int32 RequiredAreasID
Definition: SpellInfo.h:429
EnumFlag< SpellAuraInterruptFlags > ChannelInterruptFlags
Definition: SpellInfo.h:391
uint32 ProcChance
Definition: SpellInfo.h:394
float ProcBasePPM
Definition: SpellInfo.h:397
uint32 MaxAffectedTargets
Definition: SpellInfo.h:424
uint64 Stances
Definition: SpellInfo.h:369
SpellDurationEntry const * DurationEntry
Definition: SpellInfo.h:402
Definition: SpellInfo.h:233
Definition: DB2Structure.h:3407
uint32 AttributesEx13
Definition: SpellInfo.h:365
::Difficulty const Difficulty
Definition: SpellInfo.h:348
uint32 PreventionType
Definition: SpellInfo.h:428
Definition: DB2Structure.h:3180
float Speed
Definition: SpellInfo.h:405
uint32 CasterAuraState
Definition: SpellInfo.h:375
uint32 AttributesEx5
Definition: SpellInfo.h:357
SpellAuraInterruptFlags
Definition: SpellDefines.h:74
float ConeAngle
Definition: SpellInfo.h:421
uint32 ExcludeTargetAuraState
Definition: SpellInfo.h:378
uint32 LabelID
Definition: DB2Structure.h:3384
Definition: DB2Structure.h:3513
uint32 BaseLevel
Definition: SpellInfo.h:400
Definition: DB2Structure.h:3550
uint32 CasterAuraSpell
Definition: SpellInfo.h:379
uint32 MaxScalingLevel
Definition: SpellInfo.h:438
uint32 AttributesEx6
Definition: SpellInfo.h:358
DB2Storage< SpellDurationEntry > sSpellDurationStore("SpellDuration.db2", SpellDurationLoadInfo::Instance())
uint32 FacingCasterFlags
Definition: SpellInfo.h:374
EnumFlag< SpellAuraInterruptFlags2 > AuraInterruptFlags2
Definition: SpellInfo.h:390
std::array< SpellPowerEntry const *, MAX_POWERS_PER_SPELL > PowerCosts
Definition: SpellInfo.h:403
uint32 StackAmount
Definition: SpellInfo.h:407
uint32 MinScalingLevel
Definition: SpellInfo.h:437
Definition: DB2Structure.h:3252
uint32 TargetCreatureType
Definition: SpellInfo.h:372
uint32 CategoryRecoveryTime
Definition: SpellInfo.h:385
uint32 StartRecoveryTime
Definition: SpellInfo.h:387
std::unordered_set< uint32 > Labels
Definition: SpellInfo.h:432
DB2Storage< SpellRangeEntry > sSpellRangeStore("SpellRange.db2", SpellRangeLoadInfo::Instance())
DB2Storage< SpellProcsPerMinuteEntry > sSpellProcsPerMinuteStore("SpellProcsPerMinute.db2", SpellProcsPerMinuteLoadInfo::Instance())
SpellAuraInterruptFlags2
Definition: SpellDefines.h:115
Definition: DB2Structure.h:3381
EnumFlag< SpellInterruptFlags > InterruptFlags
Definition: SpellInfo.h:388
uint32 TargetAuraSpell
Definition: SpellInfo.h:380
uint32 AttributesEx4
Definition: SpellInfo.h:356
Definition: DB2Structure.h:3193
uint32 ShowFutureSpellPlayerConditionID
Definition: SpellInfo.h:419
+ Here is the call graph for this function:

◆ SpellInfo() [2/4]

SpellInfo::SpellInfo ( SpellNameEntry const *  spellName,
::Difficulty  difficulty,
std::vector< SpellEffectEntry > const &  effects 
)
explicit
1293  : Id(spellName->ID), Difficulty(difficulty)
1294 {
1295  SpellName = &spellName->Name;
1296 
1297  _effects.reserve(32);
1298  for (SpellEffectEntry const& spellEffect : effects)
1299  Trinity::Containers::EnsureWritableVectorIndex(_effects, spellEffect.EffectIndex, SpellEffectInfo(this)) = SpellEffectInfo(this, spellEffect);
1300 
1301  // Correct EffectIndex for blank effects
1302  for (size_t i = 0; i < _effects.size(); ++i)
1303  _effects[i].EffectIndex = SpellEffIndex(i);
1304 
1305  _effects.shrink_to_fit();
1306 }
decltype(auto) EnsureWritableVectorIndex(std::vector< T > &vec, typename std::vector< T >::size_type i)
Definition: Containers.h:314
LocalizedString const * SpellName
Definition: SpellInfo.h:420
Definition: DB2Structure.h:3278
std::vector< SpellEffectInfo > _effects
Definition: SpellInfo.h:625
SpellEffIndex
Definition: SharedDefines.h:27
uint32 const Id
Definition: SpellInfo.h:347
Definition: SpellInfo.h:233
::Difficulty const Difficulty
Definition: SpellInfo.h:348
+ 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 ( )
1309 {
1311 }
void _UnloadImplicitTargetConditionLists()
Definition: SpellInfo.cpp:4872
+ Here is the call graph for this function:

Member Function Documentation

◆ _InitializeExplicitTargetMask()

void SpellInfo::_InitializeExplicitTargetMask ( )
private
4348 {
4349  bool srcSet = false;
4350  bool dstSet = false;
4351  uint32 targetMask = Targets;
4352  // prepare target mask using effect target entries
4353  for (SpellEffectInfo const& effect : GetEffects())
4354  {
4355  if (!effect.IsEffect())
4356  continue;
4357 
4358  targetMask |= effect.TargetA.GetExplicitTargetMask(srcSet, dstSet);
4359  targetMask |= effect.TargetB.GetExplicitTargetMask(srcSet, dstSet);
4360 
4361  // add explicit target flags based on spell effects which have EFFECT_IMPLICIT_TARGET_EXPLICIT and no valid target provided
4362  if (effect.GetImplicitTargetType() != EFFECT_IMPLICIT_TARGET_EXPLICIT)
4363  continue;
4364 
4365  // extend explicit target mask only if valid targets for effect could not be provided by target types
4366  uint32 effectTargetMask = effect.GetMissingTargetMask(srcSet, dstSet, targetMask);
4367 
4368  // don't add explicit object/dest flags when spell has no max range
4369  if (GetMaxRange(true) == 0.0f && GetMaxRange(false) == 0.0f)
4371 
4372  targetMask |= effectTargetMask;
4373  }
4374 
4375  ExplicitTargetMask = targetMask;
4376 }
Definition: SpellInfo.h:114
Definition: SpellDefines.h:282
Definition: SpellDefines.h:301
uint32 ExplicitTargetMask
Definition: SpellInfo.h:442
Definition: SpellInfo.h:233
uint32 Targets
Definition: SpellInfo.h:371
Definition: SpellDefines.h:298
uint32_t uint32
Definition: Define.h:143
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:589
Definition: SpellDefines.h:277
float GetMaxRange(bool positive=false, WorldObject *caster=nullptr, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:3737
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _InitializeSpellPositivity()

void SpellInfo::_InitializeSpellPositivity ( )
private
4834 {
4835  std::unordered_set<std::pair<SpellInfo const*, SpellEffIndex /*effIndex*/>> visited;
4836 
4837  for (SpellEffectInfo const& effect : GetEffects())
4838  if (!_isPositiveEffectImpl(this, effect, visited))
4839  NegativeEffects[effect.EffectIndex] = true;
4840 
4841  // additional checks after effects marked
4842  for (SpellEffectInfo const& effect : GetEffects())
4843  {
4844  if (!effect.IsEffect() || !IsPositiveEffect(effect.EffectIndex))
4845  continue;
4846 
4847  switch (effect.ApplyAuraName)
4848  {
4849  // has other non positive effect?
4850  // then it should be marked negative if has same target as negative effect (ex 8510, 8511, 8893, 10267)
4851  case SPELL_AURA_DUMMY:
4852  case SPELL_AURA_MOD_STUN:
4853  case SPELL_AURA_MOD_FEAR:
4854  case SPELL_AURA_MOD_TAUNT:
4855  case SPELL_AURA_TRANSFORM:
4858  {
4859  for (size_t j = effect.EffectIndex + 1; j < GetEffects().size(); ++j)
4860  if (!IsPositiveEffect(j)
4861  && effect.TargetA.GetTarget() == GetEffect(SpellEffIndex(j)).TargetA.GetTarget()
4862  && effect.TargetB.GetTarget() == GetEffect(SpellEffIndex(j)).TargetB.GetTarget())
4863  NegativeEffects[effect.EffectIndex] = true;
4864  break;
4865  }
4866  default:
4867  break;
4868  }
4869  }
4870 }
Definition: SpellAuraDefines.h:106
Definition: SpellAuraDefines.h:101
Targets GetTarget() const
Definition: SpellInfo.cpp:130
Definition: SpellInfo.h:342
std::bitset< MAX_SPELL_EFFECTS > NegativeEffects
Definition: SpellInfo.h:368
bool IsPositiveEffect(uint8 effIndex) const
Definition: SpellInfo.cpp:1640
SpellEffIndex
Definition: SharedDefines.h:27
SpellImplicitTargetInfo TargetA
Definition: SpellInfo.h:252
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition: SpellInfo.h:590
Definition: SpellInfo.h:233
bool _isPositiveEffectImpl(SpellInfo const *spellInfo, SpellEffectInfo const &effect, std::unordered_set< std::pair< SpellInfo const *, SpellEffIndex >> &visited)
Definition: SpellInfo.cpp:4387
Definition: SpellAuraDefines.h:103
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:589
Definition: SpellAuraDefines.h:98
Definition: SpellAuraDefines.h:127
Definition: SpellAuraDefines.h:150
Definition: SpellAuraDefines.h:105
SpellImplicitTargetInfo TargetB
Definition: SpellInfo.h:253
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _LoadAuraState()

void SpellInfo::_LoadAuraState ( )
private
2441 {
2442  _auraState = [this]()->AuraStateType
2443  {
2444  // Faerie Fire (Feral)
2445  if (GetCategory() == 1133)
2446  return AURA_STATE_FAERIE_FIRE;
2447 
2448  // Swiftmend state on Regrowth, Rejuvenation, Wild Growth
2449  if (SpellFamilyName == SPELLFAMILY_DRUID && (SpellFamilyFlags[0] & 0x50 || SpellFamilyFlags[1] & 0x4000000))
2451 
2452  // Deadly poison aura state
2453  if (SpellFamilyName == SPELLFAMILY_ROGUE && SpellFamilyFlags[0] & 0x10000)
2455 
2456  // Enrage aura state
2457  if (Dispel == DISPEL_ENRAGE)
2458  return AURA_STATE_ENRAGED;
2459 
2460  // Bleeding aura state
2462  return AURA_STATE_BLEED;
2463 
2465  for (SpellEffectInfo const& effect : GetEffects())
2466  if (effect.IsAura(SPELL_AURA_MOD_STUN) || effect.IsAura(SPELL_AURA_MOD_ROOT) || effect.IsAura(SPELL_AURA_MOD_ROOT_2))
2467  return AURA_STATE_FROZEN;
2468 
2469  switch (Id)
2470  {
2471  case 1064: // Dazed
2472  return AURA_STATE_DAZED;
2473  case 32216: // Victorious
2474  return AURA_STATE_VICTORIOUS;
2475  case 71465: // Divine Surge
2476  case 50241: // Evasive Charges
2478  case 6950: // Faerie Fire
2479  case 9806: // Phantom Strike
2480  case 9991: // Touch of Zanzil
2481  case 13424: // Faerie Fire
2482  case 13752: // Faerie Fire
2483  case 16432: // Plague Mist
2484  case 20656: // Faerie Fire
2485  case 25602: // Faerie Fire
2486  case 32129: // Faerie Fire
2487  case 35325: // Glowing Blood
2488  case 35328: // Lambent Blood
2489  case 35329: // Vibrant Blood
2490  case 35331: // Black Blood
2491  case 49163: // Perpetual Instability
2492  case 65863: // Faerie Fire
2493  case 79559: // Luxscale Light
2494  case 82855: // Dazzling
2495  case 102953: // In the Rumpus
2496  case 127907: // Phosphorescence
2497  case 127913: // Phosphorescence
2498  case 129007: // Zijin Sting
2499  case 130159: // Fae Touch
2500  case 142537: // Spotter Smoke
2501  case 168455: // Spotted!
2502  case 176905: // Super Sticky Glitter Bomb
2503  case 189502: // Marked
2504  case 201785: // Intruder Alert!
2505  case 201786: // Intruder Alert!
2506  case 201935: // Spotted!
2507  case 239233: // Smoke Bomb
2508  case 319400: // Glitter Burst
2509  case 321470: // Dimensional Shifter Mishap
2510  case 331134: // Spotted
2511  return AURA_STATE_FAERIE_FIRE;
2512  default:
2513  break;
2514  }
2515 
2516  return AURA_STATE_NONE;
2517  }();
2518 }
Definition: SharedDefines.h:2437
Definition: SpellAuraDefines.h:106
Definition: SharedDefines.h:2424
Definition: SharedDefines.h:2464
Definition: SpellAuraDefines.h:120
Definition: SharedDefines.h:6246
Definition: SharedDefines.h:2432
Definition: SharedDefines.h:2506
AuraStateType
Definition: SharedDefines.h:2412
flag128 SpellFamilyFlags
Definition: SpellInfo.h:426
uint32 Dispel
Definition: SpellInfo.h:350
Definition: SharedDefines.h:317
uint32 GetAllEffectsMechanicMask() const
Definition: SpellInfo.cpp:2367
Definition: SharedDefines.h:2431
Definition: SharedDefines.h:2433
Definition: SharedDefines.h:2419
uint32 const Id
Definition: SpellInfo.h:347
uint32 GetCategory() const
Definition: SpellInfo.cpp:1313
uint32 SpellFamilyName
Definition: SpellInfo.h:425
Definition: SpellInfo.h:233
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:2362
Definition: SharedDefines.h:2427
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:589
Definition: SharedDefines.h:2425
Definition: SharedDefines.h:6245
Definition: SpellAuraDefines.h:549
Definition: SharedDefines.h:2415
Definition: SharedDefines.h:2430
AuraStateType _auraState
Definition: SpellInfo.h:628
+ Here is the call graph for this function:

◆ _LoadImmunityInfo()

void SpellInfo::_LoadImmunityInfo ( )
private
3205 {
3206  for (SpellEffectInfo& effect : _effects)
3207  {
3208  uint32 schoolImmunityMask = 0;
3209  uint32 applyHarmfulAuraImmunityMask = 0;
3210  uint32 mechanicImmunityMask = 0;
3211  uint32 dispelImmunity = 0;
3212  uint32 damageImmunityMask = 0;
3213 
3214  int32 miscVal = effect.MiscValue;
3215  int32 amount = effect.CalcValue();
3216 
3217  ImmunityInfo& immuneInfo = effect._immunityInfo;
3218 
3219  switch (effect.ApplyAuraName)
3220  {
3222  {
3223  switch (miscVal)
3224  {
3225  case 96: // Free Friend, Uncontrollable Frenzy, Warlord's Presence
3226  {
3228 
3229  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_STUN);
3230  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_DECREASE_SPEED);
3231  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT);
3232  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_CONFUSE);
3233  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_FEAR);
3234  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT_2);
3235  break;
3236  }
3237  case 1615: // Incite Rage, Wolf Spirit, Overload, Lightning Tendrils
3238  {
3239  switch (Id)
3240  {
3241  case 43292: // Incite Rage
3242  case 49172: // Wolf Spirit
3244 
3245  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_STUN);
3246  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_DECREASE_SPEED);
3247  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT);
3248  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_CONFUSE);
3249  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_FEAR);
3250  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT_2);
3251  [[fallthrough]];
3252  case 61869: // Overload
3253  case 63481:
3254  case 61887: // Lightning Tendrils
3255  case 63486:
3256  mechanicImmunityMask |= (1 << MECHANIC_INTERRUPT) | (1 << MECHANIC_SILENCE);
3257 
3258  immuneInfo.SpellEffectImmune.insert(SPELL_EFFECT_KNOCK_BACK);
3260  break;
3261  default:
3262  break;
3263  }
3264  break;
3265  }
3266  case 679: // Mind Control, Avenging Fury
3267  {
3268  if (Id == 57742) // Avenging Fury
3269  {
3271 
3272  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_STUN);
3273  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_DECREASE_SPEED);
3274  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT);
3275  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_CONFUSE);
3276  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_FEAR);
3277  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT_2);
3278  }
3279  break;
3280  }
3281  case 1557: // Startling Roar, Warlord Roar, Break Bonds, Stormshield
3282  {
3283  if (Id == 64187) // Stormshield
3284  {
3285  mechanicImmunityMask |= (1 << MECHANIC_STUN);
3286  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_STUN);
3287  }
3288  else
3289  {
3291 
3292  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_STUN);
3293  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_DECREASE_SPEED);
3294  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT);
3295  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_CONFUSE);
3296  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_FEAR);
3297  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT_2);
3298  }
3299  break;
3300  }
3301  case 1614: // Fixate
3302  case 1694: // Fixated, Lightning Tendrils
3303  {
3304  immuneInfo.SpellEffectImmune.insert(SPELL_EFFECT_ATTACK_ME);
3305  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_TAUNT);
3306  break;
3307  }
3308  case 1630: // Fervor, Berserk
3309  {
3310  if (Id == 64112) // Berserk
3311  {
3312  immuneInfo.SpellEffectImmune.insert(SPELL_EFFECT_ATTACK_ME);
3313  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_TAUNT);
3314  }
3315  else
3316  {
3318 
3319  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_STUN);
3320  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_DECREASE_SPEED);
3321  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT);
3322  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_CONFUSE);
3323  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_FEAR);
3324  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT_2);
3325  }
3326  break;
3327  }
3328  case 477: // Bladestorm
3329  case 1733: // Bladestorm, Killing Spree
3330  {
3331  if (!amount)
3332  {
3334 
3335  immuneInfo.SpellEffectImmune.insert(SPELL_EFFECT_KNOCK_BACK);
3337 
3338  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_STUN);
3339  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_DECREASE_SPEED);
3340  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT);
3341  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_CONFUSE);
3342  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_FEAR);
3343  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT_2);
3344  }
3345  break;
3346  }
3347  case 878: // Whirlwind, Fog of Corruption, Determination
3348  {
3349  if (Id == 66092) // Determination
3350  {
3351  mechanicImmunityMask |= (1 << MECHANIC_SNARE) | (1 << MECHANIC_STUN)
3352  | (1 << MECHANIC_DISORIENTED) | (1 << MECHANIC_FREEZE);
3353 
3354  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_STUN);
3355  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_DECREASE_SPEED);
3356  }
3357  break;
3358  }
3359  default:
3360  break;
3361  }
3362 
3363  if (immuneInfo.AuraTypeImmune.empty())
3364  {
3365  if (miscVal & (1 << 10))
3366  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_STUN);
3367  if (miscVal & (1 << 1))
3368  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_TRANSFORM);
3369 
3370  // These flag can be recognized wrong:
3371  if (miscVal & (1 << 6))
3372  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_DECREASE_SPEED);
3373  if (miscVal & (1 << 0))
3374  {
3375  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT);
3376  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT_2);
3377  }
3378  if (miscVal & (1 << 2))
3379  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_CONFUSE);
3380  if (miscVal & (1 << 9))
3381  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_FEAR);
3382  if (miscVal & (1 << 7))
3383  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_DISARM);
3384  }
3385  break;
3386  }
3388  {
3389  switch (Id)
3390  {
3391  case 42292: // PvP trinket
3392  case 59752: // Every Man for Himself
3395  break;
3396  case 34471: // The Beast Within
3397  case 19574: // Bestial Wrath
3398  case 46227: // Medallion of Immunity
3399  case 53490: // Bullheaded
3400  case 65547: // PvP Trinket
3401  case 134946: // Supremacy of the Alliance
3402  case 134956: // Supremacy of the Horde
3403  case 195710: // Honorable Medallion
3404  case 208683: // Gladiator's Medallion
3406  break;
3407  case 54508: // Demonic Empowerment
3408  mechanicImmunityMask |= (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT) | (1 << MECHANIC_STUN);
3409  break;
3410  default:
3411  if (miscVal < 1)
3412  return;
3413 
3414  mechanicImmunityMask |= 1 << miscVal;
3415  break;
3416  }
3417  break;
3418  }
3420  {
3421  immuneInfo.SpellEffectImmune.insert(static_cast<SpellEffectName>(miscVal));
3422  break;
3423  }
3425  {
3426  immuneInfo.AuraTypeImmune.insert(static_cast<AuraType>(miscVal));
3427  break;
3428  }
3430  {
3431  schoolImmunityMask |= uint32(miscVal);
3432  break;
3433  }
3435  {
3436  applyHarmfulAuraImmunityMask |= uint32(miscVal);
3437  break;
3438  }
3440  {
3441  damageImmunityMask |= uint32(miscVal);
3442  break;
3443  }
3445  {
3446  dispelImmunity = uint32(miscVal);
3447  break;
3448  }
3449  default:
3450  break;
3451  }
3452 
3453  immuneInfo.SchoolImmuneMask = schoolImmunityMask;
3454  immuneInfo.ApplyHarmfulAuraImmuneMask = applyHarmfulAuraImmunityMask;
3455  immuneInfo.MechanicImmuneMask = mechanicImmunityMask;
3456  immuneInfo.DispelImmune = dispelImmunity;
3457  immuneInfo.DamageSchoolMask = damageImmunityMask;
3458 
3459  immuneInfo.AuraTypeImmune.shrink_to_fit();
3460  immuneInfo.SpellEffectImmune.shrink_to_fit();
3461 
3463  }
3464 
3466  {
3467  switch (Id)
3468  {
3469  case 22812: // Barkskin
3470  case 47585: // Dispersion
3472  (1 << MECHANIC_STUN) |
3473  (1 << MECHANIC_FREEZE) |
3474  (1 << MECHANIC_KNOCKOUT) |
3475  (1 << MECHANIC_SLEEP);
3476  break;
3477  case 49039: // Lichborne, don't allow normal stuns
3478  break;
3479  default:
3481  break;
3482  }
3483  }
3484 
3487 
3489  {
3490  switch (Id)
3491  {
3492  case 22812: // Barkskin
3493  case 47585: // Dispersion
3495  break;
3496  default:
3498  break;
3499  }
3500  }
3501 }
boost::container::flat_set< AuraType > AuraTypeImmune
Definition: SpellInfo.h:229
Definition: SpellAuraDefines.h:361
Definition: SharedDefines.h:2461
Definition: SharedDefines.h:595
Definition: SpellAuraDefines.h:106
Definition: SpellAuraDefines.h:101
uint32 SchoolImmuneMask
Definition: SpellInfo.h:223
Definition: SpellAuraDefines.h:120
boost::container::flat_set< SpellEffectName > SpellEffectImmune
Definition: SpellInfo.h:230
uint32 DispelImmune
Definition: SpellInfo.h:226
#define IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK
Definition: SharedDefines.h:2486
Definition: SharedDefines.h:2473
Definition: SharedDefines.h:1262
Definition: SharedDefines.h:2456
Definition: SharedDefines.h:2460
std::vector< SpellEffectInfo > _effects
Definition: SpellInfo.h:625
Definition: SpellAuraDefines.h:131
Definition: SharedDefines.h:2451
Definition: SpellAuraDefines.h:171
Definition: SharedDefines.h:609
uint32 const Id
Definition: SpellInfo.h:347
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:461
Definition: SharedDefines.h:2463
Definition: SharedDefines.h:2462
uint32 DamageSchoolMask
Definition: SpellInfo.h:227
Definition: SpellAuraDefines.h:241
Definition: SpellAuraDefines.h:99
Definition: SpellInfo.h:233
int32_t int32
Definition: Define.h:139
uint32_t uint32
Definition: Define.h:143
Definition: SpellAuraDefines.h:135
uint32 ApplyHarmfulAuraImmuneMask
Definition: SpellInfo.h:224
Definition: SharedDefines.h:2475
Definition: SpellAuraDefines.h:285
Definition: SharedDefines.h:2458
Definition: SpellAuraDefines.h:133
Definition: SharedDefines.h:1246
Definition: SpellAuraDefines.h:127
uint32 _allowedMechanicMask
Definition: SpellInfo.h:631
Definition: SpellAuraDefines.h:134
Definition: SpellAuraDefines.h:132
Definition: SharedDefines.h:610
Definition: SpellInfo.h:213
Definition: SpellAuraDefines.h:549
Definition: SpellAuraDefines.h:150
Definition: SpellAuraDefines.h:105
Definition: SharedDefines.h:2459
Definition: SharedDefines.h:2454
Definition: SpellAuraDefines.h:161
uint32 MechanicImmuneMask
Definition: SpellInfo.h:225
Definition: SharedDefines.h:1292
+ Here is the call graph for this function:

◆ _LoadSpellDiminishInfo()

void SpellInfo::_LoadSpellDiminishInfo ( )
private
2714 {
2715  auto diminishingGroupCompute = [this]() -> DiminishingGroup
2716  {
2717  if (IsPositive())
2718  return DIMINISHING_NONE;
2719 
2721  return DIMINISHING_TAUNT;
2722 
2723  switch (Id)
2724  {
2725  case 20549: // War Stomp (Racial - Tauren)
2726  case 24394: // Intimidation
2727  case 118345: // Pulverize (Primal Earth Elemental)
2728  case 118905: // Static Charge (Capacitor Totem)
2729  return DIMINISHING_STUN;
2730  case 107079: // Quaking Palm
2731  return DIMINISHING_INCAPACITATE;
2732  case 155145: // Arcane Torrent (Racial - Blood Elf)
2733  return DIMINISHING_SILENCE;
2734  case 108199: // Gorefiend's Grasp
2735  case 191244: // Sticky Bomb
2737  default:
2738  break;
2739  }
2740 
2741  // Explicit Diminishing Groups
2742  switch (SpellFamilyName)
2743  {
2744  case SPELLFAMILY_GENERIC:
2745  // Frost Tomb
2746  if (Id == 48400)
2747  return DIMINISHING_NONE;
2748  // Gnaw
2749  else if (Id == 47481)
2750  return DIMINISHING_STUN;
2751  // ToC Icehowl Arctic Breath
2752  else if (Id == 66689)
2753  return DIMINISHING_NONE;
2754  // Black Plague
2755  else if (Id == 64155)
2756  return DIMINISHING_NONE;
2757  // Screams of the Dead (King Ymiron)
2758  else if (Id == 51750)
2759  return DIMINISHING_NONE;
2760  // Crystallize (Keristrasza heroic)
2761  else if (Id == 48179)
2762  return DIMINISHING_NONE;
2763  break;
2764  case SPELLFAMILY_MAGE:
2765  {
2766  // Frost Nova -- 122
2767  if (SpellFamilyFlags[0] & 0x40)
2768  return DIMINISHING_ROOT;
2769  // Freeze (Water Elemental) -- 33395
2770  if (SpellFamilyFlags[2] & 0x200)
2771  return DIMINISHING_ROOT;
2772 
2773  // Dragon's Breath -- 31661
2774  if (SpellFamilyFlags[0] & 0x800000)
2775  return DIMINISHING_INCAPACITATE;
2776  // Polymorph -- 118
2777  if (SpellFamilyFlags[0] & 0x1000000)
2778  return DIMINISHING_INCAPACITATE;
2779  // Ring of Frost -- 82691
2780  if (SpellFamilyFlags[2] & 0x40)
2781  return DIMINISHING_INCAPACITATE;
2782  // Ice Nova -- 157997
2783  if (SpellFamilyFlags[2] & 0x800000)
2784  return DIMINISHING_INCAPACITATE;
2785  break;
2786  }
2787  case SPELLFAMILY_WARRIOR:
2788  {
2789  // Shockwave -- 132168
2790  if (SpellFamilyFlags[1] & 0x8000)
2791  return DIMINISHING_STUN;
2792  // Storm Bolt -- 132169
2793  if (SpellFamilyFlags[2] & 0x1000)
2794  return DIMINISHING_STUN;
2795 
2796  // Intimidating Shout -- 5246
2797  if (SpellFamilyFlags[0] & 0x40000)
2798  return DIMINISHING_DISORIENT;
2799  break;
2800  }
2801  case SPELLFAMILY_WARLOCK:
2802  {
2803  // Mortal Coil -- 6789
2804  if (SpellFamilyFlags[0] & 0x80000)
2805  return DIMINISHING_INCAPACITATE;
2806  // Banish -- 710
2807  if (SpellFamilyFlags[1] & 0x8000000)
2808  return DIMINISHING_INCAPACITATE;
2809 
2810  // Fear -- 118699
2811  if (SpellFamilyFlags[1] & 0x400)
2812  return DIMINISHING_DISORIENT;
2813  // Howl of Terror -- 5484
2814  if (SpellFamilyFlags[1] & 0x8)
2815  return DIMINISHING_DISORIENT;
2816 
2817  // Shadowfury -- 30283
2818  if (SpellFamilyFlags[1] & 0x1000)
2819  return DIMINISHING_STUN;
2820  // Summon Infernal -- 22703
2821  if (SpellFamilyFlags[0] & 0x1000)
2822  return DIMINISHING_STUN;
2823 
2824  // 170995 -- Cripple
2825  if (Id == 170995)
2826  return DIMINISHING_LIMITONLY;
2827  break;
2828  }
2830  {
2831  // Fellash -- 115770
2832  // Whiplash -- 6360
2833  if (SpellFamilyFlags[0] & 0x8000000)
2835 
2836  // Mesmerize (Shivarra pet) -- 115268
2837  // Seduction (Succubus pet) -- 6358
2838  if (SpellFamilyFlags[0] & 0x2000000)
2839  return DIMINISHING_DISORIENT;
2840 
2841  // Axe Toss (Felguard pet) -- 89766
2842  if (SpellFamilyFlags[1] & 0x4)
2843  return DIMINISHING_STUN;
2844  break;
2845  }
2846  case SPELLFAMILY_DRUID:
2847  {
2848  // Maim -- 22570
2849  if (SpellFamilyFlags[1] & 0x80)
2850  return DIMINISHING_STUN;
2851  // Mighty Bash -- 5211
2852  if (SpellFamilyFlags[0] & 0x2000)
2853  return DIMINISHING_STUN;
2854  // Rake -- 163505 -- no flags on the stun
2855  if (Id == 163505)
2856  return DIMINISHING_STUN;
2857 
2858  // Incapacitating Roar -- 99, no flags on the stun, 14
2859  if (SpellFamilyFlags[1] & 0x1)
2860  return DIMINISHING_INCAPACITATE;
2861 
2862  // Cyclone -- 33786
2863  if (SpellFamilyFlags[1] & 0x20)
2864  return DIMINISHING_DISORIENT;
2865 
2866  // Solar Beam -- 81261
2867  if (Id == 81261)
2868  return DIMINISHING_SILENCE;
2869 
2870  // Typhoon -- 61391
2871  if (SpellFamilyFlags[1] & 0x1000000)
2873  // Ursol's Vortex -- 118283, no family flags
2874  if (Id == 118283)
2876 
2877  // Entangling Roots -- 339
2878  if (SpellFamilyFlags[0] & 0x200)
2879  return DIMINISHING_ROOT;
2880  // Mass Entanglement -- 102359
2881  if (SpellFamilyFlags[2] & 0x4)
2882  return DIMINISHING_ROOT;
2883  break;
2884  }
2885  case SPELLFAMILY_ROGUE:
2886  {
2887  // Between the Eyes -- 199804
2888  if (SpellFamilyFlags[0] & 0x800000)
2889  return DIMINISHING_STUN;
2890  // Cheap Shot -- 1833
2891  if (SpellFamilyFlags[0] & 0x400)
2892  return DIMINISHING_STUN;
2893  // Kidney Shot -- 408
2894  if (SpellFamilyFlags[0] & 0x200000)
2895  return DIMINISHING_STUN;
2896 
2897  // Gouge -- 1776
2898  if (SpellFamilyFlags[0] & 0x8)
2899  return DIMINISHING_INCAPACITATE;
2900  // Sap -- 6770
2901  if (SpellFamilyFlags[0] & 0x80)
2902  return DIMINISHING_INCAPACITATE;
2903 
2904  // Blind -- 2094
2905  if (SpellFamilyFlags[0] & 0x1000000)
2906  return DIMINISHING_DISORIENT;
2907 
2908  // Garrote -- 1330
2909  if (SpellFamilyFlags[1] & 0x20000000)
2910  return DIMINISHING_SILENCE;
2911  break;
2912  }
2913  case SPELLFAMILY_HUNTER:
2914  {
2915  // Charge (Tenacity pet) -- 53148, no flags
2916  if (Id == 53148)
2917  return DIMINISHING_ROOT;
2918  // Ranger's Net -- 200108
2919  // Tracker's Net -- 212638
2920  if (Id == 200108 || Id == 212638)
2921  return DIMINISHING_ROOT;
2922 
2923  // Binding Shot -- 117526, no flags
2924  if (Id == 117526)
2925  return DIMINISHING_STUN;
2926 
2927  // Freezing Trap -- 3355
2928  if (SpellFamilyFlags[0] & 0x8)
2929  return DIMINISHING_INCAPACITATE;
2930  // Wyvern Sting -- 19386
2931  if (SpellFamilyFlags[1] & 0x1000)
2932  return DIMINISHING_INCAPACITATE;
2933 
2934  // Bursting Shot -- 224729
2935  if (SpellFamilyFlags[2] & 0x40)
2936  return DIMINISHING_DISORIENT;
2937  // Scatter Shot -- 213691
2938  if (SpellFamilyFlags[2] & 0x8000)
2939  return DIMINISHING_DISORIENT;
2940 
2941  // Spider Sting -- 202933
2942  if (Id == 202933)
2943  return DIMINISHING_SILENCE;
2944  break;
2945  }
2946  case SPELLFAMILY_PALADIN:
2947  {
2948  // Repentance -- 20066
2949  if (SpellFamilyFlags[0] & 0x4)
2950  return DIMINISHING_INCAPACITATE;
2951 
2952  // Blinding Light -- 105421
2953  if (Id == 105421)
2954  return DIMINISHING_DISORIENT;
2955 
2956  // Avenger's Shield -- 31935
2957  if (SpellFamilyFlags[0] & 0x4000)
2958  return DIMINISHING_SILENCE;
2959 
2960  // Hammer of Justice -- 853
2961  if (SpellFamilyFlags[0] & 0x800)
2962  return DIMINISHING_STUN;
2963  break;
2964  }
2965  case SPELLFAMILY_SHAMAN:
2966  {
2967  // Hex -- 51514
2968  // Hex -- 196942 (Voodoo Totem)
2969  if (SpellFamilyFlags[1] & 0x8000)
2970  return DIMINISHING_INCAPACITATE;
2971 
2972  // Thunderstorm -- 51490
2973  if (SpellFamilyFlags[1] & 0x2000)
2975 
2976  // Earthgrab Totem -- 64695
2977  if (SpellFamilyFlags[2] & 0x4000)
2978  return DIMINISHING_ROOT;
2979 
2980  // Lightning Lasso -- 204437
2981  if (SpellFamilyFlags[3] & 0x2000000)
2982  return DIMINISHING_STUN;
2983  break;
2984  }
2986  {
2987  // Chains of Ice -- 96294
2988  if (Id == 96294)
2989  return DIMINISHING_ROOT;
2990 
2991  // Blinding Sleet -- 207167
2992  if (Id == 207167)
2993  return DIMINISHING_DISORIENT;
2994 
2995  // Strangulate -- 47476
2996  if (SpellFamilyFlags[0] & 0x200)
2997  return DIMINISHING_SILENCE;
2998 
2999  // Asphyxiate -- 108194
3000  if (SpellFamilyFlags[2] & 0x100000)
3001  return DIMINISHING_STUN;
3002  // Gnaw (Ghoul) -- 91800, no flags
3003  if (Id == 91800)
3004  return DIMINISHING_STUN;
3005  // Monstrous Blow (Ghoul w/ Dark Transformation active) -- 91797
3006  if (Id == 91797)
3007  return DIMINISHING_STUN;
3008  // Winter is Coming -- 207171
3009  if (Id == 207171)
3010  return DIMINISHING_STUN;
3011  break;
3012  }
3013  case SPELLFAMILY_PRIEST:
3014  {
3015  // Holy Word: Chastise -- 200200
3016  if (SpellFamilyFlags[2] & 0x20 && GetSpellVisual() == 52021)
3017  return DIMINISHING_STUN;
3018  // Mind Bomb -- 226943
3019  if (Id == 226943)
3020  return DIMINISHING_STUN;
3021 
3022  // Mind Control -- 605
3023  if (SpellFamilyFlags[0] & 0x20000 && GetSpellVisual() == 39068)
3024  return DIMINISHING_INCAPACITATE;
3025  // Holy Word: Chastise -- 200196
3026  if (SpellFamilyFlags[2] & 0x20 && GetSpellVisual() == 52019)
3027  return DIMINISHING_INCAPACITATE;
3028 
3029  // Psychic Scream -- 8122
3030  if (SpellFamilyFlags[0] & 0x10000)
3031  return DIMINISHING_DISORIENT;
3032 
3033  // Silence -- 15487
3034  if (SpellFamilyFlags[1] & 0x200000 && GetSpellVisual() == 39025)
3035  return DIMINISHING_SILENCE;
3036 
3037  // Shining Force -- 204263
3038  if (Id == 204263)
3040  break;
3041  }
3042  case SPELLFAMILY_MONK:
3043  {
3044  // Disable -- 116706, no flags
3045  if (Id == 116706)
3046  return DIMINISHING_ROOT;
3047 
3048  // Fists of Fury -- 120086
3049  if (SpellFamilyFlags[1] & 0x800000 && !(SpellFamilyFlags[2] & 0x8))
3050  return DIMINISHING_STUN;
3051  // Leg Sweep -- 119381
3052  if (SpellFamilyFlags[1] & 0x200)
3053  return DIMINISHING_STUN;
3054 
3055  // Incendiary Breath (honor talent) -- 202274, no flags
3056  if (Id == 202274)
3057  return DIMINISHING_INCAPACITATE;
3058  // Paralysis -- 115078
3059  if (SpellFamilyFlags[2] & 0x800000)
3060  return DIMINISHING_INCAPACITATE;
3061 
3062  // Song of Chi-Ji -- 198909
3063  if (Id == 198909)
3064  return DIMINISHING_DISORIENT;
3065  break;
3066  }
3068  {
3069  switch (Id)
3070  {
3071  case 179057: // Chaos Nova
3072  case 211881: // Fel Eruption
3073  case 200166: // Metamorphosis
3074  case 205630: // Illidan's Grasp
3075  return DIMINISHING_STUN;
3076  case 217832: // Imprison
3077  case 221527: // Imprison
3078  return DIMINISHING_INCAPACITATE;
3079  default:
3080  break;
3081  }
3082  break;
3083  }
3084  default:
3085  break;
3086  }
3087 
3088  return DIMINISHING_NONE;
3089  };
3090 
3091  auto diminishingTypeCompute = [](DiminishingGroup group) -> DiminishingReturnsType
3092  {
3093  switch (group)
3094  {
3095  case DIMINISHING_TAUNT:
3096  case DIMINISHING_STUN:
3097  return DRTYPE_ALL;
3098  case DIMINISHING_LIMITONLY:
3099  case DIMINISHING_NONE:
3100  return DRTYPE_NONE;
3101  default:
3102  return DRTYPE_PLAYER;
3103  }
3104  };
3105 
3106  auto diminishingMaxLevelCompute = [](DiminishingGroup group) -> DiminishingLevels
3107  {
3108  switch (group)
3109  {
3110  case DIMINISHING_TAUNT:
3113  return DIMINISHING_LEVEL_2;
3114  default:
3115  return DIMINISHING_LEVEL_IMMUNE;
3116  }
3117  };
3118 
3119  auto diminishingLimitDurationCompute = [this]() -> int32
3120  {
3121  // Explicit diminishing duration
3122  switch (SpellFamilyName)
3123  {
3124  case SPELLFAMILY_MAGE:
3125  {
3126  // Dragon's Breath - 3 seconds in PvP
3127  if (SpellFamilyFlags[0] & 0x800000)
3128  return 3 * IN_MILLISECONDS;
3129  break;
3130  }
3131  case SPELLFAMILY_WARLOCK:
3132  {
3133  // Cripple - 4 seconds in PvP
3134  if (Id == 170995)
3135  return 4 * IN_MILLISECONDS;
3136  break;
3137  }
3138  case SPELLFAMILY_HUNTER:
3139  {
3140  // Binding Shot - 3 seconds in PvP
3141  if (Id == 117526)
3142  return 3 * IN_MILLISECONDS;
3143 
3144  // Wyvern Sting - 6 seconds in PvP
3145  if (SpellFamilyFlags[1] & 0x1000)
3146  return 6 * IN_MILLISECONDS;
3147  break;
3148  }
3149  case SPELLFAMILY_MONK:
3150  {
3151  // Paralysis - 4 seconds in PvP regardless of if they are facing you
3152  if (SpellFamilyFlags[2] & 0x800000)
3153  return 4 * IN_MILLISECONDS;
3154  break;
3155  }
3157  {
3158  switch (Id)
3159  {
3160  case 217832: // Imprison
3161  case 221527: // Imprison
3162  return 4 * IN_MILLISECONDS;
3163  default:
3164  break;
3165  }
3166  break;
3167  }
3168  default:
3169  break;
3170  }
3171 
3172  return 8 * IN_MILLISECONDS;
3173  };
3174 
3175  SpellDiminishInfo diminishInfo;
3176  diminishInfo.DiminishGroup = diminishingGroupCompute();
3177  diminishInfo.DiminishReturnType = diminishingTypeCompute(diminishInfo.DiminishGroup);
3178  diminishInfo.DiminishMaxLevel = diminishingMaxLevelCompute(diminishInfo.DiminishGroup);
3179  diminishInfo.DiminishDurationLimit = diminishingLimitDurationCompute();
3180 
3181  _diminishInfo = diminishInfo;
3182 }
Definition: SharedDefines.h:6248
Definition: SharedDefines.h:5833
DiminishingGroup DiminishGroup
Definition: SpellInfo.h:330
Definition: SharedDefines.h:5832
bool HasAura(AuraType aura) const
Definition: SpellInfo.cpp:1327
Definition: SharedDefines.h:6241
Definition: SharedDefines.h:6246
Definition: SharedDefines.h:6538
Definition: SharedDefines.h:5841
Definition: SharedDefines.h:5842
Definition: SharedDefines.h:6264
Definition: SharedDefines.h:5848
Definition: SharedDefines.h:5843
flag128 SpellFamilyFlags
Definition: SpellInfo.h:426
Definition: SharedDefines.h:6253
Definition: SharedDefines.h:6257
Definition: SharedDefines.h:5844
Definition: SpellInfo.h:328
uint32 GetSpellVisual(WorldObject const *caster=nullptr, WorldObject const *viewer=nullptr) const
Definition: SpellInfo.cpp:4334
Definition: SharedDefines.h:6244
Definition: SharedDefines.h:5834
uint32 const Id
Definition: SpellInfo.h:347
uint32 SpellFamilyName
Definition: SpellInfo.h:425
Definition: SharedDefines.h:6238
Definition: SharedDefines.h:6542
SpellDiminishInfo _diminishInfo
Definition: SpellInfo.h:630
Definition: Common.h:68
int32_t int32
Definition: Define.h:139
DiminishingReturnsType
Definition: SharedDefines.h:5830
DiminishingReturnsType DiminishReturnType
Definition: SpellInfo.h:331
Definition: SharedDefines.h:5845
DiminishingLevels
Definition: SharedDefines.h:6535
bool IsPositive() const
Definition: SpellInfo.cpp:1635
Definition: SharedDefines.h:5846
DiminishingGroup
Definition: SharedDefines.h:5838
Definition: SharedDefines.h:6242
Definition: SharedDefines.h:6245
DiminishingLevels DiminishMaxLevel
Definition: SpellInfo.h:332
Definition: SpellAuraDefines.h:105
Definition: SharedDefines.h:6243
Definition: SharedDefines.h:6540
Definition: SharedDefines.h:6258
Definition: SharedDefines.h:6249
Definition: SharedDefines.h:5847
Definition: SharedDefines.h:6247
Definition: SharedDefines.h:5840
int32 DiminishDurationLimit
Definition: SpellInfo.h:333
+ Here is the call graph for this function:

◆ _LoadSpellSpecific()

void SpellInfo::_LoadSpellSpecific ( )
private

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

2526 {
2527  _spellSpecific = [this]()->SpellSpecificType
2528  {
2529  switch (SpellFamilyName)
2530  {
2531  case SPELLFAMILY_GENERIC:
2532  {
2533  // Food / Drinks (mostly)
2535  {
2536  bool food = false;
2537  bool drink = false;
2538  for (SpellEffectInfo const& effect : GetEffects())
2539  {
2540  if (!effect.IsAura())
2541  continue;
2542  switch (effect.ApplyAuraName)
2543  {
2544  // Food
2545  case SPELL_AURA_MOD_REGEN:
2547  food = true;
2548  break;
2549  // Drink
2552  drink = true;
2553  break;
2554  default:
2555  break;
2556  }
2557  }
2558 
2559  if (food && drink)
2561  else if (food)
2562  return SPELL_SPECIFIC_FOOD;
2563  else if (drink)
2564  return SPELL_SPECIFIC_DRINK;
2565  }
2566  // scrolls effects
2567  else
2568  {
2569  SpellInfo const* firstRankSpellInfo = GetFirstRankSpell();
2570  switch (firstRankSpellInfo->Id)
2571  {
2572  case 8118: // Strength
2573  case 8099: // Stamina
2574  case 8112: // Spirit
2575  case 8096: // Intellect
2576  case 8115: // Agility
2577  case 8091: // Armor
2578  return SPELL_SPECIFIC_SCROLL;
2579  default:
2580  break;
2581  }
2582  }
2583  break;
2584  }
2585  case SPELLFAMILY_MAGE:
2586  {
2587  // family flags 18(Molten), 25(Frost/Ice), 28(Mage)
2588  if (SpellFamilyFlags[0] & 0x12040000)
2590 
2591  // Arcane brillance and Arcane intelect (normal check fails because of flags difference)
2592  if (SpellFamilyFlags[0] & 0x400)
2594 
2595  if ((SpellFamilyFlags[0] & 0x1000000) && GetEffect(EFFECT_0).IsAura(SPELL_AURA_MOD_CONFUSE))
2597 
2598  break;
2599  }
2600  case SPELLFAMILY_WARRIOR:
2601  {
2602  if (Id == 12292) // Death Wish
2604 
2605  break;
2606  }
2607  case SPELLFAMILY_WARLOCK:
2608  {
2609  // Warlock (Bane of Doom | Bane of Agony | Bane of Havoc)
2610  if (Id == 603 || Id == 980 || Id == 80240)
2611  return SPELL_SPECIFIC_BANE;
2612 
2613  // only warlock curses have this
2614  if (Dispel == DISPEL_CURSE)
2615  return SPELL_SPECIFIC_CURSE;
2616 
2617  // Warlock (Demon Armor | Demon Skin | Fel Armor)
2618  if (SpellFamilyFlags[1] & 0x20000020 || SpellFamilyFlags[2] & 0x00000010)
2620 
2621  //seed of corruption and corruption
2622  if (SpellFamilyFlags[1] & 0x10 || SpellFamilyFlags[0] & 0x2)
2624  break;
2625  }
2626  case SPELLFAMILY_PRIEST:
2627  {
2628  // Divine Spirit and Prayer of Spirit
2629  if (SpellFamilyFlags[0] & 0x20)
2631 
2632  break;
2633  }
2634  case SPELLFAMILY_HUNTER:
2635  {
2636  // only hunter stings have this
2637  if (Dispel == DISPEL_POISON)
2638  return SPELL_SPECIFIC_STING;
2639 
2640  // only hunter aspects have this (but not all aspects in hunter family)
2641  if (SpellFamilyFlags & flag128(0x00200000, 0x00000000, 0x00001010, 0x00000000))
2642  return SPELL_SPECIFIC_ASPECT;
2643 
2644  break;
2645  }
2646  case SPELLFAMILY_PALADIN:
2647  {
2648  // Collection of all the seal family flags. No other paladin spell has any of those.
2649  if (SpellFamilyFlags[1] & 0xA2000800)
2650  return SPELL_SPECIFIC_SEAL;
2651 
2652  if (SpellFamilyFlags[0] & 0x00002190)
2653  return SPELL_SPECIFIC_HAND;
2654 
2655  // only paladin auras have this (for palaldin class family)
2656  switch (Id)
2657  {
2658  case 465: // Devotion Aura
2659  case 32223: // Crusader Aura
2660  case 183435: // Retribution Aura
2661  case 317920: // Concentration Aura
2662  return SPELL_SPECIFIC_AURA;
2663  default:
2664  break;
2665  }
2666 
2667  break;
2668  }
2669  case SPELLFAMILY_SHAMAN:
2670  {
2671  // family flags 10 (Lightning), 42 (Earth), 37 (Water), proc shield from T2 8 pieces bonus
2672  if (SpellFamilyFlags[1] & 0x420
2673  || SpellFamilyFlags[0] & 0x00000400
2674  || Id == 23552)
2676 
2677  break;
2678  }
2680  if (Id == 48266 || Id == 48263 || Id == 48265)
2681  return SPELL_SPECIFIC_PRESENCE;
2682  break;
2683  }
2684 
2685  for (SpellEffectInfo const& effect : GetEffects())
2686  {
2687  if (effect.IsEffect(SPELL_EFFECT_APPLY_AURA))
2688  {
2689  switch (effect.ApplyAuraName)
2690  {
2691  case SPELL_AURA_MOD_CHARM:
2694  case SPELL_AURA_AOE_CHARM:
2695  return SPELL_SPECIFIC_CHARM;
2698  if (Id == 30645) // Gas Cloud Tracking
2699  return SPELL_SPECIFIC_NORMAL;
2700  [[fallthrough]];
2703  return SPELL_SPECIFIC_TRACKER;
2704  default:
2705  break;
2706  }
2707  }
2708  }
2709  return SPELL_SPECIFIC_NORMAL;
2710  }();
2711 }
Definition: SharedDefines.h:6248
Definition: SpellInfo.h:130
Definition: SpellInfo.h:142
Definition: SpellInfo.h:124
Definition: SpellAuraDefines.h:139
Definition: SpellAuraDefines.h:179
SpellSpecificType _spellSpecific
Definition: SpellInfo.h:627
Definition: SpellInfo.h:127
Definition: SpellAuraDefines.h:114
SpellInfo const * GetFirstRankSpell() const
Definition: SpellInfo.cpp:4225
Definition: SpellInfo.h:138
Definition: SharedDefines.h:6241
Definition: SpellInfo.h:342
Definition: SpellInfo.h:136
flag128 SpellFamilyFlags
Definition: SpellInfo.h:426
uint32 Dispel
Definition: SpellInfo.h:350
bool HasAuraInterruptFlag(SpellAuraInterruptFlags flag) const
Definition: SpellInfo.h:481
Definition: SpellAuraDefines.h:96
Definition: SpellInfo.h:144
Definition: SharedDefines.h:6253
Definition: SharedDefines.h:1154
Definition: SpellInfo.h:129
Definition: SpellInfo.h:141
Definition: SharedDefines.h:6244
Definition: SpellInfo.h:123
Definition: SharedDefines.h:2499
uint32 const Id
Definition: SpellInfo.h:347
Definition: SpellInfo.h:132
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition: SpellInfo.h:590
uint32 SpellFamilyName
Definition: SpellInfo.h:425
Definition: SpellInfo.h:128
Definition: SharedDefines.h:6238
Definition: SpellInfo.h:122
Definition: FlagsArray.h:116
Definition: SpellAuraDefines.h:99
Definition: SpellInfo.h:233
Definition: SpellInfo.h:125
Definition: SpellInfo.h:139
Definition: SpellInfo.h:131
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:589
Definition: SpellAuraDefines.h:472
SpellSpecificType
Definition: SpellInfo.h:119
Definition: SpellAuraDefines.h:271
Definition: SpellInfo.h:126
Definition: SharedDefines.h:6242
Definition: SpellAuraDefines.h:138
Definition: SharedDefines.h:29
Definition: SpellInfo.h:133
Definition: SharedDefines.h:6243
Definition: SpellAuraDefines.h:245
Definition: SharedDefines.h:6249
Definition: SpellAuraDefines.h:100
Definition: SpellAuraDefines.h:178
Definition: SharedDefines.h:6247
Definition: SpellAuraDefines.h:115
Definition: SharedDefines.h:2501
Definition: SpellInfo.h:137
Definition: SpellInfo.h:135
Definition: SpellInfo.h:140
Definition: SpellInfo.h:121
Definition: SpellInfo.h:134
+ Here is the call graph for this function:

◆ _UnloadImplicitTargetConditionLists()

void SpellInfo::_UnloadImplicitTargetConditionLists ( )
private
4873 {
4874  // find the same instances of ConditionList and delete them.
4875  for (SpellEffectInfo const& effect : _effects)
4876  {
4877  ConditionContainer* cur = effect.ImplicitTargetConditions;
4878  if (!cur)
4879  continue;
4880 
4881  for (size_t j = effect.EffectIndex; j < _effects.size(); ++j)
4882  if (_effects[j].ImplicitTargetConditions == cur)
4883  _effects[j].ImplicitTargetConditions = nullptr;
4884 
4885  delete cur;
4886  }
4887 }
std::vector< SpellEffectInfo > _effects
Definition: SpellInfo.h:625
Definition: SpellInfo.h:233
std::vector< Condition * > ConditionContainer
Definition: ConditionMgr.h:265
+ Here is the caller graph for this function:

◆ ApplyAllSpellImmunitiesTo()

void SpellInfo::ApplyAllSpellImmunitiesTo ( Unit target,
SpellEffectInfo const &  spellEffectInfo,
bool  apply 
) const
3504 {
3505  ImmunityInfo const& immuneInfo = spellEffectInfo.GetImmunityInfo();
3506 
3507  if (uint32 schoolImmunity = immuneInfo.SchoolImmuneMask)
3508  {
3509  target->ApplySpellImmune(Id, IMMUNITY_SCHOOL, schoolImmunity, apply);
3510 
3512  {
3513  target->RemoveAppliedAuras([this, schoolImmunity](AuraApplication const* aurApp) -> bool
3514  {
3515  SpellInfo const* auraSpellInfo = aurApp->GetBase()->GetSpellInfo();
3516  return ((auraSpellInfo->GetSchoolMask() & schoolImmunity) != 0 && // Check for school mask
3517  CanDispelAura(auraSpellInfo) &&
3518  (IsPositive() != aurApp->IsPositive()) && // Check spell vs aura possitivity
3519  !auraSpellInfo->IsPassive() && // Don't remove passive auras
3520  auraSpellInfo->Id != Id); // Don't remove self
3521  });
3522  }
3523 
3524  if (apply && schoolImmunity & SPELL_SCHOOL_MASK_NORMAL)
3526  }
3527 
3528  if (uint32 mechanicImmunity = immuneInfo.MechanicImmuneMask)
3529  {
3530  for (uint32 i = 0; i < MAX_MECHANIC; ++i)
3531  if (mechanicImmunity & (1 << i))
3533 
3535  {
3536  // exception for purely snare mechanic (eg. hands of freedom)!
3537  if (mechanicImmunity == (1 << MECHANIC_SNARE))
3538  target->RemoveMovementImpairingAuras(false);
3539  else
3540  target->RemoveAurasWithMechanic(mechanicImmunity, AURA_REMOVE_BY_DEFAULT, Id);
3541  }
3542  }
3543 
3544  if (uint32 dispelImmunity = immuneInfo.DispelImmune)
3545  {
3546  target->ApplySpellImmune(Id, IMMUNITY_DISPEL, dispelImmunity, apply);
3547 
3549  {
3550  target->RemoveAppliedAuras([dispelImmunity](AuraApplication const* aurApp) -> bool
3551  {
3552  SpellInfo const* spellInfo = aurApp->GetBase()->GetSpellInfo();
3553  if (spellInfo->Dispel == dispelImmunity)
3554  return true;
3555 
3556  return false;
3557  });
3558  }
3559  }
3560 
3561  if (uint32 damageImmunity = immuneInfo.DamageSchoolMask)
3562  {
3563  target->ApplySpellImmune(Id, IMMUNITY_DAMAGE, damageImmunity, apply);
3564 
3565  if (apply && damageImmunity & SPELL_SCHOOL_MASK_NORMAL)
3567  }
3568 
3569  for (AuraType auraType : immuneInfo.AuraTypeImmune)
3570  {
3571  target->ApplySpellImmune(Id, IMMUNITY_STATE, auraType, apply);
3573  target->RemoveAurasByType(auraType);
3574  }
3575 
3576  for (SpellEffectName effectType : immuneInfo.SpellEffectImmune)
3577  target->ApplySpellImmune(Id, IMMUNITY_EFFECT, effectType, apply);
3578 }
boost::container::flat_set< AuraType > AuraTypeImmune
Definition: SpellInfo.h:229
Definition: SharedDefines.h:2522
bool IsPositive() const
Definition: SpellAuras.h:82
uint32 SchoolImmuneMask
Definition: SpellInfo.h:223
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:137
boost::container::flat_set< SpellEffectName > SpellEffectImmune
Definition: SpellInfo.h:230
Definition: SpellInfo.h:342
void RemoveAppliedAuras(std::function< bool(AuraApplication const *)> const &check)
Definition: Unit.cpp:3615
uint32 DispelImmune
Definition: SpellInfo.h:226
Definition: SpellAuras.h:54
uint32 Dispel
Definition: SpellInfo.h:350
Definition: SharedDefines.h:2520
bool CanDispelAura(SpellInfo const *auraSpellInfo) const
Definition: SpellInfo.cpp:1799
SpellEffectName
Definition: SharedDefines.h:1146
AuraType
Definition: SpellAuraDefines.h:92
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition: Unit.cpp:7570
bool IsPassive() const
Definition: SpellInfo.cpp:1519
Definition: SharedDefines.h:459
Definition: SharedDefines.h:2460
void apply(T *val)
Definition: ByteConverter.h:40
uint32 const Id
Definition: SpellInfo.h:347
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:461
uint32 DamageSchoolMask
Definition: SpellInfo.h:227
uint32_t uint32
Definition: Define.h:143
void RemoveAurasWithInterruptFlags(InterruptFlags flag, SpellInfo const *source=nullptr)
Definition: Unit.cpp:3956
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:2362
bool IsPositive() const
Definition: SpellInfo.cpp:1635
void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
Definition: Unit.cpp:4033
Definition: SpellInfo.h:213
Definition: SharedDefines.h:2523
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check)
Definition: Unit.cpp:3667
Definition: SpellAuraDefines.h:65
Definition: SharedDefines.h:2519
uint32 MechanicImmuneMask
Definition: SpellInfo.h:225
void RemoveMovementImpairingAuras(bool withRoot)
Definition: Unit.cpp:4009
Definition: SharedDefines.h:2521
Definition: SharedDefines.h:2524
Definition: SharedDefines.h:2482
Aura * GetBase() const
Definition: SpellAuras.h:76
Definition: SharedDefines.h:313
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalcCastTime()

uint32 SpellInfo::CalcCastTime ( Spell spell = nullptr) const
3775 {
3776  int32 castTime = 0;
3777  if (CastTimeEntry)
3778  castTime = std::max(CastTimeEntry->Base, CastTimeEntry->Minimum);
3779 
3780  if (castTime <= 0)
3781  return 0;
3782 
3783  if (spell)
3784  spell->GetCaster()->ModSpellCastTime(this, castTime, spell);
3785 
3787  castTime += 500;
3788 
3789  return (castTime > 0) ? uint32(castTime) : 0;
3790 }
void ModSpellCastTime(SpellInfo const *spellInfo, int32 &castTime, Spell *spell=nullptr) const
Definition: Object.cpp:2323
SpellCastTimesEntry const * CastTimeEntry
Definition: SpellInfo.h:383
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:461
bool IsAutoRepeatRangedSpell() const
Definition: SpellInfo.cpp:1672
int32_t int32
Definition: Define.h:139
uint32_t uint32
Definition: Define.h:143
int32 Minimum
Definition: DB2Structure.h:3212
int32 Base
Definition: DB2Structure.h:3211
Definition: SharedDefines.h:748
WorldObject * GetCaster() const
Definition: Spell.h:611
Definition: SharedDefines.h:408
+ 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
3750 {
3751  int32 duration = GetDuration();
3752 
3753  if (caster)
3754  if (Player* modOwner = caster->GetSpellModOwner())
3755  modOwner->ApplySpellMod(this, SpellModOp::Duration, duration);
3756 
3757  return duration;
3758 }
int32_t int32
Definition: Define.h:139
int32 GetDuration() const
Definition: SpellInfo.cpp:3760
Player * GetSpellModOwner() const
Definition: Object.cpp:2148
Definition: Player.h:1131
+ 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
3840 {
3841  // gameobject casts don't use power
3842  Unit const* unitCaster = caster->ToUnit();
3843  if (!unitCaster)
3844  return {};
3845 
3846  auto itr = std::find_if(PowerCosts.cbegin(), PowerCosts.cend(), [powerType](SpellPowerEntry const* spellPowerEntry)
3847  {
3848  return spellPowerEntry && spellPowerEntry->PowerType == powerType;
3849  });
3850  if (itr == PowerCosts.cend())
3851  return {};
3852 
3853  return CalcPowerCost(*itr, optionalCost, caster, schoolMask, spell);
3854 }
Definition: DB2Structure.h:3434
std::array< SpellPowerEntry const *, MAX_POWERS_PER_SPELL > PowerCosts
Definition: SpellInfo.h:403
static Unit * ToUnit(Object *o)
Definition: Object.h:210
Definition: Unit.h:746
Optional< SpellPowerCost > CalcPowerCost(Powers powerType, bool optionalCost, WorldObject const *caster, SpellSchoolMask schoolMask, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:3839
+ 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
3857 {
3858  // gameobject casts don't use power
3859  Unit const* unitCaster = caster->ToUnit();
3860  if (!unitCaster)
3861  return {};
3862 
3863  if (power->RequiredAuraSpellID && !unitCaster->HasAura(power->RequiredAuraSpellID))
3864  return {};
3865 
3866  // Spell drain all exist power on cast (Only paladin lay of Hands)
3868  {
3869  // If power type - health drain all
3870  if (power->PowerType == POWER_HEALTH)
3871  {
3872  SpellPowerCost cost;
3873  cost.Power = POWER_HEALTH;
3874  cost.Amount = unitCaster->GetHealth();
3875  return cost;
3876  }
3877  // Else drain all power
3878  if (power->PowerType < MAX_POWERS)
3879  {
3880  SpellPowerCost cost;
3881  cost.Power = Powers(power->PowerType);
3882  cost.Amount = unitCaster->GetPower(cost.Power);
3883  return cost;
3884  }
3885 
3886  TC_LOG_ERROR("spells", "SpellInfo::CalcPowerCost: Unknown power type '%d' in spell %d", power->PowerType, Id);
3887  return {};
3888  }
3889 
3890  // Base powerCost
3891  int32 powerCost = 0;
3892  if (!optionalCost)
3893  {
3894  powerCost = power->ManaCost;
3895  // PCT cost from total amount
3896  if (power->PowerCostPct)
3897  {
3898  switch (power->PowerType)
3899  {
3900  // health as power used
3901  case POWER_HEALTH:
3902  if (G3D::fuzzyEq(power->PowerCostPct, 0.0f))
3903  powerCost += int32(CalculatePct(unitCaster->GetMaxHealth(), power->PowerCostMaxPct));
3904  else
3905  powerCost += int32(CalculatePct(unitCaster->GetMaxHealth(), power->PowerCostPct));
3906  break;
3907  case POWER_MANA:
3908  powerCost += int32(CalculatePct(unitCaster->GetCreateMana(), power->PowerCostPct));
3909  break;
3910  case POWER_ALTERNATE_POWER:
3911  TC_LOG_ERROR("spells", "SpellInfo::CalcPowerCost: Unknown power type '%d' in spell %d", power->PowerType, Id);
3912  return {};
3913  default:
3914  {
3915  if (PowerTypeEntry const* powerTypeEntry = sDB2Manager.GetPowerTypeEntry(Powers(power->PowerType)))
3916  {
3917  powerCost += int32(CalculatePct(powerTypeEntry->MaxBasePower, power->PowerCostPct));
3918  break;
3919  }
3920 
3921  TC_LOG_ERROR("spells", "SpellInfo::CalcPowerCost: Unknown power type '%d' in spell %d", power->PowerType, Id);
3922  return {};
3923  }
3924  }
3925  }
3926  }
3927  else
3928  {
3929  powerCost = int32(power->OptionalCost);
3930  powerCost += unitCaster->GetTotalAuraModifier(SPELL_AURA_MOD_ADDITIONAL_POWER_COST, [this, power](AuraEffect const* aurEff) -> bool
3931  {
3932  return aurEff->GetMiscValue() == power->PowerType
3933  && aurEff->IsAffectingSpell(this);
3934  });
3935  }
3936 
3937  bool initiallyNegative = powerCost < 0;
3938 
3939  // Shiv - costs 20 + weaponSpeed*10 energy (apply only to non-triggered spell with energy cost)
3941  {
3942  uint32 speed = 0;
3943  if (SpellShapeshiftFormEntry const* ss = sSpellShapeshiftFormStore.LookupEntry(unitCaster->GetShapeshiftForm()))
3944  speed = ss->CombatRoundTime;
3945  else
3946  {
3949  slot = OFF_ATTACK;
3950 
3951  speed = unitCaster->GetBaseAttackTime(slot);
3952  }
3953 
3954  powerCost += speed / 100;
3955  }
3956 
3957  if (power->PowerType != POWER_HEALTH)
3958  {
3959  if (!optionalCost)
3960  {
3961  // Flat mod from caster auras by spell school and power type
3962  for (AuraEffect const* aura : unitCaster->GetAuraEffectsByType(SPELL_AURA_MOD_POWER_COST_SCHOOL))
3963  {
3964  if (!(aura->GetMiscValue() & schoolMask))
3965  continue;
3966 
3967  if (!(aura->GetMiscValueB() & (1 << power->PowerType)))
3968  continue;
3969 
3970  powerCost += aura->GetAmount();
3971  }
3972  }
3973 
3974  // PCT mod from user auras by spell school and power type
3975  for (auto schoolCostPct : unitCaster->GetAuraEffectsByType(SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT))
3976  {
3977  if (!(schoolCostPct->GetMiscValue() & schoolMask))
3978  continue;
3979 
3980  if (!(schoolCostPct->GetMiscValueB() & (1 << power->PowerType)))
3981  continue;
3982 
3983  powerCost += CalculatePct(powerCost, schoolCostPct->GetAmount());
3984  }
3985  }
3986 
3987  // Apply cost mod by spell
3988  if (Player* modOwner = unitCaster->GetSpellModOwner())
3989  {
3991  switch (power->OrderIndex)
3992  {
3993  case 0:
3994  mod = SpellModOp::PowerCost0;
3995  break;
3996  case 1:
3997  mod = SpellModOp::PowerCost1;
3998  break;
3999  case 2:
4000  mod = SpellModOp::PowerCost2;
4001  break;
4002  default:
4003  break;
4004  }
4005 
4006  if (mod)
4007  {
4008  if (!optionalCost)
4009  modOwner->ApplySpellMod(this, *mod, powerCost, spell);
4010  else
4011  {
4012  // optional cost ignores flat modifiers
4013  int32 flatMod = 0;
4014  float pctMod = 1.0f;
4015  modOwner->GetSpellModValues(this, *mod, spell, powerCost, &flatMod, &pctMod);
4016  powerCost = int32(powerCost * pctMod);
4017  }
4018  }
4019  }
4020 
4021  if (!unitCaster->IsControlledByPlayer() && G3D::fuzzyEq(power->PowerCostPct, 0.0f) && SpellLevel && power->PowerType == POWER_MANA)
4022  {
4024  {
4026  GtNpcManaCostScalerEntry const* casterScaler = sNpcManaCostScalerGameTable.GetRow(unitCaster->GetLevel());
4027  if (spellScaler && casterScaler)
4028  powerCost *= casterScaler->Scaler / spellScaler->Scaler;
4029  }
4030  }
4031 
4032  if (power->PowerType == POWER_MANA)
4033  powerCost = float(powerCost) * (1.0f + unitCaster->m_unitData->ManaCostMultiplier);
4034 
4035  // power cost cannot become negative if initially positive
4036  if (initiallyNegative != (powerCost < 0))
4037  powerCost = 0;
4038 
4039  SpellPowerCost cost;
4040  cost.Power = Powers(power->PowerType);
4041  cost.Amount = powerCost;
4042  return cost;
4043 }
Definition: SpellAuraDefines.h:157
Definition: SpellAuraEffects.h:28
Powers
Definition: SharedDefines.h:269
#define sDB2Manager
Definition: DB2Stores.h:479
Definition: SharedDefines.h:542
Definition: SpellAuraDefines.h:167
bool IsAffectingSpell(SpellInfo const *spell) const
Definition: SpellAuraEffects.cpp:1045
uint32 SpellLevel
Definition: SpellInfo.h:401
DB2Storage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore("SpellShapeshiftForm.db2", SpellShapeshiftFormLoadInfo::Instance())
Definition: SharedDefines.h:282
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4520
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:185
Definition: DB2Structure.h:2832
Definition: SharedDefines.h:291
uint32 GetBaseAttackTime(WeaponAttackType att) const
Definition: Unit.cpp:10258
int32 Amount
Definition: SpellInfo.h:339
Definition: SharedDefines.h:565
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:56
Definition: SpellInfo.h:336
ShapeshiftForm GetShapeshiftForm() const
Definition: Unit.h:1544
uint32 const Id
Definition: SpellInfo.h:347
uint64 GetHealth() const
Definition: Unit.h:893
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:461
float Scaler
Definition: GameTables.h:121
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1406
Powers Power
Definition: SpellInfo.h:338
Definition: SharedDefines.h:528
uint8 GetLevel() const
Definition: Unit.h:863
int32 GetTotalAuraModifier(AuraType auraType) const
Definition: Unit.cpp:4785
UF::UpdateField< UF::UnitData, 0, TYPEID_UNIT > m_unitData
Definition: Unit.h:1886
int32_t int32
Definition: Define.h:139
uint32_t uint32
Definition: Define.h:143
Definition: GameTables.h:119
uint32 GetCreateMana() const
Definition: Unit.h:1481
Definition: DB2Structure.h:3533
Definition: SharedDefines.h:445
T CalculatePct(T base, U pct)
Definition: Util.h:67
Definition: SharedDefines.h:6547
int32 GetPower(Powers power) const
Definition: Unit.cpp:9080
Player * GetSpellModOwner() const
Definition: Object.cpp:2148
Definition: SharedDefines.h:426
WeaponAttackType
Definition: SharedDefines.h:6545
static Unit * ToUnit(Object *o)
Definition: Object.h:210
Definition: SharedDefines.h:272
uint64 GetMaxHealth() const
Definition: Unit.h:894
Definition: SharedDefines.h:271
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
Definition: Unit.h:746
Definition: SpellAuraDefines.h:166
Definition: Player.h:1131
GameTable< GtNpcManaCostScalerEntry > sNpcManaCostScalerGameTable
Definition: GameTables.cpp:36
bool IsControlledByPlayer() const
Definition: Unit.h:1278
Definition: SharedDefines.h:6548
+ 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
4046 {
4047  std::vector<SpellPowerCost> costs;
4048  if (caster->IsUnit())
4049  {
4050  costs.reserve(MAX_POWERS_PER_SPELL);
4051 
4052  auto getOrCreatePowerCost = [&](Powers powerType) -> SpellPowerCost&
4053  {
4054  auto itr = std::find_if(costs.begin(), costs.end(), [powerType](SpellPowerCost const& cost)
4055  {
4056  return cost.Power == powerType;
4057  });
4058  if (itr != costs.end())
4059  return *itr;
4060 
4061  SpellPowerCost cost;
4062  cost.Power = powerType;
4063  cost.Amount = 0;
4064  costs.push_back(cost);
4065  return costs.back();
4066  };
4067 
4068  for (SpellPowerEntry const* power : PowerCosts)
4069  {
4070  if (!power)
4071  continue;
4072 
4073  if (Optional<SpellPowerCost> cost = CalcPowerCost(power, false, caster, schoolMask, spell))
4074  getOrCreatePowerCost(cost->Power).Amount += cost->Amount;
4075 
4076  if (Optional<SpellPowerCost> optionalCost = CalcPowerCost(power, true, caster, schoolMask, spell))
4077  {
4078  SpellPowerCost& cost = getOrCreatePowerCost(optionalCost->Power);
4079  int32 remainingPower = caster->ToUnit()->GetPower(optionalCost->Power) - cost.Amount;
4080  if (remainingPower > 0)
4081  cost.Amount += std::min(optionalCost->Amount, remainingPower);
4082  }
4083  }
4084  }
4085 
4086  return costs;
4087 }
Powers
Definition: SharedDefines.h:269
constexpr std::size_t MAX_POWERS_PER_SPELL
Definition: DBCEnums.h:1544
int32 Amount
Definition: SpellInfo.h:339
Definition: DB2Structure.h:3434
Definition: SpellInfo.h:336
Powers Power
Definition: SpellInfo.h:338
int32_t int32
Definition: Define.h:139
std::array< SpellPowerEntry const *, MAX_POWERS_PER_SPELL > PowerCosts
Definition: SpellInfo.h:403
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
Optional< SpellPowerCost > CalcPowerCost(Powers powerType, bool optionalCost, WorldObject const *caster, SpellSchoolMask schoolMask, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:3839
+ Here is the call graph for this function:

◆ CalcProcPPM()

float SpellInfo::CalcProcPPM ( Unit caster,
int32  itemLevel 
) const
4156 {
4157  float ppm = ProcBasePPM;
4158  if (!caster)
4159  return ppm;
4160 
4161  for (SpellProcsPerMinuteModEntry const* mod : ProcPPMMods)
4162  {
4163  switch (mod->Type)
4164  {
4165  case SPELL_PPM_MOD_HASTE:
4166  {
4167  ppm *= 1.0f + CalcPPMHasteMod(mod, caster);
4168  break;
4169  }
4170  case SPELL_PPM_MOD_CRIT:
4171  {
4172  ppm *= 1.0f + CalcPPMCritMod(mod, caster);
4173  break;
4174  }
4175  case SPELL_PPM_MOD_CLASS:
4176  {
4177  if (caster->GetClassMask() & mod->Param)
4178  ppm *= 1.0f + mod->Coeff;
4179  break;
4180  }
4181  case SPELL_PPM_MOD_SPEC:
4182  {
4183  if (Player* plrCaster = caster->ToPlayer())
4184  if (plrCaster->GetPrimarySpecialization() == uint32(mod->Param))
4185  ppm *= 1.0f + mod->Coeff;
4186  break;
4187  }
4188  case SPELL_PPM_MOD_RACE:
4189  {
4190  if (caster->GetRaceMask() & mod->Param)
4191  ppm *= 1.0f + mod->Coeff;
4192  break;
4193  }
4195  {
4196  ppm *= 1.0f + CalcPPMItemLevelMod(mod, itemLevel);
4197  break;
4198  }
4200  {
4201  if (caster->GetMap()->IsBattlegroundOrArena())
4202  ppm *= 1.0f + mod->Coeff;
4203  break;
4204  }
4205  default:
4206  break;
4207  }
4208  }
4209 
4210  return ppm;
4211 }
static Player * ToPlayer(Object *o)
Definition: Object.h:198
Definition: DBCEnums.h:1540
Definition: DBCEnums.h:1535
uint32 GetClassMask() const
Definition: Unit.h:871
float CalcPPMHasteMod(SpellProcsPerMinuteModEntry const *mod, Unit *caster)
Definition: SpellInfo.cpp:4089
Definition: DBCEnums.h:1539
bool IsBattlegroundOrArena() const
Definition: Map.cpp:4462
Definition: DBCEnums.h:1538
Map * GetMap() const
Definition: Object.h:555
Definition: DBCEnums.h:1536
Definition: DB2Structure.h:3467
Definition: DBCEnums.h:1541
std::vector< SpellProcsPerMinuteModEntry const * > ProcPPMMods
Definition: SpellInfo.h:398
float CalcPPMCritMod(SpellProcsPerMinuteModEntry const *mod, Unit *caster)
Definition: SpellInfo.cpp:4115
float ProcBasePPM
Definition: SpellInfo.h:397
uint32_t uint32
Definition: Define.h:143
Definition: DBCEnums.h:1537
uint64 GetRaceMask() const
Definition: Unit.h:868
float CalcPPMItemLevelMod(SpellProcsPerMinuteModEntry const *mod, int32 itemLevel)
Definition: SpellInfo.cpp:4142
Definition: Player.h:1131
+ 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
1381 {
1384  || (interruptTarget->IsPlayer() && InterruptFlags.HasFlag(SpellInterruptFlags::DamageCancelsPlayerOnly))
1386  || (interruptCaster && interruptCaster->IsUnit() && interruptCaster->ToUnit()->HasAuraTypeWithMiscvalue(SPELL_AURA_ALLOW_INTERRUPT_SPELL, Id))
1387  || ((!(interruptTarget->GetMechanicImmunityMask() & (1 << MECHANIC_INTERRUPT)) || ignoreImmunity)
1388  && !interruptTarget->HasAuraTypeWithAffectMask(SPELL_AURA_PREVENT_INTERRUPT, this)
1390 }
Definition: SharedDefines.h:2725
uint32 const Id
Definition: SpellInfo.h:347
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:461
Definition: SpellAuraDefines.h:578
Definition: SharedDefines.h:2475
Definition: SpellAuraDefines.h:297
uint32 PreventionType
Definition: SpellInfo.h:428
Definition: SharedDefines.h:679
constexpr bool HasFlag(T flag) const
Definition: EnumFlag.h:106
bool HasChannelInterruptFlag(SpellAuraInterruptFlags flag) const
Definition: SpellInfo.h:484
EnumFlag< SpellInterruptFlags > InterruptFlags
Definition: SpellInfo.h:388
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanBeUsedInCombat()

bool SpellInfo::CanBeUsedInCombat ( ) const
1631 {
1633 }
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:461
Definition: SharedDefines.h:435
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanDispelAura()

bool SpellInfo::CanDispelAura ( SpellInfo const *  auraSpellInfo) const
1800 {
1801  // These auras (like Divine Shield) can't be dispelled
1802  if (auraSpellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES))
1803  return false;
1804 
1805  // These spells (like Mass Dispel) can dispel all auras
1807  return true;
1808 
1809  // These auras (Cyclone for example) are not dispelable
1810  if ((auraSpellInfo->HasAttribute(SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS) && auraSpellInfo->Mechanic != MECHANIC_NONE)
1811  || auraSpellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES))
1812  return false;
1813 
1814  return true;
1815 }
Definition: SharedDefines.h:2449
Definition: SharedDefines.h:507
Definition: SharedDefines.h:436
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:461
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanPierceImmuneAura()

bool SpellInfo::CanPierceImmuneAura ( SpellInfo const *  auraSpellInfo) const
1773 {
1774  // aura can't be pierced
1775  if (!auraSpellInfo || auraSpellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES))
1776  return false;
1777 
1778  // these spells pierce all available spells (Resurrection Sickness for example)
1780  return true;
1781 
1782  // these spells (Cyclone for example) can pierce all...
1784  {
1785  // ...but not these (Divine shield, Ice block, Cyclone and Banish for example)
1786  if (auraSpellInfo->Mechanic != MECHANIC_IMMUNE_SHIELD &&
1787  auraSpellInfo->Mechanic != MECHANIC_INVULNERABILITY &&
1788  (auraSpellInfo->Mechanic != MECHANIC_BANISH || (IsRankOf(auraSpellInfo) && auraSpellInfo->Dispel != DISPEL_NONE))) // Banish shouldn't be immune to itself, but Cyclone should
1789  return true;
1790  }
1791 
1792  // Dispels other auras on immunity, check if this spell makes the unit immune to aura
1794  return true;
1795 
1796  return false;
1797 }
Definition: SharedDefines.h:2478
Definition: SharedDefines.h:507
Definition: SharedDefines.h:2467
Definition: SharedDefines.h:459
Definition: SharedDefines.h:436
Definition: SharedDefines.h:2474
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:461
bool CanSpellProvideImmunityAgainstAura(SpellInfo const *auraSpellInfo) const
Definition: SpellInfo.cpp:3580
bool IsRankOf(SpellInfo const *spellInfo) const
Definition: SpellInfo.cpp:4294
Definition: SharedDefines.h:2497
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanSpellProvideImmunityAgainstAura()

bool SpellInfo::CanSpellProvideImmunityAgainstAura ( SpellInfo const *  auraSpellInfo) const
3581 {
3582  if (!auraSpellInfo)
3583  return false;
3584 
3585  for (SpellEffectInfo const& effectInfo : _effects)
3586  {
3587  if (!effectInfo.IsEffect())
3588  continue;
3589 
3590  ImmunityInfo const& immuneInfo = effectInfo.GetImmunityInfo();
3591 
3592  if (!auraSpellInfo->HasAttribute(SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS) && !auraSpellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES))
3593  {
3594  if (uint32 schoolImmunity = immuneInfo.SchoolImmuneMask)
3595  if ((auraSpellInfo->SchoolMask & schoolImmunity) != 0)
3596  return true;
3597  }
3598 
3599  if (uint32 mechanicImmunity = immuneInfo.MechanicImmuneMask)
3600  if ((mechanicImmunity & (1 << auraSpellInfo->Mechanic)) != 0)
3601  return true;
3602 
3603  if (uint32 dispelImmunity = immuneInfo.DispelImmune)
3604  if (auraSpellInfo->Dispel == dispelImmunity)
3605  return true;
3606 
3607  bool immuneToAllEffects = true;
3608  for (SpellEffectInfo const& auraSpellEffectInfo : auraSpellInfo->GetEffects())
3609  {
3610  if (!auraSpellEffectInfo.IsEffect())
3611  continue;
3612 
3613  auto spellImmuneItr = immuneInfo.SpellEffectImmune.find(auraSpellEffectInfo.Effect);
3614  if (spellImmuneItr == immuneInfo.SpellEffectImmune.cend())
3615  {
3616  immuneToAllEffects = false;
3617  break;
3618  }
3619 
3620  if (uint32 mechanic = auraSpellEffectInfo.Mechanic)
3621  {
3622  if (!(immuneInfo.MechanicImmuneMask & (1 << mechanic)))
3623  {
3624  immuneToAllEffects = false;
3625  break;
3626  }
3627  }
3628 
3629  if (!auraSpellInfo->HasAttribute(SPELL_ATTR3_ALWAYS_HIT))
3630  {
3631  if (AuraType auraName = auraSpellEffectInfo.ApplyAuraName)
3632  {
3633  bool isImmuneToAuraEffectApply = false;
3634  auto auraImmuneItr = immuneInfo.AuraTypeImmune.find(auraName);
3635  if (auraImmuneItr != immuneInfo.AuraTypeImmune.cend())
3636  isImmuneToAuraEffectApply = true;
3637 
3638  if (!isImmuneToAuraEffectApply && !auraSpellInfo->IsPositiveEffect(auraSpellEffectInfo.EffectIndex) && !auraSpellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES))
3639  {
3640  if (uint32 applyHarmfulAuraImmunityMask = immuneInfo.ApplyHarmfulAuraImmuneMask)
3641  if ((auraSpellInfo->GetSchoolMask() & applyHarmfulAuraImmunityMask) != 0)
3642  isImmuneToAuraEffectApply = true;
3643  }
3644 
3645  if (!isImmuneToAuraEffectApply)
3646  {
3647  immuneToAllEffects = false;
3648  break;
3649  }
3650  }
3651  }
3652  }
3653 
3654  if (immuneToAllEffects)
3655  return true;
3656  }
3657 
3658  return false;
3659 }
boost::container::flat_set< AuraType > AuraTypeImmune
Definition: SpellInfo.h:229
uint32 SchoolImmuneMask
Definition: SpellInfo.h:223
Definition: SharedDefines.h:536
boost::container::flat_set< SpellEffectName > SpellEffectImmune
Definition: SpellInfo.h:230
uint32 DispelImmune
Definition: SpellInfo.h:226
Definition: SharedDefines.h:507
AuraType
Definition: SpellAuraDefines.h:92
std::vector< SpellEffectInfo > _effects
Definition: SpellInfo.h:625
Definition: SpellInfo.h:233
uint32_t uint32
Definition: Define.h:143
uint32 ApplyHarmfulAuraImmuneMask
Definition: SpellInfo.h:224
Definition: SpellInfo.h:213
uint32 MechanicImmuneMask
Definition: SpellInfo.h:225
+ 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
2257 {
2258  uint32 neededTargets = GetExplicitTargetMask();
2259  if (!target)
2260  {
2262  if (!(neededTargets & TARGET_FLAG_GAMEOBJECT_ITEM) || !itemTarget)
2263  return SPELL_FAILED_BAD_TARGETS;
2264  return SPELL_CAST_OK;
2265  }
2266 
2267  if (Unit const* unitTarget = target->ToUnit())
2268  {
2270  {
2271  Unit const* unitCaster = caster->ToUnit();
2272  if (neededTargets & TARGET_FLAG_UNIT_ENEMY)
2273  if (caster->IsValidAttackTarget(unitTarget, this))
2274  return SPELL_CAST_OK;
2275  if ((neededTargets & TARGET_FLAG_UNIT_ALLY)
2276  || ((neededTargets & TARGET_FLAG_UNIT_PARTY) && unitCaster && unitCaster->IsInPartyWith(unitTarget))
2277  || ((neededTargets & TARGET_FLAG_UNIT_RAID) && unitCaster && unitCaster->IsInRaidWith(unitTarget)))
2278  if (caster->IsValidAssistTarget(unitTarget, this))
2279  return SPELL_CAST_OK;
2280  if ((neededTargets & TARGET_FLAG_UNIT_MINIPET) && unitCaster)
2281  if (unitTarget->GetGUID() == unitCaster->GetCritterGUID())
2282  return SPELL_CAST_OK;
2283  if ((neededTargets & TARGET_FLAG_UNIT_PASSENGER) && unitCaster)
2284  if (unitTarget->IsOnVehicle(unitCaster))
2285  return SPELL_CAST_OK;
2286  return SPELL_FAILED_BAD_TARGETS;
2287  }
2288  }
2289  return SPELL_CAST_OK;
2290 }
Definition: SpellDefines.h:287
uint32 GetExplicitTargetMask() const
Definition: SpellInfo.cpp:2430
ObjectGuid GetCritterGUID() const
Definition: Unit.h:1265
Definition: SpellDefines.h:278
Definition: SpellDefines.h:291
Definition: SpellDefines.h:285
Definition: SharedDefines.h:1457
Definition: SpellDefines.h:301
Definition: SpellDefines.h:298
uint32_t uint32
Definition: Define.h:143
Definition: SpellDefines.h:274
Definition: SpellDefines.h:300
Definition: SpellDefines.h:273
Definition: SpellDefines.h:279
static Unit * ToUnit(Object *o)
Definition: Object.h:210
bool IsInPartyWith(Unit const *unit) const
Definition: Unit.cpp:11484
Definition: Unit.h:746
Definition: SharedDefines.h:1760
bool IsInRaidWith(Unit const *unit) const
Definition: Unit.cpp:11503
+ 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
1927 {
1928  // normal case
1929  if (RequiredAreasID > 0)
1930  {
1931  bool found = false;
1932  std::vector<uint32> areaGroupMembers = sDB2Manager.GetAreasForGroup(RequiredAreasID);
1933  for (uint32 areaId : areaGroupMembers)
1934  {
1935  if (areaId == zone_id || areaId == area_id)
1936  {
1937  found = true;
1938  break;
1939  }
1940  }
1941 
1942  if (!found)
1944  }
1945 
1946  // continent limitation (virtual continent)
1948  {
1949  uint32 mountFlags = 0;
1950  if (player && player->HasAuraType(SPELL_AURA_MOUNT_RESTRICTIONS))
1951  {
1952  for (AuraEffect const* auraEffect : player->GetAuraEffectsByType(SPELL_AURA_MOUNT_RESTRICTIONS))
1953  mountFlags |= auraEffect->GetMiscValue();
1954  }
1955  else if (AreaTableEntry const* areaTable = sAreaTableStore.LookupEntry(area_id))
1956  mountFlags = areaTable->MountFlags;
1957 
1958  if (!(mountFlags & AREA_MOUNT_FLAG_FLYING_ALLOWED))
1960 
1961  if (player)
1962  {
1963  uint32 mapToCheck = map_id;
1964  if (MapEntry const* mapEntry = sMapStore.LookupEntry(map_id))
1965  mapToCheck = mapEntry->CosmeticParentMapID;
1966 
1967  if ((mapToCheck == 1116 || mapToCheck == 1464) && !player->HasSpell(191645)) // Draenor Pathfinder
1969  else if (mapToCheck == 1220 && !player->HasSpell(233368)) // Broken Isles Pathfinder
1971  else if ((mapToCheck == 1642 || mapToCheck == 1643) && !player->HasSpell(278833)) // Battle for Azeroth Pathfinder
1973  }
1974  }
1975 
1976  // raid instance limitation
1978  {
1979  MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
1980  if (!mapEntry || mapEntry->IsRaid())
1982  }
1983 
1984  // DB base check (if non empty then must fit at least single for allow)
1985  SpellAreaMapBounds saBounds = sSpellMgr->GetSpellAreaMapBounds(Id);
1986  if (saBounds.first != saBounds.second)
1987  {
1988  for (SpellAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
1989  {
1990  if (itr->second.IsFitToRequirements(player, zone_id, area_id))
1991  return SPELL_CAST_OK;
1992  }
1994  }
1995 
1996  // bg spell checks
1997  switch (Id)
1998  {
1999  case 23333: // Warsong Flag
2000  case 23335: // Silverwing Flag
2001  return map_id == 489 && player && player->InBattleground() ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
2002  case 34976: // Netherstorm Flag
2003  return map_id == 566 && player && player->InBattleground() ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
2004  case 2584: // Waiting to Resurrect
2005  case 22011: // Spirit Heal Channel
2006  case 22012: // Spirit Heal
2007  case 42792: // Recently Dropped Flag
2008  case 43681: // Inactive
2009  case 44535: // Spirit Heal (mana)
2010  {
2011  MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
2012  if (!mapEntry)
2014 
2015  return zone_id == AREA_WINTERGRASP || (mapEntry->IsBattleground() && player && player->InBattleground()) ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
2016  }
2017  case 44521: // Preparation
2018  {
2019  if (!player)
2021 
2022  MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
2023  if (!mapEntry)
2025 
2026  if (!mapEntry->IsBattleground())
2028 
2029  Battleground* bg = player->GetBattleground();
2031  }
2032  case 32724: // Gold Team (Alliance)
2033  case 32725: // Green Team (Alliance)
2034  case 35774: // Gold Team (Horde)
2035  case 35775: // Green Team (Horde)
2036  {
2037  MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
2038  if (!mapEntry)
2040 
2041  return mapEntry->IsBattleArena() && player && player->InBattleground() ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
2042  }
2043  case 32727: // Arena Preparation
2044  {
2045  if (!player)
2047 
2048  MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
2049  if (!mapEntry)
2051 
2052  if (!mapEntry->IsBattleArena())
2054 
2055  Battleground* bg = player->GetBattleground();
2057  }
2058  }
2059 
2060  // aura limitations
2061  if (player)
2062  {
2063  for (SpellEffectInfo const& effect : GetEffects())
2064  {
2065  if (!effect.IsAura())
2066  continue;
2067 
2068  switch (effect.ApplyAuraName)
2069  {
2071  {
2072  if (SpellShapeshiftFormEntry const* spellShapeshiftForm = sSpellShapeshiftFormStore.LookupEntry(effect.MiscValue))
2073  if (uint32 mountType = spellShapeshiftForm->MountTypeID)
2074  if (!player->GetMountCapability(mountType))
2075  return SPELL_FAILED_NOT_HERE;
2076  break;
2077  }
2078  case SPELL_AURA_MOUNTED:
2079  {
2080  uint32 mountType = effect.MiscValueB;
2081  if (MountEntry const* mountEntry = sDB2Manager.GetMount(Id))
2082  mountType = mountEntry->MountTypeID;
2083  if (mountType && !player->GetMountCapability(mountType))
2084  return SPELL_FAILED_NOT_HERE;
2085  break;
2086  }
2087  default:
2088  break;
2089  }
2090  }
2091  }
2092 
2093  return SPELL_CAST_OK;
2094 }
Definition: SpellAuraEffects.h:28
Definition: DB2Structure.h:125
Definition: SharedDefines.h:640
#define sDB2Manager
Definition: DB2Stores.h:479
Definition: SharedDefines.h:1650
DB2Storage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore("SpellShapeshiftForm.db2", SpellShapeshiftFormLoadInfo::Instance())
Definition: SpellAuraDefines.h:172
Definition: SharedDefines.h:1506
Definition: DB2Structure.h:2488
bool IsBattleground() const
Definition: DB2Structure.h:2522
BattlegroundStatus GetStatus() const
Definition: Battleground.h:301
uint32 const Id
Definition: SpellInfo.h:347
Definition: Battleground.h:171
Definition: SharedDefines.h:581
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:461
int32 RequiredAreasID
Definition: SpellInfo.h:429
bool IsRaid() const
Definition: DB2Structure.h:2521
std::pair< SpellAreaMap::const_iterator, SpellAreaMap::const_iterator > SpellAreaMapBounds
Definition: SpellMgr.h:552
Definition: SpellAuraDefines.h:130
#define sSpellMgr
Definition: SpellMgr.h:825
Definition: SpellInfo.h:233
uint32_t uint32
Definition: Define.h:143
DB2Storage< AreaTableEntry > sAreaTableStore("AreaTable.db2", AreaTableLoadInfo::Instance())
Definition: DB2Structure.h:3533
Definition: SharedDefines.h:1527
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:589
bool IsBattleArena() const
Definition: DB2Structure.h:2523
Definition: DBCEnums.h:152
Definition: SpellAuraDefines.h:430
Definition: SharedDefines.h:7739
Definition: Battleground.h:267
Definition: SharedDefines.h:1565
DB2Storage< MapEntry > sMapStore("Map.db2", MapLoadInfo::Instance())
Definition: SharedDefines.h:1760
Definition: DB2Structure.h:2611
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckShapeshift()

SpellCastResult SpellInfo::CheckShapeshift ( uint32  form) const
1878 {
1879  // talents that learn spells can have stance requirements that need ignore
1880  // (this requirement only for client-side stance show in talent description)
1881  /* TODO: 6.x fix this in proper way (probably spell flags/attributes?)
1882  if (GetTalentSpellCost(Id) > 0 && HasEffect(SPELL_EFFECT_LEARN_SPELL))
1883  return SPELL_CAST_OK;*/
1884 
1885  //if (HasAttribute(SPELL_ATTR13_ACTIVATES_REQUIRED_SHAPESHIFT))
1886  // return SPELL_CAST_OK;
1887 
1888  uint64 stanceMask = (form ? UI64LIT(1) << (form - 1) : 0);
1889 
1890  if (stanceMask & StancesNot) // can explicitly not be cast in this stance
1892 
1893  if (stanceMask & Stances) // can explicitly be cast in this stance
1894  return SPELL_CAST_OK;
1895 
1896  bool actAsShifted = false;
1897  SpellShapeshiftFormEntry const* shapeInfo = nullptr;
1898  if (form > 0)
1899  {
1900  shapeInfo = sSpellShapeshiftFormStore.LookupEntry(form);
1901  if (!shapeInfo)
1902  {
1903  TC_LOG_ERROR("spells", "GetErrorAtShapeshiftedCast: unknown shapeshift %u", form);
1904  return SPELL_CAST_OK;
1905  }
1906  actAsShifted = !shapeInfo->GetFlags().HasFlag(SpellShapeshiftFormFlags::Stance);
1907  }
1908 
1909  if (actAsShifted)
1910  {
1911  if (HasAttribute(SPELL_ATTR0_NOT_SHAPESHIFTED) || (shapeInfo && shapeInfo->GetFlags().HasFlag(SpellShapeshiftFormFlags::CanOnlyCastShapeshiftSpells))) // not while shapeshifted
1913  else if (Stances != 0) // needs other shapeshift
1915  }
1916  else
1917  {
1918  // needs shapeshift
1921  }
1922 
1923  return SPELL_CAST_OK;
1924 }
DB2Storage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore("SpellShapeshiftForm.db2", SpellShapeshiftFormLoadInfo::Instance())
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:185
#define UI64LIT(N)
Definition: Define.h:128
EnumFlag< SpellShapeshiftFormFlags > GetFlags() const
Definition: DB2Structure.h:3547
uint64 StancesNot
Definition: SpellInfo.h:370
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:461
uint64 Stances
Definition: SpellInfo.h:369
Definition: SharedDefines.h:423
uint64_t uint64
Definition: Define.h:142
Definition: SharedDefines.h:1558
Definition: DB2Structure.h:3533
Definition: SharedDefines.h:1535
Definition: SharedDefines.h:1760
+ 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
2097 {
2098  if (HasAttribute(SPELL_ATTR1_EXCLUDE_CASTER) && caster == target)
2099  return SPELL_FAILED_BAD_TARGETS;
2100 
2101  // check visibility - ignore stealth for implicit (area) targets
2102  if (!HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT) && !caster->CanSeeOrDetect(target, implicit))
2103  return SPELL_FAILED_BAD_TARGETS;
2104 
2105  Unit const* unitTarget = target->ToUnit();
2106 
2107  // creature/player specific target checks
2108  if (unitTarget)
2109  {
2110  // spells cannot be cast if target has a pet in combat either
2113 
2114  // only spells with SPELL_ATTR3_ONLY_TARGET_GHOSTS can target ghosts
2116  {
2119  else
2120  return SPELL_FAILED_BAD_TARGETS;
2121  }
2122 
2123  if (caster != unitTarget)
2124  {
2125  if (caster->GetTypeId() == TYPEID_PLAYER)
2126  {
2127  // Do not allow these spells to target creatures not tapped by us (Banish, Polymorph, many quest spells)
2129  if (Creature const* targetCreature = unitTarget->ToCreature())
2130  if (targetCreature->hasLootRecipient() && !targetCreature->isTappedBy(caster->ToPlayer()))
2132 
2134  {
2135  if (unitTarget->GetTypeId() == TYPEID_PLAYER)
2136  return SPELL_FAILED_BAD_TARGETS;
2137  else if ((unitTarget->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) == 0)
2139  }
2140 
2141  // Not allow disarm unarmed player
2142  if (Mechanic == MECHANIC_DISARM)
2143  {
2144  if (unitTarget->GetTypeId() == TYPEID_PLAYER)
2145  {
2146  Player const* player = unitTarget->ToPlayer();
2147  if (!player->GetWeaponForAttack(BASE_ATTACK) || !player->IsUseEquipedWeapon(true))
2149  }
2150  else if (!unitTarget->GetVirtualItemId(0))
2152  }
2153  }
2154  }
2155  }
2156  // corpse specific target checks
2157  else if (Corpse const* corpseTarget = target->ToCorpse())
2158  {
2159  // cannot target bare bones
2160  if (corpseTarget->GetType() == CORPSE_BONES)
2161  return SPELL_FAILED_BAD_TARGETS;
2162  // we have to use owner for some checks (aura preventing resurrection for example)
2163  if (Player* owner = ObjectAccessor::FindPlayer(corpseTarget->GetOwnerGUID()))
2164  unitTarget = owner;
2165  // we're not interested in corpses without owner
2166  else
2167  return SPELL_FAILED_BAD_TARGETS;
2168  }
2169  // other types of objects - always valid
2170  else return SPELL_CAST_OK;
2171 
2172  // corpseOwner and unit specific target checks
2173  if (!unitTarget->IsPlayer())
2174  {
2177 
2180  }
2183 
2184  if (!IsAllowingDeadTarget() && !unitTarget->IsAlive())
2186 
2187  // check this flag only for implicit targets (chain and area), allow to explicitly target units for spells like Shield of Righteousness
2189  return SPELL_FAILED_BAD_TARGETS;
2190 
2191  // checked in Unit::IsValidAttack/AssistTarget, shouldn't be checked for ENTRY targets
2192  //if (!HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNINTERACTIBLE))
2193  // return SPELL_FAILED_BAD_TARGETS;
2194 
2195  if (!CheckTargetCreatureType(unitTarget))
2196  {
2197  if (target->GetTypeId() == TYPEID_PLAYER)
2199  else
2200  return SPELL_FAILED_BAD_TARGETS;
2201  }
2202 
2203  // check GM mode and GM invisibility - only for player casts (npc casts are controlled by AI) and negative spells
2204  if (unitTarget != caster && (caster->GetAffectingPlayer() || !IsPositive()) && unitTarget->GetTypeId() == TYPEID_PLAYER)
2205  {
2206  if (!unitTarget->ToPlayer()->IsVisible())
2208 
2209  if (unitTarget->ToPlayer()->IsGameMaster())
2211  }
2212 
2213  // not allow casting on flying player
2215  return SPELL_FAILED_BAD_TARGETS;
2216 
2217  /* TARGET_UNIT_MASTER gets blocked here for passengers, because the whole idea of this check is to
2218  not allow passengers to be implicitly hit by spells, however this target type should be an exception,
2219  if this is left it kills spells that award kill credit from vehicle to master (few spells),
2220  the use of these 2 covers passenger target check, logically, if vehicle cast this to master it should always hit
2221  him, because it would be it's passenger, there's no such case where this gets to fail legitimacy, this problem
2222  cannot be solved from within the check in other way since target type cannot be called for the spell currently
2223  Spell examples: [ID - 52864 Devour Water, ID - 52862 Devour Wind, ID - 49370 Wyrmrest Defender: Destabilize Azure Dragonshrine Effect] */
2224  if (Unit const* unitCaster = caster->ToUnit())
2225  {
2226  if (!unitCaster->IsVehicle() && !(unitCaster->GetCharmerOrOwner() == target))
2227  {
2228  if (TargetAuraState && !unitTarget->HasAuraState(AuraStateType(TargetAuraState), this, unitCaster))
2230 
2231  if (ExcludeTargetAuraState && unitTarget->HasAuraState(AuraStateType(ExcludeTargetAuraState), this, unitCaster))
2233  }
2234  }
2235 
2236  if (TargetAuraSpell && !unitTarget->HasAura(TargetAuraSpell))
2238 
2241 
2245 
2247  if (Map* map = caster->GetMap())
2248  if (InstanceMap* iMap = map->ToInstanceMap())
2249  if (InstanceScript* instance = iMap->GetInstanceScript())
2250  if (instance->GetCombatResurrectionCharges() == 0 && instance->IsEncounterInProgress())
2252 
2253  return SPELL_CAST_OK;
2254 }
uint32 const CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD
Definition: SharedDefines.h:4462
bool HasAuraState(AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
Definition: Unit.cpp:5795
static Player * ToPlayer(Object *o)
Definition: Object.h:198
Definition: SharedDefines.h:1573
Definition: Corpse.h:51
Definition: SharedDefines.h:693
Definition: SpellAuraDefines.h:408
Item * GetWeaponForAttack(WeaponAttackType attackType, bool useable=false) const
Definition: Player.cpp:10090
TypeID GetTypeId() const
Definition: Object.h:170
Definition: SharedDefines.h:726
uint32 TargetAuraState
Definition: SpellInfo.h:376
Definition: SharedDefines.h:1589
Definition: SharedDefines.h:452
Definition: SharedDefines.h:1465
bool HasEffect(SpellEffectName effect) const
Definition: SpellInfo.cpp:1318
Definition: SharedDefines.h:1242
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4520
Definition: SpellAuraDefines.h:189
AuraStateType
Definition: SharedDefines.h:2412
Definition: UnitDefines.h:136
bool IsInCombat() const
Definition: Unit.h:1149
bool CanFreeMove() const
Definition: Unit.cpp:9002
uint32 ExcludeTargetAuraSpell
Definition: SpellInfo.h:382
static Corpse * ToCorpse(Object *o)
Definition: Object.h:222
Definition: SharedDefines.h:526
uint32 Mechanic
Definition: SpellInfo.h:351
Definition: Creature.h:69
Definition: SharedDefines.h:1574
Definition: SharedDefines.h:1166
bool HasUnitFlag(UnitFlags flags) const
Definition: Unit.h:948
Definition: SharedDefines.h:1583
Definition: SharedDefines.h:600
Definition: SharedDefines.h:2452
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:252
Definition: SharedDefines.h:1609
bool IsPlayer() const
Definition: Object.h:197
Definition: Map.h:945
Definition: SharedDefines.h:1457
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:461
Definition: SharedDefines.h:642
Definition: SharedDefines.h:463
bool IsAlive() const
Definition: Unit.h:1251
bool HasUnitState(const uint32 f) const
Definition: Unit.h:850
bool IsGameMaster() const
Definition: Player.h:1202
InstanceMap * ToInstanceMap()
Definition: Map.h:528
Definition: SharedDefines.h:530
static Creature * ToCreature(Object *o)
Definition: Object.h:204
Definition: Map.h:264
bool IsVisible() const
Definition: Unit.cpp:8071
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4530
Definition: SharedDefines.h:6547
bool IsPositive() const
Definition: SpellInfo.cpp:1635
bool IsUseEquipedWeapon(bool mainhand) const
Definition: Player.cpp:13756
uint32 GetCreatureTypeMask() const
Definition: Unit.cpp:8587
Definition: ObjectGuid.h:40
Definition: SpellInfo.h:159
uint32 ExcludeTargetAuraState
Definition: SpellInfo.h:378
Definition: InstanceScript.h:149
Definition: SharedDefines.h:1625
Definition: SharedDefines.h:1575
Definition: SharedDefines.h:1587
uint32 GetVirtualItemId(uint32 slot) const
Definition: Unit.cpp:13413
bool IsAllowingDeadTarget() const
Definition: SpellInfo.cpp:1595
static Unit * ToUnit(Object *o)
Definition: Object.h:210
Definition: SharedDefines.h:1673
Definition: Unit.h:746
Definition: Unit.h:250
Definition: Player.h:1131
Definition: SpellInfo.h:167
Definition: SharedDefines.h:1760
Definition: SharedDefines.h:1582
uint32 TargetAuraSpell
Definition: SpellInfo.h:380
Definition: SharedDefines.h:487
Definition: SharedDefines.h:1588
bool IsControlledByPlayer() const
Definition: Unit.h:1278
bool CheckTargetCreatureType(Unit const *target) const
Definition: SpellInfo.cpp:2342
Definition: SharedDefines.h:599
Definition: Corpse.h:30
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckTargetCreatureType()

bool SpellInfo::CheckTargetCreatureType ( Unit const *  target) const
2343 {
2344  // Curse of Doom & Exorcism: not find another way to fix spell target check :/
2345  if (SpellFamilyName == SPELLFAMILY_WARLOCK && GetCategory() == 1179)
2346  {
2347  // not allow cast at player
2348  if (target->GetTypeId() == TYPEID_PLAYER)
2349  return false;
2350  else
2351  return true;
2352  }
2353 
2354  // if target is magnet (i.e Grounding Totem) the check is skipped
2355  if (target->IsMagnet())
2356  return true;
2357 
2358  uint32 creatureType = target->GetCreatureTypeMask();
2359  return !TargetCreatureType || !creatureType || (creatureType & TargetCreatureType);
2360 }
uint32 GetCategory() const
Definition: SpellInfo.cpp:1313
uint32 SpellFamilyName
Definition: SpellInfo.h:425
uint32_t uint32
Definition: Define.h:143
Definition: ObjectGuid.h:40
Definition: SharedDefines.h:6243
uint32 TargetCreatureType
Definition: SpellInfo.h:372
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckVehicle()

SpellCastResult SpellInfo::CheckVehicle ( Unit const *  caster) const
2293 {
2294  // All creatures should be able to cast as passengers freely, restriction and attribute are only for players
2295  if (caster->GetTypeId() != TYPEID_PLAYER)
2296  return SPELL_CAST_OK;
2297 
2298  Vehicle* vehicle = caster->GetVehicle();
2299  if (vehicle)
2300  {
2301  uint16 checkMask = 0;
2302  for (SpellEffectInfo const& effect : GetEffects())
2303  {
2304  if (effect.IsAura(SPELL_AURA_MOD_SHAPESHIFT))
2305  {
2306  SpellShapeshiftFormEntry const* shapeShiftFromEntry = sSpellShapeshiftFormStore.LookupEntry(effect.MiscValue);
2307  if (shapeShiftFromEntry && (shapeShiftFromEntry->Flags & 1) == 0) // unk flag
2308  checkMask |= VEHICLE_SEAT_FLAG_UNCONTROLLED;
2309  break;
2310  }
2311  }
2312 
2315 
2316  if (!checkMask)
2317  checkMask = VEHICLE_SEAT_FLAG_CAN_ATTACK;
2318 
2319  VehicleSeatEntry const* vehicleSeat = vehicle->GetSeatForPassenger(caster);
2321  && (vehicleSeat->Flags & checkMask) != checkMask)
2323 
2324  // Can only summon uncontrolled minions/guardians when on controlled vehicle
2326  {
2327  for (SpellEffectInfo const& effect : GetEffects())
2328  {
2329  if (!effect.IsEffect(SPELL_EFFECT_SUMMON))
2330  continue;
2331 
2332  SummonPropertiesEntry const* props = sSummonPropertiesStore.LookupEntry(effect.MiscValueB);
2333  if (props && props->Control != SUMMON_CATEGORY_WILD)
2335  }
2336  }
2337  }
2338 
2339  return SPELL_CAST_OK;
2340 }
Definition: DB2Structure.h:3951
Definition: Vehicle.h:30
Definition: SharedDefines.h:1656
bool HasAura(AuraType aura) const
Definition: SpellInfo.cpp:1327
int32 Flags
Definition: DB2Structure.h:3956
DB2Storage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore("SpellShapeshiftForm.db2", SpellShapeshiftFormLoadInfo::Instance())
Definition: SpellAuraDefines.h:172
int32 Control
Definition: DB2Structure.h:3665
Definition: DBCEnums.h:1885
Definition: DBCEnums.h:1884
Definition: SharedDefines.h:1176
Definition: DBCEnums.h:1901
Definition: DBCEnums.h:1883
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
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:461
Definition: DBCEnums.h:1882
Definition: SpellAuraDefines.h:130
Definition: SpellInfo.h:233
int32 Flags
Definition: DB2Structure.h:3538
uint16_t uint16
Definition: Define.h:144
Definition: SharedDefines.h:5855
Definition: DB2Structure.h:3533
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:589
Definition: ObjectGuid.h:40
DB2Storage< SummonPropertiesEntry > sSummonPropertiesStore("SummonProperties.db2", SummonPropertiesLoadInfo::Instance())
Definition: SharedDefines.h:641
Definition: SharedDefines.h:1760
Definition: SharedDefines.h:431
Definition: DB2Structure.h:3662
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAllEffectsMechanicMask()

uint32 SpellInfo::GetAllEffectsMechanicMask ( ) const
2368 {
2369  uint32 mask = 0;
2370  if (Mechanic)
2371  mask |= 1 << Mechanic;
2372 
2373  for (SpellEffectInfo const& effect : GetEffects())
2374  if (effect.IsEffect() && effect.Mechanic)
2375  mask |= 1 << effect.Mechanic;
2376 
2377  return mask;
2378 }
uint32 Mechanic
Definition: SpellInfo.h:351
Definition: SpellInfo.h:233
uint32_t uint32
Definition: Define.h:143
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:589
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAllowedMechanicMask()

uint32 SpellInfo::GetAllowedMechanicMask ( ) const
3709 {
3710  return _allowedMechanicMask;
3711 }
uint32 _allowedMechanicMask
Definition: SpellInfo.h:631

◆ GetAttackType()

WeaponAttackType SpellInfo::GetAttackType ( ) const
1688 {
1689  WeaponAttackType result;
1690  switch (DmgClass)
1691  {
1694  result = OFF_ATTACK;
1695  else
1696  result = BASE_ATTACK;
1697  break;
1700  break;
1701  default:
1702  // Wands
1704  result = RANGED_ATTACK;
1705  else
1706  result = BASE_ATTACK;
1707  break;
1708  }
1709 
1710  return result;
1711 }
Definition: SharedDefines.h:542
uint32 DmgClass
Definition: SpellInfo.h:427
Definition: SharedDefines.h:2718
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:461
bool IsAutoRepeatRangedSpell() const
Definition: SpellInfo.cpp:1672
Definition: SharedDefines.h:2717
Definition: SharedDefines.h:6547
Definition: SharedDefines.h:6549
bool IsRangedWeaponSpell() const
Definition: SpellInfo.cpp:1665
WeaponAttackType
Definition: SharedDefines.h:6545
Definition: SharedDefines.h:6548
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAuraRankForLevel()

SpellInfo const * SpellInfo::GetAuraRankForLevel ( uint8  level) const
4254 {
4255  // ignore passive spells
4256  if (IsPassive())
4257  return this;
4258 
4259  // Client ignores spell with these attributes (sub_53D9D0)
4261  return this;
4262 
4263  bool needRankSelection = false;
4264  for (SpellEffectInfo const& effect : GetEffects())
4265  {
4266  if (IsPositiveEffect(effect.EffectIndex) &&
4267  (effect.Effect == SPELL_EFFECT_APPLY_AURA ||
4268  effect.Effect == SPELL_EFFECT_APPLY_AREA_AURA_PARTY ||
4269  effect.Effect == SPELL_EFFECT_APPLY_AREA_AURA_RAID) &&
4270  !effect.Scaling.Coefficient)
4271  {
4272  needRankSelection = true;
4273  break;
4274  }
4275  }
4276 
4277  // not required
4278  if (!needRankSelection)
4279  return this;
4280 
4281  for (SpellInfo const* nextSpellInfo = this; nextSpellInfo != nullptr; nextSpellInfo = nextSpellInfo->GetPrevRankSpell())
4282  {
4283  // if found appropriate level
4284  if (uint32(level + 10) >= nextSpellInfo->SpellLevel)
4285  return nextSpellInfo;
4286 
4287  // one rank less then
4288  }
4289 
4290  // not found
4291  return nullptr;
4292 }
Definition: SpellInfo.h:342
bool IsPositiveEffect(uint8 effIndex) const
Definition: SpellInfo.cpp:1640
bool IsPassive() const
Definition: SpellInfo.cpp:1519
Definition: SharedDefines.h:1154
Definition: SharedDefines.h:545
Definition: SharedDefines.h:433
SpellInfo const * GetPrevRankSpell() const
Definition: SpellInfo.cpp:4246
Definition: SharedDefines.h:1213
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:461
Definition: SpellInfo.h:233
uint32_t uint32
Definition: Define.h:143
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:589
Definition: SharedDefines.h:1183
Definition: SharedDefines.h:484
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAuraState()

AuraStateType SpellInfo::GetAuraState ( ) const
2436 {
2437  return _auraState;
2438 }
AuraStateType _auraState
Definition: SpellInfo.h:628
+ Here is the caller graph for this function:

◆ GetCategory()

uint32 SpellInfo::GetCategory ( ) const
1314 {
1315  return CategoryId;
1316 }
uint32 CategoryId
Definition: SpellInfo.h:349
+ Here is the caller graph for this function:

◆ GetDiminishingReturnsGroupForSpell()

DiminishingGroup SpellInfo::GetDiminishingReturnsGroupForSpell ( ) const
3185 {
3187 }
DiminishingGroup DiminishGroup
Definition: SpellInfo.h:330
SpellDiminishInfo _diminishInfo
Definition: SpellInfo.h:630
+ Here is the caller graph for this function:

◆ GetDiminishingReturnsGroupType()

DiminishingReturnsType SpellInfo::GetDiminishingReturnsGroupType ( ) const
3190 {
3192 }
SpellDiminishInfo _diminishInfo
Definition: SpellInfo.h:630
DiminishingReturnsType DiminishReturnType
Definition: SpellInfo.h:331
+ Here is the caller graph for this function:

◆ GetDiminishingReturnsLimitDuration()

int32 SpellInfo::GetDiminishingReturnsLimitDuration ( ) const
3200 {
3202 }
SpellDiminishInfo _diminishInfo
Definition: SpellInfo.h:630
int32 DiminishDurationLimit
Definition: SpellInfo.h:333
+ Here is the caller graph for this function:

◆ GetDiminishingReturnsMaxLevel()

DiminishingLevels SpellInfo::GetDiminishingReturnsMaxLevel ( ) const
3195 {
3197 }
SpellDiminishInfo _diminishInfo
Definition: SpellInfo.h:630
DiminishingLevels DiminishMaxLevel
Definition: SpellInfo.h:332
+ Here is the caller graph for this function:

◆ GetDispelMask() [1/2]

uint32 SpellInfo::GetDispelMask ( ) const
2417 {
2418  return GetDispelMask(DispelType(Dispel));
2419 }
uint32 Dispel
Definition: SpellInfo.h:350
DispelType
Definition: SharedDefines.h:2495
uint32 GetDispelMask() const
Definition: SpellInfo.cpp:2416
+ Here is the caller graph for this function:

◆ GetDispelMask() [2/2]

uint32 SpellInfo::GetDispelMask ( DispelType  type)
static
2422 {
2423  // If dispel all
2424  if (type == DISPEL_ALL)
2425  return DISPEL_ALL_MASK;
2426  else
2427  return uint32(1 << type);
2428 }
#define DISPEL_ALL_MASK
Definition: SharedDefines.h:2511
uint32_t uint32
Definition: Define.h:143
Definition: SharedDefines.h:2504

◆ GetDuration()

int32 SpellInfo::GetDuration ( ) const
3761 {
3762  if (!DurationEntry)
3763  return IsPassive() ? -1 : 0;
3764  return (DurationEntry->Duration == -1) ? -1 : abs(DurationEntry->Duration);
3765 }
int32 Duration
Definition: DB2Structure.h:3274
bool IsPassive() const
Definition: SpellInfo.cpp:1519
SpellDurationEntry const * DurationEntry
Definition: SpellInfo.h:402
+ 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
590 { ASSERT(index < _effects.size()); return _effects[index]; }
std::vector< SpellEffectInfo > _effects
Definition: SpellInfo.h:625
#define ASSERT
Definition: Errors.h:68
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetEffectMechanic()

Mechanics SpellInfo::GetEffectMechanic ( SpellEffIndex  effIndex) const
2406 {
2407  if (GetEffect(effIndex).IsEffect() && GetEffect(effIndex).Mechanic)
2408  return GetEffect(effIndex).Mechanic;
2409 
2410  if (Mechanic)
2411  return Mechanics(Mechanic);
2412 
2413  return MECHANIC_NONE;
2414 }
Definition: SharedDefines.h:2449
Mechanics
Definition: SharedDefines.h:2447
uint32 Mechanic
Definition: SpellInfo.h:351
Mechanics Mechanic
Definition: SpellInfo.h:250
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition: SpellInfo.h:590
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetEffectMechanicMask()

uint32 SpellInfo::GetEffectMechanicMask ( SpellEffIndex  effIndex) const
2381 {
2382  uint32 mask = 0;
2383  if (Mechanic)
2384  mask |= 1 << Mechanic;
2385 
2386  if (GetEffect(effIndex).IsEffect() && GetEffect(effIndex).Mechanic)
2387  mask |= 1 << GetEffect(effIndex).Mechanic;
2388 
2389  return mask;
2390 }
uint32 Mechanic
Definition: SpellInfo.h:351
Mechanics Mechanic
Definition: SpellInfo.h:250
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition: SpellInfo.h:590
uint32_t uint32
Definition: Define.h:143
+ Here is the call graph for this function:

◆ GetEffects()

std::vector<SpellEffectInfo> const& SpellInfo::GetEffects ( ) const
inline
589 { return _effects; }
std::vector< SpellEffectInfo > _effects
Definition: SpellInfo.h:625

◆ GetExplicitTargetMask()

uint32 SpellInfo::GetExplicitTargetMask ( ) const
2431 {
2432  return ExplicitTargetMask;
2433 }
uint32 ExplicitTargetMask
Definition: SpellInfo.h:442
+ Here is the caller graph for this function:

◆ GetFirstRankSpell()

SpellInfo const * SpellInfo::GetFirstRankSpell ( ) const
4226 {
4227  if (!ChainEntry)
4228  return this;
4229  return ChainEntry->first;
4230 }
SpellInfo const * first
Definition: SpellMgr.h:562
SpellChainNode const * ChainEntry
Definition: SpellInfo.h:443
+ Here is the caller graph for this function:

◆ GetLastRankSpell()

SpellInfo const * SpellInfo::GetLastRankSpell ( ) const
4233 {
4234  if (!ChainEntry)
4235  return nullptr;
4236  return ChainEntry->last;
4237 }
SpellInfo const * last
Definition: SpellMgr.h:563
SpellChainNode const * ChainEntry
Definition: SpellInfo.h:443

◆ GetMaxDuration()

int32 SpellInfo::GetMaxDuration ( ) const
3768 {
3769  if (!DurationEntry)
3770  return IsPassive() ? -1 : 0;
3771  return (DurationEntry->MaxDuration == -1) ? -1 : abs(DurationEntry->MaxDuration);
3772 }
bool IsPassive() const
Definition: SpellInfo.cpp:1519
int32 MaxDuration
Definition: DB2Structure.h:3275
SpellDurationEntry const * DurationEntry
Definition: SpellInfo.h:402
+ 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
3738 {
3739  if (!RangeEntry)
3740  return 0.0f;
3741  float range = RangeEntry->RangeMax[positive ? 1 : 0];
3742  if (caster)
3743  if (Player* modOwner = caster->GetSpellModOwner())
3744  modOwner->ApplySpellMod(this, SpellModOp::Range, range, spell);
3745 
3746  return range;
3747 }
std::array< float, 2 > RangeMax
Definition: DB2Structure.h:3492
SpellRangeEntry const * RangeEntry
Definition: SpellInfo.h:404
Player * GetSpellModOwner() const
Definition: Object.cpp:2148
Definition: Player.h:1131
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMaxTicks()

uint32 SpellInfo::GetMaxTicks ( ) const
3793 {
3794  uint32 totalTicks = 0;
3795  int32 DotDuration = GetDuration();
3796 
3797  for (SpellEffectInfo const& effect : GetEffects())
3798  {
3799  if (effect.IsEffect(SPELL_EFFECT_APPLY_AURA))
3800  {
3801  switch (effect.ApplyAuraName)
3802  {
3809  case SPELL_AURA_POWER_BURN:
3817  // skip infinite periodics
3818  if (effect.ApplyAuraPeriod > 0 && DotDuration > 0)
3819  {
3820  totalTicks = static_cast<uint32>(DotDuration) / effect.ApplyAuraPeriod;
3822  ++totalTicks;
3823  }
3824  break;
3825  default:
3826  break;
3827  }
3828  }
3829  }
3830 
3831  return totalTicks;
3832 }
Definition: SpellAuraDefines.h:147
Definition: SpellAuraDefines.h:117
Definition: SpellAuraDefines.h:156
Definition: SpellAuraDefines.h:114
Definition: SharedDefines.h:1154
Definition: SpellAuraDefines.h:158
Definition: SpellAuraDefines.h:256
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:461
Definition: SpellInfo.h:233
Definition: SpellAuraDefines.h:183
int32_t int32
Definition: Define.h:139
uint32_t uint32
Definition: Define.h:143
Definition: SpellAuraDefines.h:320
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:589
Definition: SpellAuraDefines.h:321
Definition: SpellAuraDefines.h:102
int32 GetDuration() const
Definition: SpellInfo.cpp:3760
Definition: SpellAuraDefines.h:97
Definition: SpellAuraDefines.h:142
Definition: SpellAuraDefines.h:118
Definition: SpellAuraDefines.h:115
Definition: SharedDefines.h:601
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMechanicImmunityMask()

uint32 SpellInfo::GetMechanicImmunityMask ( Unit const *  caster) const
3714 {
3715  uint32 casterMechanicImmunityMask = caster->GetMechanicImmunityMask();
3716  uint32 mechanicImmunityMask = 0;
3717 
3718  if (CanBeInterrupted(nullptr, caster, true))
3719  {
3720  if (casterMechanicImmunityMask & (1 << MECHANIC_SILENCE))
3721  mechanicImmunityMask |= (1 << MECHANIC_SILENCE);
3722 
3723  if (casterMechanicImmunityMask & (1 << MECHANIC_INTERRUPT))
3724  mechanicImmunityMask |= (1 << MECHANIC_INTERRUPT);
3725  }
3726 
3727  return mechanicImmunityMask;
3728 }
bool CanBeInterrupted(WorldObject const *interruptCaster, Unit const *interruptTarget, bool ignoreImmunity=false) const
Definition: SpellInfo.cpp:1380
uint32_t uint32
Definition: Define.h:143
Definition: SharedDefines.h:2475
Definition: SharedDefines.h:2458
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMinRange()

float SpellInfo::GetMinRange ( bool  positive = false) const
3731 {
3732  if (!RangeEntry)
3733  return 0.0f;
3734  return RangeEntry->RangeMin[positive ? 1 : 0];
3735 }
std::array< float, 2 > RangeMin
Definition: DB2Structure.h:3491
SpellRangeEntry const * RangeEntry
Definition: SpellInfo.h:404
+ Here is the caller graph for this function:

◆ GetNextRankSpell()

SpellInfo const * SpellInfo::GetNextRankSpell ( ) const
4240 {
4241  if (!ChainEntry)
4242  return nullptr;
4243  return ChainEntry->next;
4244 }
SpellInfo const * next
Definition: SpellMgr.h:561
SpellChainNode const * ChainEntry
Definition: SpellInfo.h:443
+ Here is the caller graph for this function:

◆ GetPrevRankSpell()

SpellInfo const * SpellInfo::GetPrevRankSpell ( ) const
4247 {
4248  if (!ChainEntry)
4249  return nullptr;
4250  return ChainEntry->prev;
4251 }
SpellInfo const * prev
Definition: SpellMgr.h:560
SpellChainNode const * ChainEntry
Definition: SpellInfo.h:443
+ Here is the caller graph for this function:

◆ GetRank()

uint8 SpellInfo::GetRank ( ) const
4219 {
4220  if (!ChainEntry)
4221  return 1;
4222  return ChainEntry->rank;
4223 }
SpellChainNode const * ChainEntry
Definition: SpellInfo.h:443
uint8 rank
Definition: SpellMgr.h:564
+ Here is the caller graph for this function:

◆ GetRecoveryTime()

uint32 SpellInfo::GetRecoveryTime ( ) const
3835 {
3837 }
uint32 RecoveryTime
Definition: SpellInfo.h:384
uint32 CategoryRecoveryTime
Definition: SpellInfo.h:385
+ Here is the caller graph for this function:

◆ GetSchoolMask()

SpellSchoolMask SpellInfo::GetSchoolMask ( ) const
2363 {
2364  return SpellSchoolMask(SchoolMask);
2365 }
uint32 SchoolMask
Definition: SpellInfo.h:430
SpellSchoolMask
Definition: SharedDefines.h:310
+ Here is the caller graph for this function:

◆ GetSpellMechanicMaskByEffectMask()

uint32 SpellInfo::GetSpellMechanicMaskByEffectMask ( uint32  effectMask) const
2393 {
2394  uint32 mask = 0;
2395  if (Mechanic)
2396  mask |= 1 << Mechanic;
2397 
2398  for (SpellEffectInfo const& effect : GetEffects())
2399  if ((effectMask & (1 << effect.EffectIndex)) && effect.Mechanic)
2400  mask |= 1 << effect.Mechanic;
2401 
2402  return mask;
2403 }
uint32 Mechanic
Definition: SpellInfo.h:351
Definition: SpellInfo.h:233
uint32_t uint32
Definition: Define.h:143
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:589
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSpellSpecific()

SpellSpecificType SpellInfo::GetSpellSpecific ( ) const
2521 {
2522  return _spellSpecific;
2523 };
SpellSpecificType _spellSpecific
Definition: SpellInfo.h:627
+ Here is the caller graph for this function:

◆ GetSpellVisual()

uint32 SpellInfo::GetSpellVisual ( WorldObject const *  caster = nullptr,
WorldObject const *  viewer = nullptr 
) const
4335 {
4336  if (SpellXSpellVisualEntry const* visual = sSpellXSpellVisualStore.LookupEntry(GetSpellXSpellVisualId(caster, viewer)))
4337  {
4338  //if (visual->LowViolenceSpellVisualID && forPlayer->GetViolenceLevel() operator 2)
4339  // return visual->LowViolenceSpellVisualID;
4340 
4341  return visual->SpellVisualID;
4342  }
4343 
4344  return 0;
4345 }
DB2Storage< SpellXSpellVisualEntry > sSpellXSpellVisualStore("SpellXSpellVisual.db2", SpellXSpellVisualLoadInfo::Instance())
uint32 GetSpellXSpellVisualId(WorldObject const *caster=nullptr, WorldObject const *viewer=nullptr) const
Definition: SpellInfo.cpp:4316
Definition: DB2Structure.h:3646
+ 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
4317 {
4318  for (SpellXSpellVisualEntry const* visual : _visuals)
4319  {
4320  if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(visual->CasterPlayerConditionID))
4321  if (!caster || !caster->IsPlayer() || !ConditionMgr::IsPlayerMeetingCondition(caster->ToPlayer(), playerCondition))
4322  continue;
4323 
4324  if (UnitConditionEntry const* unitCondition = sUnitConditionStore.LookupEntry(visual->CasterUnitConditionID))
4325  if (!caster || !caster->IsUnit() || !ConditionMgr::IsUnitMeetingCondition(caster->ToUnit(), Object::ToUnit(viewer), unitCondition))
4326  continue;
4327 
4328  return visual->ID;
4329  }
4330 
4331  return 0;
4332 }
static bool IsUnitMeetingCondition(Unit const *unit, Unit const *otherUnit, UnitConditionEntry const *condition)
Definition: ConditionMgr.cpp:3976
SpellVisualVector _visuals
Definition: SpellInfo.h:626
Definition: DB2Structure.h:3894
static bool IsPlayerMeetingCondition(Player const *player, PlayerConditionEntry const *condition)
Definition: ConditionMgr.cpp:2915
Definition: DB2Structure.h:3646
Definition: DB2Structure.h:2737
DB2Storage< UnitConditionEntry > sUnitConditionStore("UnitCondition.db2", UnitConditionLoadInfo::Instance())
DB2Storage< PlayerConditionEntry > sPlayerConditionStore("PlayerCondition.db2", PlayerConditionLoadInfo::Instance())
Unit * ToUnit()
Definition: Object.h:212
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasAnyAuraInterruptFlag()

bool SpellInfo::HasAnyAuraInterruptFlag ( ) const
1393 {
1395 }
EnumFlag< SpellAuraInterruptFlags > AuraInterruptFlags
Definition: SpellInfo.h:389
EnumFlag< SpellAuraInterruptFlags2 > AuraInterruptFlags2
Definition: SpellInfo.h:390
+ Here is the caller graph for this function:

◆ HasAreaAuraEffect()

bool SpellInfo::HasAreaAuraEffect ( ) const
1337 {
1338  for (SpellEffectInfo const& effect : GetEffects())
1339  if (effect.IsAreaAuraEffect())
1340  return true;
1341 
1342  return false;
1343 }
Definition: SpellInfo.h:233
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:589
+ 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
461 { return !!(Attributes & attribute); }
uint32 Attributes
Definition: SpellInfo.h:352

◆ HasAttribute() [2/16]

bool SpellInfo::HasAttribute ( SpellAttr1  attribute) const
inline
462 { return !!(AttributesEx & attribute); }
uint32 AttributesEx
Definition: SpellInfo.h:353

◆ HasAttribute() [3/16]

bool SpellInfo::HasAttribute ( SpellAttr2  attribute) const
inline
463 { return !!(AttributesEx2 & attribute); }
uint32 AttributesEx2
Definition: SpellInfo.h:354

◆ HasAttribute() [4/16]

bool SpellInfo::HasAttribute ( SpellAttr3  attribute) const
inline
464 { return !!(AttributesEx3 & attribute); }
uint32 AttributesEx3
Definition: SpellInfo.h:355

◆ HasAttribute() [5/16]

bool SpellInfo::HasAttribute ( SpellAttr4  attribute) const
inline
465 { return !!(AttributesEx4 & attribute); }
uint32 AttributesEx4
Definition: SpellInfo.h:356

◆ HasAttribute() [6/16]

bool SpellInfo::HasAttribute ( SpellAttr5  attribute) const
inline
466 { return !!(AttributesEx5 & attribute); }
uint32 AttributesEx5
Definition: SpellInfo.h:357

◆ HasAttribute() [7/16]

bool SpellInfo::HasAttribute ( SpellAttr6  attribute) const
inline
467 { return !!(AttributesEx6 & attribute); }
uint32 AttributesEx6
Definition: SpellInfo.h:358

◆ HasAttribute() [8/16]

bool SpellInfo::HasAttribute ( SpellAttr7  attribute) const
inline
468 { return !!(AttributesEx7 & attribute); }
uint32 AttributesEx7
Definition: SpellInfo.h:359

◆ HasAttribute() [9/16]

bool SpellInfo::HasAttribute ( SpellAttr8  attribute) const
inline
469 { return !!(AttributesEx8 & attribute); }
uint32 AttributesEx8
Definition: SpellInfo.h:360

◆ HasAttribute() [10/16]

bool SpellInfo::HasAttribute ( SpellAttr9  attribute) const
inline
470 { return !!(AttributesEx9 & attribute); }
uint32 AttributesEx9
Definition: SpellInfo.h:361

◆ HasAttribute() [11/16]

bool SpellInfo::HasAttribute ( SpellAttr10  attribute) const
inline
471 { return !!(AttributesEx10 & attribute); }
uint32 AttributesEx10
Definition: SpellInfo.h:362

◆ HasAttribute() [12/16]

bool SpellInfo::HasAttribute ( SpellAttr11  attribute) const
inline
472 { return !!(AttributesEx11 & attribute); }
uint32 AttributesEx11
Definition: SpellInfo.h:363

◆ HasAttribute() [13/16]

bool SpellInfo::HasAttribute ( SpellAttr12  attribute) const
inline
473 { return !!(AttributesEx12 & attribute); }
uint32 AttributesEx12
Definition: SpellInfo.h:364

◆ HasAttribute() [14/16]

bool SpellInfo::HasAttribute ( SpellAttr13  attribute) const
inline
474 { return !!(AttributesEx13 & attribute); }
uint32 AttributesEx13
Definition: SpellInfo.h:365

◆ HasAttribute() [15/16]

bool SpellInfo::HasAttribute ( SpellAttr14  attribute) const
inline
475 { return !!(AttributesEx14 & attribute); }
uint32 AttributesEx14
Definition: SpellInfo.h:366

◆ HasAttribute() [16/16]

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

◆ HasAura()

bool SpellInfo::HasAura ( AuraType  aura) const
1328 {
1329  for (SpellEffectInfo const& effect : GetEffects())
1330  if (effect.IsAura(aura))
1331  return true;
1332 
1333  return false;
1334 }
Definition: SpellInfo.h:233
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:589
+ 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
481 { return AuraInterruptFlags.HasFlag(flag); }
EnumFlag< SpellAuraInterruptFlags > AuraInterruptFlags
Definition: SpellInfo.h:389