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 ()
 
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) 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 IsQuestTame () 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 IsBreakingStealth () 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) const
 
uint32 GetSpellVisual (WorldObject const *caster=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
 
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
 
uint32 ProcFlags = 0
 
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< uint32, MAX_SPELL_TOTEMSTotem = {}
 
std::array< uint32, MAX_SPELL_TOTEMSTotemCategory = {}
 
std::array< int32, MAX_SPELL_REAGENTSReagent = {}
 
std::array< uint32, 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/2]

SpellInfo::SpellInfo ( SpellNameEntry const *  spellName,
::Difficulty  difficulty,
SpellInfoLoadHelper const &  data 
)
1076  : Id(spellName->ID), Difficulty(difficulty)
1077 {
1078  _effects.reserve(32);
1079  for (SpellEffectEntry const* spellEffect : data.Effects)
1080  {
1081  if (!spellEffect)
1082  continue;
1083 
1085  }
1086 
1087  _effects.shrink_to_fit();
1088 
1089  SpellName = &spellName->Name;
1090 
1091  // SpellMiscEntry
1092  if (SpellMiscEntry const* _misc = data.Misc)
1093  {
1094  Attributes = _misc->Attributes[0];
1095  AttributesEx = _misc->Attributes[1];
1096  AttributesEx2 = _misc->Attributes[2];
1097  AttributesEx3 = _misc->Attributes[3];
1098  AttributesEx4 = _misc->Attributes[4];
1099  AttributesEx5 = _misc->Attributes[5];
1100  AttributesEx6 = _misc->Attributes[6];
1101  AttributesEx7 = _misc->Attributes[7];
1102  AttributesEx8 = _misc->Attributes[8];
1103  AttributesEx9 = _misc->Attributes[9];
1104  AttributesEx10 = _misc->Attributes[10];
1105  AttributesEx11 = _misc->Attributes[11];
1106  AttributesEx12 = _misc->Attributes[12];
1107  AttributesEx13 = _misc->Attributes[13];
1108  AttributesEx14 = _misc->Attributes[14];
1109  CastTimeEntry = sSpellCastTimesStore.LookupEntry(_misc->CastingTimeIndex);
1110  DurationEntry = sSpellDurationStore.LookupEntry(_misc->DurationIndex);
1111  RangeEntry = sSpellRangeStore.LookupEntry(_misc->RangeIndex);
1112  Speed = _misc->Speed;
1113  LaunchDelay = _misc->LaunchDelay;
1114  SchoolMask = _misc->SchoolMask;
1115  IconFileDataId = _misc->SpellIconFileDataID;
1116  ActiveIconFileDataId = _misc->ActiveIconFileDataID;
1117  ContentTuningId = _misc->ContentTuningID;
1118  ShowFutureSpellPlayerConditionID = _misc->ShowFutureSpellPlayerConditionID;
1119  }
1120 
1121  // SpellScalingEntry
1122  if (SpellScalingEntry const* _scaling = data.Scaling)
1123  {
1124  Scaling.MinScalingLevel = _scaling->MinScalingLevel;
1125  Scaling.MaxScalingLevel = _scaling->MaxScalingLevel;
1126  Scaling.ScalesFromItemLevel = _scaling->ScalesFromItemLevel;
1127  }
1128 
1129  // SpellAuraOptionsEntry
1130  if (SpellAuraOptionsEntry const* _options = data.AuraOptions)
1131  {
1132  ProcFlags = _options->ProcTypeMask[0];
1133  ProcChance = _options->ProcChance;
1134  ProcCharges = _options->ProcCharges;
1135  ProcCooldown = _options->ProcCategoryRecovery;
1136  StackAmount = _options->CumulativeAura;
1137  if (SpellProcsPerMinuteEntry const* _ppm = sSpellProcsPerMinuteStore.LookupEntry(_options->SpellProcsPerMinuteID))
1138  {
1139  ProcBasePPM = _ppm->BaseProcRate;
1140  ProcPPMMods = sDB2Manager.GetSpellProcsPerMinuteMods(_ppm->ID);
1141  }
1142  }
1143 
1144  // SpellAuraRestrictionsEntry
1145  if (SpellAuraRestrictionsEntry const* _aura = data.AuraRestrictions)
1146  {
1147  CasterAuraState = _aura->CasterAuraState;
1148  TargetAuraState = _aura->TargetAuraState;
1149  ExcludeCasterAuraState = _aura->ExcludeCasterAuraState;
1150  ExcludeTargetAuraState = _aura->ExcludeTargetAuraState;
1151  CasterAuraSpell = _aura->CasterAuraSpell;
1152  TargetAuraSpell = _aura->TargetAuraSpell;
1153  ExcludeCasterAuraSpell = _aura->ExcludeCasterAuraSpell;
1154  ExcludeTargetAuraSpell = _aura->ExcludeTargetAuraSpell;
1155  }
1156 
1157  // SpellCastingRequirementsEntry
1158  if (SpellCastingRequirementsEntry const* _castreq = data.CastingRequirements)
1159  {
1160  RequiresSpellFocus = _castreq->RequiresSpellFocus;
1161  FacingCasterFlags = _castreq->FacingCasterFlags;
1162  RequiredAreasID = _castreq->RequiredAreasID;
1163  }
1164 
1165  // SpellCategoriesEntry
1166  if (SpellCategoriesEntry const* _categories = data.Categories)
1167  {
1168  CategoryId = _categories->Category;
1169  Dispel = _categories->DispelType;
1170  Mechanic = _categories->Mechanic;
1171  StartRecoveryCategory = _categories->StartRecoveryCategory;
1172  DmgClass = _categories->DefenseType;
1173  PreventionType = _categories->PreventionType;
1174  ChargeCategoryId = _categories->ChargeCategory;
1175  }
1176 
1177  // SpellClassOptionsEntry
1178  if (SpellClassOptionsEntry const* _class = data.ClassOptions)
1179  {
1180  SpellFamilyName = _class->SpellClassSet;
1181  SpellFamilyFlags = _class->SpellClassMask;
1182  }
1183 
1184  // SpellCooldownsEntry
1185  if (SpellCooldownsEntry const* _cooldowns = data.Cooldowns)
1186  {
1187  RecoveryTime = _cooldowns->RecoveryTime;
1188  CategoryRecoveryTime = _cooldowns->CategoryRecoveryTime;
1189  StartRecoveryTime = _cooldowns->StartRecoveryTime;
1190  }
1191 
1192  // SpellEquippedItemsEntry
1193  if (SpellEquippedItemsEntry const* _equipped = data.EquippedItems)
1194  {
1195  EquippedItemClass = _equipped->EquippedItemClass;
1196  EquippedItemSubClassMask = _equipped->EquippedItemSubclass;
1197  EquippedItemInventoryTypeMask = _equipped->EquippedItemInvTypes;
1198  }
1199 
1200  // SpellInterruptsEntry
1201  if (SpellInterruptsEntry const* _interrupt = data.Interrupts)
1202  {
1203  InterruptFlags = SpellInterruptFlags(_interrupt->InterruptFlags);
1204  AuraInterruptFlags = SpellAuraInterruptFlags(_interrupt->AuraInterruptFlags[0]);
1205  AuraInterruptFlags2 = SpellAuraInterruptFlags2(_interrupt->AuraInterruptFlags[1]);
1206  ChannelInterruptFlags = SpellAuraInterruptFlags(_interrupt->ChannelInterruptFlags[0]);
1207  ChannelInterruptFlags2 = SpellAuraInterruptFlags2(_interrupt->ChannelInterruptFlags[1]);
1208  }
1209 
1210  for (SpellLabelEntry const* label : data.Labels)
1211  Labels.insert(label->LabelID);
1212 
1213  // SpellLevelsEntry
1214  if (SpellLevelsEntry const* _levels = data.Levels)
1215  {
1216  MaxLevel = _levels->MaxLevel;
1217  BaseLevel = _levels->BaseLevel;
1218  SpellLevel = _levels->SpellLevel;
1219  }
1220 
1221  // SpellPowerEntry
1222  PowerCosts = data.Powers;
1223 
1224  // SpellReagentsEntry
1225  if (SpellReagentsEntry const* _reagents = data.Reagents)
1226  {
1227  std::copy(std::begin(_reagents->Reagent), std::end(_reagents->Reagent), Reagent.begin());
1228  std::copy(std::begin(_reagents->ReagentCount), std::end(_reagents->ReagentCount), ReagentCount.begin());
1229  }
1230 
1231  ReagentsCurrency = data.ReagentsCurrency;
1232 
1233  // SpellShapeshiftEntry
1234  if (SpellShapeshiftEntry const* _shapeshift = data.Shapeshift)
1235  {
1236  Stances = MAKE_PAIR64(_shapeshift->ShapeshiftMask[0], _shapeshift->ShapeshiftMask[1]);
1237  StancesNot = MAKE_PAIR64(_shapeshift->ShapeshiftExclude[0], _shapeshift->ShapeshiftExclude[1]);
1238  }
1239 
1240  // SpellTargetRestrictionsEntry
1241  if (SpellTargetRestrictionsEntry const* _target = data.TargetRestrictions)
1242  {
1243  ConeAngle = _target->ConeDegrees;
1244  Width = _target->Width;
1245  Targets = _target->Targets;
1246  TargetCreatureType = _target->TargetCreatureType;
1247  MaxAffectedTargets = _target->MaxTargets;
1248  MaxTargetLevel = _target->MaxTargetLevel;
1249  }
1250 
1251  // SpellTotemsEntry
1252  if (SpellTotemsEntry const* _totem = data.Totems)
1253  {
1254  std::copy(std::begin(_totem->RequiredTotemCategoryID), std::end(_totem->RequiredTotemCategoryID), TotemCategory.begin());
1255  std::copy(std::begin(_totem->Totem), std::end(_totem->Totem), Totem.begin());
1256  }
1257 
1258  _visuals = data.Visuals;
1259 }
Definition: DB2Structure.h:3385
Targets
Definition: SharedDefines.h:2426
#define sDB2Manager
Definition: DB2Stores.h:446
Definition: DB2Structure.h:3342
int32 EquippedItemClass
Definition: SpellInfo.h:406
uint32 AttributesEx11
Definition: SpellInfo.h:356
uint32 ActiveIconFileDataId
Definition: SpellInfo.h:410
DB2Storage< SpellCastTimesEntry > sSpellCastTimesStore("SpellCastTimes.db2", SpellCastTimesLoadInfo::Instance())
decltype(auto) EnsureWritableVectorIndex(std::vector< T > &vec, typename std::vector< T >::size_type i)
Definition: Containers.h:254
Definition: DB2Structure.h:3136
uint32 AttributesEx12
Definition: SpellInfo.h:357
int32 EffectIndex
Definition: DB2Structure.h:3105
uint32 ProcCooldown
Definition: SpellInfo.h:389
struct SpellInfo::ScalingInfo Scaling
uint32 IconFileDataId
Definition: SpellInfo.h:409
float Width
Definition: SpellInfo.h:415
uint32 TargetAuraState
Definition: SpellInfo.h:369
uint32 DmgClass
Definition: SpellInfo.h:420
Definition: DB2Structure.h:3037
uint32 MaxLevel
Definition: SpellInfo.h:392
uint32 SpellLevel
Definition: SpellInfo.h:394
uint32 AttributesEx
Definition: SpellInfo.h:346
uint32 ProcCharges
Definition: SpellInfo.h:388
constexpr auto data(C &c)
Definition: advstd.h:96
int32 EquippedItemSubClassMask
Definition: SpellInfo.h:407
uint32 AttributesEx8
Definition: SpellInfo.h:353
Definition: DB2Structure.h:3216
uint32 AttributesEx10
Definition: SpellInfo.h:355
flag128 SpellFamilyFlags
Definition: SpellInfo.h:419
uint32 ExcludeCasterAuraSpell
Definition: SpellInfo.h:374
uint32 SchoolMask
Definition: SpellInfo.h:423
uint32 Dispel
Definition: SpellInfo.h:343
uint32 ExcludeTargetAuraSpell
Definition: SpellInfo.h:375
uint32 RequiresSpellFocus
Definition: SpellInfo.h:366
LocalizedString const * SpellName
Definition: SpellInfo.h:413
uint32 StartRecoveryCategory
Definition: SpellInfo.h:379
std::array< int32, MAX_SPELL_REAGENTS > Reagent
Definition: SpellInfo.h:403
EnumFlag< SpellAuraInterruptFlags2 > ChannelInterruptFlags2
Definition: SpellInfo.h:385
Definition: DB2Structure.h:3083
uint32 Mechanic
Definition: SpellInfo.h:344
Definition: DB2Structure.h:3100
uint32 AttributesEx14
Definition: SpellInfo.h:359
uint32 Attributes
Definition: SpellInfo.h:345
uint32 MaxTargetLevel
Definition: SpellInfo.h:416
Definition: DB2Structure.h:3317
uint32 ChargeCategoryId
Definition: SpellInfo.h:424
Definition: DB2Structure.h:3280
Definition: DB2Structure.h:3151
uint64 MAKE_PAIR64(uint32 l, uint32 h)
Definition: ObjectDefines.h:89
int32 EquippedItemInventoryTypeMask
Definition: SpellInfo.h:408
TotemCategory
Definition: SharedDefines.h:5468
std::vector< SpellEffectInfo > _effects
Definition: SpellInfo.h:613
uint32 AttributesEx3
Definition: SpellInfo.h:348
std::vector< SpellReagentsCurrencyEntry const * > ReagentsCurrency
Definition: SpellInfo.h:405
uint64 StancesNot
Definition: SpellInfo.h:363
SpellInterruptFlags
Definition: SpellDefines.h:52
uint32 CategoryId
Definition: SpellInfo.h:342
EnumFlag< SpellAuraInterruptFlags > AuraInterruptFlags
Definition: SpellInfo.h:382
SpellCastTimesEntry const * CastTimeEntry
Definition: SpellInfo.h:376
float LaunchDelay
Definition: SpellInfo.h:399
Definition: Totem.h:30
uint32 const Id
Definition: SpellInfo.h:340
uint32 AttributesEx7
Definition: SpellInfo.h:352
uint32 ScalesFromItemLevel
Definition: SpellInfo.h:432
uint32 AttributesEx9
Definition: SpellInfo.h:354
std::vector< SpellProcsPerMinuteModEntry const * > ProcPPMMods
Definition: SpellInfo.h:391
Definition: DB2Structure.h:3049
SpellRangeEntry const * RangeEntry
Definition: SpellInfo.h:397
uint32 RecoveryTime
Definition: SpellInfo.h:377
uint32 ContentTuningId
Definition: SpellInfo.h:411
uint32 AttributesEx2
Definition: SpellInfo.h:347
uint32 ExcludeCasterAuraState
Definition: SpellInfo.h:370
SpellVisualVector _visuals
Definition: SpellInfo.h:614
uint32 SpellFamilyName
Definition: SpellInfo.h:418
int32 RequiredAreasID
Definition: SpellInfo.h:422
EnumFlag< SpellAuraInterruptFlags > ChannelInterruptFlags
Definition: SpellInfo.h:384
uint32 ProcChance
Definition: SpellInfo.h:387
float ProcBasePPM
Definition: SpellInfo.h:390
uint32 MaxAffectedTargets
Definition: SpellInfo.h:417
uint64 Stances
Definition: SpellInfo.h:362
SpellDurationEntry const * DurationEntry
Definition: SpellInfo.h:395
Definition: SpellInfo.h:227
Definition: DB2Structure.h:3227
uint32 AttributesEx13
Definition: SpellInfo.h:358
::Difficulty const Difficulty
Definition: SpellInfo.h:341
uint32 PreventionType
Definition: SpellInfo.h:421
Definition: DB2Structure.h:3002
float Speed
Definition: SpellInfo.h:398
uint32 CasterAuraState
Definition: SpellInfo.h:368
uint32 AttributesEx5
Definition: SpellInfo.h:350
SpellAuraInterruptFlags
Definition: SpellDefines.h:70
float ConeAngle
Definition: SpellInfo.h:414
uint32 ExcludeTargetAuraState
Definition: SpellInfo.h:371
uint32 LabelID
Definition: DB2Structure.h:3204
Definition: DB2Structure.h:3333
uint32 BaseLevel
Definition: SpellInfo.h:393
Definition: DB2Structure.h:3370
uint32 CasterAuraSpell
Definition: SpellInfo.h:372
uint32 MaxScalingLevel
Definition: SpellInfo.h:431
uint32 AttributesEx6
Definition: SpellInfo.h:351
DB2Storage< SpellDurationEntry > sSpellDurationStore("SpellDuration.db2", SpellDurationLoadInfo::Instance())
uint32 FacingCasterFlags
Definition: SpellInfo.h:367
EnumFlag< SpellAuraInterruptFlags2 > AuraInterruptFlags2
Definition: SpellInfo.h:383
std::array< SpellPowerEntry const *, MAX_POWERS_PER_SPELL > PowerCosts
Definition: SpellInfo.h:396
ProcFlags
Definition: SpellMgr.h:133
uint32 StackAmount
Definition: SpellInfo.h:400
uint32 MinScalingLevel
Definition: SpellInfo.h:430
Definition: DB2Structure.h:3074
uint32 TargetCreatureType
Definition: SpellInfo.h:365
uint32 CategoryRecoveryTime
Definition: SpellInfo.h:378
std::array< uint32, MAX_SPELL_REAGENTS > ReagentCount
Definition: SpellInfo.h:404
uint32 StartRecoveryTime
Definition: SpellInfo.h:380
std::unordered_set< uint32 > Labels
Definition: SpellInfo.h:425
DB2Storage< SpellRangeEntry > sSpellRangeStore("SpellRange.db2", SpellRangeLoadInfo::Instance())
DB2Storage< SpellProcsPerMinuteEntry > sSpellProcsPerMinuteStore("SpellProcsPerMinute.db2", SpellProcsPerMinuteLoadInfo::Instance())
SpellAuraInterruptFlags2
Definition: SpellDefines.h:111
Definition: DB2Structure.h:3201
EnumFlag< SpellInterruptFlags > InterruptFlags
Definition: SpellInfo.h:381
uint32 TargetAuraSpell
Definition: SpellInfo.h:373
uint32 AttributesEx4
Definition: SpellInfo.h:349
Definition: DB2Structure.h:3015
uint32 ShowFutureSpellPlayerConditionID
Definition: SpellInfo.h:412
+ Here is the call graph for this function:

◆ SpellInfo() [2/2]

SpellInfo::SpellInfo ( SpellNameEntry const *  spellName,
::Difficulty  difficulty,
std::vector< SpellEffectEntry > const &  effects 
)
1262  : Id(spellName->ID), Difficulty(difficulty)
1263 {
1264  SpellName = &spellName->Name;
1265 
1266  _effects.reserve(32);
1267  for (SpellEffectEntry const& spellEffect : effects)
1268  Trinity::Containers::EnsureWritableVectorIndex(_effects, spellEffect.EffectIndex, SpellEffectInfo(this)) = SpellEffectInfo(this, spellEffect);
1269 
1270  _effects.shrink_to_fit();
1271 }
decltype(auto) EnsureWritableVectorIndex(std::vector< T > &vec, typename std::vector< T >::size_type i)
Definition: Containers.h:254
LocalizedString const * SpellName
Definition: SpellInfo.h:413
Definition: DB2Structure.h:3100
std::vector< SpellEffectInfo > _effects
Definition: SpellInfo.h:613
uint32 const Id
Definition: SpellInfo.h:340
Definition: SpellInfo.h:227
::Difficulty const Difficulty
Definition: SpellInfo.h:341
+ Here is the call graph for this function:

◆ ~SpellInfo()

SpellInfo::~SpellInfo ( )
1274 {
1276 }
void _UnloadImplicitTargetConditionLists()
Definition: SpellInfo.cpp:4780
+ Here is the call graph for this function:

Member Function Documentation

◆ _InitializeExplicitTargetMask()

void SpellInfo::_InitializeExplicitTargetMask ( )
private
4287 {
4288  bool srcSet = false;
4289  bool dstSet = false;
4290  uint32 targetMask = Targets;
4291  // prepare target mask using effect target entries
4292  for (SpellEffectInfo const& effect : GetEffects())
4293  {
4294  if (!effect.IsEffect())
4295  continue;
4296 
4297  targetMask |= effect.TargetA.GetExplicitTargetMask(srcSet, dstSet);
4298  targetMask |= effect.TargetB.GetExplicitTargetMask(srcSet, dstSet);
4299 
4300  // add explicit target flags based on spell effects which have EFFECT_IMPLICIT_TARGET_EXPLICIT and no valid target provided
4301  if (effect.GetImplicitTargetType() != EFFECT_IMPLICIT_TARGET_EXPLICIT)
4302  continue;
4303 
4304  // extend explicit target mask only if valid targets for effect could not be provided by target types
4305  uint32 effectTargetMask = effect.GetMissingTargetMask(srcSet, dstSet, targetMask);
4306 
4307  // don't add explicit object/dest flags when spell has no max range
4308  if (GetMaxRange(true) == 0.0f && GetMaxRange(false) == 0.0f)
4310 
4311  targetMask |= effectTargetMask;
4312  }
4313 
4314  ExplicitTargetMask = targetMask;
4315 }
Definition: SpellInfo.h:115
Definition: SpellDefines.h:278
Definition: SpellDefines.h:297
uint32 ExplicitTargetMask
Definition: SpellInfo.h:435
Definition: SpellInfo.h:227
uint32 Targets
Definition: SpellInfo.h:364
Definition: SpellDefines.h:294
uint32_t uint32
Definition: Define.h:152
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:579
Definition: SpellDefines.h:273
float GetMaxRange(bool positive=false, WorldObject *caster=nullptr, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:3682
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _InitializeSpellPositivity()

void SpellInfo::_InitializeSpellPositivity ( )
private
4742 {
4743  std::unordered_set<std::pair<SpellInfo const*, SpellEffIndex /*effIndex*/>> visited;
4744 
4745  for (SpellEffectInfo const& effect : GetEffects())
4746  if (!_isPositiveEffectImpl(this, effect, visited))
4747  NegativeEffects[effect.EffectIndex] = true;
4748 
4749  // additional checks after effects marked
4750  for (SpellEffectInfo const& effect : GetEffects())
4751  {
4752  if (!effect.IsEffect() || !IsPositiveEffect(effect.EffectIndex))
4753  continue;
4754 
4755  switch (effect.ApplyAuraName)
4756  {
4757  // has other non positive effect?
4758  // then it should be marked negative if has same target as negative effect (ex 8510, 8511, 8893, 10267)
4759  case SPELL_AURA_DUMMY:
4760  case SPELL_AURA_MOD_STUN:
4761  case SPELL_AURA_MOD_FEAR:
4762  case SPELL_AURA_MOD_TAUNT:
4763  case SPELL_AURA_TRANSFORM:
4766  {
4767  for (size_t j = effect.EffectIndex + 1; j < GetEffects().size(); ++j)
4768  if (!IsPositiveEffect(j)
4769  && effect.TargetA.GetTarget() == GetEffect(SpellEffIndex(j)).TargetA.GetTarget()
4770  && effect.TargetB.GetTarget() == GetEffect(SpellEffIndex(j)).TargetB.GetTarget())
4771  NegativeEffects[effect.EffectIndex] = true;
4772  break;
4773  }
4774  default:
4775  break;
4776  }
4777  }
4778 }
Definition: SpellAuraDefines.h:100
Definition: SpellAuraDefines.h:95
Targets GetTarget() const
Definition: SpellInfo.cpp:130
Definition: SpellInfo.h:335
std::bitset< MAX_SPELL_EFFECTS > NegativeEffects
Definition: SpellInfo.h:361
bool IsPositiveEffect(uint8 effIndex) const
Definition: SpellInfo.cpp:1613
SpellEffIndex
Definition: SharedDefines.h:26
SpellImplicitTargetInfo TargetA
Definition: SpellInfo.h:246
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition: SpellInfo.h:580
Definition: SpellInfo.h:227
bool _isPositiveEffectImpl(SpellInfo const *spellInfo, SpellEffectInfo const &effect, std::unordered_set< std::pair< SpellInfo const *, SpellEffIndex >> &visited)
Definition: SpellInfo.cpp:4326
Definition: SpellAuraDefines.h:97
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:579
Definition: SpellAuraDefines.h:92
Definition: SpellAuraDefines.h:121
Definition: SpellAuraDefines.h:144
Definition: SpellAuraDefines.h:99
SpellImplicitTargetInfo TargetB
Definition: SpellInfo.h:247
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _LoadAuraState()

void SpellInfo::_LoadAuraState ( )
private
2423 {
2424  _auraState = [this]()->AuraStateType
2425  {
2426  // Faerie Fire (Feral)
2427  if (GetCategory() == 1133)
2428  return AURA_STATE_FAERIE_FIRE;
2429 
2430  // Swiftmend state on Regrowth, Rejuvenation, Wild Growth
2431  if (SpellFamilyName == SPELLFAMILY_DRUID && (SpellFamilyFlags[0] & 0x50 || SpellFamilyFlags[1] & 0x4000000))
2433 
2434  // Deadly poison aura state
2435  if (SpellFamilyName == SPELLFAMILY_ROGUE && SpellFamilyFlags[0] & 0x10000)
2437 
2438  // Enrage aura state
2439  if (Dispel == DISPEL_ENRAGE)
2440  return AURA_STATE_ENRAGED;
2441 
2442  // Bleeding aura state
2444  return AURA_STATE_BLEED;
2445 
2447  for (SpellEffectInfo const& effect : GetEffects())
2448  if (effect.IsAura(SPELL_AURA_MOD_STUN) || effect.IsAura(SPELL_AURA_MOD_ROOT) || effect.IsAura(SPELL_AURA_MOD_ROOT_2))
2449  return AURA_STATE_FROZEN;
2450 
2451  switch (Id)
2452  {
2453  case 1064: // Dazed
2454  return AURA_STATE_DAZED;
2455  case 32216: // Victorious
2456  return AURA_STATE_VICTORIOUS;
2457  case 71465: // Divine Surge
2458  case 50241: // Evasive Charges
2460  case 6950: // Faerie Fire
2461  case 9806: // Phantom Strike
2462  case 9991: // Touch of Zanzil
2463  case 13424: // Faerie Fire
2464  case 13752: // Faerie Fire
2465  case 16432: // Plague Mist
2466  case 20656: // Faerie Fire
2467  case 25602: // Faerie Fire
2468  case 32129: // Faerie Fire
2469  case 35325: // Glowing Blood
2470  case 35328: // Lambent Blood
2471  case 35329: // Vibrant Blood
2472  case 35331: // Black Blood
2473  case 49163: // Perpetual Instability
2474  case 65863: // Faerie Fire
2475  case 79559: // Luxscale Light
2476  case 82855: // Dazzling
2477  case 102953: // In the Rumpus
2478  case 127907: // Phosphorescence
2479  case 127913: // Phosphorescence
2480  case 129007: // Zijin Sting
2481  case 130159: // Fae Touch
2482  case 142537: // Spotter Smoke
2483  case 168455: // Spotted!
2484  case 176905: // Super Sticky Glitter Bomb
2485  case 189502: // Marked
2486  case 201785: // Intruder Alert!
2487  case 201786: // Intruder Alert!
2488  case 201935: // Spotted!
2489  case 239233: // Smoke Bomb
2490  case 319400: // Glitter Burst
2491  case 321470: // Dimensional Shifter Mishap
2492  case 331134: // Spotted
2493  return AURA_STATE_FAERIE_FIRE;
2494  default:
2495  break;
2496  }
2497 
2498  return AURA_STATE_NONE;
2499  }();
2500 }
Definition: SharedDefines.h:2331
Definition: SpellAuraDefines.h:100
Definition: SharedDefines.h:2318
Definition: SharedDefines.h:2357
Definition: SpellAuraDefines.h:114
Definition: SharedDefines.h:6062
Definition: SharedDefines.h:2326
Definition: SharedDefines.h:2399
AuraStateType
Definition: SharedDefines.h:2306
flag128 SpellFamilyFlags
Definition: SpellInfo.h:419
uint32 Dispel
Definition: SpellInfo.h:343
Definition: SharedDefines.h:310
uint32 GetAllEffectsMechanicMask() const
Definition: SpellInfo.cpp:2349
Definition: SharedDefines.h:2325
Definition: SharedDefines.h:2327
Definition: SharedDefines.h:2313
uint32 const Id
Definition: SpellInfo.h:340
uint32 GetCategory() const
Definition: SpellInfo.cpp:1278
uint32 SpellFamilyName
Definition: SpellInfo.h:418
Definition: SpellInfo.h:227
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:2344
Definition: SharedDefines.h:2321
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:579
Definition: SharedDefines.h:2319
Definition: SharedDefines.h:6061
Definition: SpellAuraDefines.h:543
Definition: SharedDefines.h:2309
Definition: SharedDefines.h:2324
AuraStateType _auraState
Definition: SpellInfo.h:616
+ Here is the call graph for this function:

◆ _LoadImmunityInfo()

void SpellInfo::_LoadImmunityInfo ( )
private
3173 {
3174  for (SpellEffectInfo& effect : _effects)
3175  {
3176  uint32 schoolImmunityMask = 0;
3177  uint32 applyHarmfulAuraImmunityMask = 0;
3178  uint32 mechanicImmunityMask = 0;
3179  uint32 dispelImmunity = 0;
3180  uint32 damageImmunityMask = 0;
3181 
3182  int32 miscVal = effect.MiscValue;
3183  int32 amount = effect.CalcValue();
3184 
3185  ImmunityInfo& immuneInfo = effect._immunityInfo;
3186 
3187  switch (effect.ApplyAuraName)
3188  {
3190  {
3191  switch (miscVal)
3192  {
3193  case 96: // Free Friend, Uncontrollable Frenzy, Warlord's Presence
3194  {
3196 
3197  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_STUN);
3198  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_DECREASE_SPEED);
3199  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT);
3200  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_CONFUSE);
3201  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_FEAR);
3202  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT_2);
3203  break;
3204  }
3205  case 1615: // Incite Rage, Wolf Spirit, Overload, Lightning Tendrils
3206  {
3207  switch (Id)
3208  {
3209  case 43292: // Incite Rage
3210  case 49172: // Wolf Spirit
3212 
3213  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_STUN);
3214  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_DECREASE_SPEED);
3215  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT);
3216  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_CONFUSE);
3217  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_FEAR);
3218  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT_2);
3219  /* fallthrough */
3220  case 61869: // Overload
3221  case 63481:
3222  case 61887: // Lightning Tendrils
3223  case 63486:
3224  mechanicImmunityMask |= (1 << MECHANIC_INTERRUPT) | (1 << MECHANIC_SILENCE);
3225 
3226  immuneInfo.SpellEffectImmune.insert(SPELL_EFFECT_KNOCK_BACK);
3228  break;
3229  default:
3230  break;
3231  }
3232  break;
3233  }
3234  case 679: // Mind Control, Avenging Fury
3235  {
3236  if (Id == 57742) // Avenging Fury
3237  {
3239 
3240  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_STUN);
3241  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_DECREASE_SPEED);
3242  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT);
3243  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_CONFUSE);
3244  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_FEAR);
3245  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT_2);
3246  }
3247  break;
3248  }
3249  case 1557: // Startling Roar, Warlord Roar, Break Bonds, Stormshield
3250  {
3251  if (Id == 64187) // Stormshield
3252  {
3253  mechanicImmunityMask |= (1 << MECHANIC_STUN);
3254  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_STUN);
3255  }
3256  else
3257  {
3259 
3260  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_STUN);
3261  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_DECREASE_SPEED);
3262  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT);
3263  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_CONFUSE);
3264  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_FEAR);
3265  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT_2);
3266  }
3267  break;
3268  }
3269  case 1614: // Fixate
3270  case 1694: // Fixated, Lightning Tendrils
3271  {
3272  immuneInfo.SpellEffectImmune.insert(SPELL_EFFECT_ATTACK_ME);
3273  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_TAUNT);
3274  break;
3275  }
3276  case 1630: // Fervor, Berserk
3277  {
3278  if (Id == 64112) // Berserk
3279  {
3280  immuneInfo.SpellEffectImmune.insert(SPELL_EFFECT_ATTACK_ME);
3281  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_TAUNT);
3282  }
3283  else
3284  {
3286 
3287  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_STUN);
3288  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_DECREASE_SPEED);
3289  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT);
3290  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_CONFUSE);
3291  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_FEAR);
3292  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT_2);
3293  }
3294  break;
3295  }
3296  case 477: // Bladestorm
3297  case 1733: // Bladestorm, Killing Spree
3298  {
3299  if (!amount)
3300  {
3302 
3303  immuneInfo.SpellEffectImmune.insert(SPELL_EFFECT_KNOCK_BACK);
3305 
3306  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_STUN);
3307  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_DECREASE_SPEED);
3308  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT);
3309  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_CONFUSE);
3310  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_FEAR);
3311  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT_2);
3312  }
3313  break;
3314  }
3315  case 878: // Whirlwind, Fog of Corruption, Determination
3316  {
3317  if (Id == 66092) // Determination
3318  {
3319  mechanicImmunityMask |= (1 << MECHANIC_SNARE) | (1 << MECHANIC_STUN)
3320  | (1 << MECHANIC_DISORIENTED) | (1 << MECHANIC_FREEZE);
3321 
3322  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_STUN);
3323  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_DECREASE_SPEED);
3324  }
3325  break;
3326  }
3327  default:
3328  break;
3329  }
3330 
3331  if (immuneInfo.AuraTypeImmune.empty())
3332  {
3333  if (miscVal & (1 << 10))
3334  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_STUN);
3335  if (miscVal & (1 << 1))
3336  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_TRANSFORM);
3337 
3338  // These flag can be recognized wrong:
3339  if (miscVal & (1 << 6))
3340  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_DECREASE_SPEED);
3341  if (miscVal & (1 << 0))
3342  {
3343  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT);
3344  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_ROOT_2);
3345  }
3346  if (miscVal & (1 << 2))
3347  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_CONFUSE);
3348  if (miscVal & (1 << 9))
3349  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_FEAR);
3350  if (miscVal & (1 << 7))
3351  immuneInfo.AuraTypeImmune.insert(SPELL_AURA_MOD_DISARM);
3352  }
3353  break;
3354  }
3356  {
3357  switch (Id)
3358  {
3359  case 42292: // PvP trinket
3360  case 59752: // Every Man for Himself
3363  break;
3364  case 34471: // The Beast Within
3365  case 19574: // Bestial Wrath
3366  case 46227: // Medallion of Immunity
3367  case 53490: // Bullheaded
3368  case 65547: // PvP Trinket
3369  case 134946: // Supremacy of the Alliance
3370  case 134956: // Supremacy of the Horde
3371  case 195710: // Honorable Medallion
3372  case 208683: // Gladiator's Medallion
3374  break;
3375  case 54508: // Demonic Empowerment
3376  mechanicImmunityMask |= (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT) | (1 << MECHANIC_STUN);
3377  break;
3378  default:
3379  if (miscVal < 1)
3380  return;
3381 
3382  mechanicImmunityMask |= 1 << miscVal;
3383  break;
3384  }
3385  break;
3386  }
3388  {
3389  immuneInfo.SpellEffectImmune.insert(static_cast<SpellEffectName>(miscVal));
3390  break;
3391  }
3393  {
3394  immuneInfo.AuraTypeImmune.insert(static_cast<AuraType>(miscVal));
3395  break;
3396  }
3398  {
3399  schoolImmunityMask |= uint32(miscVal);
3400  break;
3401  }
3403  {
3404  applyHarmfulAuraImmunityMask |= uint32(miscVal);
3405  break;
3406  }
3408  {
3409  damageImmunityMask |= uint32(miscVal);
3410  break;
3411  }
3413  {
3414  dispelImmunity = uint32(miscVal);
3415  break;
3416  }
3417  default:
3418  break;
3419  }
3420 
3421  immuneInfo.SchoolImmuneMask = schoolImmunityMask;
3422  immuneInfo.ApplyHarmfulAuraImmuneMask = applyHarmfulAuraImmunityMask;
3423  immuneInfo.MechanicImmuneMask = mechanicImmunityMask;
3424  immuneInfo.DispelImmune = dispelImmunity;
3425  immuneInfo.DamageSchoolMask = damageImmunityMask;
3426 
3427  immuneInfo.AuraTypeImmune.shrink_to_fit();
3428  immuneInfo.SpellEffectImmune.shrink_to_fit();
3429 
3431  }
3432 
3434  {
3435  switch (Id)
3436  {
3437  case 22812: // Barkskin
3438  case 47585: // Dispersion
3440  (1 << MECHANIC_STUN) |
3441  (1 << MECHANIC_FREEZE) |
3442  (1 << MECHANIC_KNOCKOUT) |
3443  (1 << MECHANIC_SLEEP);
3444  break;
3445  case 49039: // Lichborne, don't allow normal stuns
3446  break;
3447  default:
3449  break;
3450  }
3451  }
3452 
3455 
3457  {
3458  switch (Id)
3459  {
3460  case 22812: // Barkskin
3461  case 47585: // Dispersion
3463  break;
3464  default:
3466  break;
3467  }
3468  }
3469 }
boost::container::flat_set< AuraType > AuraTypeImmune
Definition: SpellInfo.h:223
Definition: SpellAuraDefines.h:355
Definition: SharedDefines.h:2354
Definition: SpellAuraDefines.h:100
Definition: SpellAuraDefines.h:95
uint32 SchoolImmuneMask
Definition: SpellInfo.h:217
Definition: SpellAuraDefines.h:114
boost::container::flat_set< SpellEffectName > SpellEffectImmune
Definition: SpellInfo.h:224
uint32 DispelImmune
Definition: SpellInfo.h:220
#define IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK
Definition: SharedDefines.h:2379
Definition: SharedDefines.h:580
Definition: SharedDefines.h:2366
Definition: SharedDefines.h:1212
Definition: SharedDefines.h:2349
Definition: SharedDefines.h:2353
std::vector< SpellEffectInfo > _effects
Definition: SpellInfo.h:613
Definition: SpellAuraDefines.h:125
Definition: SharedDefines.h:2344
Definition: SpellAuraDefines.h:165
uint32 const Id
Definition: SpellInfo.h:340
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:449
Definition: SharedDefines.h:2356
Definition: SharedDefines.h:2355
Definition: SharedDefines.h:565
uint32 DamageSchoolMask
Definition: SpellInfo.h:221
Definition: SpellAuraDefines.h:235
Definition: SpellAuraDefines.h:93
Definition: SpellInfo.h:227
int32_t int32
Definition: Define.h:148
uint32_t uint32
Definition: Define.h:152
Definition: SpellAuraDefines.h:129
uint32 ApplyHarmfulAuraImmuneMask
Definition: SpellInfo.h:218
Definition: SharedDefines.h:2368
Definition: SpellAuraDefines.h:279
Definition: SharedDefines.h:2351
Definition: SpellAuraDefines.h:127
Definition: SharedDefines.h:1196
Definition: SpellAuraDefines.h:121
uint32 _allowedMechanicMask
Definition: SpellInfo.h:619
Definition: SpellAuraDefines.h:128
Definition: SpellAuraDefines.h:126
Definition: SpellInfo.h:215
Definition: SpellAuraDefines.h:543
Definition: SpellAuraDefines.h:144
Definition: SpellAuraDefines.h:99
Definition: SharedDefines.h:2352
Definition: SharedDefines.h:2347
Definition: SharedDefines.h:579
Definition: SpellAuraDefines.h:155
uint32 MechanicImmuneMask
Definition: SpellInfo.h:219
Definition: SharedDefines.h:1242
+ Here is the call graph for this function:

◆ _LoadSpellDiminishInfo()

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

◆ _LoadSpellSpecific()

void SpellInfo::_LoadSpellSpecific ( )
private

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

2508 {
2509  _spellSpecific = [this]()->SpellSpecificType
2510  {
2511  switch (SpellFamilyName)
2512  {
2513  case SPELLFAMILY_GENERIC:
2514  {
2515  // Food / Drinks (mostly)
2517  {
2518  bool food = false;
2519  bool drink = false;
2520  for (SpellEffectInfo const& effect : GetEffects())
2521  {
2522  if (!effect.IsAura())
2523  continue;
2524  switch (effect.ApplyAuraName)
2525  {
2526  // Food
2527  case SPELL_AURA_MOD_REGEN:
2529  food = true;
2530  break;
2531  // Drink
2534  drink = true;
2535  break;
2536  default:
2537  break;
2538  }
2539  }
2540 
2541  if (food && drink)
2543  else if (food)
2544  return SPELL_SPECIFIC_FOOD;
2545  else if (drink)
2546  return SPELL_SPECIFIC_DRINK;
2547  }
2548  // scrolls effects
2549  else
2550  {
2551  SpellInfo const* firstRankSpellInfo = GetFirstRankSpell();
2552  switch (firstRankSpellInfo->Id)
2553  {
2554  case 8118: // Strength
2555  case 8099: // Stamina
2556  case 8112: // Spirit
2557  case 8096: // Intellect
2558  case 8115: // Agility
2559  case 8091: // Armor
2560  return SPELL_SPECIFIC_SCROLL;
2561  default:
2562  break;
2563  }
2564  }
2565  break;
2566  }
2567  case SPELLFAMILY_MAGE:
2568  {
2569  // family flags 18(Molten), 25(Frost/Ice), 28(Mage)
2570  if (SpellFamilyFlags[0] & 0x12040000)
2572 
2573  // Arcane brillance and Arcane intelect (normal check fails because of flags difference)
2574  if (SpellFamilyFlags[0] & 0x400)
2576 
2577  if ((SpellFamilyFlags[0] & 0x1000000) && GetEffect(EFFECT_0).IsAura(SPELL_AURA_MOD_CONFUSE))
2579 
2580  break;
2581  }
2582  case SPELLFAMILY_WARRIOR:
2583  {
2584  if (Id == 12292) // Death Wish
2586 
2587  break;
2588  }
2589  case SPELLFAMILY_WARLOCK:
2590  {
2591  // Warlock (Bane of Doom | Bane of Agony | Bane of Havoc)
2592  if (Id == 603 || Id == 980 || Id == 80240)
2593  return SPELL_SPECIFIC_BANE;
2594 
2595  // only warlock curses have this
2596  if (Dispel == DISPEL_CURSE)
2597  return SPELL_SPECIFIC_CURSE;
2598 
2599  // Warlock (Demon Armor | Demon Skin | Fel Armor)
2600  if (SpellFamilyFlags[1] & 0x20000020 || SpellFamilyFlags[2] & 0x00000010)
2602 
2603  //seed of corruption and corruption
2604  if (SpellFamilyFlags[1] & 0x10 || SpellFamilyFlags[0] & 0x2)
2606  break;
2607  }
2608  case SPELLFAMILY_PRIEST:
2609  {
2610  // Divine Spirit and Prayer of Spirit
2611  if (SpellFamilyFlags[0] & 0x20)
2613 
2614  break;
2615  }
2616  case SPELLFAMILY_HUNTER:
2617  {
2618  // only hunter stings have this
2619  if (Dispel == DISPEL_POISON)
2620  return SPELL_SPECIFIC_STING;
2621 
2622  // only hunter aspects have this (but not all aspects in hunter family)
2623  if (SpellFamilyFlags & flag128(0x00200000, 0x00000000, 0x00001010, 0x00000000))
2624  return SPELL_SPECIFIC_ASPECT;
2625 
2626  break;
2627  }
2628  case SPELLFAMILY_PALADIN:
2629  {
2630  // Collection of all the seal family flags. No other paladin spell has any of those.
2631  if (SpellFamilyFlags[1] & 0xA2000800)
2632  return SPELL_SPECIFIC_SEAL;
2633 
2634  if (SpellFamilyFlags[0] & 0x00002190)
2635  return SPELL_SPECIFIC_HAND;
2636 
2637  // Judgement
2638  if (Id == 20271)
2639  return SPELL_SPECIFIC_JUDGEMENT;
2640 
2641  // only paladin auras have this (for palaldin class family)
2642  switch (Id)
2643  {
2644  case 465: // Devotion Aura
2645  case 32223: // Crusader Aura
2646  case 183435: // Retribution Aura
2647  case 317920: // Concentration Aura
2648  return SPELL_SPECIFIC_AURA;
2649  default:
2650  break;
2651  }
2652 
2653  break;
2654  }
2655  case SPELLFAMILY_SHAMAN:
2656  {
2657  // family flags 10 (Lightning), 42 (Earth), 37 (Water), proc shield from T2 8 pieces bonus
2658  if (SpellFamilyFlags[1] & 0x420
2659  || SpellFamilyFlags[0] & 0x00000400
2660  || Id == 23552)
2662 
2663  break;
2664  }
2666  if (Id == 48266 || Id == 48263 || Id == 48265)
2667  return SPELL_SPECIFIC_PRESENCE;
2668  break;
2669  }
2670 
2671  for (SpellEffectInfo const& effect : GetEffects())
2672  {
2673  if (effect.IsEffect(SPELL_EFFECT_APPLY_AURA))
2674  {
2675  switch (effect.ApplyAuraName)
2676  {
2677  case SPELL_AURA_MOD_CHARM:
2680  case SPELL_AURA_AOE_CHARM:
2681  return SPELL_SPECIFIC_CHARM;
2684  if (Id == 30645) // Gas Cloud Tracking
2685  return SPELL_SPECIFIC_NORMAL;
2686  /* fallthrough */
2689  return SPELL_SPECIFIC_TRACKER;
2690  default:
2691  break;
2692  }
2693  }
2694  }
2695  return SPELL_SPECIFIC_NORMAL;
2696  }();
2697 }
Definition: SharedDefines.h:6064
Definition: SpellInfo.h:131
Definition: SpellInfo.h:144
Definition: SpellInfo.h:125
Definition: SpellAuraDefines.h:133
Definition: SpellAuraDefines.h:173
SpellSpecificType _spellSpecific
Definition: SpellInfo.h:615
Definition: SpellInfo.h:128
Definition: SpellAuraDefines.h:108
SpellInfo const * GetFirstRankSpell() const
Definition: SpellInfo.cpp:4170
Definition: SpellInfo.h:140
Definition: SharedDefines.h:6057
Definition: SpellInfo.h:133
Definition: SpellInfo.h:335
Definition: SpellInfo.h:138
flag128 SpellFamilyFlags
Definition: SpellInfo.h:419
uint32 Dispel
Definition: SpellInfo.h:343
bool HasAuraInterruptFlag(SpellAuraInterruptFlags flag) const
Definition: SpellInfo.h:469
Definition: SpellAuraDefines.h:90
Definition: SpellInfo.h:146
Definition: SharedDefines.h:6069
Definition: SharedDefines.h:1104
Definition: SpellInfo.h:130
Definition: SpellInfo.h:143
Definition: SharedDefines.h:6060
Definition: SpellInfo.h:124
Definition: SharedDefines.h:2392
uint32 const Id
Definition: SpellInfo.h:340
Definition: SpellInfo.h:134
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition: SpellInfo.h:580
uint32 SpellFamilyName
Definition: SpellInfo.h:418
Definition: SpellInfo.h:129
Definition: SharedDefines.h:6054
Definition: SpellInfo.h:123
Definition: Util.h:400
Definition: SpellAuraDefines.h:93
Definition: SpellInfo.h:227
Definition: SpellInfo.h:126
Definition: SpellInfo.h:141
Definition: SpellInfo.h:132
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:579
Definition: SpellAuraDefines.h:466
SpellSpecificType
Definition: SpellInfo.h:120
Definition: SpellAuraDefines.h:265
Definition: SpellInfo.h:127
Definition: SharedDefines.h:6058
Definition: SpellAuraDefines.h:132
Definition: SharedDefines.h:28
Definition: SpellInfo.h:135
Definition: SharedDefines.h:6059
Definition: SpellAuraDefines.h:239
Definition: SharedDefines.h:6065
Definition: SpellAuraDefines.h:94
Definition: SpellAuraDefines.h:172
Definition: SharedDefines.h:6063
Definition: SpellAuraDefines.h:109
Definition: SharedDefines.h:2394
Definition: SpellInfo.h:139
Definition: SpellInfo.h:137
Definition: SpellInfo.h:142
Definition: SpellInfo.h:122
Definition: SpellInfo.h:136
+ Here is the call graph for this function:

◆ _UnloadImplicitTargetConditionLists()

void SpellInfo::_UnloadImplicitTargetConditionLists ( )
private
4781 {
4782  // find the same instances of ConditionList and delete them.
4783  for (SpellEffectInfo const& effect : _effects)
4784  {
4785  ConditionContainer* cur = effect.ImplicitTargetConditions;
4786  if (!cur)
4787  continue;
4788 
4789  for (size_t j = effect.EffectIndex; j < _effects.size(); ++j)
4790  if (_effects[j].ImplicitTargetConditions == cur)
4791  _effects[j].ImplicitTargetConditions = nullptr;
4792 
4793  delete cur;
4794  }
4795 }
std::vector< SpellEffectInfo > _effects
Definition: SpellInfo.h:613
Definition: SpellInfo.h:227
std::vector< Condition * > ConditionContainer
Definition: ConditionMgr.h:257
+ Here is the caller graph for this function:

◆ ApplyAllSpellImmunitiesTo()

void SpellInfo::ApplyAllSpellImmunitiesTo ( Unit target,
SpellEffectInfo const &  spellEffectInfo,
bool  apply 
) const
3472 {
3473  ImmunityInfo const* immuneInfo = spellEffectInfo.GetImmunityInfo();
3474 
3475  if (uint32 schoolImmunity = immuneInfo->SchoolImmuneMask)
3476  {
3477  target->ApplySpellImmune(Id, IMMUNITY_SCHOOL, schoolImmunity, apply);
3478 
3480  {
3481  target->RemoveAppliedAuras([this, schoolImmunity](AuraApplication const* aurApp) -> bool
3482  {
3483  SpellInfo const* auraSpellInfo = aurApp->GetBase()->GetSpellInfo();
3484  return ((auraSpellInfo->GetSchoolMask() & schoolImmunity) != 0 && // Check for school mask
3485  CanDispelAura(auraSpellInfo) &&
3486  (IsPositive() != aurApp->IsPositive()) && // Check spell vs aura possitivity
3487  !auraSpellInfo->IsPassive() && // Don't remove passive auras
3488  auraSpellInfo->Id != Id); // Don't remove self
3489  });
3490  }
3491 
3492  if (apply && schoolImmunity & SPELL_SCHOOL_MASK_NORMAL)
3494  }
3495 
3496  if (uint32 mechanicImmunity = immuneInfo->MechanicImmuneMask)
3497  {
3498  for (uint32 i = 0; i < MAX_MECHANIC; ++i)
3499  if (mechanicImmunity & (1 << i))
3501 
3503  target->RemoveAurasWithMechanic(mechanicImmunity, AURA_REMOVE_BY_DEFAULT, Id);
3504  }
3505 
3506  if (uint32 dispelImmunity = immuneInfo->DispelImmune)
3507  {
3508  target->ApplySpellImmune(Id, IMMUNITY_DISPEL, dispelImmunity, apply);
3509 
3511  {
3512  target->RemoveAppliedAuras([dispelImmunity](AuraApplication const* aurApp) -> bool
3513  {
3514  SpellInfo const* spellInfo = aurApp->GetBase()->GetSpellInfo();
3515  if (spellInfo->Dispel == dispelImmunity)
3516  return true;
3517 
3518  return false;
3519  });
3520  }
3521  }
3522 
3523  if (uint32 damageImmunity = immuneInfo->DamageSchoolMask)
3524  {
3525  target->ApplySpellImmune(Id, IMMUNITY_DAMAGE, damageImmunity, apply);
3526 
3527  if (apply && damageImmunity & SPELL_SCHOOL_MASK_NORMAL)
3529  }
3530 
3531  for (AuraType auraType : immuneInfo->AuraTypeImmune)
3532  {
3533  target->ApplySpellImmune(Id, IMMUNITY_STATE, auraType, apply);
3535  target->RemoveAurasByType(auraType);
3536  }
3537 
3538  for (SpellEffectName effectType : immuneInfo->SpellEffectImmune)
3539  target->ApplySpellImmune(Id, IMMUNITY_EFFECT, effectType, apply);
3540 }
boost::container::flat_set< AuraType > AuraTypeImmune
Definition: SpellInfo.h:223
Definition: SharedDefines.h:2415
bool IsPositive() const
Definition: SpellAuras.h:81
uint32 SchoolImmuneMask
Definition: SpellInfo.h:217
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:134
boost::container::flat_set< SpellEffectName > SpellEffectImmune
Definition: SpellInfo.h:224
Definition: SpellInfo.h:335
void RemoveAppliedAuras(std::function< bool(AuraApplication const *)> const &check)
Definition: Unit.cpp:3580
uint32 DispelImmune
Definition: SpellInfo.h:220
Definition: SpellAuras.h:53
uint32 Dispel
Definition: SpellInfo.h:343
Definition: SharedDefines.h:2413
bool CanDispelAura(SpellInfo const *auraSpellInfo) const
Definition: SpellInfo.cpp:1777
SpellEffectName
Definition: SharedDefines.h:1096
AuraType
Definition: SpellAuraDefines.h:86
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition: Unit.cpp:7439
bool IsPassive() const
Definition: SpellInfo.cpp:1492
R apply(R(*func)(Ts...), apply_tuple_type< Ts... > &&args)
Definition: advstd.h:37
void RemoveAurasWithInterruptFlags(InterruptFlags flag, uint32 except=0)
Definition: Unit.cpp:3902
uint32 const Id
Definition: SpellInfo.h:340
Definition: SharedDefines.h:433
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:449
uint32 DamageSchoolMask
Definition: SpellInfo.h:221
uint32_t uint32
Definition: Define.h:152
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:2344
bool IsPositive() const
Definition: SpellInfo.cpp:1608
void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
Definition: Unit.cpp:3979
Definition: SpellInfo.h:215
Definition: SharedDefines.h:2416
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check)
Definition: Unit.cpp:3632
Definition: SpellAuraDefines.h:65
Definition: SharedDefines.h:2412
uint32 MechanicImmuneMask
Definition: SpellInfo.h:219
Definition: SharedDefines.h:2414
Definition: SharedDefines.h:2417
Definition: SharedDefines.h:2375
Aura * GetBase() const
Definition: SpellAuras.h:75
Definition: SharedDefines.h:306
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalcCastTime()

uint32 SpellInfo::CalcCastTime ( Spell spell = nullptr) const
3720 {
3721  int32 castTime = 0;
3722  if (CastTimeEntry)
3723  castTime = std::max(CastTimeEntry->Base, CastTimeEntry->Minimum);
3724 
3725  if (castTime <= 0)
3726  return 0;
3727 
3728  if (spell)
3729  spell->GetCaster()->ModSpellCastTime(this, castTime, spell);
3730 
3732  castTime += 500;
3733 
3734  return (castTime > 0) ? uint32(castTime) : 0;
3735 }
void ModSpellCastTime(SpellInfo const *spellInfo, int32 &castTime, Spell *spell=nullptr) const
Definition: Object.cpp:2246
SpellCastTimesEntry const * CastTimeEntry
Definition: SpellInfo.h:376
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:449
bool IsAutoRepeatRangedSpell() const
Definition: SpellInfo.cpp:1650
int32_t int32
Definition: Define.h:148
uint32_t uint32
Definition: Define.h:152
int32 Minimum
Definition: DB2Structure.h:3034
int32 Base
Definition: DB2Structure.h:3033
WorldObject * GetCaster() const
Definition: Spell.h:601
Definition: SharedDefines.h:383
Definition: SharedDefines.h:714
+ 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
3695 {
3696  int32 duration = GetDuration();
3697 
3698  if (caster)
3699  if (Player* modOwner = caster->GetSpellModOwner())
3700  modOwner->ApplySpellMod(this, SpellModOp::Duration, duration);
3701 
3702  return duration;
3703 }
int32_t int32
Definition: Define.h:148
int32 GetDuration() const
Definition: SpellInfo.cpp:3705
Player * GetSpellModOwner() const
Definition: Object.cpp:2075
Definition: Player.h:1081
+ 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
3785 {
3786  // gameobject casts don't use power
3787  Unit const* unitCaster = caster->ToUnit();
3788  if (!unitCaster)
3789  return {};
3790 
3791  auto itr = std::find_if(PowerCosts.cbegin(), PowerCosts.cend(), [powerType](SpellPowerEntry const* spellPowerEntry)
3792  {
3793  return spellPowerEntry && spellPowerEntry->PowerType == powerType;
3794  });
3795  if (itr == PowerCosts.cend())
3796  return {};
3797 
3798  return CalcPowerCost(*itr, optionalCost, caster, schoolMask, spell);
3799 }
Definition: DB2Structure.h:3254
std::array< SpellPowerEntry const *, MAX_POWERS_PER_SPELL > PowerCosts
Definition: SpellInfo.h:396
Definition: Unit.h:737
Unit * ToUnit()
Definition: Object.h:200
Optional< SpellPowerCost > CalcPowerCost(Powers powerType, bool optionalCost, WorldObject const *caster, SpellSchoolMask schoolMask, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:3784
+ 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
3802 {
3803  // gameobject casts don't use power
3804  Unit const* unitCaster = caster->ToUnit();
3805  if (!unitCaster)
3806  return {};
3807 
3808  if (power->RequiredAuraSpellID && !unitCaster->HasAura(power->RequiredAuraSpellID))
3809  return {};
3810 
3811  // Spell drain all exist power on cast (Only paladin lay of Hands)
3813  {
3814  // If power type - health drain all
3815  if (power->PowerType == POWER_HEALTH)
3816  {
3817  SpellPowerCost cost;
3818  cost.Power = POWER_HEALTH;
3819  cost.Amount = unitCaster->GetHealth();
3820  return cost;
3821  }
3822  // Else drain all power
3823  if (power->PowerType < MAX_POWERS)
3824  {
3825  SpellPowerCost cost;
3826  cost.Power = Powers(power->PowerType);
3827  cost.Amount = unitCaster->GetPower(cost.Power);
3828  return cost;
3829  }
3830 
3831  TC_LOG_ERROR("spells", "SpellInfo::CalcPowerCost: Unknown power type '%d' in spell %d", power->PowerType, Id);
3832  return {};
3833  }
3834 
3835  // Base powerCost
3836  int32 powerCost = 0;
3837  if (!optionalCost)
3838  {
3839  powerCost = power->ManaCost;
3840  // PCT cost from total amount
3841  if (power->PowerCostPct)
3842  {
3843  switch (power->PowerType)
3844  {
3845  // health as power used
3846  case POWER_HEALTH:
3847  if (G3D::fuzzyEq(power->PowerCostPct, 0.0f))
3848  powerCost += int32(CalculatePct(unitCaster->GetMaxHealth(), power->PowerCostMaxPct));
3849  else
3850  powerCost += int32(CalculatePct(unitCaster->GetMaxHealth(), power->PowerCostPct));
3851  break;
3852  case POWER_MANA:
3853  powerCost += int32(CalculatePct(unitCaster->GetCreateMana(), power->PowerCostPct));
3854  break;
3855  case POWER_ALTERNATE_POWER:
3856  TC_LOG_ERROR("spells", "SpellInfo::CalcPowerCost: Unknown power type '%d' in spell %d", power->PowerType, Id);
3857  return {};
3858  default:
3859  {
3860  if (PowerTypeEntry const* powerTypeEntry = sDB2Manager.GetPowerTypeEntry(Powers(power->PowerType)))
3861  {
3862  powerCost += int32(CalculatePct(powerTypeEntry->MaxBasePower, power->PowerCostPct));
3863  break;
3864  }
3865 
3866  TC_LOG_ERROR("spells", "SpellInfo::CalcPowerCost: Unknown power type '%d' in spell %d", power->PowerType, Id);
3867  return {};
3868  }
3869  }
3870  }
3871  }
3872  else
3873  {
3874  powerCost = int32(power->OptionalCost);
3875  powerCost += unitCaster->GetTotalAuraModifier(SPELL_AURA_MOD_ADDITIONAL_POWER_COST, [this, power](AuraEffect const* aurEff) -> bool
3876  {
3877  return aurEff->GetMiscValue() == power->PowerType
3878  && aurEff->IsAffectingSpell(this);
3879  });
3880  }
3881 
3882  bool initiallyNegative = powerCost < 0;
3883 
3884  // Shiv - costs 20 + weaponSpeed*10 energy (apply only to non-triggered spell with energy cost)
3886  {
3887  uint32 speed = 0;
3888  if (SpellShapeshiftFormEntry const* ss = sSpellShapeshiftFormStore.LookupEntry(unitCaster->GetShapeshiftForm()))
3889  speed = ss->CombatRoundTime;
3890  else
3891  {
3894  slot = OFF_ATTACK;
3895 
3896  speed = unitCaster->GetBaseAttackTime(slot);
3897  }
3898 
3899  powerCost += speed / 100;
3900  }
3901 
3902  if (power->PowerType != POWER_HEALTH)
3903  {
3904  if (!optionalCost)
3905  {
3906  // Flat mod from caster auras by spell school and power type
3907  for (AuraEffect const* aura : unitCaster->GetAuraEffectsByType(SPELL_AURA_MOD_POWER_COST_SCHOOL))
3908  {
3909  if (!(aura->GetMiscValue() & schoolMask))
3910  continue;
3911 
3912  if (!(aura->GetMiscValueB() & (1 << power->PowerType)))
3913  continue;
3914 
3915  powerCost += aura->GetAmount();
3916  }
3917  }
3918 
3919  // PCT mod from user auras by spell school and power type
3920  for (auto schoolCostPct : unitCaster->GetAuraEffectsByType(SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT))
3921  {
3922  if (!(schoolCostPct->GetMiscValue() & schoolMask))
3923  continue;
3924 
3925  if (!(schoolCostPct->GetMiscValueB() & (1 << power->PowerType)))
3926  continue;
3927 
3928  powerCost += CalculatePct(powerCost, schoolCostPct->GetAmount());
3929  }
3930  }
3931 
3932  // Apply cost mod by spell
3933  if (Player* modOwner = unitCaster->GetSpellModOwner())
3934  {
3936  switch (power->OrderIndex)
3937  {
3938  case 0:
3939  mod = SpellModOp::PowerCost0;
3940  break;
3941  case 1:
3942  mod = SpellModOp::PowerCost1;
3943  break;
3944  case 2:
3945  mod = SpellModOp::PowerCost2;
3946  break;
3947  default:
3948  break;
3949  }
3950 
3951  if (mod)
3952  {
3953  if (!optionalCost)
3954  modOwner->ApplySpellMod(this, *mod, powerCost, spell);
3955  else
3956  {
3957  // optional cost ignores flat modifiers
3958  int32 flatMod = 0;
3959  float pctMod = 1.0f;
3960  modOwner->GetSpellModValues(this, *mod, spell, powerCost, &flatMod, &pctMod);
3961  powerCost = int32(powerCost * pctMod);
3962  }
3963  }
3964  }
3965 
3966  if (!unitCaster->IsControlledByPlayer() && G3D::fuzzyEq(power->PowerCostPct, 0.0f) && SpellLevel && power->PowerType == POWER_MANA)
3967  {
3969  {
3971  GtNpcManaCostScalerEntry const* casterScaler = sNpcManaCostScalerGameTable.GetRow(unitCaster->getLevel());
3972  if (spellScaler && casterScaler)
3973  powerCost *= casterScaler->Scaler / spellScaler->Scaler;
3974  }
3975  }
3976 
3977  if (power->PowerType == POWER_MANA)
3978  powerCost = float(powerCost) * (1.0f + unitCaster->m_unitData->ManaCostMultiplier);
3979 
3980  // power cost cannot become negative if initially positive
3981  if (initiallyNegative != (powerCost < 0))
3982  powerCost = 0;
3983 
3984  SpellPowerCost cost;
3985  cost.Power = Powers(power->PowerType);
3986  cost.Amount = powerCost;
3987  return cost;
3988 }
Definition: SpellAuraDefines.h:151
Definition: SpellAuraEffects.h:28
Powers
Definition: SharedDefines.h:263
#define sDB2Manager
Definition: DB2Stores.h:446
Definition: SpellAuraDefines.h:161
Definition: SharedDefines.h:514
bool IsAffectingSpell(SpellInfo const *spell) const
Definition: SpellAuraEffects.cpp:1044
uint32 SpellLevel
Definition: SpellInfo.h:394
DB2Storage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore("SpellShapeshiftForm.db2", SpellShapeshiftFormLoadInfo::Instance())
uint8 getLevel() const
Definition: Unit.h:847
Definition: SharedDefines.h:275
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4415
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:186
Definition: DB2Structure.h:2668
Definition: SharedDefines.h:401
Definition: SharedDefines.h:284
uint32 GetBaseAttackTime(WeaponAttackType att) const
Definition: Unit.cpp:10023
Definition: SharedDefines.h:419
int32 Amount
Definition: SpellInfo.h:332
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:56
Definition: SpellInfo.h:329
ShapeshiftForm GetShapeshiftForm() const
Definition: Unit.h:1511
uint32 const Id
Definition: SpellInfo.h:340
uint64 GetHealth() const
Definition: Unit.h:875
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:449
float Scaler
Definition: GameTables.h:115
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1374
Powers Power
Definition: SpellInfo.h:331
int32 GetTotalAuraModifier(AuraType auraType) const
Definition: Unit.cpp:4672
UF::UpdateField< UF::UnitData, 0, TYPEID_UNIT > m_unitData
Definition: Unit.h:1835
int32_t int32
Definition: Define.h:148
uint32_t uint32
Definition: Define.h:152
Definition: SharedDefines.h:536
Definition: GameTables.h:113
uint32 GetCreateMana() const
Definition: Unit.h:1448
Definition: DB2Structure.h:3353
T CalculatePct(T base, U pct)
Definition: Util.h:70
Definition: SharedDefines.h:6352
int32 GetPower(Powers power) const
Definition: Unit.cpp:8905
Player * GetSpellModOwner() const
Definition: Object.cpp:2075
WeaponAttackType
Definition: SharedDefines.h:6350
Definition: SharedDefines.h:265
uint64 GetMaxHealth() const
Definition: Unit.h:876
Definition: SharedDefines.h:286
Definition: Unit.h:737
Definition: OptionalFwd.h:24
Definition: SpellAuraDefines.h:160
Definition: Player.h:1081
Unit * ToUnit()
Definition: Object.h:200
GameTable< GtNpcManaCostScalerEntry > sNpcManaCostScalerGameTable
Definition: GameTables.cpp:35
Definition: SharedDefines.h:500
bool IsControlledByPlayer() const
Definition: Unit.h:1250
Definition: SharedDefines.h:6353
+ 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
3991 {
3992  std::vector<SpellPowerCost> costs;
3993  if (caster->IsUnit())
3994  {
3995  costs.reserve(MAX_POWERS_PER_SPELL);
3996 
3997  auto getOrCreatePowerCost = [&](Powers powerType) -> SpellPowerCost&
3998  {
3999  auto itr = std::find_if(costs.begin(), costs.end(), [powerType](SpellPowerCost const& cost)
4000  {
4001  return cost.Power == powerType;
4002  });
4003  if (itr != costs.end())
4004  return *itr;
4005 
4006  SpellPowerCost cost;
4007  cost.Power = powerType;
4008  cost.Amount = 0;
4009  costs.push_back(cost);
4010  return costs.back();
4011  };
4012 
4013  for (SpellPowerEntry const* power : PowerCosts)
4014  {
4015  if (!power)
4016  continue;
4017 
4018  if (Optional<SpellPowerCost> cost = CalcPowerCost(power, false, caster, schoolMask, spell))
4019  getOrCreatePowerCost(cost->Power).Amount += cost->Amount;
4020 
4021  if (Optional<SpellPowerCost> optionalCost = CalcPowerCost(power, true, caster, schoolMask, spell))
4022  {
4023  SpellPowerCost& cost = getOrCreatePowerCost(optionalCost->Power);
4024  int32 remainingPower = caster->ToUnit()->GetPower(optionalCost->Power) - cost.Amount;
4025  if (remainingPower > 0)
4026  cost.Amount += std::min(optionalCost->Amount, remainingPower);
4027  }
4028  }
4029  }
4030 
4031  return costs;
4032 }
Powers
Definition: SharedDefines.h:263
constexpr std::size_t MAX_POWERS_PER_SPELL
Definition: DBCEnums.h:1471
int32 Amount
Definition: SpellInfo.h:332
Definition: DB2Structure.h:3254
Definition: SpellInfo.h:329
Powers Power
Definition: SpellInfo.h:331
int32_t int32
Definition: Define.h:148
std::array< SpellPowerEntry const *, MAX_POWERS_PER_SPELL > PowerCosts
Definition: SpellInfo.h:396
Definition: OptionalFwd.h:24
Optional< SpellPowerCost > CalcPowerCost(Powers powerType, bool optionalCost, WorldObject const *caster, SpellSchoolMask schoolMask, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:3784
+ Here is the call graph for this function:

◆ CalcProcPPM()

float SpellInfo::CalcProcPPM ( Unit caster,
int32  itemLevel 
) const
4101 {
4102  float ppm = ProcBasePPM;
4103  if (!caster)
4104  return ppm;
4105 
4106  for (SpellProcsPerMinuteModEntry const* mod : ProcPPMMods)
4107  {
4108  switch (mod->Type)
4109  {
4110  case SPELL_PPM_MOD_HASTE:
4111  {
4112  ppm *= 1.0f + CalcPPMHasteMod(mod, caster);
4113  break;
4114  }
4115  case SPELL_PPM_MOD_CRIT:
4116  {
4117  ppm *= 1.0f + CalcPPMCritMod(mod, caster);
4118  break;
4119  }
4120  case SPELL_PPM_MOD_CLASS:
4121  {
4122  if (caster->getClassMask() & mod->Param)
4123  ppm *= 1.0f + mod->Coeff;
4124  break;
4125  }
4126  case SPELL_PPM_MOD_SPEC:
4127  {
4128  if (Player* plrCaster = caster->ToPlayer())
4129  if (plrCaster->GetPrimarySpecialization() == uint32(mod->Param))
4130  ppm *= 1.0f + mod->Coeff;
4131  break;
4132  }
4133  case SPELL_PPM_MOD_RACE:
4134  {
4135  if (caster->getRaceMask() & mod->Param)
4136  ppm *= 1.0f + mod->Coeff;
4137  break;
4138  }
4140  {
4141  ppm *= 1.0f + CalcPPMItemLevelMod(mod, itemLevel);
4142  break;
4143  }
4145  {
4146  if (caster->GetMap()->IsBattlegroundOrArena())
4147  ppm *= 1.0f + mod->Coeff;
4148  break;
4149  }
4150  default:
4151  break;
4152  }
4153  }
4154 
4155  return ppm;
4156 }
Definition: DBCEnums.h:1467
Definition: DBCEnums.h:1462
float CalcPPMHasteMod(SpellProcsPerMinuteModEntry const *mod, Unit *caster)
Definition: SpellInfo.cpp:4034
Definition: DBCEnums.h:1466
bool IsBattlegroundOrArena() const
Definition: Map.cpp:4318
Definition: DBCEnums.h:1465
Player * ToPlayer()
Definition: Object.h:192
Map * GetMap() const
Definition: Object.h:535
Definition: DBCEnums.h:1463
Definition: DB2Structure.h:3287
Definition: DBCEnums.h:1468
std::vector< SpellProcsPerMinuteModEntry const * > ProcPPMMods
Definition: SpellInfo.h:391
uint64 getRaceMask() const
Definition: Unit.h:852
float CalcPPMCritMod(SpellProcsPerMinuteModEntry const *mod, Unit *caster)
Definition: SpellInfo.cpp:4060
float ProcBasePPM
Definition: SpellInfo.h:390
uint32_t uint32
Definition: Define.h:152
Definition: DBCEnums.h:1464
float CalcPPMItemLevelMod(SpellProcsPerMinuteModEntry const *mod, int32 itemLevel)
Definition: SpellInfo.cpp:4087
uint32 getClassMask() const
Definition: Unit.h:855
Definition: Player.h:1081
+ 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 
) const
1346 {
1349  || (interruptTarget->IsPlayer() && InterruptFlags.HasFlag(SpellInterruptFlags::DamageCancelsPlayerOnly))
1351  || (interruptCaster->IsUnit() && interruptCaster->ToUnit()->HasAuraTypeWithMiscvalue(SPELL_AURA_ALLOW_INTERRUPT_SPELL, Id))
1352  || (!(interruptTarget->GetMechanicImmunityMask() & (1 << MECHANIC_INTERRUPT))
1353  && !interruptTarget->HasAuraTypeWithAffectMask(SPELL_AURA_PREVENT_INTERRUPT, this)
1355 }
Definition: SharedDefines.h:2615
uint32 const Id
Definition: SpellInfo.h:340
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:449
Definition: SpellAuraDefines.h:572
Definition: SharedDefines.h:2368
Definition: SpellAuraDefines.h:291
uint32 PreventionType
Definition: SpellInfo.h:421
constexpr bool HasFlag(T flag) const
Definition: EnumFlag.h:106
Definition: SharedDefines.h:647
bool HasChannelInterruptFlag(SpellAuraInterruptFlags flag) const
Definition: SpellInfo.h:472
EnumFlag< SpellInterruptFlags > InterruptFlags
Definition: SpellInfo.h:381
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanBeUsedInCombat()

bool SpellInfo::CanBeUsedInCombat ( ) const
1604 {
1606 }
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:449
Definition: SharedDefines.h:410
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanDispelAura()

bool SpellInfo::CanDispelAura ( SpellInfo const *  auraSpellInfo) const
1778 {
1779  // These auras (like Divine Shield) can't be dispelled
1780  if (auraSpellInfo->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY))
1781  return false;
1782 
1783  // These spells (like Mass Dispel) can dispel all auras
1785  return true;
1786 
1787  // These auras (Cyclone for example) are not dispelable
1788  if ((auraSpellInfo->HasAttribute(SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE) && auraSpellInfo->Mechanic != MECHANIC_NONE)
1789  || auraSpellInfo->HasAttribute(SPELL_ATTR2_UNAFFECTED_BY_AURA_SCHOOL_IMMUNE))
1790  return false;
1791 
1792  return true;
1793 }
Definition: SharedDefines.h:2342
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:449
Definition: SharedDefines.h:480
Definition: SharedDefines.h:411
Definition: SharedDefines.h:434
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanPierceImmuneAura()

bool SpellInfo::CanPierceImmuneAura ( SpellInfo const *  auraSpellInfo) const
1751 {
1752  // aura can't be pierced
1753  if (!auraSpellInfo || auraSpellInfo->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY))
1754  return false;
1755 
1756  // these spells pierce all available spells (Resurrection Sickness for example)
1758  return true;
1759 
1760  // these spells (Cyclone for example) can pierce all...
1762  {
1763  // ...but not these (Divine shield, Ice block, Cyclone and Banish for example)
1764  if (auraSpellInfo->Mechanic != MECHANIC_IMMUNE_SHIELD &&
1765  auraSpellInfo->Mechanic != MECHANIC_INVULNERABILITY &&
1766  (auraSpellInfo->Mechanic != MECHANIC_BANISH || (IsRankOf(auraSpellInfo) && auraSpellInfo->Dispel != DISPEL_NONE))) // Banish shouldn't be immune to itself, but Cyclone should
1767  return true;
1768  }
1769 
1770  // Dispels other auras on immunity, check if this spell makes the unit immune to aura
1772  return true;
1773 
1774  return false;
1775 }
Definition: SharedDefines.h:2371
Definition: SharedDefines.h:2360
Definition: SharedDefines.h:2367
Definition: SharedDefines.h:433
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:449
bool CanSpellProvideImmunityAgainstAura(SpellInfo const *auraSpellInfo) const
Definition: SpellInfo.cpp:3542
Definition: SharedDefines.h:480
bool IsRankOf(SpellInfo const *spellInfo) const
Definition: SpellInfo.cpp:4239
Definition: SharedDefines.h:2390
Definition: SharedDefines.h:411
Definition: SharedDefines.h:434
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanSpellProvideImmunityAgainstAura()

bool SpellInfo::CanSpellProvideImmunityAgainstAura ( SpellInfo const *  auraSpellInfo) const
3543 {
3544  if (!auraSpellInfo)
3545  return false;
3546 
3547  for (SpellEffectInfo const& effectInfo : _effects)
3548  {
3549  if (!effectInfo.IsEffect())
3550  continue;
3551 
3552  ImmunityInfo const* immuneInfo = effectInfo.GetImmunityInfo();
3553 
3554  if (!auraSpellInfo->HasAttribute(SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE) && !auraSpellInfo->HasAttribute(SPELL_ATTR2_UNAFFECTED_BY_AURA_SCHOOL_IMMUNE))
3555  {
3556  if (uint32 schoolImmunity = immuneInfo->SchoolImmuneMask)
3557  if ((auraSpellInfo->SchoolMask & schoolImmunity) != 0)
3558  return true;
3559  }
3560 
3561  if (uint32 mechanicImmunity = immuneInfo->MechanicImmuneMask)
3562  if ((mechanicImmunity & (1 << auraSpellInfo->Mechanic)) != 0)
3563  return true;
3564 
3565  if (uint32 dispelImmunity = immuneInfo->DispelImmune)
3566  if (auraSpellInfo->Dispel == dispelImmunity)
3567  return true;
3568 
3569  bool immuneToAllEffects = true;
3570  for (SpellEffectInfo const& auraSpellEffectInfo : auraSpellInfo->GetEffects())
3571  {
3572  if (!auraSpellEffectInfo.IsEffect())
3573  continue;
3574 
3575  auto spellImmuneItr = immuneInfo->SpellEffectImmune.find(auraSpellEffectInfo.Effect);
3576  if (spellImmuneItr == immuneInfo->SpellEffectImmune.cend())
3577  {
3578  immuneToAllEffects = false;
3579  break;
3580  }
3581 
3582  if (uint32 mechanic = auraSpellEffectInfo.Mechanic)
3583  {
3584  if (!(immuneInfo->MechanicImmuneMask & (1 << mechanic)))
3585  {
3586  immuneToAllEffects = false;
3587  break;
3588  }
3589  }
3590 
3591  if (!auraSpellInfo->HasAttribute(SPELL_ATTR3_IGNORE_HIT_RESULT))
3592  {
3593  if (AuraType auraName = auraSpellEffectInfo.ApplyAuraName)
3594  {
3595  bool isImmuneToAuraEffectApply = false;
3596  auto auraImmuneItr = immuneInfo->AuraTypeImmune.find(auraName);
3597  if (auraImmuneItr != immuneInfo->AuraTypeImmune.cend())
3598  isImmuneToAuraEffectApply = true;
3599 
3600  if (!isImmuneToAuraEffectApply && !auraSpellInfo->IsPositiveEffect(auraSpellEffectInfo.EffectIndex) && !auraSpellInfo->HasAttribute(SPELL_ATTR2_UNAFFECTED_BY_AURA_SCHOOL_IMMUNE))
3601  {
3602  if (uint32 applyHarmfulAuraImmunityMask = immuneInfo->ApplyHarmfulAuraImmuneMask)
3603  if ((auraSpellInfo->GetSchoolMask() & applyHarmfulAuraImmunityMask) != 0)
3604  isImmuneToAuraEffectApply = true;
3605  }
3606 
3607  if (!isImmuneToAuraEffectApply)
3608  {
3609  immuneToAllEffects = false;
3610  break;
3611  }
3612  }
3613  }
3614  }
3615 
3616  if (immuneToAllEffects)
3617  return true;
3618  }
3619 
3620  return false;
3621 }
boost::container::flat_set< AuraType > AuraTypeImmune
Definition: SpellInfo.h:223
uint32 SchoolImmuneMask
Definition: SpellInfo.h:217
boost::container::flat_set< SpellEffectName > SpellEffectImmune
Definition: SpellInfo.h:224
uint32 DispelImmune
Definition: SpellInfo.h:220
AuraType
Definition: SpellAuraDefines.h:86
std::vector< SpellEffectInfo > _effects
Definition: SpellInfo.h:613
Definition: SpellInfo.h:227
uint32_t uint32
Definition: Define.h:152
Definition: SharedDefines.h:480
uint32 ApplyHarmfulAuraImmuneMask
Definition: SpellInfo.h:218
Definition: SpellInfo.h:215
uint32 MechanicImmuneMask
Definition: SpellInfo.h:219
Definition: SharedDefines.h:508
Definition: SharedDefines.h:434
+ 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
2239 {
2240  uint32 neededTargets = GetExplicitTargetMask();
2241  if (!target)
2242  {
2244  if (!(neededTargets & TARGET_FLAG_GAMEOBJECT_ITEM) || !itemTarget)
2245  return SPELL_FAILED_BAD_TARGETS;
2246  return SPELL_CAST_OK;
2247  }
2248 
2249  if (Unit const* unitTarget = target->ToUnit())
2250  {
2252  {
2253  Unit const* unitCaster = caster->ToUnit();
2254  if (neededTargets & TARGET_FLAG_UNIT_ENEMY)
2255  if (caster->IsValidAttackTarget(unitTarget, this))
2256  return SPELL_CAST_OK;
2257  if ((neededTargets & TARGET_FLAG_UNIT_ALLY)
2258  || ((neededTargets & TARGET_FLAG_UNIT_PARTY) && unitCaster && unitCaster->IsInPartyWith(unitTarget))
2259  || ((neededTargets & TARGET_FLAG_UNIT_RAID) && unitCaster && unitCaster->IsInRaidWith(unitTarget)))
2260  if (caster->IsValidAssistTarget(unitTarget, this))
2261  return SPELL_CAST_OK;
2262  if ((neededTargets & TARGET_FLAG_UNIT_MINIPET) && unitCaster)
2263  if (unitTarget->GetGUID() == unitCaster->GetCritterGUID())
2264  return SPELL_CAST_OK;
2265  if ((neededTargets & TARGET_FLAG_UNIT_PASSENGER) && unitCaster)
2266  if (unitTarget->IsOnVehicle(unitCaster))
2267  return SPELL_CAST_OK;
2268  return SPELL_FAILED_BAD_TARGETS;
2269  }
2270  }
2271  return SPELL_CAST_OK;
2272 }
Definition: SpellDefines.h:283
uint32 GetExplicitTargetMask() const
Definition: SpellInfo.cpp:2412
ObjectGuid GetCritterGUID() const
Definition: Unit.h:1237
Definition: SpellDefines.h:274
Definition: SpellDefines.h:287
Definition: SpellDefines.h:281
Definition: SharedDefines.h:1402
Definition: SpellDefines.h:297
Definition: SpellDefines.h:294
uint32_t uint32
Definition: Define.h:152
Definition: SpellDefines.h:270
Definition: SpellDefines.h:296
Definition: SpellDefines.h:269
Definition: SpellDefines.h:275
bool IsInPartyWith(Unit const *unit) const
Definition: Unit.cpp:11152
Definition: Unit.h:737
Definition: SharedDefines.h:1703
Unit * ToUnit()
Definition: Object.h:200
bool IsInRaidWith(Unit const *unit) const
Definition: Unit.cpp:11171
+ 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
1914 {
1915  // normal case
1916  if (RequiredAreasID > 0)
1917  {
1918  bool found = false;
1919  std::vector<uint32> areaGroupMembers = sDB2Manager.GetAreasForGroup(RequiredAreasID);
1920  for (uint32 areaId : areaGroupMembers)
1921  {
1922  if (areaId == zone_id || areaId == area_id)
1923  {
1924  found = true;
1925  break;
1926  }
1927  }
1928 
1929  if (!found)
1931  }
1932 
1933  // continent limitation (virtual continent)
1935  {
1936  uint32 mountFlags = 0;
1937  if (player && player->HasAuraType(SPELL_AURA_MOUNT_RESTRICTIONS))
1938  {
1939  for (AuraEffect const* auraEffect : player->GetAuraEffectsByType(SPELL_AURA_MOUNT_RESTRICTIONS))
1940  mountFlags |= auraEffect->GetMiscValue();
1941  }
1942  else if (AreaTableEntry const* areaTable = sAreaTableStore.LookupEntry(area_id))
1943  mountFlags = areaTable->MountFlags;
1944 
1945  if (!(mountFlags & AREA_MOUNT_FLAG_FLYING_ALLOWED))
1947 
1948  if (player)
1949  {
1950  uint32 mapToCheck = map_id;
1951  if (MapEntry const* mapEntry = sMapStore.LookupEntry(map_id))
1952  mapToCheck = mapEntry->CosmeticParentMapID;
1953 
1954  if ((mapToCheck == 1116 || mapToCheck == 1464) && !player->HasSpell(191645)) // Draenor Pathfinder
1956  else if (mapToCheck == 1220 && !player->HasSpell(233368)) // Broken Isles Pathfinder
1958  else if ((mapToCheck == 1642 || mapToCheck == 1643) && !player->HasSpell(278833)) // Battle for Azeroth Pathfinder
1960  }
1961  }
1962 
1963  // raid instance limitation
1965  {
1966  MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
1967  if (!mapEntry || mapEntry->IsRaid())
1969  }
1970 
1971  // DB base check (if non empty then must fit at least single for allow)
1972  SpellAreaMapBounds saBounds = sSpellMgr->GetSpellAreaMapBounds(Id);
1973  if (saBounds.first != saBounds.second)
1974  {
1975  for (SpellAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
1976  {
1977  if (itr->second.IsFitToRequirements(player, zone_id, area_id))
1978  return SPELL_CAST_OK;
1979  }
1981  }
1982 
1983  // bg spell checks
1984  switch (Id)
1985  {
1986  case 23333: // Warsong Flag
1987  case 23335: // Silverwing Flag
1988  return map_id == 489 && player && player->InBattleground() ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
1989  case 34976: // Netherstorm Flag
1990  return map_id == 566 && player && player->InBattleground() ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
1991  case 2584: // Waiting to Resurrect
1992  case 22011: // Spirit Heal Channel
1993  case 22012: // Spirit Heal
1994  case 24171: // Resurrection Impact Visual
1995  case 42792: // Recently Dropped Flag
1996  case 43681: // Inactive
1997  case 44535: // Spirit Heal (mana)
1998  {
1999  MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
2000  if (!mapEntry)
2002 
2003  return zone_id == 4197 || (mapEntry->IsBattleground() && player && player->InBattleground()) ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
2004  }
2005  case 44521: // Preparation
2006  {
2007  if (!player)
2009 
2010  MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
2011  if (!mapEntry)
2013 
2014  if (!mapEntry->IsBattleground())
2016 
2017  Battleground* bg = player->GetBattleground();
2019  }
2020  case 32724: // Gold Team (Alliance)
2021  case 32725: // Green Team (Alliance)
2022  case 35774: // Gold Team (Horde)
2023  case 35775: // Green Team (Horde)
2024  {
2025  MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
2026  if (!mapEntry)
2028 
2029  return mapEntry->IsBattleArena() && player && player->InBattleground() ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
2030  }
2031  case 32727: // Arena Preparation
2032  {
2033  if (!player)
2035 
2036  MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
2037  if (!mapEntry)
2039 
2040  if (!mapEntry->IsBattleArena())
2042 
2043  Battleground* bg = player->GetBattleground();
2045  }
2046  }
2047 
2048  // aura limitations
2049  if (player)
2050  {
2051  for (SpellEffectInfo const& effect : GetEffects())
2052  {
2053  if (!effect.IsAura())
2054  continue;
2055 
2056  switch (effect.ApplyAuraName)
2057  {
2059  {
2060  if (SpellShapeshiftFormEntry const* spellShapeshiftForm = sSpellShapeshiftFormStore.LookupEntry(effect.MiscValue))
2061  if (uint32 mountType = spellShapeshiftForm->MountTypeID)
2062  if (!player->GetMountCapability(mountType))
2063  return SPELL_FAILED_NOT_HERE;
2064  break;
2065  }
2066  case SPELL_AURA_MOUNTED:
2067  {
2068  uint32 mountType = effect.MiscValueB;
2069  if (MountEntry const* mountEntry = sDB2Manager.GetMount(Id))
2070  mountType = mountEntry->MountTypeID;
2071  if (mountType && !player->GetMountCapability(mountType))
2072  return SPELL_FAILED_NOT_HERE;
2073  break;
2074  }
2075  default:
2076  break;
2077  }
2078  }
2079  }
2080 
2081  return SPELL_CAST_OK;
2082 }
Definition: SpellAuraEffects.h:28
Definition: DB2Structure.h:125
#define sDB2Manager
Definition: DB2Stores.h:446
Definition: SharedDefines.h:609
Definition: SharedDefines.h:1595
DB2Storage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore("SpellShapeshiftForm.db2", SpellShapeshiftFormLoadInfo::Instance())
Definition: SpellAuraDefines.h:166
Definition: SharedDefines.h:1451
Definition: DB2Structure.h:2345
bool IsBattleground() const
Definition: DB2Structure.h:2379
BattlegroundStatus GetStatus() const
Definition: Battleground.h:293
uint32 const Id
Definition: SpellInfo.h:340
Definition: Battleground.h:164
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:449
int32 RequiredAreasID
Definition: SpellInfo.h:422
bool IsRaid() const
Definition: DB2Structure.h:2378
std::pair< SpellAreaMap::const_iterator, SpellAreaMap::const_iterator > SpellAreaMapBounds
Definition: SpellMgr.h:514
Definition: SpellAuraDefines.h:124
#define sSpellMgr
Definition: SpellMgr.h:792
Definition: SpellInfo.h:227
uint32_t uint32
Definition: Define.h:152
DB2Storage< AreaTableEntry > sAreaTableStore("AreaTable.db2", AreaTableLoadInfo::Instance())
Definition: SharedDefines.h:552
Definition: DB2Structure.h:3353
Definition: SharedDefines.h:1472
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:579
bool IsBattleArena() const
Definition: DB2Structure.h:2380
Definition: DBCEnums.h:152
Definition: SpellAuraDefines.h:424
Definition: Battleground.h:259
Definition: SharedDefines.h:1510
DB2Storage< MapEntry > sMapStore("Map.db2", MapLoadInfo::Instance())
Definition: SharedDefines.h:1703
Definition: DB2Structure.h:2449
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckShapeshift()

SpellCastResult SpellInfo::CheckShapeshift ( uint32  form) const
1865 {
1866  // talents that learn spells can have stance requirements that need ignore
1867  // (this requirement only for client-side stance show in talent description)
1868  /* TODO: 6.x fix this in proper way (probably spell flags/attributes?)
1869  if (GetTalentSpellCost(Id) > 0 && HasEffect(SPELL_EFFECT_LEARN_SPELL))
1870  return SPELL_CAST_OK;*/
1871 
1872  //if (HasAttribute(SPELL_ATTR13_ACTIVATES_REQUIRED_SHAPESHIFT))
1873  // return SPELL_CAST_OK;
1874 
1875  uint64 stanceMask = (form ? UI64LIT(1) << (form - 1) : 0);
1876 
1877  if (stanceMask & StancesNot) // can explicitly not be cast in this stance
1879 
1880  if (stanceMask & Stances) // can explicitly be cast in this stance
1881  return SPELL_CAST_OK;
1882 
1883  bool actAsShifted = false;
1884  SpellShapeshiftFormEntry const* shapeInfo = nullptr;
1885  if (form > 0)
1886  {
1887  shapeInfo = sSpellShapeshiftFormStore.LookupEntry(form);
1888  if (!shapeInfo)
1889  {
1890  TC_LOG_ERROR("spells", "GetErrorAtShapeshiftedCast: unknown shapeshift %u", form);
1891  return SPELL_CAST_OK;
1892  }
1893  actAsShifted = !shapeInfo->GetFlags().HasFlag(SpellShapeshiftFormFlags::Stance);
1894  }
1895 
1896  if (actAsShifted)
1897  {
1898  if (HasAttribute(SPELL_ATTR0_NOT_SHAPESHIFT) || (shapeInfo && shapeInfo->GetFlags().HasFlag(SpellShapeshiftFormFlags::CanOnlyCastShapeshiftSpells))) // not while shapeshifted
1900  else if (Stances != 0) // needs other shapeshift
1902  }
1903  else
1904  {
1905  // needs shapeshift
1906  if (!HasAttribute(SPELL_ATTR2_NOT_NEED_SHAPESHIFT) && Stances != 0)
1908  }
1909 
1910  return SPELL_CAST_OK;
1911 }
DB2Storage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore("SpellShapeshiftForm.db2", SpellShapeshiftFormLoadInfo::Instance())
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:186
#define UI64LIT(N)
Definition: Define.h:140
EnumFlag< SpellShapeshiftFormFlags > GetFlags() const
Definition: DB2Structure.h:3367
uint64 StancesNot
Definition: SpellInfo.h:363
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:449
uint64 Stances
Definition: SpellInfo.h:362
uint64_t uint64
Definition: Define.h:151
Definition: SharedDefines.h:1503
Definition: DB2Structure.h:3353
Definition: SharedDefines.h:398
Definition: SharedDefines.h:1480
Definition: SharedDefines.h:1703
Definition: SharedDefines.h:473
+ 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
2085 {
2086  if (HasAttribute(SPELL_ATTR1_CANT_TARGET_SELF) && caster == target)
2087  return SPELL_FAILED_BAD_TARGETS;
2088 
2089  // check visibility - ignore stealth for implicit (area) targets
2090  if (!HasAttribute(SPELL_ATTR6_CAN_TARGET_INVISIBLE) && !caster->CanSeeOrDetect(target, implicit))
2091  return SPELL_FAILED_BAD_TARGETS;
2092 
2093  Unit const* unitTarget = target->ToUnit();
2094 
2095  // creature/player specific target checks
2096  if (unitTarget)
2097  {
2098  // spells cannot be cast if target has a pet in combat either
2101 
2102  // only spells with SPELL_ATTR3_ONLY_TARGET_GHOSTS can target ghosts
2104  {
2107  else
2108  return SPELL_FAILED_BAD_TARGETS;
2109  }
2110 
2111  if (caster != unitTarget)
2112  {
2113  if (caster->GetTypeId() == TYPEID_PLAYER)
2114  {
2115  // Do not allow these spells to target creatures not tapped by us (Banish, Polymorph, many quest spells)
2117  if (Creature const* targetCreature = unitTarget->ToCreature())
2118  if (targetCreature->hasLootRecipient() && !targetCreature->isTappedBy(caster->ToPlayer()))
2120 
2122  {
2123  if (unitTarget->GetTypeId() == TYPEID_PLAYER)
2124  return SPELL_FAILED_BAD_TARGETS;
2125  else if ((unitTarget->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) == 0)
2127  }
2128 
2129  // Not allow disarm unarmed player
2130  if (Mechanic == MECHANIC_DISARM)
2131  {
2132  if (unitTarget->GetTypeId() == TYPEID_PLAYER)
2133  {
2134  Player const* player = unitTarget->ToPlayer();
2135  if (!player->GetWeaponForAttack(BASE_ATTACK) || !player->IsUseEquipedWeapon(true))
2137  }
2138  else if (!unitTarget->GetVirtualItemId(0))
2140  }
2141  }
2142  }
2143  }
2144  // corpse specific target checks
2145  else if (Corpse const* corpseTarget = target->ToCorpse())
2146  {
2147  // cannot target bare bones
2148  if (corpseTarget->GetType() == CORPSE_BONES)
2149  return SPELL_FAILED_BAD_TARGETS;
2150  // we have to use owner for some checks (aura preventing resurrection for example)
2151  if (Player* owner = ObjectAccessor::FindPlayer(corpseTarget->GetOwnerGUID()))
2152  unitTarget = owner;
2153  // we're not interested in corpses without owner
2154  else
2155  return SPELL_FAILED_BAD_TARGETS;
2156  }
2157  // other types of objects - always valid
2158  else return SPELL_CAST_OK;
2159 
2160  // corpseOwner and unit specific target checks
2163 
2164  if (!IsAllowingDeadTarget() && !unitTarget->IsAlive())
2166 
2167  // check this flag only for implicit targets (chain and area), allow to explicitly target units for spells like Shield of Righteousness
2168  if (implicit && HasAttribute(SPELL_ATTR6_CANT_TARGET_CROWD_CONTROLLED) && !unitTarget->CanFreeMove())
2169  return SPELL_FAILED_BAD_TARGETS;
2170 
2171  // checked in Unit::IsValidAttack/AssistTarget, shouldn't be checked for ENTRY targets
2172  //if (!HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE))
2173  // return SPELL_FAILED_BAD_TARGETS;
2174 
2175  //if (!HasAttribute(SPELL_ATTR6_CAN_TARGET_POSSESSED_FRIENDS))
2176 
2177  if (!CheckTargetCreatureType(unitTarget))
2178  {
2179  if (target->GetTypeId() == TYPEID_PLAYER)
2181  else
2182  return SPELL_FAILED_BAD_TARGETS;
2183  }
2184 
2185  // check GM mode and GM invisibility - only for player casts (npc casts are controlled by AI) and negative spells
2186  if (unitTarget != caster && (caster->GetAffectingPlayer() || !IsPositive()) && unitTarget->GetTypeId() == TYPEID_PLAYER)
2187  {
2188  if (!unitTarget->ToPlayer()->IsVisible())
2190 
2191  if (unitTarget->ToPlayer()->IsGameMaster())
2193  }
2194 
2195  // not allow casting on flying player
2197  return SPELL_FAILED_BAD_TARGETS;
2198 
2199  /* TARGET_UNIT_MASTER gets blocked here for passengers, because the whole idea of this check is to
2200  not allow passengers to be implicitly hit by spells, however this target type should be an exception,
2201  if this is left it kills spells that award kill credit from vehicle to master (few spells),
2202  the use of these 2 covers passenger target check, logically, if vehicle cast this to master it should always hit
2203  him, because it would be it's passenger, there's no such case where this gets to fail legitimacy, this problem
2204  cannot be solved from within the check in other way since target type cannot be called for the spell currently
2205  Spell examples: [ID - 52864 Devour Water, ID - 52862 Devour Wind, ID - 49370 Wyrmrest Defender: Destabilize Azure Dragonshrine Effect] */
2206  if (Unit const* unitCaster = caster->ToUnit())
2207  {
2208  if (!unitCaster->IsVehicle() && !(unitCaster->GetCharmerOrOwner() == target))
2209  {
2210  if (TargetAuraState && !unitTarget->HasAuraState(AuraStateType(TargetAuraState), this, unitCaster))
2212 
2213  if (ExcludeTargetAuraState && unitTarget->HasAuraState(AuraStateType(ExcludeTargetAuraState), this, unitCaster))
2215  }
2216  }
2217 
2218  if (TargetAuraSpell && !unitTarget->HasAura(TargetAuraSpell))
2220 
2223 
2227 
2229  if (Map* map = caster->GetMap())
2230  if (InstanceMap* iMap = map->ToInstanceMap())
2231  if (InstanceScript* instance = iMap->GetInstanceScript())
2232  if (instance->GetCombatResurrectionCharges() == 0 && instance->IsEncounterInProgress())
2234 
2235  return SPELL_CAST_OK;
2236 }
Definition: SharedDefines.h:498
uint32 const CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD
Definition: SharedDefines.h:4330
bool HasAuraState(AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
Definition: Unit.cpp:5689
Definition: SharedDefines.h:1518
Definition: Corpse.h:50
Definition: SpellAuraDefines.h:402
Item * GetWeaponForAttack(WeaponAttackType attackType, bool useable=false) const
Definition: Player.cpp:10150
TypeID GetTypeId() const
Definition: Object.h:167
uint32 TargetAuraState
Definition: SpellInfo.h:369
Definition: SharedDefines.h:1534
Definition: SharedDefines.h:1410
bool HasEffect(SpellEffectName effect) const
Definition: SpellInfo.cpp:1283
Definition: SharedDefines.h:693
Definition: SharedDefines.h:1192
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4415
Definition: SpellAuraDefines.h:183
AuraStateType
Definition: SharedDefines.h:2306
Definition: UnitDefines.h:130
bool IsInCombat() const
Definition: Unit.h:1115
bool CanFreeMove() const
Definition: Unit.cpp:8833
uint32 ExcludeTargetAuraSpell
Definition: SpellInfo.h:375
uint32 Mechanic
Definition: SpellInfo.h:344
Definition: Creature.h:69
Definition: SharedDefines.h:1519
Definition: SharedDefines.h:437
Definition: SharedDefines.h:1116
bool HasUnitFlag(UnitFlags flags) const
Definition: Unit.h:929
Player * ToPlayer()
Definition: Object.h:192
Definition: SharedDefines.h:2345
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:264
Definition: SharedDefines.h:1554
Definition: Map.h:862
Definition: SharedDefines.h:1402
Definition: SharedDefines.h:460
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:449
bool IsAlive() const
Definition: Unit.h:1223
bool HasUnitState(const uint32 f) const
Definition: Unit.h:834
bool IsGameMaster() const
Definition: Player.h:1154
Corpse * ToCorpse()
Definition: Object.h:208
InstanceMap * ToInstanceMap()
Definition: Map.h:490
Definition: Map.h:252
Definition: SharedDefines.h:611
bool IsVisible() const
Definition: Unit.cpp:7916
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4425
Definition: SharedDefines.h:6352
bool IsPositive() const
Definition: SpellInfo.cpp:1608
Definition: SharedDefines.h:502
bool IsUseEquipedWeapon(bool mainhand) const
Definition: Player.cpp:13793
uint32 GetCreatureTypeMask() const
Definition: Unit.cpp:8418
Definition: ObjectGuid.h:40
Definition: SpellInfo.h:161
Creature * ToCreature()
Definition: Object.h:196
uint32 ExcludeTargetAuraState
Definition: SpellInfo.h:371
Definition: SharedDefines.h:606
Definition: InstanceScript.h:155
Definition: SharedDefines.h:1570
Definition: SharedDefines.h:1520
Definition: SharedDefines.h:1532
uint32 GetVirtualItemId(uint32 slot) const
Definition: Unit.cpp:13046
bool IsAllowingDeadTarget() const
Definition: SpellInfo.cpp:1568
Definition: SharedDefines.h:426
Definition: SharedDefines.h:1618
Definition: Unit.h:737
Definition: Unit.h:245
Definition: Player.h:1081
Definition: SpellInfo.h:169
Definition: SharedDefines.h:1703
Definition: SharedDefines.h:1527
uint32 TargetAuraSpell
Definition: SpellInfo.h:373
Unit * ToUnit()
Definition: Object.h:200
Definition: SharedDefines.h:1533
bool CheckTargetCreatureType(Unit const *target) const
Definition: SpellInfo.cpp:2324
Definition: Corpse.h:29
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckTargetCreatureType()

bool SpellInfo::CheckTargetCreatureType ( Unit const *  target) const
2325 {
2326  // Curse of Doom & Exorcism: not find another way to fix spell target check :/
2327  if (SpellFamilyName == SPELLFAMILY_WARLOCK && GetCategory() == 1179)
2328  {
2329  // not allow cast at player
2330  if (target->GetTypeId() == TYPEID_PLAYER)
2331  return false;
2332  else
2333  return true;
2334  }
2335 
2336  // if target is magnet (i.e Grounding Totem) the check is skipped
2337  if (target->IsMagnet())
2338  return true;
2339 
2340  uint32 creatureType = target->GetCreatureTypeMask();
2341  return !TargetCreatureType || !creatureType || (creatureType & TargetCreatureType);
2342 }
uint32 GetCategory() const
Definition: SpellInfo.cpp:1278
uint32 SpellFamilyName
Definition: SpellInfo.h:418
uint32_t uint32
Definition: Define.h:152
Definition: ObjectGuid.h:40
Definition: SharedDefines.h:6059
uint32 TargetCreatureType
Definition: SpellInfo.h:365
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckVehicle()

SpellCastResult SpellInfo::CheckVehicle ( Unit const *  caster) const
2275 {
2276  // All creatures should be able to cast as passengers freely, restriction and attribute are only for players
2277  if (caster->GetTypeId() != TYPEID_PLAYER)
2278  return SPELL_CAST_OK;
2279 
2280  Vehicle* vehicle = caster->GetVehicle();
2281  if (vehicle)
2282  {
2283  uint16 checkMask = 0;
2284  for (SpellEffectInfo const& effect : GetEffects())
2285  {
2286  if (effect.IsAura(SPELL_AURA_MOD_SHAPESHIFT))
2287  {
2288  SpellShapeshiftFormEntry const* shapeShiftFromEntry = sSpellShapeshiftFormStore.LookupEntry(effect.MiscValue);
2289  if (shapeShiftFromEntry && (shapeShiftFromEntry->Flags & 1) == 0) // unk flag
2290  checkMask |= VEHICLE_SEAT_FLAG_UNCONTROLLED;
2291  break;
2292  }
2293  }
2294 
2297 
2298  if (!checkMask)
2299  checkMask = VEHICLE_SEAT_FLAG_CAN_ATTACK;
2300 
2301  VehicleSeatEntry const* vehicleSeat = vehicle->GetSeatForPassenger(caster);
2303  && (vehicleSeat->Flags & checkMask) != checkMask)
2305 
2306  // Can only summon uncontrolled minions/guardians when on controlled vehicle
2308  {
2309  for (SpellEffectInfo const& effect : GetEffects())
2310  {
2311  if (!effect.IsEffect(SPELL_EFFECT_SUMMON))
2312  continue;
2313 
2314  SummonPropertiesEntry const* props = sSummonPropertiesStore.LookupEntry(effect.MiscValueB);
2315  if (props && props->Control != SUMMON_CATEGORY_WILD)
2317  }
2318  }
2319  }
2320 
2321  return SPELL_CAST_OK;
2322 }
Definition: DB2Structure.h:3671
Definition: Vehicle.h:31
Definition: SharedDefines.h:1601
bool HasAura(AuraType aura) const
Definition: SpellInfo.cpp:1292
int32 Flags
Definition: DB2Structure.h:3676
DB2Storage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore("SpellShapeshiftForm.db2", SpellShapeshiftFormLoadInfo::Instance())
Definition: SpellAuraDefines.h:166
Definition: SharedDefines.h:406
int32 Control
Definition: DB2Structure.h:3422
Definition: DBCEnums.h:1643
Definition: DBCEnums.h:1642
Definition: SharedDefines.h:1126
Definition: DBCEnums.h:1659
Definition: DBCEnums.h:1641
VehicleSeatEntry const * GetSeatForPassenger(Unit const *passenger) const
Returns information on the seat of specified passenger, represented by the format in VehicleSeat...
Definition: Vehicle.cpp:612
Definition: SharedDefines.h:610
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:449
Definition: DBCEnums.h:1640
Definition: SpellAuraDefines.h:124
Definition: SpellInfo.h:227
int32 Flags
Definition: DB2Structure.h:3358
uint16_t uint16
Definition: Define.h:153
Definition: SharedDefines.h:5705
Definition: DB2Structure.h:3353
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:579
Definition: ObjectGuid.h:40
DB2Storage< SummonPropertiesEntry > sSummonPropertiesStore("SummonProperties.db2", SummonPropertiesLoadInfo::Instance())
Definition: SharedDefines.h:1703
Definition: DB2Structure.h:3419
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAllEffectsMechanicMask()

uint32 SpellInfo::GetAllEffectsMechanicMask ( ) const
2350 {
2351  uint32 mask = 0;
2352  if (Mechanic)
2353  mask |= 1 << Mechanic;
2354 
2355  for (SpellEffectInfo const& effect : GetEffects())
2356  if (effect.IsEffect() && effect.Mechanic)
2357  mask |= 1 << effect.Mechanic;
2358 
2359  return mask;
2360 }
uint32 Mechanic
Definition: SpellInfo.h:344
Definition: SpellInfo.h:227
uint32_t uint32
Definition: Define.h:152
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:579
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAllowedMechanicMask()

uint32 SpellInfo::GetAllowedMechanicMask ( ) const
3671 {
3672  return _allowedMechanicMask;
3673 }
uint32 _allowedMechanicMask
Definition: SpellInfo.h:619

◆ GetAttackType()

WeaponAttackType SpellInfo::GetAttackType ( ) const
1666 {
1667  WeaponAttackType result;
1668  switch (DmgClass)
1669  {
1672  result = OFF_ATTACK;
1673  else
1674  result = BASE_ATTACK;
1675  break;
1678  break;
1679  default:
1680  // Wands
1682  result = RANGED_ATTACK;
1683  else
1684  result = BASE_ATTACK;
1685  break;
1686  }
1687 
1688  return result;
1689 }
Definition: SharedDefines.h:514
uint32 DmgClass
Definition: SpellInfo.h:420
Definition: SharedDefines.h:2610
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:449
bool IsAutoRepeatRangedSpell() const
Definition: SpellInfo.cpp:1650
Definition: SharedDefines.h:2609
Definition: SharedDefines.h:6352
Definition: SharedDefines.h:6354
bool IsRangedWeaponSpell() const
Definition: SpellInfo.cpp:1643
WeaponAttackType
Definition: SharedDefines.h:6350
Definition: SharedDefines.h:6353
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAuraRankForLevel()

SpellInfo const * SpellInfo::GetAuraRankForLevel ( uint8  level) const
4199 {
4200  // ignore passive spells
4201  if (IsPassive())
4202  return this;
4203 
4204  // Client ignores spell with these attributes (sub_53D9D0)
4206  return this;
4207 
4208  bool needRankSelection = false;
4209  for (SpellEffectInfo const& effect : GetEffects())
4210  {
4211  if (IsPositiveEffect(effect.EffectIndex) &&
4212  (effect.Effect == SPELL_EFFECT_APPLY_AURA ||
4213  effect.Effect == SPELL_EFFECT_APPLY_AREA_AURA_PARTY ||
4214  effect.Effect == SPELL_EFFECT_APPLY_AREA_AURA_RAID) &&
4215  !effect.Scaling.Coefficient)
4216  {
4217  needRankSelection = true;
4218  break;
4219  }
4220  }
4221 
4222  // not required
4223  if (!needRankSelection)
4224  return this;
4225 
4226  for (SpellInfo const* nextSpellInfo = this; nextSpellInfo != nullptr; nextSpellInfo = nextSpellInfo->GetPrevRankSpell())
4227  {
4228  // if found appropriate level
4229  if (uint32(level + 10) >= nextSpellInfo->SpellLevel)
4230  return nextSpellInfo;
4231 
4232  // one rank less then
4233  }
4234 
4235  // not found
4236  return nullptr;
4237 }
Definition: SpellInfo.h:335
bool IsPositiveEffect(uint8 effIndex) const
Definition: SpellInfo.cpp:1613
bool IsPassive() const
Definition: SpellInfo.cpp:1492
Definition: SharedDefines.h:1104
SpellInfo const * GetPrevRankSpell() const
Definition: SpellInfo.cpp:4191
Definition: SharedDefines.h:1163
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:449
Definition: SpellInfo.h:227
uint32_t uint32
Definition: Define.h:152
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:579
Definition: SharedDefines.h:457
Definition: SharedDefines.h:408
Definition: SharedDefines.h:1133
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAuraState()

AuraStateType SpellInfo::GetAuraState ( ) const
2418 {
2419  return _auraState;
2420 }
AuraStateType _auraState
Definition: SpellInfo.h:616
+ Here is the caller graph for this function:

◆ GetCategory()

uint32 SpellInfo::GetCategory ( ) const
1279 {
1280  return CategoryId;
1281 }
uint32 CategoryId
Definition: SpellInfo.h:342
+ Here is the caller graph for this function:

◆ GetDiminishingReturnsGroupForSpell()

DiminishingGroup SpellInfo::GetDiminishingReturnsGroupForSpell ( ) const
3153 {
3155 }
DiminishingGroup DiminishGroup
Definition: SpellInfo.h:323
SpellDiminishInfo _diminishInfo
Definition: SpellInfo.h:618
+ Here is the caller graph for this function:

◆ GetDiminishingReturnsGroupType()

DiminishingReturnsType SpellInfo::GetDiminishingReturnsGroupType ( ) const
3158 {
3160 }
SpellDiminishInfo _diminishInfo
Definition: SpellInfo.h:618
DiminishingReturnsType DiminishReturnType
Definition: SpellInfo.h:324
+ Here is the caller graph for this function:

◆ GetDiminishingReturnsLimitDuration()

int32 SpellInfo::GetDiminishingReturnsLimitDuration ( ) const
3168 {
3170 }
SpellDiminishInfo _diminishInfo
Definition: SpellInfo.h:618
int32 DiminishDurationLimit
Definition: SpellInfo.h:326
+ Here is the caller graph for this function:

◆ GetDiminishingReturnsMaxLevel()

DiminishingLevels SpellInfo::GetDiminishingReturnsMaxLevel ( ) const
3163 {
3165 }
SpellDiminishInfo _diminishInfo
Definition: SpellInfo.h:618
DiminishingLevels DiminishMaxLevel
Definition: SpellInfo.h:325
+ Here is the caller graph for this function:

◆ GetDispelMask() [1/2]

uint32 SpellInfo::GetDispelMask ( ) const
2399 {
2400  return GetDispelMask(DispelType(Dispel));
2401 }
uint32 Dispel
Definition: SpellInfo.h:343
DispelType
Definition: SharedDefines.h:2388
uint32 GetDispelMask() const
Definition: SpellInfo.cpp:2398
+ Here is the caller graph for this function:

◆ GetDispelMask() [2/2]

uint32 SpellInfo::GetDispelMask ( DispelType  type)
static
2404 {
2405  // If dispel all
2406  if (type == DISPEL_ALL)
2407  return DISPEL_ALL_MASK;
2408  else
2409  return uint32(1 << type);
2410 }
#define DISPEL_ALL_MASK
Definition: SharedDefines.h:2404
uint32_t uint32
Definition: Define.h:152
Definition: SharedDefines.h:2397

◆ GetDuration()

int32 SpellInfo::GetDuration ( ) const
3706 {
3707  if (!DurationEntry)
3708  return IsPassive() ? -1 : 0;
3709  return (DurationEntry->Duration == -1) ? -1 : abs(DurationEntry->Duration);
3710 }
int32 Duration
Definition: DB2Structure.h:3096
bool IsPassive() const
Definition: SpellInfo.cpp:1492
SpellDurationEntry const * DurationEntry
Definition: SpellInfo.h:395
+ 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
580 { ASSERT(index < _effects.size()); return _effects[index]; }
std::vector< SpellEffectInfo > _effects
Definition: SpellInfo.h:613
#define ASSERT
Definition: Errors.h:61
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetEffectMechanic()

Mechanics SpellInfo::GetEffectMechanic ( SpellEffIndex  effIndex) const
2388 {
2389  if (GetEffect(effIndex).IsEffect() && GetEffect(effIndex).Mechanic)
2390  return GetEffect(effIndex).Mechanic;
2391 
2392  if (Mechanic)
2393  return Mechanics(Mechanic);
2394 
2395  return MECHANIC_NONE;
2396 }
Definition: SharedDefines.h:2342
Mechanics
Definition: SharedDefines.h:2340
uint32 Mechanic
Definition: SpellInfo.h:344
Mechanics Mechanic
Definition: SpellInfo.h:244
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition: SpellInfo.h:580
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetEffectMechanicMask()

uint32 SpellInfo::GetEffectMechanicMask ( SpellEffIndex  effIndex) const
2363 {
2364  uint32 mask = 0;
2365  if (Mechanic)
2366  mask |= 1 << Mechanic;
2367 
2368  if (GetEffect(effIndex).IsEffect() && GetEffect(effIndex).Mechanic)
2369  mask |= 1 << GetEffect(effIndex).Mechanic;
2370 
2371  return mask;
2372 }
uint32 Mechanic
Definition: SpellInfo.h:344
Mechanics Mechanic
Definition: SpellInfo.h:244
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition: SpellInfo.h:580
uint32_t uint32
Definition: Define.h:152
+ Here is the call graph for this function:

◆ GetEffects()

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

◆ GetExplicitTargetMask()

uint32 SpellInfo::GetExplicitTargetMask ( ) const
2413 {
2414  return ExplicitTargetMask;
2415 }
uint32 ExplicitTargetMask
Definition: SpellInfo.h:435
+ Here is the caller graph for this function:

◆ GetFirstRankSpell()

SpellInfo const * SpellInfo::GetFirstRankSpell ( ) const
4171 {
4172  if (!ChainEntry)
4173  return this;
4174  return ChainEntry->first;
4175 }
SpellInfo const * first
Definition: SpellMgr.h:525
SpellChainNode const * ChainEntry
Definition: SpellInfo.h:436
+ Here is the caller graph for this function:

◆ GetLastRankSpell()

SpellInfo const * SpellInfo::GetLastRankSpell ( ) const
4178 {
4179  if (!ChainEntry)
4180  return nullptr;
4181  return ChainEntry->last;
4182 }
SpellInfo const * last
Definition: SpellMgr.h:526
SpellChainNode const * ChainEntry
Definition: SpellInfo.h:436

◆ GetMaxDuration()

int32 SpellInfo::GetMaxDuration ( ) const
3713 {
3714  if (!DurationEntry)
3715  return IsPassive() ? -1 : 0;
3716  return (DurationEntry->MaxDuration == -1) ? -1 : abs(DurationEntry->MaxDuration);
3717 }
bool IsPassive() const
Definition: SpellInfo.cpp:1492
int32 MaxDuration
Definition: DB2Structure.h:3097
SpellDurationEntry const * DurationEntry
Definition: SpellInfo.h:395
+ 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
3683 {
3684  if (!RangeEntry)
3685  return 0.0f;
3686  float range = RangeEntry->RangeMax[positive ? 1 : 0];
3687  if (caster)
3688  if (Player* modOwner = caster->GetSpellModOwner())
3689  modOwner->ApplySpellMod(this, SpellModOp::Range, range, spell);
3690 
3691  return range;
3692 }
float RangeMax[2]
Definition: DB2Structure.h:3312
SpellRangeEntry const * RangeEntry
Definition: SpellInfo.h:397
Player * GetSpellModOwner() const
Definition: Object.cpp:2075
Definition: Player.h:1081
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMaxTicks()

uint32 SpellInfo::GetMaxTicks ( ) const
3738 {
3739  uint32 totalTicks = 0;
3740  int32 DotDuration = GetDuration();
3741 
3742  for (SpellEffectInfo const& effect : GetEffects())
3743  {
3744  if (effect.IsEffect(SPELL_EFFECT_APPLY_AURA))
3745  {
3746  switch (effect.ApplyAuraName)
3747  {
3753  case SPELL_AURA_48:
3754  case SPELL_AURA_POWER_BURN:
3762  // skip infinite periodics
3763  if (effect.ApplyAuraPeriod > 0 && DotDuration > 0)
3764  {
3765  totalTicks = static_cast<uint32>(DotDuration) / effect.ApplyAuraPeriod;
3767  ++totalTicks;
3768  }
3769  break;
3770  default:
3771  break;
3772  }
3773  }
3774  }
3775 
3776  return totalTicks;
3777 }
Definition: SpellAuraDefines.h:141
Definition: SpellAuraDefines.h:111
Definition: SpellAuraDefines.h:150
Definition: SpellAuraDefines.h:108
Definition: SharedDefines.h:1104
Definition: SharedDefines.h:571
Definition: SpellAuraDefines.h:152
Definition: SpellAuraDefines.h:250
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:449
Definition: SpellInfo.h:227
Definition: SpellAuraDefines.h:177
int32_t int32
Definition: Define.h:148
uint32_t uint32
Definition: Define.h:152
Definition: SpellAuraDefines.h:314
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:579
Definition: SpellAuraDefines.h:315
Definition: SpellAuraDefines.h:136
Definition: SpellAuraDefines.h:96
int32 GetDuration() const
Definition: SpellInfo.cpp:3705
Definition: SpellAuraDefines.h:91
Definition: SpellAuraDefines.h:112
Definition: SpellAuraDefines.h:109
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMinRange()

float SpellInfo::GetMinRange ( bool  positive = false) const
3676 {
3677  if (!RangeEntry)
3678  return 0.0f;
3679  return RangeEntry->RangeMin[positive ? 1 : 0];
3680 }
SpellRangeEntry const * RangeEntry
Definition: SpellInfo.h:397
float RangeMin[2]
Definition: DB2Structure.h:3311
+ Here is the caller graph for this function:

◆ GetNextRankSpell()

SpellInfo const * SpellInfo::GetNextRankSpell ( ) const
4185 {
4186  if (!ChainEntry)
4187  return nullptr;
4188  return ChainEntry->next;
4189 }
SpellInfo const * next
Definition: SpellMgr.h:524
SpellChainNode const * ChainEntry
Definition: SpellInfo.h:436
+ Here is the caller graph for this function:

◆ GetPrevRankSpell()

SpellInfo const * SpellInfo::GetPrevRankSpell ( ) const
4192 {
4193  if (!ChainEntry)
4194  return nullptr;
4195  return ChainEntry->prev;
4196 }
SpellInfo const * prev
Definition: SpellMgr.h:523
SpellChainNode const * ChainEntry
Definition: SpellInfo.h:436
+ Here is the caller graph for this function:

◆ GetRank()

uint8 SpellInfo::GetRank ( ) const
4164 {
4165  if (!ChainEntry)
4166  return 1;
4167  return ChainEntry->rank;
4168 }
SpellChainNode const * ChainEntry
Definition: SpellInfo.h:436
uint8 rank
Definition: SpellMgr.h:527
+ Here is the caller graph for this function:

◆ GetRecoveryTime()

uint32 SpellInfo::GetRecoveryTime ( ) const
3780 {
3782 }
uint32 RecoveryTime
Definition: SpellInfo.h:377
uint32 CategoryRecoveryTime
Definition: SpellInfo.h:378
+ Here is the caller graph for this function:

◆ GetSchoolMask()

SpellSchoolMask SpellInfo::GetSchoolMask ( ) const
2345 {
2346  return SpellSchoolMask(SchoolMask);
2347 }
uint32 SchoolMask
Definition: SpellInfo.h:423
SpellSchoolMask
Definition: SharedDefines.h:303
+ Here is the caller graph for this function:

◆ GetSpellMechanicMaskByEffectMask()

uint32 SpellInfo::GetSpellMechanicMaskByEffectMask ( uint32  effectMask) const
2375 {
2376  uint32 mask = 0;
2377  if (Mechanic)
2378  mask |= 1 << Mechanic;
2379 
2380  for (SpellEffectInfo const& effect : GetEffects())
2381  if ((effectMask & (1 << effect.EffectIndex)) && effect.Mechanic)
2382  mask |= 1 << effect.Mechanic;
2383 
2384  return mask;
2385 }
uint32 Mechanic
Definition: SpellInfo.h:344
Definition: SpellInfo.h:227
uint32_t uint32
Definition: Define.h:152
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:579
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSpellSpecific()

SpellSpecificType SpellInfo::GetSpellSpecific ( ) const
2503 {
2504  return _spellSpecific;
2505 };
SpellSpecificType _spellSpecific
Definition: SpellInfo.h:615
+ Here is the caller graph for this function:

◆ GetSpellVisual()

uint32 SpellInfo::GetSpellVisual ( WorldObject const *  caster = nullptr) const
4274 {
4275  if (SpellXSpellVisualEntry const* visual = sSpellXSpellVisualStore.LookupEntry(GetSpellXSpellVisualId(caster)))
4276  {
4277  //if (visual->LowViolenceSpellVisualID && forPlayer->GetViolenceLevel() operator 2)
4278  // return visual->LowViolenceSpellVisualID;
4279 
4280  return visual->SpellVisualID;
4281  }
4282 
4283  return 0;
4284 }
DB2Storage< SpellXSpellVisualEntry > sSpellXSpellVisualStore("SpellXSpellVisual.db2", SpellXSpellVisualLoadInfo::Instance())
Definition: DB2Structure.h:3403
uint32 GetSpellXSpellVisualId(WorldObject const *caster=nullptr) const
Definition: SpellInfo.cpp:4261
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSpellXSpellVisualId()

uint32 SpellInfo::GetSpellXSpellVisualId ( WorldObject const *  caster = nullptr) const
4262 {
4263  for (SpellXSpellVisualEntry const* visual : _visuals)
4264  {
4265  PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(visual->CasterPlayerConditionID);
4266  if (!playerCondition || (caster && caster->GetTypeId() == TYPEID_PLAYER && sConditionMgr->IsPlayerMeetingCondition(caster->ToPlayer(), playerCondition)))
4267  return visual->ID;
4268  }
4269 
4270  return 0;
4271 }
SpellVisualVector _visuals
Definition: SpellInfo.h:614
#define sConditionMgr
Definition: ConditionMgr.h:330
Definition: DB2Structure.h:3403
Definition: ObjectGuid.h:40
Definition: DB2Structure.h:2573
DB2Storage< PlayerConditionEntry > sPlayerConditionStore("PlayerCondition.db2", PlayerConditionLoadInfo::Instance())
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasAnyAuraInterruptFlag()

bool SpellInfo::HasAnyAuraInterruptFlag ( ) const
1358 {
1360 }
EnumFlag< SpellAuraInterruptFlags > AuraInterruptFlags
Definition: SpellInfo.h:382
EnumFlag< SpellAuraInterruptFlags2 > AuraInterruptFlags2
Definition: SpellInfo.h:383
+ Here is the caller graph for this function:

◆ HasAreaAuraEffect()

bool SpellInfo::HasAreaAuraEffect ( ) const
1302 {
1303  for (SpellEffectInfo const& effect : GetEffects())
1304  if (effect.IsAreaAuraEffect())
1305  return true;
1306 
1307  return false;
1308 }
Definition: SpellInfo.h:227
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:579
+ 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
449 { return !!(Attributes & attribute); }
uint32 Attributes
Definition: SpellInfo.h:345

◆ HasAttribute() [2/16]

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

◆ HasAttribute() [3/16]

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

◆ HasAttribute() [4/16]

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

◆ HasAttribute() [5/16]

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

◆ HasAttribute() [6/16]

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

◆ HasAttribute() [7/16]

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

◆ HasAttribute() [8/16]

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

◆ HasAttribute() [9/16]

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

◆ HasAttribute() [10/16]

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

◆ HasAttribute() [11/16]

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

◆ HasAttribute() [12/16]

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

◆ HasAttribute() [13/16]

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

◆ HasAttribute() [14/16]

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

◆ HasAttribute() [15/16]

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

◆ HasAttribute() [16/16]

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

◆ HasAura()

bool SpellInfo::HasAura ( AuraType  aura) const
1293 {
1294  for (SpellEffectInfo const& effect : GetEffects())
1295  if (effect.IsAura(aura))
1296  return true;
1297 
1298  return false;
1299 }
Definition: SpellInfo.h:227
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:579
+ 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
469 { return AuraInterruptFlags.HasFlag(flag); }
EnumFlag< SpellAuraInterruptFlags > AuraInterruptFlags
Definition: SpellInfo.h:382
constexpr bool HasFlag(T flag) const
Definition: EnumFlag.h:106
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasAuraInterruptFlag() [2/2]

bool SpellInfo::HasAuraInterruptFlag ( SpellAuraInterruptFlags2  flag) const
inline
470 { return AuraInterruptFlags2.HasFlag(flag); }
constexpr bool HasFlag(T flag) const
Definition: EnumFlag.h:106
EnumFlag< SpellAuraInterruptFlags2 > AuraInterruptFlags2
Definition: SpellInfo.h:383
+ Here is the call graph for this function:

◆ HasChannelInterruptFlag() [1/2]

bool SpellInfo::HasChannelInterruptFlag ( SpellAuraInterruptFlags  flag) const
inline
472 { return ChannelInterruptFlags.HasFlag(flag); }
EnumFlag< SpellAuraInterruptFlags > ChannelInterruptFlags
Definition: SpellInfo.h:384
constexpr bool HasFlag(T flag) const
Definition: EnumFlag.h:106
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasChannelInterruptFlag() [2/2]

bool SpellInfo::HasChannelInterruptFlag ( SpellAuraInterruptFlags2  flag) const
inline
473 { return ChannelInterruptFlags2.HasFlag(flag); }
EnumFlag< SpellAuraInterruptFlags2 > ChannelInterruptFlags2
Definition: SpellInfo.h:385
constexpr bool HasFlag(T flag) const
Definition: EnumFlag.h:106
+ Here is the call graph for this function:

◆ HasEffect()

bool SpellInfo::HasEffect ( SpellEffectName  effect) const
1284 {
1285  for (SpellEffectInfo const& eff : GetEffects())
1286  if (eff.IsEffect(effect))
1287  return true;
1288 
1289  return false;
1290 }
Definition: SpellInfo.h:227
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:579
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasHitDelay()

bool SpellInfo::HasHitDelay ( ) const
1661 {
1662  return Speed > 0.0f || LaunchDelay > 0.0f;
1663 }
float LaunchDelay
Definition: SpellInfo.h:399
float Speed
Definition: SpellInfo.h:398
+ Here is the caller graph for this function:

◆ HasInitialAggro()

bool SpellInfo::HasInitialAggro ( ) const
1656 {
1658 }
Definition: SharedDefines.h:507
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:449
Definition: SharedDefines.h:428
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasLabel()

bool SpellInfo::HasLabel ( uint32  labelId) const
4807 {
4808  return Labels.find(labelId) != Labels.end();
4809 }
std::unordered_set< uint32 > Labels
Definition: SpellInfo.h:425
+ Here is the caller graph for this function:

◆ HasOnlyDamageEffects()

bool SpellInfo::HasOnlyDamageEffects ( ) const
1311 {
1312  for (SpellEffectInfo const& effect : GetEffects())
1313  {
1314  if (effect.IsEffect())
1315  {
1316  switch (effect.Effect)
1317  {
1318  case