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

#include "Spell.h"

Classes

struct  GOTargetInfo
 
struct  HitTriggerSpell
 
struct  ItemTargetInfo
 

Public Types

typedef std::set< Aura * > UsedSpellMods
 

Public Member Functions

 Spell (Unit *caster, SpellInfo const *info, TriggerCastFlags triggerFlags, ObjectGuid originalCasterGUID=ObjectGuid::Empty, bool skipCheck=false)
 
 ~Spell ()
 
void EffectNULL (SpellEffIndex effIndex)
 
void EffectUnused (SpellEffIndex effIndex)
 
void EffectDistract (SpellEffIndex effIndex)
 
void EffectPull (SpellEffIndex effIndex)
 
void EffectSchoolDMG (SpellEffIndex effIndex)
 
void EffectEnvironmentalDMG (SpellEffIndex effIndex)
 
void EffectInstaKill (SpellEffIndex effIndex)
 
void EffectDummy (SpellEffIndex effIndex)
 
void EffectTeleportUnits (SpellEffIndex effIndex)
 
void EffectApplyAura (SpellEffIndex effIndex)
 
void EffectSendEvent (SpellEffIndex effIndex)
 
void EffectPowerBurn (SpellEffIndex effIndex)
 
void EffectPowerDrain (SpellEffIndex effIndex)
 
void EffectHeal (SpellEffIndex effIndex)
 
void EffectBind (SpellEffIndex effIndex)
 
void EffectHealthLeech (SpellEffIndex effIndex)
 
void EffectQuestComplete (SpellEffIndex effIndex)
 
void EffectCreateItem (SpellEffIndex effIndex)
 
void EffectCreateItem2 (SpellEffIndex effIndex)
 
void EffectCreateRandomItem (SpellEffIndex effIndex)
 
void EffectPersistentAA (SpellEffIndex effIndex)
 
void EffectEnergize (SpellEffIndex effIndex)
 
void EffectOpenLock (SpellEffIndex effIndex)
 
void EffectSummonChangeItem (SpellEffIndex effIndex)
 
void EffectProficiency (SpellEffIndex effIndex)
 
void EffectApplyAreaAura (SpellEffIndex effIndex)
 
void EffectSummonType (SpellEffIndex effIndex)
 
void EffectLearnSpell (SpellEffIndex effIndex)
 
void EffectDispel (SpellEffIndex effIndex)
 
void EffectDualWield (SpellEffIndex effIndex)
 
void EffectPickPocket (SpellEffIndex effIndex)
 
void EffectAddFarsight (SpellEffIndex effIndex)
 
void EffectUntrainTalents (SpellEffIndex effIndex)
 
void EffectHealMechanical (SpellEffIndex effIndex)
 
void EffectJump (SpellEffIndex effIndex)
 
void EffectJumpDest (SpellEffIndex effIndex)
 
void EffectLeapBack (SpellEffIndex effIndex)
 
void EffectQuestClear (SpellEffIndex effIndex)
 
void EffectTeleUnitsFaceCaster (SpellEffIndex effIndex)
 
void EffectLearnSkill (SpellEffIndex effIndex)
 
void EffectAddHonor (SpellEffIndex effIndex)
 
void EffectTradeSkill (SpellEffIndex effIndex)
 
void EffectEnchantItemPerm (SpellEffIndex effIndex)
 
void EffectEnchantItemTmp (SpellEffIndex effIndex)
 
void EffectTameCreature (SpellEffIndex effIndex)
 
void EffectSummonPet (SpellEffIndex effIndex)
 
void EffectLearnPetSpell (SpellEffIndex effIndex)
 
void EffectWeaponDmg (SpellEffIndex effIndex)
 
void EffectForceCast (SpellEffIndex effIndex)
 
void EffectTriggerSpell (SpellEffIndex effIndex)
 
void EffectTriggerMissileSpell (SpellEffIndex effIndex)
 
void EffectThreat (SpellEffIndex effIndex)
 
void EffectHealMaxHealth (SpellEffIndex effIndex)
 
void EffectInterruptCast (SpellEffIndex effIndex)
 
void EffectSummonObjectWild (SpellEffIndex effIndex)
 
void EffectScriptEffect (SpellEffIndex effIndex)
 
void EffectSanctuary (SpellEffIndex effIndex)
 
void EffectAddComboPoints (SpellEffIndex effIndex)
 
void EffectDuel (SpellEffIndex effIndex)
 
void EffectStuck (SpellEffIndex effIndex)
 
void EffectSummonPlayer (SpellEffIndex effIndex)
 
void EffectActivateObject (SpellEffIndex effIndex)
 
void EffectApplyGlyph (SpellEffIndex effIndex)
 
void EffectEnchantHeldItem (SpellEffIndex effIndex)
 
void EffectSummonObject (SpellEffIndex effIndex)
 
void EffectResurrect (SpellEffIndex effIndex)
 
void EffectParry (SpellEffIndex effIndex)
 
void EffectBlock (SpellEffIndex effIndex)
 
void EffectLeap (SpellEffIndex effIndex)
 
void EffectTransmitted (SpellEffIndex effIndex)
 
void EffectDisEnchant (SpellEffIndex effIndex)
 
void EffectInebriate (SpellEffIndex effIndex)
 
void EffectFeedPet (SpellEffIndex effIndex)
 
void EffectDismissPet (SpellEffIndex effIndex)
 
void EffectReputation (SpellEffIndex effIndex)
 
void EffectForceDeselect (SpellEffIndex effIndex)
 
void EffectSelfResurrect (SpellEffIndex effIndex)
 
void EffectSkinning (SpellEffIndex effIndex)
 
void EffectCharge (SpellEffIndex effIndex)
 
void EffectChargeDest (SpellEffIndex effIndex)
 
void EffectProspecting (SpellEffIndex effIndex)
 
void EffectMilling (SpellEffIndex effIndex)
 
void EffectRenamePet (SpellEffIndex effIndex)
 
void EffectSendTaxi (SpellEffIndex effIndex)
 
void EffectSummonCritter (SpellEffIndex effIndex)
 
void EffectKnockBack (SpellEffIndex effIndex)
 
void EffectPullTowards (SpellEffIndex effIndex)
 
void EffectDispelMechanic (SpellEffIndex effIndex)
 
void EffectResurrectPet (SpellEffIndex effIndex)
 
void EffectDestroyAllTotems (SpellEffIndex effIndex)
 
void EffectDurabilityDamage (SpellEffIndex effIndex)
 
void EffectSkill (SpellEffIndex effIndex)
 
void EffectTaunt (SpellEffIndex effIndex)
 
void EffectDurabilityDamagePCT (SpellEffIndex effIndex)
 
void EffectModifyThreatPercent (SpellEffIndex effIndex)
 
void EffectResurrectNew (SpellEffIndex effIndex)
 
void EffectAddExtraAttacks (SpellEffIndex effIndex)
 
void EffectSpiritHeal (SpellEffIndex effIndex)
 
void EffectSkinPlayerCorpse (SpellEffIndex effIndex)
 
void EffectStealBeneficialBuff (SpellEffIndex effIndex)
 
void EffectUnlearnSpecialization (SpellEffIndex effIndex)
 
void EffectHealPct (SpellEffIndex effIndex)
 
void EffectEnergizePct (SpellEffIndex effIndex)
 
void EffectTriggerRitualOfSummoning (SpellEffIndex effIndex)
 
void EffectSummonRaFFriend (SpellEffIndex effIndex)
 
void EffectKillCreditPersonal (SpellEffIndex effIndex)
 
void EffectKillCredit (SpellEffIndex effIndex)
 
void EffectQuestFail (SpellEffIndex effIndex)
 
void EffectQuestStart (SpellEffIndex effIndex)
 
void EffectRedirectThreat (SpellEffIndex effIndex)
 
void EffectGameObjectDamage (SpellEffIndex effIndex)
 
void EffectGameObjectRepair (SpellEffIndex effIndex)
 
void EffectGameObjectSetDestructionState (SpellEffIndex effIndex)
 
void EffectActivateRune (SpellEffIndex effIndex)
 
void EffectCreateTamedPet (SpellEffIndex effIndex)
 
void EffectDiscoverTaxi (SpellEffIndex effIndex)
 
void EffectTitanGrip (SpellEffIndex effIndex)
 
void EffectEnchantItemPrismatic (SpellEffIndex effIndex)
 
void EffectPlayMusic (SpellEffIndex effIndex)
 
void EffectSpecCount (SpellEffIndex effIndex)
 
void EffectActivateSpec (SpellEffIndex effIndex)
 
void EffectPlaySound (SpellEffIndex effIndex)
 
void EffectRemoveAura (SpellEffIndex effIndex)
 
void EffectCastButtons (SpellEffIndex effIndex)
 
void EffectRechargeManaGem (SpellEffIndex effIndex)
 
void InitExplicitTargets (SpellCastTargets const &targets)
 
void SelectExplicitTargets ()
 
void SelectSpellTargets ()
 
void SelectEffectImplicitTargets (SpellEffIndex effIndex, SpellImplicitTargetInfo const &targetType, uint32 &processedEffectMask)
 
void SelectImplicitChannelTargets (SpellEffIndex effIndex, SpellImplicitTargetInfo const &targetType)
 
void SelectImplicitNearbyTargets (SpellEffIndex effIndex, SpellImplicitTargetInfo const &targetType, uint32 effMask)
 
void SelectImplicitConeTargets (SpellEffIndex effIndex, SpellImplicitTargetInfo const &targetType, uint32 effMask)
 
void SelectImplicitAreaTargets (SpellEffIndex effIndex, SpellImplicitTargetInfo const &targetType, uint32 effMask)
 
void SelectImplicitCasterDestTargets (SpellEffIndex effIndex, SpellImplicitTargetInfo const &targetType)
 
void SelectImplicitTargetDestTargets (SpellEffIndex effIndex, SpellImplicitTargetInfo const &targetType)
 
void SelectImplicitDestDestTargets (SpellEffIndex effIndex, SpellImplicitTargetInfo const &targetType)
 
void SelectImplicitCasterObjectTargets (SpellEffIndex effIndex, SpellImplicitTargetInfo const &targetType)
 
void SelectImplicitTargetObjectTargets (SpellEffIndex effIndex, SpellImplicitTargetInfo const &targetType)
 
void SelectImplicitChainTargets (SpellEffIndex effIndex, SpellImplicitTargetInfo const &targetType, WorldObject *target, uint32 effMask)
 
void SelectImplicitTrajTargets (SpellEffIndex effIndex, SpellImplicitTargetInfo const &targetType)
 
void SelectEffectTypeImplicitTargets (uint8 effIndex)
 
uint32 GetSearcherTypeMask (SpellTargetObjectTypes objType, ConditionList *condList)
 
template<class SEARCHER >
void SearchTargets (SEARCHER &searcher, uint32 containerMask, Unit *referer, Position const *pos, float radius)
 
WorldObjectSearchNearbyTarget (float range, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionList *condList=nullptr)
 
void SearchAreaTargets (std::list< WorldObject * > &targets, float range, Position const *position, Unit *referer, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionList *condList)
 
void SearchChainTargets (std::list< WorldObject * > &targets, uint32 chainTargets, WorldObject *target, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectType, SpellTargetSelectionCategories selectCategory, ConditionList *condList, bool isChainHeal)
 
SpellCastResult prepare (SpellCastTargets const *targets, AuraEffect const *triggeredByAura=nullptr)
 
void cancel (bool bySelf=false)
 
void update (uint32 difftime)
 
void cast (bool skipCheck=false)
 
void _cast (bool skipCheck)
 
void finish (bool ok=true)
 
void TakePower ()
 
void TakeAmmo ()
 
void TakeRunePower (bool didHit)
 
void TakeReagents ()
 
void TakeCastItem ()
 
SpellCastResult CheckCast (bool strict)
 
SpellCastResult CheckPetCast (Unit *target)
 
void handle_immediate ()
 
uint64 handle_delayed (uint64 t_offset)
 
void _handle_immediate_phase ()
 
void _handle_finish_phase ()
 
void OnSpellLaunch ()
 
SpellCastResult CheckItems ()
 
SpellCastResult CheckSpellFocus ()
 
SpellCastResult CheckRange (bool strict)
 
SpellCastResult CheckPower ()
 
SpellCastResult CheckRuneCost (uint32 RuneCostID)
 
SpellCastResult CheckCasterAuras (bool preventionOnly) const
 
int32 CalculateSpellDamage (uint8 i, Unit const *target) const
 
bool HaveTargetsForEffect (uint8 effect) const
 
void Delayed ()
 
void DelayedChannel ()
 
uint32 getState () const
 
void setState (uint32 state)
 
void DoCreateItem (uint8 effIndex, uint32 itemId)
 
void WriteSpellGoTargets (WorldPacket *data)
 Writes miss and hit targets for a SMSG_SPELL_GO packet.
 
void WriteAmmoToPacket (WorldPacket *data)
 
bool CheckEffectTarget (Unit const *target, uint32 eff) const
 
bool CanAutoCast (Unit *target)
 
void CheckSrc ()
 
void CheckDst ()
 
void SendCastResult (SpellCastResult result)
 
void SendPetCastResult (SpellCastResult result)
 
void SendSpellStart ()
 
void SendSpellGo ()
 
void SendSpellCooldown ()
 
void SendLogExecute ()
 
void ExecuteLogEffectTakeTargetPower (uint8 effIndex, Unit *target, uint32 PowerType, uint32 powerTaken, float gainMultiplier)
 
void ExecuteLogEffectExtraAttacks (uint8 effIndex, Unit *victim, uint32 attCount)
 
void ExecuteLogEffectInterruptCast (uint8 effIndex, Unit *victim, uint32 spellId)
 
void ExecuteLogEffectDurabilityDamage (uint8 effIndex, Unit *victim, int32 itemId, int32 slot)
 
void ExecuteLogEffectOpenLock (uint8 effIndex, Object *obj)
 
void ExecuteLogEffectCreateItem (uint8 effIndex, uint32 entry)
 
void ExecuteLogEffectDestroyItem (uint8 effIndex, uint32 entry)
 
void ExecuteLogEffectSummonObject (uint8 effIndex, WorldObject *obj)
 
void ExecuteLogEffectUnsummonObject (uint8 effIndex, WorldObject *obj)
 
void ExecuteLogEffectResurrect (uint8 effIndex, Unit *target)
 
void SendInterrupted (uint8 result)
 
void SendChannelUpdate (uint32 time)
 
void SendChannelStart (uint32 duration)
 
void SendResurrectRequest (Player *target)
 
void HandleEffects (Unit *pUnitTarget, Item *pItemTarget, GameObject *pGOTarget, uint32 i, SpellEffectHandleMode mode)
 
void HandleThreatSpells ()
 
void AddComboPointGain (Unit *target, int8 amount)
 
int32 GetCastTime () const
 
bool IsAutoRepeat () const
 
void SetAutoRepeat (bool rep)
 
void ReSetTimer ()
 
bool IsNextMeleeSwingSpell () const
 
bool IsTriggered () const
 
bool IsChannelActive () const
 
bool IsAutoActionResetSpell () const
 
bool IsIgnoringCooldowns () const
 
bool IsDeletable () const
 
void SetReferencedFromCurrent (bool yes)
 
bool IsInterruptable () const
 
void SetExecutedCurrently (bool yes)
 
uint64 GetDelayStart () const
 
void SetDelayStart (uint64 m_time)
 
uint64 GetDelayMoment () const
 
uint64 GetDelayTrajectory () const
 
uint64 CalculateDelayMomentForDst () const
 
void RecalculateDelayMomentForDst ()
 
bool IsNeedSendToClient (bool go) const
 
CurrentSpellTypes GetCurrentContainer () const
 
UnitGetCaster () const
 
UnitGetOriginalCaster () const
 
SpellInfo const * GetSpellInfo () const
 
int32 GetPowerCost () const
 
bool UpdatePointers ()
 
void CleanupTargetList ()
 
void SetSpellValue (SpellValueMod mod, int32 value)
 
SpellValue const * GetSpellValue ()
 
void LoadScripts ()
 
std::list< TargetInfo > * GetUniqueTargetInfo ()
 
uint32 GetTriggeredByAuraTickNumber () const
 
TriggerCastFlags GetTriggeredCastFlags () const
 
SpellSchoolMask GetSpellSchoolMask () const
 

Static Public Member Functions

static void WriteCastResultInfo (WorldPacket &data, Player *caster, SpellInfo const *spellInfo, uint8 castCount, SpellCastResult result, SpellCustomErrors customError)
 
static void SendCastResult (Player *caster, SpellInfo const *spellInfo, uint8 castCount, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE)
 

Public Attributes

SpellInfo const *const m_spellInfo
 
Itemm_CastItem
 
Itemm_weaponItem
 
ObjectGuid m_castItemGUID
 
uint8 m_cast_count
 
uint32 m_glyphIndex
 
uint32 m_preCastSpell
 
SpellCastTargets m_targets
 
SpellCustomErrors m_customError
 
Unitm_comboTarget
 
int8 m_comboPointGain
 
UsedSpellMods m_appliedMods
 

Protected Types

typedef std::list< HitTriggerSpellHitTriggerSpellList
 

Protected Member Functions

bool HasGlobalCooldown () const
 
void TriggerGlobalCooldown ()
 
void CancelGlobalCooldown ()
 
void SendLoot (ObjectGuid guid, LootType loottype)
 
std::string GetDebugInfo () const
 
bool isDelayableNoMore ()
 
void prepareDataForTriggerSystem (AuraEffect const *triggeredByAura)
 
void AddUnitTarget (Unit *target, uint32 effectMask, bool checkIfValid=true, bool implicit=true)
 
void AddGOTarget (GameObject *target, uint32 effectMask)
 
void AddItemTarget (Item *item, uint32 effectMask)
 
void AddDestTarget (SpellDestination const &dest, uint32 effIndex)
 
void DoAllEffectOnTarget (TargetInfo *target)
 
SpellMissInfo DoSpellHitOnUnit (Unit *unit, uint32 effectMask, bool scaleAura)
 
void DoTriggersOnSpellHit (Unit *unit, uint8 effMask)
 
void DoAllEffectOnTarget (GOTargetInfo *target)
 
void DoAllEffectOnTarget (ItemTargetInfo *target)
 
bool UpdateChanneledTargetList ()
 
bool IsValidDeadOrAliveTarget (Unit const *target) const
 
void HandleLaunchPhase ()
 
void DoAllEffectOnLaunchTarget (TargetInfo &targetInfo, float *multiplier)
 
void PrepareTargetProcessing ()
 
void FinishTargetProcessing ()
 
void InitEffectExecuteData (uint8 effIndex)
 
void CheckEffectExecuteData ()
 
void CallScriptBeforeCastHandlers ()
 
void CallScriptOnCastHandlers ()
 
void CallScriptAfterCastHandlers ()
 
SpellCastResult CallScriptCheckCastHandlers ()
 
void PrepareScriptHitHandlers ()
 
bool CallScriptEffectHandlers (SpellEffIndex effIndex, SpellEffectHandleMode mode)
 
void CallScriptBeforeHitHandlers (SpellMissInfo missInfo)
 
void CallScriptOnHitHandlers ()
 
void CallScriptAfterHitHandlers ()
 
void CallScriptObjectAreaTargetSelectHandlers (std::list< WorldObject * > &targets, SpellEffIndex effIndex, SpellImplicitTargetInfo const &targetType)
 
void CallScriptObjectTargetSelectHandlers (WorldObject *&target, SpellEffIndex effIndex, SpellImplicitTargetInfo const &targetType)
 
void CallScriptDestinationTargetSelectHandlers (SpellDestination &target, SpellEffIndex effIndex, SpellImplicitTargetInfo const &targetType)
 
bool CheckScriptEffectImplicitTargets (uint32 effIndex, uint32 effIndexToCheck)
 
bool CanExecuteTriggersOnHit (uint8 effMask, SpellInfo const *triggeredByAura=nullptr) const
 
void PrepareTriggersExecutedOnHit ()
 
void SummonGuardian (uint32 i, uint32 entry, SummonPropertiesEntry const *properties, uint32 numSummons, bool personalSpawn)
 
void CalculateJumpSpeeds (uint8 i, float dist, float &speedxy, float &speedz)
 
SpellCastResult CanOpenLock (uint32 effIndex, uint32 lockid, SkillType &skillid, int32 &reqSkillValue, int32 &skillValue)
 

Protected Attributes

Unit *const m_caster
 
SpellValue *const m_spellValue
 
ObjectGuid m_originalCasterGUID
 
Unitm_originalCaster
 
Spell ** m_selfContainer
 
SpellSchoolMask m_spellSchoolMask
 
WeaponAttackType m_attackType
 
int32 m_powerCost
 
int32 m_casttime
 
int32 m_channeledDuration
 
bool m_canReflect
 
uint8 m_spellFlags
 
bool m_autoRepeat
 
uint8 m_runesState
 
uint8 m_delayAtDamageCount
 
uint64 m_delayStart
 
uint64 m_delayMoment
 
uint64 m_delayTrajectory
 
bool m_immediateHandled
 
bool m_referencedFromCurrentSpell
 
bool m_executedCurrently
 
bool m_needComboPoints
 
uint8 m_applyMultiplierMask
 
float m_damageMultipliers [3]
 
UnitunitTarget
 
ItemitemTarget
 
GameObjectgameObjTarget
 
WorldLocationdestTarget
 
int32 damage
 
SpellEffectHandleMode effectHandleMode
 
Auram_spellAura
 
DiminishingLevels m_diminishLevel
 
DiminishingGroup m_diminishGroup
 
GameObjectfocusObject
 
int32 m_damage
 
int32 m_healing
 
uint32 m_procAttacker
 
uint32 m_procVictim
 
uint32 m_procEx
 
std::list< TargetInfom_UniqueTargetInfo
 
uint8 m_channelTargetEffectMask
 
std::list< GOTargetInfom_UniqueGOTargetInfo
 
std::list< ItemTargetInfom_UniqueItemInfo
 
SpellDestination m_destTargets [MAX_SPELL_EFFECTS]
 
bool _scriptsLoaded
 
std::list< SpellScript * > m_loadedScripts
 
HitTriggerSpellList m_hitTriggerSpells
 
uint32 m_spellState
 
int32 m_timer
 
SpellEvent_spellEvent
 
TriggerCastFlags _triggeredCastFlags
 
TriggeredByAuraSpellData m_triggeredByAuraSpell
 
bool m_skipCheck
 
uint8 m_auraScaleMask
 
std::unique_ptr< PathGeneratorm_preGeneratedPath
 
bool _spellTargetsSelected
 
ByteBufferm_effectExecuteData [MAX_SPELL_EFFECTS]
 

Friends

class SpellScript
 
void Unit::SetCurrentCastedSpell (Spell *pSpell)
 

Detailed Description

Member Typedef Documentation

◆ HitTriggerSpellList

typedef std::list<HitTriggerSpell> Spell::HitTriggerSpellList
protected

◆ UsedSpellMods

typedef std::set<Aura*> Spell::UsedSpellMods

Constructor & Destructor Documentation

◆ Spell()

Spell::Spell ( Unit caster,
SpellInfo const *  info,
TriggerCastFlags  triggerFlags,
ObjectGuid  originalCasterGUID = ObjectGuid::Empty,
bool  skipCheck = false 
)
566 :
567 m_spellInfo(sSpellMgr->GetSpellForDifficultyFromSpell(info, caster)),
568 m_caster((info->HasAttribute(SPELL_ATTR6_ORIGINATE_FROM_CONTROLLER) && caster->GetCharmerOrOwner()) ? caster->GetCharmerOrOwner() : caster)
570{
572 m_skipCheck = skipCheck;
573 m_selfContainer = nullptr;
575 m_executedCurrently = false;
578 m_comboTarget = nullptr;
579 m_delayStart = 0;
581
583 m_auraScaleMask = 0;
584 memset(m_damageMultipliers, 0, sizeof(m_damageMultipliers));
585
586 // Get data for type of attack
587 switch (m_spellInfo->DmgClass)
588 {
592 else
594 break;
597 break;
598 default:
599 // Wands
602 else
604 break;
605 }
606
607 m_spellSchoolMask = info->GetSchoolMask(); // Can be override for some spell (wand shoot for example)
608
610 // wand case
613 m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetTemplate()->Damage[0].DamageType);
614
615 if (originalCasterGUID)
616 m_originalCasterGUID = originalCasterGUID;
617 else
619
622 else
623 {
626 m_originalCaster = nullptr;
627 }
628
630 _triggeredCastFlags = triggerFlags;
631 if (info->HasAttribute(SPELL_ATTR4_ALLOW_CAST_WHILE_CASTING))
633
634 m_CastItem = nullptr;
635
636 unitTarget = nullptr;
637 itemTarget = nullptr;
638 gameObjTarget = nullptr;
639 destTarget = nullptr;
640 damage = 0;
644 m_damage = 0;
645 m_healing = 0;
646 m_procAttacker = 0;
647 m_procVictim = 0;
648 m_procEx = 0;
649 focusObject = nullptr;
650 m_cast_count = 0;
651 m_glyphIndex = 0;
652 m_preCastSpell = 0;
653 m_spellAura = nullptr;
654 _scriptsLoaded = false;
655
656 //Auto Shot & Shoot (wand)
658
659 m_runesState = 0;
660 m_powerCost = 0; // setup to correct value in Spell::prepare, must not be used before.
661 m_casttime = 0; // setup to correct value in Spell::prepare, must not be used before.
662 m_timer = 0; // will set to castime in prepare
663 m_channeledDuration = 0; // will be setup in Spell::handle_immediate
664 m_immediateHandled = false;
665
667
669
670 // Determine if spell can be reflected back to the caster
671 // Patch 1.2 notes: Spell Reflection no longer reflects abilities
675
677 memset(m_effectExecuteData, 0, MAX_SPELL_EFFECTS * sizeof(ByteBuffer*));
678
679 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
681
682 // xinef:
683 _spellTargetsSelected = false;
684
685 m_weaponItem = nullptr;
686}
std::uint8_t uint8
Definition: Define.h:110
std::uint32_t uint32
Definition: Define.h:108
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
@ OFF_ATTACK
Definition: Unit.h:397
@ BASE_ATTACK
Definition: Unit.h:396
@ RANGED_ATTACK
Definition: Unit.h:398
@ DIMINISHING_LEVEL_1
Definition: Unit.h:694
@ SPELL_EFFECT_HANDLE_LAUNCH
Definition: Spell.h:233
@ SPELL_FLAG_NORMAL
Definition: Spell.h:81
@ SPELL_STATE_NULL
Definition: Spell.h:223
TriggerCastFlags
Definition: SpellDefines.h:130
@ TRIGGERED_CAST_DIRECTLY
Will ignore combo point requirement.
Definition: SpellDefines.h:139
@ TRIGGERED_IGNORE_CAST_IN_PROGRESS
Will ignore aura scaling.
Definition: SpellDefines.h:137
#define sSpellMgr
Definition: SpellMgr.h:825
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1635
@ DIMINISHING_NONE
Definition: SharedDefines.h:3258
@ SPELL_EFFECT_DISPEL
Definition: SharedDefines.h:816
#define CLASSMASK_WAND_USERS
Definition: SharedDefines.h:174
@ SPELL_ATTR2_AUTO_REPEAT
Definition: SharedDefines.h:461
@ SPELL_ATTR1_NO_REFLECTION
Definition: SharedDefines.h:426
@ SPELL_ATTR3_REQUIRES_OFF_HAND_WEAPON
Definition: SharedDefines.h:517
@ SPELL_DAMAGE_CLASS_RANGED
Definition: SharedDefines.h:1548
@ SPELL_DAMAGE_CLASS_MAGIC
Definition: SharedDefines.h:1546
@ SPELL_DAMAGE_CLASS_MELEE
Definition: SharedDefines.h:1547
@ SPELL_CUSTOM_ERROR_NONE
Definition: SharedDefines.h:1143
@ SPELL_ATTR0_IS_ABILITY
Definition: SharedDefines.h:386
@ SPELL_ATTR0_NO_IMMUNITIES
Definition: SharedDefines.h:411
@ SPELL_ATTR4_ALLOW_CAST_WHILE_CASTING
Definition: SharedDefines.h:537
@ SPELL_ATTR6_ORIGINATE_FROM_CONTROLLER
Definition: SharedDefines.h:622
SpellSchoolMask
Definition: SharedDefines.h:295
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:202
Definition: Item.h:214
Player * ToPlayer()
Definition: Object.h:195
bool IsInWorld() const
Definition: Object.h:101
TypeID GetTypeId() const
Definition: Object.h:121
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
Item * GetWeaponForAttack(WeaponAttackType attackType, bool useable=false) const
Definition: PlayerStorage.cpp:516
Unit * GetCharmerOrOwner() const
Definition: Unit.h:1861
uint32 getClassMask() const
Definition: Unit.h:1439
Definition: Spell.h:94
Definition: Spell.h:211
Unit * m_comboTarget
Definition: Spell.h:542
int8 m_comboPointGain
Definition: Spell.h:543
GameObject * gameObjTarget
Definition: Spell.h:652
bool m_referencedFromCurrentSpell
Definition: Spell.h:643
bool m_canReflect
Definition: Spell.h:619
uint32 m_procVictim
Definition: Spell.h:674
Unit * m_originalCaster
Definition: Spell.h:607
bool m_needComboPoints
Definition: Spell.h:645
uint64 m_delayStart
Definition: Spell.h:637
bool _scriptsLoaded
Definition: Spell.h:725
TriggerCastFlags _triggeredCastFlags
Definition: Spell.h:766
int32 damage
Definition: Spell.h:654
SpellEffectHandleMode effectHandleMode
Definition: Spell.h:655
int32 m_channeledDuration
Definition: Spell.h:618
Aura * m_spellAura
Definition: Spell.h:657
SpellDestination m_destTargets[MAX_SPELL_EFFECTS]
Definition: Spell.h:700
Unit *const m_caster
Definition: Spell.h:601
uint8 m_delayAtDamageCount
Definition: Spell.h:626
WeaponAttackType m_attackType
Definition: Spell.h:615
bool m_immediateHandled
Definition: Spell.h:640
uint32 m_spellState
Definition: Spell.h:762
ObjectGuid m_originalCasterGUID
Definition: Spell.h:605
void CleanupTargetList()
Definition: Spell.cpp:2370
int32 m_timer
Definition: Spell.h:763
int32 m_casttime
Definition: Spell.h:617
Item * itemTarget
Definition: Spell.h:651
uint8 m_cast_count
Definition: Spell.h:524
int32 m_damage
Definition: Spell.h:667
bool m_executedCurrently
Definition: Spell.h:644
DiminishingLevels m_diminishLevel
Definition: Spell.h:660
float m_damageMultipliers[3]
Definition: Spell.h:647
ByteBuffer * m_effectExecuteData[MAX_SPELL_EFFECTS]
Definition: Spell.h:780
uint8 m_auraScaleMask
Definition: Spell.h:774
SpellCustomErrors m_customError
Definition: Spell.h:528
uint8 m_spellFlags
Definition: Spell.h:621
bool m_skipCheck
Definition: Spell.h:773
int32 m_healing
Definition: Spell.h:668
uint32 m_glyphIndex
Definition: Spell.h:525
uint8 m_channelTargetEffectMask
Definition: Spell.h:682
Item * m_weaponItem
Definition: Spell.h:522
Unit * unitTarget
Definition: Spell.h:650
SpellSchoolMask m_spellSchoolMask
Definition: Spell.h:614
SpellEvent * _spellEvent
Definition: Spell.h:765
bool _spellTargetsSelected
Definition: Spell.h:778
uint32 m_preCastSpell
Definition: Spell.h:526
WorldLocation * destTarget
Definition: Spell.h:653
Spell ** m_selfContainer
Definition: Spell.h:609
uint8 m_applyMultiplierMask
Definition: Spell.h:646
DiminishingGroup m_diminishGroup
Definition: Spell.h:661
uint32 m_procEx
Definition: Spell.h:675
Item * m_CastItem
Definition: Spell.h:521
SpellValue *const m_spellValue
Definition: Spell.h:603
int32 m_powerCost
Definition: Spell.h:616
uint32 m_procAttacker
Definition: Spell.h:673
GameObject * focusObject
Definition: Spell.h:664
SpellInfo const *const m_spellInfo
Definition: Spell.h:520
uint8 m_runesState
Definition: Spell.h:624
bool m_autoRepeat
Definition: Spell.h:623
bool IsPassive() const
Definition: SpellInfo.cpp:1085
bool NeedsComboPoints() const
Definition: SpellInfo.cpp:1253
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:412
bool HasEffect(SpellEffects effect) const
Definition: SpellInfo.cpp:872
bool IsPositive() const
Definition: SpellInfo.cpp:1224
bool IsAutoRepeatRangedSpell() const
Definition: SpellInfo.cpp:1270
uint32 DmgClass
Definition: SpellInfo.h:387
bool IsRangedWeaponSpell() const
Definition: SpellInfo.cpp:1263
Definition: ByteBuffer.h:70

References _scriptsLoaded, _spellTargetsSelected, _triggeredCastFlags, BASE_ATTACK, CLASSMASK_WAND_USERS, CleanupTargetList(), damage, destTarget, DIMINISHING_LEVEL_1, DIMINISHING_NONE, SpellInfo::DmgClass, effectHandleMode, focusObject, gameObjTarget, Unit::getClassMask(), Object::GetGUID(), SpellInfo::GetSchoolMask(), Object::GetTypeId(), ObjectAccessor::GetUnit(), Player::GetWeaponForAttack(), SpellInfo::HasAttribute(), SpellInfo::HasEffect(), SpellInfo::IsAutoRepeatRangedSpell(), Object::IsInWorld(), SpellInfo::IsPassive(), SpellInfo::IsPositive(), SpellInfo::IsRangedWeaponSpell(), itemTarget, m_applyMultiplierMask, m_attackType, m_auraScaleMask, m_autoRepeat, m_canReflect, m_cast_count, m_caster, m_CastItem, m_casttime, m_channeledDuration, m_channelTargetEffectMask, m_comboPointGain, m_comboTarget, m_customError, m_damage, m_damageMultipliers, m_delayAtDamageCount, m_delayStart, m_destTargets, m_diminishGroup, m_diminishLevel, m_effectExecuteData, m_executedCurrently, m_glyphIndex, m_healing, m_immediateHandled, m_needComboPoints, m_originalCaster, m_originalCasterGUID, m_powerCost, m_preCastSpell, m_procAttacker, m_procEx, m_procVictim, m_referencedFromCurrentSpell, m_runesState, m_selfContainer, m_skipCheck, m_spellAura, m_spellFlags, m_spellInfo, m_spellSchoolMask, m_spellState, m_timer, m_weaponItem, MAX_SPELL_EFFECTS, SpellInfo::NeedsComboPoints(), OFF_ATTACK, RANGED_ATTACK, SPELL_ATTR0_IS_ABILITY, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR1_NO_REFLECTION, SPELL_ATTR2_AUTO_REPEAT, SPELL_ATTR3_REQUIRES_OFF_HAND_WEAPON, SPELL_ATTR4_ALLOW_CAST_WHILE_CASTING, SPELL_CUSTOM_ERROR_NONE, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_RANGED, SPELL_EFFECT_DISPEL, SPELL_EFFECT_HANDLE_LAUNCH, SPELL_FLAG_NORMAL, SPELL_STATE_NULL, Object::ToPlayer(), TRIGGERED_CAST_DIRECTLY, TRIGGERED_IGNORE_CAST_IN_PROGRESS, TYPEID_PLAYER, and unitTarget.

◆ ~Spell()

Spell::~Spell ( )
689{
690 // unload scripts
691 while (!m_loadedScripts.empty())
692 {
693 std::list<SpellScript*>::iterator itr = m_loadedScripts.begin();
694 (*itr)->_Unload();
695 delete (*itr);
696 m_loadedScripts.erase(itr);
697 }
698
700 {
701 // Clean the reference to avoid later crash.
702 // If this error is repeating, we may have to add an ASSERT to better track down how we get into this case.
703 LOG_ERROR("spells", "Spell::~Spell: deleting spell for spell ID {}. However, spell still referenced.", m_spellInfo->Id);
704 *m_selfContainer = nullptr;
705 }
706
707 delete m_spellValue;
708
710}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:157
void CheckEffectExecuteData()
Definition: Spell.cpp:8449
std::list< SpellScript * > m_loadedScripts
Definition: Spell.h:740
uint32 Id
Definition: SpellInfo.h:318

References CheckEffectExecuteData(), SpellInfo::Id, LOG_ERROR, m_loadedScripts, m_referencedFromCurrentSpell, m_selfContainer, m_spellInfo, and m_spellValue.

Member Function Documentation

◆ _cast()

void Spell::_cast ( bool  skipCheck)

Not own traded item (in trader trade slot) req. reagents including triggered spell case

3797{
3798 // update pointers base at GUIDs to prevent access to non-existed already object
3799 if (!UpdatePointers())
3800 {
3801 // cancel the spell if UpdatePointers() returned false, something wrong happened there
3802 cancel();
3803 return;
3804 }
3805
3806 // cancel at lost explicit target during cast
3808 {
3809 cancel();
3810 return;
3811 }
3812
3813 // Xinef: implement attribute SPELL_ATTR1_DISMISS_PET_FIRST, on spell cast current pet is dismissed and charms are removed
3815 {
3817 if (Pet* pet = m_caster->ToPlayer()->GetPet())
3819
3820 if (Unit* charm = m_caster->GetCharm())
3821 charm->RemoveAurasByType(SPELL_AURA_MOD_CHARM, m_caster->GetGUID());
3822 }
3823
3824 if (Player* playerCaster = m_caster->ToPlayer())
3825 {
3826 // now that we've done the basic check, now run the scripts
3827 // should be done before the spell is actually executed
3828 sScriptMgr->OnPlayerSpellCast(playerCaster, this, skipCheck);
3829
3830 // As of 3.0.2 pets begin attacking their owner's target immediately
3831 // Let any pets know we've attacked something. Check DmgClass for harmful spells only
3832 // This prevents spells such as Hunter's Mark from triggering pet attack
3833 // xinef: take into account SPELL_ATTR3_SUPRESS_TARGET_PROCS
3835 if (!playerCaster->m_Controlled.empty())
3836 for (Unit::ControlSet::iterator itr = playerCaster->m_Controlled.begin(); itr != playerCaster->m_Controlled.end(); ++itr)
3837 if (Unit* pet = *itr)
3838 if (pet->IsAlive() && pet->GetTypeId() == TYPEID_UNIT)
3839 pet->ToCreature()->AI()->OwnerAttacked(m_targets.GetUnitTarget());
3840 }
3841
3843
3847
3849
3850 Player* modOwner = m_caster->GetSpellModOwner();
3851 // skip check if done already (for instant cast spells for example)
3852 if (!skipCheck)
3853 {
3854 SpellCastResult castResult = CheckCast(false);
3855 if (castResult != SPELL_CAST_OK)
3856 {
3857 SendCastResult(castResult);
3858 SendInterrupted(0);
3859
3860 finish(false);
3861 SetExecutedCurrently(false);
3862 return;
3863 }
3864
3865 // additional check after cast bar completes (must not be in CheckCast)
3866 // if trade not complete then remember it in trade data
3868 {
3870 {
3871 if (TradeData* my_trade = m_caster->ToPlayer()->GetTradeData())
3872 {
3873 if (!my_trade->IsInAcceptProcess())
3874 {
3875 // Spell will be casted at completing the trade. Silently ignore at this place
3876 my_trade->SetSpell(m_spellInfo->Id, m_CastItem);
3878 SendInterrupted(0);
3879
3880 finish(false);
3881 SetExecutedCurrently(false);
3882 return;
3883 }
3884 }
3885 }
3886 }
3887 }
3888
3889 if (modOwner)
3890 modOwner->SetSpellModTakingSpell(this, true);
3891
3894
3895 if (modOwner)
3896 modOwner->SetSpellModTakingSpell(this, false);
3897
3898 // Spell may be finished after target map check
3900 {
3901 SendInterrupted(0);
3902 finish(false);
3903 SetExecutedCurrently(false);
3904 return;
3905 }
3906
3907 if (modOwner)
3908 modOwner->SetSpellModTakingSpell(this, true);
3909
3911
3913
3914 if (modOwner)
3915 modOwner->SetSpellModTakingSpell(this, false);
3916
3917 // traded items have trade slot instead of guid in m_itemTargetGUID
3918 // set to real guid to be sent later to the client
3920
3922 {
3924 {
3927 }
3928
3930 }
3931
3933 {
3934 // Powers have to be taken before SendSpellGo
3935 TakePower();
3936 TakeReagents(); // we must remove reagents before HandleEffects to allow place crafted item in same slot
3937 }
3938 else if (Item* targetItem = m_targets.GetItemTarget())
3939 {
3941 if (targetItem->GetOwnerGUID() != m_caster->GetGUID())
3942 TakeReagents();
3943 }
3944
3946
3947 // CAST SPELL
3948 if (modOwner)
3949 modOwner->SetSpellModTakingSpell(this, true);
3950
3952
3954
3955 // we must send smsg_spell_go packet before m_castItem delete in TakeCastItem()...
3956 SendSpellGo();
3957
3958 if (modOwner)
3959 modOwner->SetSpellModTakingSpell(this, false);
3960
3961 if (m_originalCaster)
3962 {
3963 // Handle procs on cast
3964 uint32 procAttacker = m_procAttacker;
3965 if (!procAttacker)
3966 {
3967 bool IsPositive = m_spellInfo->IsPositive();
3969 {
3971 }
3972 else
3973 {
3975 }
3976 }
3977
3978 uint32 procEx = PROC_EX_NORMAL_HIT;
3979
3980 for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
3981 {
3982 if (ihit->missCondition != SPELL_MISS_NONE)
3983 {
3984 continue;
3985 }
3986
3987 if (!ihit->crit)
3988 {
3989 continue;
3990 }
3991
3992 procEx |= PROC_EX_CRITICAL_HIT;
3993 break;
3994 }
3995
3998 }
3999
4000 if (modOwner)
4001 modOwner->SetSpellModTakingSpell(this, true);
4002
4004 if (resetAttackTimers)
4005 {
4007 for (Unit::AuraEffectList::const_iterator i = vIgnoreReset.begin(); i != vIgnoreReset.end(); ++i)
4008 {
4009 if ((*i)->IsAffectedOnSpell(m_spellInfo))
4010 {
4011 resetAttackTimers = false;
4012 break;
4013 }
4014 }
4015 }
4016
4017 // Okay, everything is prepared. Now we need to distinguish between immediate and evented delayed spells
4018 if ((m_spellInfo->Speed > 0.0f && !m_spellInfo->IsChanneled())/* xinef: we dont need this || m_spellInfo->Id == 14157*/)
4019 {
4020 // Remove used for cast item if need (it can be already nullptr after TakeReagents call
4021 // in case delayed spell remove item at cast delay start
4022 TakeCastItem();
4023
4024 // Okay, maps created, now prepare flags
4025 m_immediateHandled = false;
4027 SetDelayStart(0);
4028
4031
4032 // remove all applied mods at this point
4033 // dont allow user to use them twice in case spell did not reach current target
4034 if (modOwner)
4035 modOwner->RemoveSpellMods(this);
4036
4037 // Xinef: why do we keep focus after spell is sent to air?
4038 // Xinef: Because of this, in the middle of some animation after setting targetguid to 0 etc
4039 // Xinef: we get focused to it out of nowhere...
4040 if (Creature* creatureCaster = m_caster->ToCreature())
4041 creatureCaster->ReleaseFocus(this);
4042 }
4043 else
4044 {
4045 // Immediate spell, no big deal
4047 }
4048
4049 if (resetAttackTimers)
4050 {
4051 if (m_casttime == 0 && m_spellInfo->CalcCastTime())
4052 {
4053 resetAttackTimers = false;
4054 }
4055
4056 if (resetAttackTimers)
4057 {
4059
4061 {
4063 }
4064
4066 }
4067 }
4068
4070
4071 if (modOwner)
4072 modOwner->SetSpellModTakingSpell(this, false);
4073
4074 if (const std::vector<int32>* spell_triggered = sSpellMgr->GetSpellLinked(m_spellInfo->Id))
4075 {
4076 for (std::vector<int32>::const_iterator i = spell_triggered->begin(); i != spell_triggered->end(); ++i)
4077 if (*i < 0)
4079 else
4081 }
4082
4083 // Interrupt Spell casting
4084 // handle this here, in other places SpellHitTarget can be set to nullptr, if there is an error in this function
4086 if (Unit* target = m_targets.GetUnitTarget())
4087 if (target->GetTypeId() == TYPEID_UNIT)
4088 m_caster->CastSpell(target, 32747, true);
4089
4090 // xinef: start combat at cast for delayed spells, only for explicit target
4091 if (Unit* target = m_targets.GetUnitTarget())
4094 m_caster->CombatStartOnCast(target, !m_spellInfo->HasAttribute(SPELL_ATTR3_SUPRESS_TARGET_PROCS), GetDelayMoment() + 500); // xinef: increase this time so we dont leave and enter combat in a moment
4095
4099
4100 SetExecutedCurrently(false);
4101}
@ TYPEID_UNIT
Definition: ObjectGuid.h:37
@ PET_SAVE_AS_CURRENT
Definition: PetDefines.h:42
@ CHEAT_COOLDOWN
Definition: Player.h:993
@ UNIT_STATE_CASTING
Definition: Unit.h:340
#define sScriptMgr
Definition: ScriptMgr.h:698
@ SPELL_AURA_MOD_CHARM
Definition: SpellAuraDefines.h:69
@ SPELL_AURA_IGNORE_MELEE_RESET
Definition: SpellAuraDefines.h:335
@ SPELL_AURA_BIND_SIGHT
Definition: SpellAuraDefines.h:64
@ SPELL_STATE_DELAYED
Definition: Spell.h:228
@ SPELL_STATE_FINISHED
Definition: Spell.h:226
@ TRIGGERED_IGNORE_POWER_AND_REAGENT_COST
Will ignore Spell and Category cooldowns.
Definition: SpellDefines.h:134
@ TRIGGERED_IGNORE_CAST_ITEM
Will ignore power and reagent cost.
Definition: SpellDefines.h:135
@ TRIGGERED_IGNORE_SET_FACING
Will ignore interruptible aura's at cast.
Definition: SpellDefines.h:141
@ TARGET_FLAG_TRADE_ITEM
Definition: SpellInfo.h:58
@ TARGET_FLAG_UNIT
Definition: SpellInfo.h:47
@ PROC_EX_CRITICAL_HIT
Definition: SpellMgr.h:195
@ PROC_EX_NORMAL_HIT
Definition: SpellMgr.h:194
@ PROC_SPELL_PHASE_CAST
Definition: SpellMgr.h:243
@ PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS
Definition: SpellMgr.h:128
@ PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS
Definition: SpellMgr.h:122
@ PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG
Definition: SpellMgr.h:125
@ PROC_FLAG_NONE
Definition: SpellMgr.h:105
@ PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG
Definition: SpellMgr.h:131
@ ACHIEVEMENT_TIMED_TYPE_ITEM
Definition: DBCEnums.h:123
@ ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM
Definition: DBCEnums.h:163
@ ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL
Definition: DBCEnums.h:151
@ SPELL_ATTR7_CAN_CAUSE_INTERRUPT
Definition: SharedDefines.h:652
@ SPELL_EFFECT_SUMMON_PET
Definition: SharedDefines.h:834
@ SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS
Definition: SharedDefines.h:473
@ SPELL_ATTR1_DISMISS_PET_FIRST
Definition: SharedDefines.h:419
@ SPELL_ATTR3_SUPRESS_TARGET_PROCS
Definition: SharedDefines.h:510
@ SPELL_DAMAGE_CLASS_NONE
Definition: SharedDefines.h:1545
@ SPELL_MISS_NONE
Definition: SharedDefines.h:1519
SpellCastResult
Definition: SharedDefines.h:948
@ SPELL_FAILED_DONT_REPORT
Definition: SharedDefines.h:976
@ SPELL_CAST_OK
Definition: SharedDefines.h:1138
Definition: Creature.h:46
uint32 GetEntry() const
Definition: Object.h:109
Creature * ToCreature()
Definition: Object.h:197
Definition: Pet.h:40
Definition: Player.h:1056
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
Definition: PlayerUpdates.cpp:2131
void SetSpellModTakingSpell(Spell *spell, bool apply)
Definition: Player.cpp:9996
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost=0)
Definition: Player.cpp:13836
void RemoveSpellMods(Spell *spell)
Definition: Player.cpp:9928
Pet * GetPet() const
Definition: Player.cpp:8819
bool GetCommandStatus(uint32 command) const
Definition: Player.h:1166
void RemovePet(Pet *pet, PetSaveMode mode, bool returnreagent=false)
Definition: Player.cpp:8970
TradeData * GetTradeData() const
Definition: Player.h:1356
void RemoveSpellCooldown(uint32 spell_id, bool update=false)
Definition: Player.cpp:3475
Definition: TradeData.h:36
Definition: Unit.h:1302
void ClearUnitState(uint32 f)
Definition: Unit.h:1411
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1981
Unit * GetCharm() const
Definition: Unit.cpp:10665
Player * GetSpellModOwner() const
Definition: Unit.cpp:16845
void CombatStartOnCast(Unit *target, bool initialAggro=true, uint32 duration=0)
Definition: Unit.cpp:13695
bool haveOffhandWeapon() const
Definition: Unit.cpp:540
bool IsPet() const
Definition: Unit.h:1425
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition: Unit.cpp:4051
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1169
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4855
static void ProcDamageAndSpell(Unit *actor, Unit *victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType=BASE_ATTACK, SpellInfo const *procSpellInfo=nullptr, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
Definition: Unit.cpp:6316
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1410
bool IsFriendlyTo(Unit const *unit) const
Definition: Unit.cpp:10249
bool IsControlledByPlayer() const
Definition: Unit.h:1842
std::list< AuraEffect * > AuraEffectList
Definition: Unit.h:1318
void SetInFront(WorldObject const *target)
Definition: Unit.cpp:20878
void resetAttackTimer(WeaponAttackType type=BASE_ATTACK)
Definition: Unit.cpp:661
WorldObject * GetObjectTarget() const
Definition: Spell.cpp:310
void UpdateTradeSlotItem()
Definition: Spell.cpp:347
ObjectGuid GetObjectTargetGUID() const
Definition: Spell.cpp:315
Item * GetItemTarget() const
Definition: Spell.h:139
uint32 GetTargetMask() const
Definition: Spell.h:117
Unit * GetUnitTarget() const
Definition: Spell.cpp:231
int8 effectIndex
Definition: Spell.h:279
SpellInfo const * spellInfo
Definition: Spell.h:278
SpellInfo const * GetSpellInfo() const
Definition: Spell.h:574
void CallScriptAfterCastHandlers()
Definition: Spell.cpp:8503
void PrepareTriggersExecutedOnHit()
Definition: Spell.cpp:8709
SpellCastTargets m_targets
Definition: Spell.h:527
TriggeredByAuraSpellData m_triggeredByAuraSpell
Definition: Spell.h:771
void handle_immediate()
Definition: Spell.cpp:4103
void SendSpellGo()
Definition: Spell.cpp:4773
void TakeReagents()
Definition: Spell.cpp:5507
void SetExecutedCurrently(bool yes)
Definition: Spell.h:560
void SendInterrupted(uint8 result)
Definition: Spell.cpp:5150
void PrepareScriptHitHandlers()
Definition: Spell.cpp:8535
void CallScriptOnCastHandlers()
Definition: Spell.cpp:8490
void cancel(bool bySelf=false)
Definition: Spell.cpp:3707
void SendSpellCooldown()
Definition: Spell.cpp:4340
void CallScriptBeforeCastHandlers()
Definition: Spell.cpp:8477
void HandleLaunchPhase()
Definition: Spell.cpp:8190
bool UpdatePointers()
Definition: Spell.cpp:7823
void SetDelayStart(uint64 m_time)
Definition: Spell.h:562
std::list< TargetInfo > m_UniqueTargetInfo
Definition: Spell.h:681
void SelectSpellTargets()
Definition: Spell.cpp:814
void TakePower()
Definition: Spell.cpp:5291
SpellCastResult CheckCast(bool strict)
Definition: Spell.cpp:5626
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, uint8 castCount, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE)
Definition: Spell.cpp:4645
uint64 GetDelayMoment() const
Definition: Spell.h:563
void TakeCastItem()
Definition: Spell.cpp:5228
bool IsAutoActionResetSpell() const
Definition: Spell.cpp:8037
void finish(bool ok=true)
Definition: Spell.cpp:4463
float Speed
Definition: SpellInfo.h:368
bool IsChanneled() const
Definition: SpellInfo.cpp:1243
uint32 CalcCastTime(Unit *caster=nullptr, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:2338
bool HasAura(AuraType aura) const
Definition: SpellInfo.cpp:880

References _spellTargetsSelected, _triggeredCastFlags, ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM, ACHIEVEMENT_TIMED_TYPE_ITEM, BASE_ATTACK, SpellInfo::CalcCastTime(), CallScriptAfterCastHandlers(), CallScriptBeforeCastHandlers(), CallScriptOnCastHandlers(), cancel(), Unit::CastSpell(), CHEAT_COOLDOWN, CheckCast(), Unit::ClearUnitState(), Unit::CombatStartOnCast(), SpellInfo::DmgClass, TriggeredByAuraSpellData::effectIndex, finish(), Unit::GetAuraEffectsByType(), Unit::GetCharm(), Player::GetCommandStatus(), GetDelayMoment(), Object::GetEntry(), Object::GetGUID(), SpellCastTargets::GetItemTarget(), SpellCastTargets::GetObjectTarget(), SpellCastTargets::GetObjectTargetGUID(), Player::GetPet(), GetSpellInfo(), Unit::GetSpellModOwner(), SpellCastTargets::GetTargetMask(), Player::GetTradeData(), Object::GetTypeId(), SpellCastTargets::GetUnitTarget(), handle_immediate(), HandleLaunchPhase(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), SpellInfo::HasEffect(), Unit::HasUnitState(), Unit::haveOffhandWeapon(), SpellInfo::Id, IsAutoActionResetSpell(), SpellInfo::IsChanneled(), Unit::IsControlledByPlayer(), Unit::IsFriendlyTo(), Unit::IsNonMeleeSpellCast(), Unit::IsPet(), SpellInfo::IsPositive(), m_caster, m_CastItem, m_casttime, m_immediateHandled, m_originalCaster, m_procAttacker, m_spellInfo, m_spellState, m_targets, m_triggeredByAuraSpell, m_UniqueTargetInfo, OFF_ATTACK, PET_SAVE_AS_CURRENT, PrepareScriptHitHandlers(), PrepareTriggersExecutedOnHit(), PROC_EX_CRITICAL_HIT, PROC_EX_NORMAL_HIT, PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG, PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS, PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG, PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS, PROC_FLAG_NONE, PROC_SPELL_PHASE_CAST, Unit::ProcDamageAndSpell(), RANGED_ATTACK, Unit::RemoveAurasDueToSpell(), Player::RemovePet(), Player::RemoveSpellCooldown(), Player::RemoveSpellMods(), Unit::resetAttackTimer(), SelectSpellTargets(), SendCastResult(), SendInterrupted(), SendSpellCooldown(), SendSpellGo(), SetDelayStart(), SetExecutedCurrently(), Unit::SetInFront(), Player::SetSpellModTakingSpell(), SpellInfo::Speed, SPELL_ATTR1_DISMISS_PET_FIRST, SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS, SPELL_ATTR3_SUPRESS_TARGET_PROCS, SPELL_ATTR7_CAN_CAUSE_INTERRUPT, SPELL_AURA_BIND_SIGHT, SPELL_AURA_IGNORE_MELEE_RESET, SPELL_AURA_MOD_CHARM, SPELL_CAST_OK, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_NONE, SPELL_EFFECT_DISPEL, SPELL_EFFECT_SUMMON_PET, SPELL_FAILED_DONT_REPORT, SPELL_MISS_NONE, SPELL_STATE_DELAYED, SPELL_STATE_FINISHED, TriggeredByAuraSpellData::spellInfo, sScriptMgr, sSpellMgr, Player::StartTimedAchievement(), TakeCastItem(), TakePower(), TakeReagents(), TARGET_FLAG_TRADE_ITEM, TARGET_FLAG_UNIT, Object::ToCreature(), Object::ToPlayer(), TRIGGERED_IGNORE_CAST_ITEM, TRIGGERED_IGNORE_POWER_AND_REAGENT_COST, TRIGGERED_IGNORE_SET_FACING, TYPEID_PLAYER, TYPEID_UNIT, UNIT_STATE_CASTING, Player::UpdateAchievementCriteria(), UpdatePointers(), and SpellCastTargets::UpdateTradeSlotItem().

Referenced by cast().

◆ _handle_finish_phase()

void Spell::_handle_finish_phase ( )
4266{
4267 // Take for real after all targets are processed
4269 {
4271 }
4272
4273 // Real add combo points from effects
4275 {
4276 // remove Premed-like effects unless they were caused by ourselves
4277 // (this Aura removes the already-added CP when it expires from duration - now that we've added CP, this shouldn't happen anymore!)
4279 {
4281 }
4282
4284 }
4285
4287 {
4289 }
4290
4293 for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
4294 {
4295 // Xinef: Properly clear infinite cooldowns in some cases
4296 if (ihit->targetGUID == m_caster->GetGUID() && ihit->missCondition != SPELL_MISS_NONE)
4299 }
4300
4301 // Handle procs on finish
4302 if (m_originalCaster)
4303 {
4304 uint32 procAttacker = m_procAttacker;
4305 if (!procAttacker)
4306 {
4307 bool IsPositive = m_spellInfo->IsPositive();
4309 {
4311 }
4312 else
4313 {
4315 }
4316 }
4317
4318 uint32 procEx = PROC_EX_NORMAL_HIT;
4319 for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
4320 {
4321 if (ihit->missCondition != SPELL_MISS_NONE)
4322 {
4323 continue;
4324 }
4325
4326 if (!ihit->crit)
4327 {
4328 continue;
4329 }
4330
4331 procEx |= PROC_EX_CRITICAL_HIT;
4332 break;
4333 }
4334
4337 }
4338}
@ SPELL_AURA_RETAIN_COMBO_POINTS
Definition: SpellAuraDefines.h:211
@ PROC_SPELL_PHASE_FINISH
Definition: SpellMgr.h:245
@ SPELL_EFFECT_ADD_EXTRA_ATTACKS
Definition: SharedDefines.h:797
void SendCooldownEvent(SpellInfo const *spellInfo, uint32 itemId=0, Spell *spell=nullptr, bool setCooldown=true)
Definition: Player.cpp:11024
void SetLastExtraAttackSpell(uint32 spellId)
Definition: Unit.h:1583
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition: Unit.cpp:10615
void ClearComboPoints()
Definition: Unit.cpp:17129
void AddComboPoints(Unit *target, int8 count)
Definition: Unit.cpp:17103
void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
Definition: Unit.cpp:5045
bool IsAutoRepeat() const
Definition: Spell.h:548
bool IsNextMeleeSwingSpell() const
Definition: Spell.cpp:8027
bool IsCooldownStartedOnEvent() const
Definition: SpellInfo.cpp:1199

References Unit::AddComboPoints(), BASE_ATTACK, Unit::ClearComboPoints(), SpellInfo::DmgClass, TriggeredByAuraSpellData::effectIndex, Unit::GetCharmerOrOwnerPlayerOrPlayerItself(), Object::GetGUID(), Object::GetTypeId(), SpellInfo::HasAura(), SpellInfo::HasEffect(), SpellInfo::Id, IsAutoRepeat(), SpellInfo::IsCooldownStartedOnEvent(), IsNextMeleeSwingSpell(), SpellInfo::IsPositive(), m_caster, m_comboPointGain, m_comboTarget, m_needComboPoints, m_originalCaster, m_procAttacker, m_spellInfo, m_triggeredByAuraSpell, m_UniqueTargetInfo, PROC_EX_CRITICAL_HIT, PROC_EX_NORMAL_HIT, PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG, PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS, PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG, PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS, PROC_FLAG_NONE, PROC_SPELL_PHASE_FINISH, Unit::ProcDamageAndSpell(), Unit::RemoveAurasByType(), Player::SendCooldownEvent(), Unit::SetLastExtraAttackSpell(), SPELL_AURA_RETAIN_COMBO_POINTS, SPELL_DAMAGE_CLASS_MAGIC, SPELL_EFFECT_ADD_EXTRA_ATTACKS, SPELL_MISS_NONE, TriggeredByAuraSpellData::spellInfo, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by handle_delayed(), and handle_immediate().

◆ _handle_immediate_phase()

void Spell::_handle_immediate_phase ( )
4238{
4239 m_spellAura = nullptr;
4240 // initialize Diminishing Returns Data
4243
4244 // handle some immediate features of the spell here
4246
4248
4249 // handle effects with SPELL_EFFECT_HANDLE_HIT mode
4250 for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
4251 {
4252 // don't do anything for empty effect
4253 if (!m_spellInfo->Effects[j].IsEffect())
4254 continue;
4255
4256 // call effect handlers to handle destination hit
4257 HandleEffects(nullptr, nullptr, nullptr, j, SPELL_EFFECT_HANDLE_HIT);
4258 }
4259
4260 // process items
4261 for (std::list<ItemTargetInfo>::iterator ihit = m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit)
4262 DoAllEffectOnTarget(&(*ihit));
4263}
@ SPELL_EFFECT_HANDLE_HIT
Definition: Spell.h:235
void HandleThreatSpells()
Definition: Spell.cpp:5556
void HandleEffects(Unit *pUnitTarget, Item *pItemTarget, GameObject *pGOTarget, uint32 i, SpellEffectHandleMode mode)
Definition: Spell.cpp:5603
std::list< ItemTargetInfo > m_UniqueItemInfo
Definition: Spell.h:698
void DoAllEffectOnTarget(TargetInfo *target)
Definition: Spell.cpp:2608
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition: SpellInfo.h:391

References DIMINISHING_LEVEL_1, DIMINISHING_NONE, DoAllEffectOnTarget(), SpellInfo::Effects, HandleEffects(), HandleThreatSpells(), m_diminishGroup, m_diminishLevel, m_spellAura, m_spellInfo, m_UniqueItemInfo, MAX_SPELL_EFFECTS, PrepareScriptHitHandlers(), and SPELL_EFFECT_HANDLE_HIT.

Referenced by handle_delayed(), and handle_immediate().

◆ AddComboPointGain()

void Spell::AddComboPointGain ( Unit target,
int8  amount 
)
inline
531 {
532 if (target != m_comboTarget)
533 {
534 m_comboTarget = target;
535 m_comboPointGain = amount;
536 }
537 else
538 {
539 m_comboPointGain += amount;
540 }
541 }

References m_comboPointGain, and m_comboTarget.

Referenced by EffectAddComboPoints(), and EffectWeaponDmg().

◆ AddDestTarget()

void Spell::AddDestTarget ( SpellDestination const &  dest,
uint32  effIndex 
)
protected
2604{
2605 m_destTargets[effIndex] = dest;
2606}

References m_destTargets.

Referenced by SelectSpellTargets().

◆ AddGOTarget()

void Spell::AddGOTarget ( GameObject target,
uint32  effectMask 
)
protected
2513{
2514 for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
2515 {
2516 if (!m_spellInfo->Effects[effIndex].IsEffect())
2517 effectMask &= ~(1 << effIndex);
2518 else
2519 {
2520 switch (m_spellInfo->Effects[effIndex].Effect)
2521 {
2525 if (go->GetGoType() != GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING)
2526 effectMask &= ~(1 << effIndex);
2527 break;
2528 default:
2529 break;
2530 }
2531 }
2532 }
2533
2534 if (!effectMask)
2535 return;
2536
2537 ObjectGuid targetGUID = go->GetGUID();
2538
2539 // Lookup target in already in list
2540 for (std::list<GOTargetInfo>::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit)
2541 {
2542 if (targetGUID == ihit->targetGUID) // Found in list
2543 {
2544 ihit->effectMask |= effectMask; // Add only effect mask
2545 return;
2546 }
2547 }
2548
2549 // This is new target calculate data for him
2550
2551 GOTargetInfo target;
2552 target.targetGUID = targetGUID;
2553 target.effectMask = effectMask;
2554 target.processed = false; // Effects not apply on target
2555
2556 // Spell have speed - need calculate incoming time
2557 if (m_spellInfo->Speed > 0.0f)
2558 {
2559 // calculate spell incoming interval
2560 float dist = m_caster->GetDistance(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ());
2561 if (dist < 5.0f)
2562 dist = 5.0f;
2563 target.timeDelay = uint64(floor(dist / m_spellInfo->Speed * 1000.0f));
2564 if (m_delayMoment == 0 || m_delayMoment > target.timeDelay)
2565 m_delayMoment = target.timeDelay;
2566 }
2567 else
2568 target.timeDelay = 0LL;
2569
2570 // Add target to list
2571 m_UniqueGOTargetInfo.push_back(target);
2572}
std::uint64_t uint64
Definition: Define.h:107
@ GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING
Definition: SharedDefines.h:1593
@ SPELL_EFFECT_GAMEOBJECT_REPAIR
Definition: SharedDefines.h:866
@ SPELL_EFFECT_GAMEOBJECT_SET_DESTRUCTION_STATE
Definition: SharedDefines.h:867
@ SPELL_EFFECT_GAMEOBJECT_DAMAGE
Definition: SharedDefines.h:865
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1245
Definition: ObjectGuid.h:120
uint64 m_delayMoment
Definition: Spell.h:638
std::list< GOTargetInfo > m_UniqueGOTargetInfo
Definition: Spell.h:691

References Spell::GOTargetInfo::effectMask, SpellInfo::Effects, GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING, WorldObject::GetDistance(), GameObject::GetGoType(), Object::GetGUID(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), m_caster, m_delayMoment, m_spellInfo, m_UniqueGOTargetInfo, MAX_SPELL_EFFECTS, Spell::GOTargetInfo::processed, SpellInfo::Speed, SPELL_EFFECT_GAMEOBJECT_DAMAGE, SPELL_EFFECT_GAMEOBJECT_REPAIR, SPELL_EFFECT_GAMEOBJECT_SET_DESTRUCTION_STATE, Spell::GOTargetInfo::targetGUID, and Spell::GOTargetInfo::timeDelay.

Referenced by SelectEffectTypeImplicitTargets(), SelectImplicitAreaTargets(), SelectImplicitConeTargets(), SelectImplicitNearbyTargets(), and SelectImplicitTargetObjectTargets().

◆ AddItemTarget()

void Spell::AddItemTarget ( Item item,
uint32  effectMask 
)
protected
2575{
2576 for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
2577 if (!m_spellInfo->Effects[effIndex].IsEffect())
2578 effectMask &= ~(1 << effIndex);
2579
2580 // no effects left
2581 if (!effectMask)
2582 return;
2583
2584 // Lookup target in already in list
2585 for (std::list<ItemTargetInfo>::iterator ihit = m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit)
2586 {
2587 if (item == ihit->item) // Found in list
2588 {
2589 ihit->effectMask |= effectMask; // Add only effect mask
2590 return;
2591 }
2592 }
2593
2594 // This is new target add data
2595
2596 ItemTargetInfo target;
2597 target.item = item;
2598 target.effectMask = effectMask;
2599
2600 m_UniqueItemInfo.push_back(target);
2601}

References Spell::ItemTargetInfo::effectMask, SpellInfo::Effects, Spell::ItemTargetInfo::item, m_spellInfo, m_UniqueItemInfo, and MAX_SPELL_EFFECTS.

Referenced by SelectEffectTypeImplicitTargets(), and SelectImplicitTargetObjectTargets().

◆ AddUnitTarget()

void Spell::AddUnitTarget ( Unit target,
uint32  effectMask,
bool  checkIfValid = true,
bool  implicit = true 
)
protected
Todo:
: this is a hack
Todo:
: seduction should be casted only on humanoids (not demons)
2380{
2381 for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
2382 if (!m_spellInfo->Effects[effIndex].IsEffect() || !CheckEffectTarget(target, effIndex))
2383 effectMask &= ~(1 << effIndex);
2384
2385 // no effects left
2386 if (!effectMask)
2387 return;
2388
2389 if (checkIfValid)
2390 {
2391 SpellCastResult res = m_spellInfo->CheckTarget(m_caster, target, implicit);
2392 if (res != SPELL_CAST_OK)
2393 return;
2394 }
2395
2396 // Check for effect immune skip if immuned
2397 for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
2398 if (target->IsImmunedToSpellEffect(m_spellInfo, effIndex))
2399 effectMask &= ~(1 << effIndex);
2400
2401 ObjectGuid targetGUID = target->GetGUID();
2402
2403 // Lookup target in already in list
2404 for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
2405 {
2406 if (targetGUID == ihit->targetGUID) // Found in list
2407 {
2408 ihit->effectMask |= effectMask; // Immune effects removed from mask
2409 ihit->scaleAura = false;
2410 if (m_auraScaleMask && ihit->effectMask == m_auraScaleMask && m_caster != target)
2411 {
2412 SpellInfo const* auraSpell = m_spellInfo->GetFirstRankSpell();
2413 if (uint32(target->GetLevel() + 10) >= auraSpell->SpellLevel)
2414 ihit->scaleAura = true;
2415 }
2416
2417 sScriptMgr->OnScaleAuraUnitAdd(this, target, effectMask, checkIfValid, implicit, m_auraScaleMask, *ihit);
2418 return;
2419 }
2420 }
2421
2422 // This is new target calculate data for him
2423
2424 // Get spell hit result on target
2425 TargetInfo targetInfo;
2426 targetInfo.targetGUID = targetGUID; // Store target GUID
2427 targetInfo.effectMask = effectMask; // Store all effects not immune
2428 targetInfo.processed = false; // Effects not apply on target
2429 targetInfo.alive = target->IsAlive();
2430 targetInfo.damage = 0;
2431 targetInfo.crit = false;
2432 targetInfo.scaleAura = false;
2433 if (m_auraScaleMask && targetInfo.effectMask == m_auraScaleMask && m_caster != target)
2434 {
2435 SpellInfo const* auraSpell = m_spellInfo->GetFirstRankSpell();
2436 if (uint32(target->GetLevel() + 10) >= auraSpell->SpellLevel)
2437 targetInfo.scaleAura = true;
2438 }
2439
2440 sScriptMgr->OnScaleAuraUnitAdd(this, target, effectMask, checkIfValid, implicit, m_auraScaleMask, targetInfo);
2441
2442 // Calculate hit result
2443 if (m_originalCaster)
2444 {
2445 targetInfo.missCondition = m_originalCaster->SpellHitResult(target, this, m_canReflect);
2446 if (m_skipCheck && targetInfo.missCondition != SPELL_MISS_IMMUNE)
2447 {
2448 targetInfo.missCondition = SPELL_MISS_NONE;
2449 }
2450 }
2451 else
2452 targetInfo.missCondition = SPELL_MISS_EVADE; //SPELL_MISS_NONE;
2453
2454 // Spell have speed - need calculate incoming time
2455 // Incoming time is zero for self casts. At least I think so.
2456 if (m_spellInfo->Speed > 0.0f && m_caster != target)
2457 {
2458 // calculate spell incoming interval
2460 float dist = m_caster->GetDistance(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
2461
2462 if (dist < 5.0f)
2463 dist = 5.0f;
2464 targetInfo.timeDelay = (uint64) floor(dist / m_spellInfo->Speed * 1000.0f);
2465
2466 // Calculate minimum incoming time
2467 if (m_delayMoment == 0 || m_delayMoment > targetInfo.timeDelay)
2468 m_delayMoment = targetInfo.timeDelay;
2469 }
2470 else
2471 targetInfo.timeDelay = 0LL;
2472
2473 // If target reflect spell back to caster
2474 if (targetInfo.missCondition == SPELL_MISS_REFLECT)
2475 {
2476 // Calculate reflected spell result on caster
2478
2479 if (targetInfo.reflectResult == SPELL_MISS_REFLECT) // Impossible reflect again, so simply deflect spell
2480 targetInfo.reflectResult = SPELL_MISS_PARRY;
2481
2482 // Increase time interval for reflected spells by 1.5
2484 targetInfo.timeDelay += targetInfo.timeDelay >> 1;
2485
2487
2488 // HACK: workaround check for succubus seduction case
2490 if (m_caster->IsPet())
2491 {
2492 CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(m_caster->GetEntry());
2493 switch (ci->family)
2494 {
2496 {
2497 if (m_spellInfo->SpellIconID != 694) // Soothing Kiss
2498 cancel();
2499 }
2500 break;
2501 return;
2502 }
2503 }
2504 }
2505 else
2506 targetInfo.reflectResult = SPELL_MISS_NONE;
2507
2508 // Add target to list
2509 m_UniqueTargetInfo.push_back(targetInfo);
2510}
#define sObjectMgr
Definition: ObjectMgr.h:1640
@ SPELL_FLAG_REFLECTED
Definition: Spell.h:82
@ CREATURE_FAMILY_SUCCUBUS
Definition: SharedDefines.h:2664
@ SPELL_MISS_PARRY
Definition: SharedDefines.h:1523
@ SPELL_MISS_IMMUNE
Definition: SharedDefines.h:1526
@ SPELL_MISS_EVADE
Definition: SharedDefines.h:1525
@ SPELL_MISS_REFLECT
Definition: SharedDefines.h:1530
void AddEvent(BasicEvent *Event, uint64 e_time, bool set_addtime=true)
Definition: EventProcessor.h:104
uint64 CalculateTime(uint64 t_offset) const
Definition: EventProcessor.cpp:159
Definition: CreatureData.h:176
uint32 family
Definition: CreatureData.h:210
float GetPositionZ() const
Definition: Position.h:119
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118
bool IsAlive() const
Definition: Unit.h:1822
SpellMissInfo SpellHitResult(Unit *victim, SpellInfo const *spell, bool canReflect=false)
Definition: Unit.cpp:3434
EventProcessor m_Events
Definition: Unit.h:2108
virtual bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, uint32 index) const
Definition: Unit.cpp:13000
uint8 GetLevel() const
Definition: Unit.h:1432
Definition: Spell.h:254
bool processed
Definition: Spell.h:260
int32 damage
Definition: Spell.h:264
SpellMissInfo missCondition
Definition: Spell.h:257
bool scaleAura
Definition: Spell.h:263
bool crit
Definition: Spell.h:262
uint64 timeDelay
Definition: Spell.h:256
ObjectGuid targetGUID
Definition: Spell.h:255
SpellMissInfo reflectResult
Definition: Spell.h:258
bool alive
Definition: Spell.h:261
uint8 effectMask
Definition: Spell.h:259
bool CheckEffectTarget(Unit const *target, uint32 eff) const
Definition: Spell.cpp:7885
Definition: Spell.h:845
Definition: SpellInfo.h:314
uint32 SpellLevel
Definition: SpellInfo.h:358
SpellInfo const * GetFirstRankSpell() const
Definition: SpellInfo.cpp:2487
uint32 SpellIconID
Definition: SpellInfo.h:378
SpellCastResult CheckTarget(Unit const *caster, WorldObject const *target, bool implicit=true) const
Definition: SpellInfo.cpp:1746

References EventProcessor::AddEvent(), TargetInfo::alive, EventProcessor::CalculateTime(), cancel(), CheckEffectTarget(), SpellInfo::CheckTarget(), CREATURE_FAMILY_SUCCUBUS, TargetInfo::crit, TargetInfo::damage, TargetInfo::effectMask, SpellInfo::Effects, CreatureTemplate::family, WorldObject::GetDistance(), Object::GetEntry(), SpellInfo::GetFirstRankSpell(), Object::GetGUID(), Unit::GetLevel(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Unit::IsAlive(), Unit::IsImmunedToSpellEffect(), Unit::IsPet(), m_auraScaleMask, m_canReflect, m_caster, m_delayMoment, Unit::m_Events, m_originalCaster, m_skipCheck, m_spellFlags, m_spellInfo, m_UniqueTargetInfo, MAX_SPELL_EFFECTS, TargetInfo::missCondition, TargetInfo::processed, TargetInfo::reflectResult, TargetInfo::scaleAura, sObjectMgr, SpellInfo::Speed, SPELL_CAST_OK, SPELL_FLAG_REFLECTED, SPELL_MISS_EVADE, SPELL_MISS_IMMUNE, SPELL_MISS_NONE, SPELL_MISS_PARRY, SPELL_MISS_REFLECT, Unit::SpellHitResult(), SpellInfo::SpellIconID, SpellInfo::SpellLevel, sScriptMgr, TargetInfo::targetGUID, and TargetInfo::timeDelay.

Referenced by SelectEffectTypeImplicitTargets(), SelectImplicitAreaTargets(), SelectImplicitCasterObjectTargets(), SelectImplicitChainTargets(), SelectImplicitChannelTargets(), SelectImplicitConeTargets(), SelectImplicitNearbyTargets(), and SelectImplicitTargetObjectTargets().

◆ CalculateDelayMomentForDst()

uint64 Spell::CalculateDelayMomentForDst ( ) const
895{
896 if (m_targets.HasDst())
897 {
898 if (m_targets.HasTraj())
899 {
900 float speed = m_targets.GetSpeedXY();
901 if (speed > 0.0f)
902 return (uint64)floor(m_targets.GetDist2d() / speed * 1000.0f);
903 }
904 else if (m_spellInfo->Speed > 0.0f)
905 {
906 // We should not subtract caster size from dist calculation (fixes execution time desync with animation on client, eg. Malleable Goo cast by PP)
907 float dist = m_caster->GetExactDist(*m_targets.GetDstPos());
908 return (uint64)std::floor(dist / m_spellInfo->Speed * 1000.0f);
909 }
910 }
911
912 return 0;
913}
float GetExactDist(float x, float y, float z) const
Definition: Position.h:178
bool HasTraj() const
Definition: Spell.h:166
bool HasDst() const
Definition: Spell.h:165
float GetSpeedXY() const
Definition: Spell.h:174
float GetDist2d() const
Definition: Spell.h:173
WorldLocation const * GetDstPos() const
Definition: Spell.cpp:400

References SpellCastTargets::GetDist2d(), SpellCastTargets::GetDstPos(), Position::GetExactDist(), SpellCastTargets::GetSpeedXY(), SpellCastTargets::HasDst(), SpellCastTargets::HasTraj(), m_caster, m_spellInfo, m_targets, and SpellInfo::Speed.

Referenced by RecalculateDelayMomentForDst(), and SelectSpellTargets().

◆ CalculateJumpSpeeds()

void Spell::CalculateJumpSpeeds ( uint8  i,
float  dist,
float &  speedxy,
float &  speedz 
)
protected
1178{
1179 if (m_spellInfo->Effects[i].MiscValue)
1180 speedZ = float(m_spellInfo->Effects[i].MiscValue) / 10;
1181 else if (m_spellInfo->Effects[i].MiscValueB)
1182 speedZ = float(m_spellInfo->Effects[i].MiscValueB) / 10;
1183 else
1184 speedZ = 10.0f;
1185 speedXY = dist * 10.0f / speedZ;
1186}

References SpellInfo::Effects, and m_spellInfo.

Referenced by EffectJump(), and EffectJumpDest().

◆ CalculateSpellDamage()

int32 Spell::CalculateSpellDamage ( uint8  i,
Unit const *  target 
) const
inline
int32 CalculateSpellDamage(Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
Definition: Unit.cpp:14837
int32 EffectBasePoints[MAX_SPELL_EFFECTS]
Definition: Spell.h:213

References Unit::CalculateSpellDamage(), SpellValue::EffectBasePoints, m_caster, m_spellInfo, and m_spellValue.

Referenced by CheckCast(), CheckEffectTarget(), EffectWeaponDmg(), and HandleEffects().

◆ CallScriptAfterCastHandlers()

void Spell::CallScriptAfterCastHandlers ( )
protected
8504{
8505 for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
8506 {
8507 (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_AFTER_CAST);
8508 std::list<SpellScript::CastHandler>::iterator hookItrEnd = (*scritr)->AfterCast.end(), hookItr = (*scritr)->AfterCast.begin();
8509 for (; hookItr != hookItrEnd; ++hookItr)
8510 (*hookItr).Call(*scritr);
8511
8512 (*scritr)->_FinishScriptCall();
8513 }
8514}
@ SPELL_SCRIPT_HOOK_AFTER_CAST
Definition: SpellScript.h:172

References m_loadedScripts, and SPELL_SCRIPT_HOOK_AFTER_CAST.

Referenced by _cast().

◆ CallScriptAfterHitHandlers()

void Spell::CallScriptAfterHitHandlers ( )
protected
8616{
8617 for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
8618 {
8619 (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_AFTER_HIT);
8620 std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->AfterHit.end(), hookItr = (*scritr)->AfterHit.begin();
8621 for (; hookItr != hookItrEnd; ++hookItr)
8622 (*hookItr).Call(*scritr);
8623
8624 (*scritr)->_FinishScriptCall();
8625 }
8626}
@ SPELL_SCRIPT_HOOK_AFTER_HIT
Definition: SpellScript.h:165

References m_loadedScripts, and SPELL_SCRIPT_HOOK_AFTER_HIT.

Referenced by DoAllEffectOnTarget().

◆ CallScriptBeforeCastHandlers()

void Spell::CallScriptBeforeCastHandlers ( )
protected
8478{
8479 for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
8480 {
8481 (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_BEFORE_CAST);
8482 std::list<SpellScript::CastHandler>::iterator hookItrEnd = (*scritr)->BeforeCast.end(), hookItr = (*scritr)->BeforeCast.begin();
8483 for (; hookItr != hookItrEnd; ++hookItr)
8484 (*hookItr).Call(*scritr);
8485
8486 (*scritr)->_FinishScriptCall();
8487 }
8488}
@ SPELL_SCRIPT_HOOK_BEFORE_CAST
Definition: SpellScript.h:170

References m_loadedScripts, and SPELL_SCRIPT_HOOK_BEFORE_CAST.

Referenced by _cast().

◆ CallScriptBeforeHitHandlers()

void Spell::CallScriptBeforeHitHandlers ( SpellMissInfo  missInfo)
protected
8590{
8591 for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
8592 {
8593 (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_BEFORE_HIT);
8594 std::list<SpellScript::BeforeHitHandler>::iterator hookItrEnd = (*scritr)->BeforeHit.end(), hookItr = (*scritr)->BeforeHit.begin();
8595 for (; hookItr != hookItrEnd; ++hookItr)
8596 (*hookItr).Call(*scritr, missInfo);
8597
8598 (*scritr)->_FinishScriptCall();
8599 }
8600}
@ SPELL_SCRIPT_HOOK_BEFORE_HIT
Definition: SpellScript.h:163

References m_loadedScripts, and SPELL_SCRIPT_HOOK_BEFORE_HIT.

Referenced by DoAllEffectOnTarget().

◆ CallScriptCheckCastHandlers()

SpellCastResult Spell::CallScriptCheckCastHandlers ( )
protected
8517{
8519 for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
8520 {
8521 (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_CHECK_CAST);
8522 std::list<SpellScript::CheckCastHandler>::iterator hookItrEnd = (*scritr)->OnCheckCast.end(), hookItr = (*scritr)->OnCheckCast.begin();
8523 for (; hookItr != hookItrEnd; ++hookItr)
8524 {
8525 SpellCastResult tempResult = (*hookItr).Call(*scritr);
8526 if (retVal == SPELL_CAST_OK)
8527 retVal = tempResult;
8528 }
8529
8530 (*scritr)->_FinishScriptCall();
8531 }
8532 return retVal;
8533}
@ SPELL_SCRIPT_HOOK_CHECK_CAST
Definition: SpellScript.h:169

References m_loadedScripts, SPELL_CAST_OK, and SPELL_SCRIPT_HOOK_CHECK_CAST.

Referenced by CheckCast().

◆ CallScriptDestinationTargetSelectHandlers()

void Spell::CallScriptDestinationTargetSelectHandlers ( SpellDestination target,
SpellEffIndex  effIndex,
SpellImplicitTargetInfo const &  targetType 
)
protected
8657{
8658 for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
8659 {
8660 (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_DESTINATION_TARGET_SELECT);
8661 std::list<SpellScript::DestinationTargetSelectHandler>::iterator hookItrEnd = (*scritr)->OnDestinationTargetSelect.end(), hookItr = (*scritr)->OnDestinationTargetSelect.begin();
8662 for (; hookItr != hookItrEnd; ++hookItr)
8663 if (hookItr->IsEffectAffected(m_spellInfo, effIndex) && targetType.GetTarget() == hookItr->GetTarget())
8664 hookItr->Call(*scritr, target);
8665
8666 (*scritr)->_FinishScriptCall();
8667 }
8668}
@ SPELL_SCRIPT_HOOK_DESTINATION_TARGET_SELECT
Definition: SpellScript.h:168

References SpellImplicitTargetInfo::GetTarget(), m_loadedScripts, m_spellInfo, and SPELL_SCRIPT_HOOK_DESTINATION_TARGET_SELECT.

Referenced by SelectImplicitCasterDestTargets(), SelectImplicitDestDestTargets(), SelectImplicitTargetDestTargets(), and SelectImplicitTrajTargets().

◆ CallScriptEffectHandlers()

bool Spell::CallScriptEffectHandlers ( SpellEffIndex  effIndex,
SpellEffectHandleMode  mode 
)
protected
8542{
8543 // execute script effect handler hooks and check if effects was prevented
8544 bool preventDefault = false;
8545 for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
8546 {
8547 std::list<SpellScript::EffectHandler>::iterator effItr, effEndItr;
8548 SpellScriptHookType hookType;
8549 switch (mode)
8550 {
8552 effItr = (*scritr)->OnEffectLaunch.begin();
8553 effEndItr = (*scritr)->OnEffectLaunch.end();
8555 break;
8557 effItr = (*scritr)->OnEffectLaunchTarget.begin();
8558 effEndItr = (*scritr)->OnEffectLaunchTarget.end();
8560 break;
8562 effItr = (*scritr)->OnEffectHit.begin();
8563 effEndItr = (*scritr)->OnEffectHit.end();
8565 break;
8567 effItr = (*scritr)->OnEffectHitTarget.begin();
8568 effEndItr = (*scritr)->OnEffectHitTarget.end();
8570 break;
8571 default:
8572 ABORT();
8573 return false;
8574 }
8575 (*scritr)->_PrepareScriptCall(hookType);
8576 for (; effItr != effEndItr; ++effItr)
8577 // effect execution can be prevented
8578 if (!(*scritr)->_IsEffectPrevented(effIndex) && (*effItr).IsEffectAffected(m_spellInfo, effIndex))
8579 (*effItr).Call(*scritr, effIndex);
8580
8581 if (!preventDefault)
8582 preventDefault = (*scritr)->_IsDefaultEffectPrevented(effIndex);
8583
8584 (*scritr)->_FinishScriptCall();
8585 }
8586 return preventDefault;
8587}
#define ABORT
Definition: Errors.h:76
@ SPELL_EFFECT_HANDLE_LAUNCH_TARGET
Definition: Spell.h:234
@ SPELL_EFFECT_HANDLE_HIT_TARGET
Definition: Spell.h:236
SpellScriptHookType
Definition: SpellScript.h:158
@ SPELL_SCRIPT_HOOK_EFFECT_HIT
Definition: SpellScript.h:161
@ SPELL_SCRIPT_HOOK_EFFECT_LAUNCH
Definition: SpellScript.h:159
@ SPELL_SCRIPT_HOOK_EFFECT_LAUNCH_TARGET
Definition: SpellScript.h:160
@ SPELL_SCRIPT_HOOK_EFFECT_HIT_TARGET
Definition: SpellScript.h:162

References ABORT, m_loadedScripts, m_spellInfo, SPELL_EFFECT_HANDLE_HIT, SPELL_EFFECT_HANDLE_HIT_TARGET, SPELL_EFFECT_HANDLE_LAUNCH, SPELL_EFFECT_HANDLE_LAUNCH_TARGET, SPELL_SCRIPT_HOOK_EFFECT_HIT, SPELL_SCRIPT_HOOK_EFFECT_HIT_TARGET, SPELL_SCRIPT_HOOK_EFFECT_LAUNCH, and SPELL_SCRIPT_HOOK_EFFECT_LAUNCH_TARGET.

Referenced by HandleEffects().

◆ CallScriptObjectAreaTargetSelectHandlers()

void Spell::CallScriptObjectAreaTargetSelectHandlers ( std::list< WorldObject * > &  targets,
SpellEffIndex  effIndex,
SpellImplicitTargetInfo const &  targetType 
)
protected
8629{
8630 for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
8631 {
8632 (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_OBJECT_AREA_TARGET_SELECT);
8633 std::list<SpellScript::ObjectAreaTargetSelectHandler>::iterator hookItrEnd = (*scritr)->OnObjectAreaTargetSelect.end(), hookItr = (*scritr)->OnObjectAreaTargetSelect.begin();
8634 for (; hookItr != hookItrEnd; ++hookItr)
8635 if (hookItr->IsEffectAffected(m_spellInfo, effIndex) && targetType.GetTarget() == hookItr->GetTarget())
8636 hookItr->Call(*scritr, targets);
8637
8638 (*scritr)->_FinishScriptCall();
8639 }
8640}
@ SPELL_SCRIPT_HOOK_OBJECT_AREA_TARGET_SELECT
Definition: SpellScript.h:166

References SpellImplicitTargetInfo::GetTarget(), m_loadedScripts, m_spellInfo, and SPELL_SCRIPT_HOOK_OBJECT_AREA_TARGET_SELECT.

Referenced by SelectImplicitAreaTargets(), SelectImplicitChainTargets(), and SelectImplicitConeTargets().

◆ CallScriptObjectTargetSelectHandlers()

void Spell::CallScriptObjectTargetSelectHandlers ( WorldObject *&  target,
SpellEffIndex  effIndex,
SpellImplicitTargetInfo const &  targetType 
)
protected
8643{
8644 for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
8645 {
8646 (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_OBJECT_TARGET_SELECT);
8647 std::list<SpellScript::ObjectTargetSelectHandler>::iterator hookItrEnd = (*scritr)->OnObjectTargetSelect.end(), hookItr = (*scritr)->OnObjectTargetSelect.begin();
8648 for (; hookItr != hookItrEnd; ++hookItr)
8649 if (hookItr->IsEffectAffected(m_spellInfo, effIndex) && targetType.GetTarget() == hookItr->GetTarget())
8650 hookItr->Call(*scritr, target);
8651
8652 (*scritr)->_FinishScriptCall();
8653 }
8654}
@ SPELL_SCRIPT_HOOK_OBJECT_TARGET_SELECT
Definition: SpellScript.h:167

References SpellImplicitTargetInfo::GetTarget(), m_loadedScripts, m_spellInfo, and SPELL_SCRIPT_HOOK_OBJECT_TARGET_SELECT.

Referenced by SelectEffectTypeImplicitTargets(), SelectImplicitCasterObjectTargets(), SelectImplicitChannelTargets(), SelectImplicitNearbyTargets(), and SelectImplicitTargetObjectTargets().

◆ CallScriptOnCastHandlers()

void Spell::CallScriptOnCastHandlers ( )
protected
8491{
8492 for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
8493 {
8494 (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_ON_CAST);
8495 std::list<SpellScript::CastHandler>::iterator hookItrEnd = (*scritr)->OnCast.end(), hookItr = (*scritr)->OnCast.begin();
8496 for (; hookItr != hookItrEnd; ++hookItr)
8497 (*hookItr).Call(*scritr);
8498
8499 (*scritr)->_FinishScriptCall();
8500 }
8501}
@ SPELL_SCRIPT_HOOK_ON_CAST
Definition: SpellScript.h:171

References m_loadedScripts, and SPELL_SCRIPT_HOOK_ON_CAST.

Referenced by _cast().

◆ CallScriptOnHitHandlers()

void Spell::CallScriptOnHitHandlers ( )
protected
8603{
8604 for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
8605 {
8606 (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_HIT);
8607 std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->OnHit.end(), hookItr = (*scritr)->OnHit.begin();
8608 for (; hookItr != hookItrEnd; ++hookItr)
8609 (*hookItr).Call(*scritr);
8610
8611 (*scritr)->_FinishScriptCall();
8612 }
8613}
@ SPELL_SCRIPT_HOOK_HIT
Definition: SpellScript.h:164

References m_loadedScripts, and SPELL_SCRIPT_HOOK_HIT.

Referenced by DoAllEffectOnTarget().

◆ CanAutoCast()

bool Spell::CanAutoCast ( Unit target)
6976{
6977 ObjectGuid targetguid = target->GetGUID();
6978
6979 for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
6980 {
6982 {
6983 if (m_spellInfo->StackAmount <= 1)
6984 {
6985 if (target->HasAuraEffect(m_spellInfo->Id, j))
6986 return false;
6987 }
6988 else
6989 {
6990 if (AuraEffect* aureff = target->GetAuraEffect(m_spellInfo->Id, j))
6991 if (aureff->GetBase()->GetStackAmount() >= m_spellInfo->StackAmount)
6992 return false;
6993 }
6994 }
6995 else if (m_spellInfo->Effects[j].IsAreaAuraEffect())
6996 {
6997 if (target->HasAuraEffect(m_spellInfo->Id, j))
6998 return false;
6999 }
7000 }
7001
7002 SpellCastResult result = CheckPetCast(target);
7003
7004 if (result == SPELL_CAST_OK || result == SPELL_FAILED_UNIT_NOT_INFRONT)
7005 {
7007 //check if among target units, our WANTED target is as well (->only self cast spells return false)
7008 for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
7009 if (ihit->targetGUID == targetguid)
7010 return true;
7011 }
7012 return false; //target invalid
7013}
@ SPELL_EFFECT_APPLY_AURA
Definition: SharedDefines.h:784
@ SPELL_FAILED_UNIT_NOT_INFRONT
Definition: SharedDefines.h:1083
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:5432
bool HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
Definition: Unit.cpp:5606
Definition: SpellAuraEffects.h:39
SpellCastResult CheckPetCast(Unit *target)
Definition: Spell.cpp:6782
uint32 StackAmount
Definition: SpellInfo.h:369

References CheckPetCast(), SpellInfo::Effects, Unit::GetAuraEffect(), Object::GetGUID(), Unit::HasAuraEffect(), SpellInfo::Id, m_spellInfo, m_UniqueTargetInfo, MAX_SPELL_EFFECTS, SelectSpellTargets(), SPELL_CAST_OK, SPELL_EFFECT_APPLY_AURA, SPELL_FAILED_UNIT_NOT_INFRONT, and SpellInfo::StackAmount.

Referenced by PetAI::UpdateAI().

◆ cancel()

void Spell::cancel ( bool  bySelf = false)
Todo:
: Not sure whether the fallthrough was a mistake (forgetting a break) or intended. This should be double-checked.
3708{
3710 return;
3711
3712 uint32 oldState = m_spellState;
3713 bool autoRepeat = m_autoRepeat;
3715
3716 m_autoRepeat = false;
3717 switch (oldState)
3718 {
3722 {
3724 ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, bySelf ? 99998 : 99999);
3725 }
3726 [[fallthrough]];
3728 SendInterrupted(0);
3729 // xinef: fixes bugged gcd reset in some cases
3730 if (!autoRepeat)
3732 break;
3733
3735 if (!bySelf)
3736 {
3737 for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
3738 if ((*ihit).missCondition == SPELL_MISS_NONE)
3739 if (Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID))
3740 unit->RemoveOwnedAura(m_spellInfo->Id, m_originalCasterGUID, 0, AURA_REMOVE_BY_CANCEL);
3741
3743 SendInterrupted(0);
3745 }
3746
3748 ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, bySelf ? 99998 : 99999);
3749
3750 // spell is canceled-take mods and clear list
3751 if (Player* player = m_caster->GetSpellModOwner())
3752 player->RemoveSpellMods(this);
3753
3754 m_appliedMods.clear();
3755 break;
3756 default:
3757 break;
3758 }
3759
3761 if (m_selfContainer && *m_selfContainer == this)
3762 *m_selfContainer = nullptr;
3763
3764 // Do not remove current far sight object (already done in Spell::EffectAddFarsight) to prevent from reset viewpoint to player
3766 {
3768 }
3769
3770 if (m_spellInfo->IsChanneled()) // if not channeled then the object for the current cast wasn't summoned yet
3772
3773 //set state back so finish will be processed
3774 m_spellState = oldState;
3775
3776 finish(false);
3777}
@ AURA_REMOVE_BY_CANCEL
Definition: SpellAuraDefines.h:393
@ SPELL_STATE_PREPARING
Definition: Spell.h:224
@ SPELL_STATE_CASTING
Definition: Spell.h:225
@ SPELL_EFFECT_ADD_FARSIGHT
Definition: SharedDefines.h:850
@ SPELL_FAILED_INTERRUPTED
Definition: SharedDefines.h:989
void SendCommand_Spell(T *o, ObjectGuid targetGUID, const char *prefix, uint32 id, int32 casttime)
Definition: ArenaSpectator.h:80
Map * FindMap() const
Definition: Object.h:518
bool NeedSendSpectatorData() const
Definition: Player.cpp:15319
void RemoveGameObject(GameObject *gameObj, bool del)
Definition: Unit.cpp:6135
bool RemoveDynObject(uint32 spellId)
Definition: Unit.cpp:6079
void SendChannelUpdate(uint32 time)
Definition: Spell.cpp:5167
void CancelGlobalCooldown()
Definition: Spell.cpp:8844
void SetReferencedFromCurrent(bool yes)
Definition: Spell.h:558
UsedSpellMods m_appliedMods
Definition: Spell.h:545

References AURA_REMOVE_BY_CANCEL, CancelGlobalCooldown(), WorldObject::FindMap(), finish(), Object::GetGUID(), Unit::GetSpellModOwner(), Object::GetTypeId(), ObjectAccessor::GetUnit(), SpellInfo::HasEffect(), SpellInfo::Id, SpellInfo::IsChanneled(), m_appliedMods, m_autoRepeat, m_caster, m_originalCasterGUID, m_selfContainer, m_spellInfo, m_spellState, m_UniqueTargetInfo, Player::NeedSendSpectatorData(), Unit::RemoveDynObject(), Unit::RemoveGameObject(), SendCastResult(), SendChannelUpdate(), ArenaSpectator::SendCommand_Spell(), SendInterrupted(), SetReferencedFromCurrent(), SPELL_EFFECT_ADD_FARSIGHT, SPELL_FAILED_INTERRUPTED, SPELL_MISS_NONE, SPELL_STATE_CASTING, SPELL_STATE_DELAYED, SPELL_STATE_FINISHED, SPELL_STATE_PREPARING, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by _cast(), SpellEvent::Abort(), AddUnitTarget(), SpellScript::Cancel(), Unit::InterruptSpell(), update(), and SpellEvent::~SpellEvent().

◆ CancelGlobalCooldown()

void Spell::CancelGlobalCooldown ( )
protected
8845{
8847 return;
8848
8849 // Cancel global cooldown when interrupting current cast
8851 return;
8852
8853 // Only players or controlled units have global cooldown
8854 if (m_caster->GetCharmInfo())
8856 else if (m_caster->GetTypeId() == TYPEID_PLAYER)
8858}
@ CURRENT_GENERIC_SPELL
Definition: Unit.h:991
GlobalCooldownMgr & GetGlobalCooldownMgr()
Definition: Player.h:1768
void CancelGlobalCooldown(SpellInfo const *spellInfo)
Definition: Unit.cpp:352
GlobalCooldownMgr & GetGlobalCooldownMgr()
Definition: Unit.h:1139
CharmInfo * GetCharmInfo()
Definition: Unit.h:1897
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition: Unit.h:2075
uint32 StartRecoveryTime
Definition: SpellInfo.h:349

References GlobalCooldownMgr::CancelGlobalCooldown(), CURRENT_GENERIC_SPELL, Unit::GetCharmInfo(), Unit::GetCurrentSpell(), Player::GetGlobalCooldownMgr(), CharmInfo::GetGlobalCooldownMgr(), Object::GetTypeId(), m_caster, m_spellInfo, SpellInfo::StartRecoveryTime, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by cancel().

◆ CanExecuteTriggersOnHit()

bool Spell::CanExecuteTriggersOnHit ( uint8  effMask,
SpellInfo const *  triggeredByAura = nullptr 
) const
protected
8694{
8695 // Relentless strikes, proc only from first effect
8696 if (triggeredByAura && triggeredByAura->SpellIconID == 559)
8697 return effMask & (1 << EFFECT_0);
8698
8699 bool only_on_caster = (triggeredByAura && triggeredByAura->HasAttribute(SPELL_ATTR4_CLASS_TRIGGER_ONLY_ON_TARGET));
8700 // If triggeredByAura has SPELL_ATTR4_CLASS_TRIGGER_ONLY_ON_TARGET then it can only proc on a casted spell with TARGET_UNIT_CASTER
8701 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
8702 {
8703 if ((effMask & (1 << i)) && (!only_on_caster || (m_spellInfo->Effects[i].TargetA.GetTarget() == TARGET_UNIT_CASTER)))
8704 return true;
8705 }
8706 return effMask;
8707}
@ EFFECT_0
Definition: SharedDefines.h:31
@ TARGET_UNIT_CASTER
Definition: SharedDefines.h:1410
@ SPELL_ATTR4_CLASS_TRIGGER_ONLY_ON_TARGET
Definition: SharedDefines.h:531

References EFFECT_0, SpellInfo::Effects, SpellInfo::HasAttribute(), m_spellInfo, MAX_SPELL_EFFECTS, SPELL_ATTR4_CLASS_TRIGGER_ONLY_ON_TARGET, SpellInfo::SpellIconID, and TARGET_UNIT_CASTER.

Referenced by DoAllEffectOnTarget(), and DoTriggersOnSpellHit().

◆ CanOpenLock()

SpellCastResult Spell::CanOpenLock ( uint32  effIndex,
uint32  lockid,
SkillType skillid,
int32 reqSkillValue,
int32 skillValue 
)
protected
8318{
8319 if (!lockId) // possible case for GO and maybe for items.
8320 return SPELL_CAST_OK;
8321
8322 // Get LockInfo
8323 LockEntry const* lockInfo = sLockStore.LookupEntry(lockId);
8324
8325 if (!lockInfo)
8327
8328 bool reqKey = false; // some locks not have reqs
8329
8330 for (int j = 0; j < MAX_LOCK_CASE; ++j)
8331 {
8332 switch (lockInfo->Type[j])
8333 {
8334 // check key item (many fit cases can be)
8335 case LOCK_KEY_ITEM:
8336 if (lockInfo->Index[j] && m_CastItem && m_CastItem->GetEntry() == lockInfo->Index[j])
8337 return SPELL_CAST_OK;
8338 reqKey = true;
8339 break;
8340 // check key skill (only single first fit case can be)
8341 case LOCK_KEY_SKILL:
8342 {
8343 reqKey = true;
8344
8345 // wrong locktype, skip
8346 if (uint32(m_spellInfo->Effects[effIndex].MiscValue) != lockInfo->Index[j])
8347 continue;
8348
8349 skillId = SkillByLockType(LockType(lockInfo->Index[j]));
8350
8351 if (skillId != SKILL_NONE)
8352 {
8353 reqSkillValue = lockInfo->Skill[j];
8354
8355 // castitem check: rogue using skeleton keys. the skill values should not be added in this case.
8356 skillValue = m_CastItem || m_caster->GetTypeId() != TYPEID_PLAYER ?
8357 0 : m_caster->ToPlayer()->GetSkillValue(skillId);
8358
8359 // skill bonus provided by casting spell (mostly item spells)
8360 // add the effect base points modifier from the spell casted (cheat lock / skeleton key etc.)
8361 if ((m_spellInfo->Effects[effIndex].TargetA.GetTarget() == TARGET_GAMEOBJECT_ITEM_TARGET || m_spellInfo->Effects[effIndex].TargetB.GetTarget() == TARGET_GAMEOBJECT_ITEM_TARGET)
8363 {
8364 skillValue += m_spellInfo->Effects[effIndex].CalcValue();
8365 }
8366
8367 if (skillValue < reqSkillValue)
8369 }
8370
8371 return SPELL_CAST_OK;
8372 }
8373 case LOCK_KEY_SPELL:
8374 {
8375 if (m_spellInfo->Id == lockInfo->Index[j])
8376 {
8377 return SPELL_CAST_OK;
8378 }
8379 reqKey = true;
8380 break;
8381 }
8382 }
8383 }
8384
8385 if (reqKey)
8387
8388 return SPELL_CAST_OK;
8389}
DBCStorage< LockEntry > sLockStore(LockEntryfmt)
#define MAX_LOCK_CASE
Definition: DBCStructure.h:1303
@ TARGET_GAMEOBJECT_ITEM_TARGET
Definition: SharedDefines.h:1430
LockType
Definition: SharedDefines.h:2591
@ LOCK_KEY_ITEM
Definition: SharedDefines.h:2585
@ LOCK_KEY_SKILL
Definition: SharedDefines.h:2586
@ LOCK_KEY_SPELL
Definition: SharedDefines.h:2587
@ SPELL_FAILED_BAD_TARGETS
Definition: SharedDefines.h:961
@ SPELL_FAILED_LOW_CASTLEVEL
Definition: SharedDefines.h:998
SkillType SkillByLockType(LockType locktype)
Definition: SharedDefines.h:3020
@ SKILL_NONE
Definition: SharedDefines.h:2864
@ SKILL_LOCKPICKING
Definition: SharedDefines.h:2975
uint16 GetSkillValue(uint32 skill) const
Definition: Player.cpp:5367
bool IsAbilityOfSkillType(uint32 skillType) const
Definition: SpellInfo.cpp:992
Definition: DBCStructure.h:1306
uint32 Type[MAX_LOCK_CASE]
Definition: DBCStructure.h:1308
uint32 Index[MAX_LOCK_CASE]
Definition: DBCStructure.h:1309
uint32 Skill[MAX_LOCK_CASE]
Definition: DBCStructure.h:1310

References SpellInfo::Effects, Object::GetEntry(), Player::GetSkillValue(), Object::GetTypeId(), SpellInfo::Id, LockEntry::Index, SpellInfo::IsAbilityOfSkillType(), LOCK_KEY_ITEM, LOCK_KEY_SKILL, LOCK_KEY_SPELL, m_caster, m_CastItem, m_spellInfo, MAX_LOCK_CASE, LockEntry::Skill, SKILL_LOCKPICKING, SKILL_NONE, SkillByLockType(), sLockStore, SPELL_CAST_OK, SPELL_FAILED_BAD_TARGETS, SPELL_FAILED_LOW_CASTLEVEL, TARGET_GAMEOBJECT_ITEM_TARGET, Object::ToPlayer(), LockEntry::Type, and TYPEID_PLAYER.

Referenced by CheckCast(), and EffectOpenLock().

◆ cast()

void Spell::cast ( bool  skipCheck = false)
3780{
3781 Player* modOwner = m_caster->GetSpellModOwner();
3782 Spell* lastMod = nullptr;
3783 if (modOwner)
3784 {
3785 lastMod = modOwner->m_spellModTakingSpell;
3786 if (lastMod)
3787 modOwner->SetSpellModTakingSpell(lastMod, false);
3788 }
3789
3790 _cast(skipCheck);
3791
3792 if (lastMod)
3793 modOwner->SetSpellModTakingSpell(lastMod, true);
3794}
Spell * m_spellModTakingSpell
Definition: Player.h:2515
Definition: Spell.h:284
void _cast(bool skipCheck)
Definition: Spell.cpp:3796

References _cast(), Unit::GetSpellModOwner(), m_caster, Player::m_spellModTakingSpell, and Player::SetSpellModTakingSpell().

Referenced by Unit::AttackerStateUpdate(), prepare(), and update().

◆ CheckCast()

SpellCastResult Spell::CheckCast ( bool  strict)
Todo:
: determine if there is some flag to enable/disable the check
5627{
5628 // check death state
5631
5632 // Spectator check
5634 if (((Player const*)m_caster)->IsSpectator() && m_spellInfo->Id != SPECTATOR_SPELL_BINDSIGHT)
5635 return SPELL_FAILED_NOT_HERE;
5636
5638
5639 sScriptMgr->OnSpellCheckCast(this, strict, res);
5640
5641 if (res != SPELL_CAST_OK)
5642 return res;
5643
5644 // check cooldowns to prevent cheating
5646 {
5648 {
5649 //can cast triggered (by aura only?) spells while have this flag
5652
5654 {
5657 else
5659 }
5660
5661 // check if we are using a potion in combat for the 2nd+ time. Cooldown is added only after caster gets out of combat
5664 }
5667 }
5668
5670 {
5673 }
5674
5675 // Check global cooldown
5678
5679 // only triggered spells can be processed an ended battleground
5682 if (bg->GetStatus() == STATUS_WAIT_LEAVE)
5684
5685 if (m_caster->GetTypeId() == TYPEID_PLAYER /*&& VMAP::VMapFactory::createOrGetVMapMgr()->isLineOfSightCalcEnabled()*/) // pussywizard: optimization (commented)
5686 {
5688 !m_caster->IsOutdoors())
5690
5694 }
5695
5696 // only check at first call, Stealth auras are already removed at second call
5697 // for now, ignore triggered spells
5699 {
5700 bool checkForm = true;
5701 // Ignore form req aura
5703 for (Unit::AuraEffectList::const_iterator i = ignore.begin(); i != ignore.end(); ++i)
5704 {
5705 if (!(*i)->IsAffectedOnSpell(m_spellInfo))
5706 continue;
5707 checkForm = false;
5708 break;
5709 }
5710 if (checkForm)
5711 {
5712 // Cannot be used in this stance/form
5714 if (shapeError != SPELL_CAST_OK)
5715 return shapeError;
5716
5719 }
5720 }
5721
5723 for (Unit::AuraEffectList::const_iterator blockItr = blockSpells.begin(); blockItr != blockSpells.end(); ++blockItr)
5724 if (uint32((*blockItr)->GetMiscValue()) == m_spellInfo->SpellFamilyName)
5726
5727 bool reqCombat = true;
5729 for (Unit::AuraEffectList::const_iterator j = stateAuras.begin(); j != stateAuras.end(); ++j)
5730 {
5731 if ((*j)->IsAffectedOnSpell(m_spellInfo))
5732 {
5733 m_needComboPoints = false;
5734 if ((*j)->GetMiscValue() == 1)
5735 {
5736 reqCombat = false;
5737 break;
5738 }
5739 }
5740 }
5741
5742 // caster state requirements
5743 // not for triggered spells (needed by execute)
5745 {
5750
5751 // Note: spell 62473 requres CasterAuraSpell = triggering spell
5756
5757 if (reqCombat && m_caster->IsInCombat() && !m_spellInfo->CanBeUsedInCombat())
5759 }
5760
5761 // Xinef: exploit protection
5763 {
5765 if (InstanceScript* instanceScript = m_caster->GetInstanceScript())
5766 if (instanceScript->IsEncounterInProgress())
5767 {
5768 if (Group* group = m_caster->ToPlayer()->GetGroup())
5769 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
5770 if (Player* member = itr->GetSource())
5771 if (member->IsInMap(m_caster))
5772 if (Unit* victim = member->GetVictim())
5773 if (victim->IsInCombat() && m_caster->GetDistance(victim) < m_caster->GetVisibilityRange())
5774 {
5775 m_caster->CombatStart(victim);
5776 victim->AddThreat(m_caster, 1.0f);
5777 break;
5778 }
5780 }
5781 }
5782
5783 // cancel autorepeat spells if cast start when moving
5784 // (not wand currently autorepeat cast delayed to moving stop anyway in spell update code)
5786 {
5787 // skip stuck spell to allow use it in falling case and apply spell limitations at movement
5790 return SPELL_FAILED_MOVING;
5791 }
5792
5793 Vehicle* vehicle = m_caster->GetVehicle();
5795 {
5796 uint16 checkMask = 0;
5797 for (uint8 effIndex = EFFECT_0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
5798 {
5799 SpellEffectInfo const* effInfo = &m_spellInfo->Effects[effIndex];
5801 {
5802 SpellShapeshiftEntry const* shapeShiftEntry = sSpellShapeshiftStore.LookupEntry(effInfo->MiscValue);
5803 if (shapeShiftEntry && (shapeShiftEntry->flags1 & 1) == 0) // unk flag
5804 checkMask |= VEHICLE_SEAT_FLAG_UNCONTROLLED;
5805 break;
5806 }
5807 }
5808
5811
5812 if (!checkMask)
5813 checkMask = VEHICLE_SEAT_FLAG_CAN_ATTACK;
5814
5815 // All creatures should be able to cast as passengers freely, restriction and attribute are only for players
5816 VehicleSeatEntry const* vehicleSeat = vehicle->GetSeatForPassenger(m_caster);
5818 && (vehicleSeat->m_flags & checkMask) != checkMask && m_caster->GetTypeId() == TYPEID_PLAYER)
5820 }
5821
5822 // check spell cast conditions from database
5823 {
5826 ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL, m_spellInfo->Id);
5827 if (!conditions.empty() && !sConditionMgr->IsObjectMeetToConditions(condInfo, conditions))
5828 {
5829 // mLastFailedCondition can be nullptr if there was an error processing the condition in Condition::Meets (i.e. wrong data for ConditionTarget or others)
5830 if (condInfo.mLastFailedCondition && condInfo.mLastFailedCondition->ErrorType)
5831 {
5835 }
5836 if (!condInfo.mLastFailedCondition || !condInfo.mLastFailedCondition->ConditionTarget)
5839 }
5840 }
5841
5842 // Don't check explicit target for passive spells (workaround) (check should be skipped only for learn case)
5843 // those spells may have incorrect target entries or not filled at all (for example 15332)
5844 // such spells when learned are not targeting anyone using targeting system, they should apply directly to caster instead
5845 // also, such casts shouldn't be sent to client
5846 // Xinef: do not check explicit casts for self cast of triggered spells (eg. reflect case)
5848 {
5849 // Check explicit target for m_originalCaster - todo: get rid of such workarounds
5850 // Xinef: do not check explicit target for triggered spell casted on self with targetflag enemy
5852 {
5854 if (castResult != SPELL_CAST_OK)
5855 return castResult;
5856 }
5857 }
5858
5859 if (Unit* target = m_targets.GetUnitTarget())
5860 {
5861 SpellCastResult castResult = m_spellInfo->CheckTarget(m_caster, target, false);
5862 if (castResult != SPELL_CAST_OK)
5863 return castResult;
5864
5865 if (target != m_caster)
5866 {
5867 // Must be behind the target
5868 if (m_spellInfo->HasAttribute(SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET) && target->HasInArc(static_cast<float>(M_PI), m_caster))
5870
5871 // Target must be facing you
5872 if (m_spellInfo->HasAttribute(SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER) && !target->HasInArc(static_cast<float>(M_PI), m_caster))
5874
5877 {
5878 bool castedByGameobject = false;
5879 uint32 losChecks = LINEOFSIGHT_ALL_CHECKS;
5881 {
5882 castedByGameobject = m_caster->GetMap()->GetGameObject(m_originalCasterGUID) != nullptr;
5883 }
5884 else if (m_caster->GetEntry() == WORLD_TRIGGER)
5885 {
5886 if (TempSummon* tempSummon = m_caster->ToTempSummon())
5887 {
5888 castedByGameobject = tempSummon->GetSummonerGameObject() != nullptr;
5889 }
5890 }
5891
5892 if (castedByGameobject)
5893 {
5894 // If spell casted by gameobject then ignore M2 models
5895 losChecks &= ~LINEOFSIGHT_CHECK_GOBJECT_M2;
5896 }
5897
5899 {
5901 }
5902 }
5903 }
5904 }
5905
5906 // Check for line of sight for spells with dest
5907 if (m_targets.HasDst())
5908 {
5909 float x, y, z;
5910 m_targets.GetDstPos()->GetPosition(x, y, z);
5911
5914 {
5915 bool castedByGameobject = false;
5916 uint32 losChecks = LINEOFSIGHT_ALL_CHECKS;
5918 {
5919 castedByGameobject = m_caster->GetMap()->GetGameObject(m_originalCasterGUID) != nullptr;
5920 }
5921 else if (m_caster->GetEntry() == WORLD_TRIGGER)
5922 {
5923 if (TempSummon* tempSummon = m_caster->ToTempSummon())
5924 {
5925 castedByGameobject = tempSummon->GetSummonerGameObject() != nullptr;
5926 }
5927 }
5928
5929 if (castedByGameobject)
5930 {
5931 // If spell casted by gameobject then ignore M2 models
5932 losChecks &= ~LINEOFSIGHT_CHECK_GOBJECT_M2;
5933 }
5934
5936 {
5938 }
5939 }
5940 }
5941
5942 // check pet presence
5943 for (int j = 0; j < MAX_SPELL_EFFECTS; ++j)
5944 {
5945 if (m_spellInfo->Effects[j].TargetA.GetTarget() == TARGET_UNIT_PET)
5946 {
5948 {
5949 if (m_triggeredByAuraSpell.spellInfo) // not report pet not existence for triggered spells
5951 else
5952 return SPELL_FAILED_NO_PET;
5953 }
5954 break;
5955 }
5956 }
5957 // Spell casted only on battleground
5959 if (!m_caster->ToPlayer()->InBattleground())
5961
5962 // do not allow spells to be cast in arenas
5963 // - with greater than 10 min CD without SPELL_ATTR4_IGNORE_DEFAULT_ARENA_RESTRICTIONS flag
5964 // - with SPELL_ATTR4_NOT_IN_ARENA_OR_RATED_BATTLEGROUND flag
5967 if (MapEntry const* mapEntry = sMapStore.LookupEntry(m_caster->GetMapId()))
5968 if (mapEntry->IsBattleArena())
5970
5971 // zone check
5973 {
5974 uint32 zone, area;
5975 m_caster->GetZoneAndAreaId(zone, area);
5976
5978 m_caster->GetTypeId() == TYPEID_PLAYER ? m_caster->ToPlayer() : nullptr);
5979 if (locRes != SPELL_CAST_OK)
5980 return locRes;
5981 }
5982
5983 // not let players cast spells at mount (and let do it to creatures)
5986 {
5987 if (m_caster->IsInFlight())
5989 else
5991 }
5992
5993 SpellCastResult castResult = SPELL_CAST_OK;
5994
5995 // always (except passive spells) check items (focus object can be required for any type casts)
5996 if (!m_spellInfo->IsPassive())
5997 {
5998 // spell focus needs to be checked not only for players! there are vehicle spells that require spell focus
5999 castResult = CheckSpellFocus();
6000 if (castResult != SPELL_CAST_OK)
6001 return castResult;
6002
6003 castResult = CheckItems();
6004 if (castResult != SPELL_CAST_OK)
6005 return castResult;
6006 }
6007
6008 // Triggered spells also have range check
6010 castResult = CheckRange(strict);
6011 if (castResult != SPELL_CAST_OK)
6012 return castResult;
6013
6015 {
6016 castResult = CheckPower();
6017 if (castResult != SPELL_CAST_OK)
6018 return castResult;
6019 }
6020
6021 // xinef: do not skip triggered spells if they posses prevention type (eg. Bladestorm vs Hand of Protection)
6023 {
6025 if (castResult != SPELL_CAST_OK)
6026 return castResult;
6027
6028 // xinef: Enraged Regeneration: While this is active, the warrior is blocked from using abilities that trigger being enraged (which would do nothing and waste the cooldowns).
6030 {
6032 for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
6033 if (itr->type == m_spellInfo->Mechanic)
6035 }
6036 }
6037
6038 // script hook
6039 castResult = CallScriptCheckCastHandlers();
6040 if (castResult != SPELL_CAST_OK)
6041 return castResult;
6042
6043 bool hasDispellableAura = false;
6044 bool hasNonDispelEffect = false;
6045 uint32 dispelMask = 0;
6046 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
6047 if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_DISPEL)
6048 {
6050 {
6051 hasDispellableAura = true;
6052 break;
6053 }
6054
6055 dispelMask |= SpellInfo::GetDispelMask(DispelType(m_spellInfo->Effects[i].MiscValue));
6056 }
6057 else if (m_spellInfo->Effects[i].IsEffect())
6058 {
6059 hasNonDispelEffect = true;
6060 break;
6061 }
6062
6063 if (!hasNonDispelEffect && !hasDispellableAura && dispelMask && !IsTriggered())
6064 {
6065 if (Unit* target = m_targets.GetUnitTarget())
6066 {
6067 // Xinef: do not allow to cast on hostile targets in sanctuary
6068 if (!m_caster->IsFriendlyTo(target))
6069 {
6070 if (m_caster->IsInSanctuary() || target->IsInSanctuary())
6071 {
6072 // Xinef: fix for duels
6073 Player* player = m_caster->ToPlayer();
6074 if (!player || !player->duel || target != player->duel->Opponent)
6076 }
6077 }
6078
6079 DispelChargesList dispelList;
6080 target->GetDispellableAuraList(m_caster, dispelMask, dispelList, m_spellInfo);
6081
6082 if (dispelList.empty())
6084 }
6085 }
6086
6087 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
6088 {
6089 // for effects of spells that have only one target
6090 switch (m_spellInfo->Effects[i].Effect)
6091 {
6093 {
6096
6097 if (m_spellInfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_PET)
6098 break;
6099
6100 Pet* pet = m_caster->ToPlayer()->GetPet();
6101
6102 if (!pet)
6103 return SPELL_FAILED_NO_PET;
6104
6105 SpellInfo const* learn_spellproto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[i].TriggerSpell);
6106
6107 if (!learn_spellproto)
6109
6110 if (m_spellInfo->SpellLevel > pet->GetLevel())
6111 return SPELL_FAILED_LOWLEVEL;
6112
6113 break;
6114 }
6116 {
6117 // check target only for unit target case
6119 {
6122
6123 Pet* pet = unitTarget->ToPet();
6124 if (!pet || pet->GetOwner() != m_caster)
6126
6127 SpellInfo const* learn_spellproto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[i].TriggerSpell);
6128
6129 if (!learn_spellproto)
6131
6132 if (m_spellInfo->SpellLevel > pet->GetLevel())
6133 return SPELL_FAILED_LOWLEVEL;
6134 }
6135 break;
6136 }
6138 {
6139 uint32 glyphId = m_spellInfo->Effects[i].MiscValue;
6140 if (GlyphPropertiesEntry const* gp = sGlyphPropertiesStore.LookupEntry(glyphId))
6141 if (m_caster->HasAura(gp->SpellId))
6143 break;
6144 }
6146 {
6149
6150 Item* foodItem = m_targets.GetItemTarget();
6151 if (!foodItem)
6153
6154 Pet* pet = m_caster->ToPlayer()->GetPet();
6155
6156 if (!pet)
6157 return SPELL_FAILED_NO_PET;
6158
6159 if (!pet->HaveInDiet(foodItem->GetTemplate()))
6161
6162 if (!pet->GetCurrentFoodBenefitLevel(foodItem->GetTemplate()->ItemLevel))
6164
6165 if (m_caster->IsInCombat() || pet->IsInCombat())
6167
6168 break;
6169 }
6172 {
6173 // Can be area effect, Check only for players and not check if target - caster (spell can have multiply drain/burn effects)
6175 if (Unit* target = m_targets.GetUnitTarget())
6176 if (target != m_caster && target->getPowerType() != Powers(m_spellInfo->Effects[i].MiscValue))
6178 break;
6179 }
6181 {
6183 {
6185 }
6186
6188 {
6189 // Warbringer - can't be handled in proc system - should be done before checkcast root check and charge effect process
6190 if (strict && m_caster->IsScriptOverriden(m_spellInfo, 6953))
6192 }
6194 {
6195 // Exception for Master's Call
6196 if (m_spellInfo->Id != 54216)
6197 {
6198 return SPELL_FAILED_ROOTED;
6199 }
6200 }
6202 if (Unit* target = m_targets.GetUnitTarget())
6203 if (!target->IsAlive())
6205 // Xinef: Pass only explicit unit target spells
6206 // pussywizard:
6208 {
6209 Unit* target = m_targets.GetUnitTarget();
6210 if (!target)
6212
6213 // first we must check to see if the target is in LoS. A path can usually be built but LoS matters for charge spells
6214 if (!target->IsWithinLOSInMap(m_caster)) //Do full LoS/Path check. Don't exclude m2
6216
6217 float objSize = target->GetCombatReach();
6218 float range = m_spellInfo->GetMaxRange(true, m_caster, this) * 1.5f + objSize; // can't be overly strict
6219
6220 m_preGeneratedPath = std::make_unique<PathGenerator>(m_caster);
6221 m_preGeneratedPath->SetPathLengthLimit(range);
6222
6223 // first try with raycast, if it fails fall back to normal path
6224 bool result = m_preGeneratedPath->CalculatePath(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), false);
6225 if (m_preGeneratedPath->GetPathType() & PATHFIND_SHORT)
6226 return SPELL_FAILED_NOPATH;
6227 else if (!result || m_preGeneratedPath->GetPathType() & (PATHFIND_NOPATH | PATHFIND_INCOMPLETE))
6228 return SPELL_FAILED_NOPATH;
6229 else if (m_preGeneratedPath->IsInvalidDestinationZ(target)) // Check position z, if not in a straight line
6230 return SPELL_FAILED_NOPATH;
6231
6232 m_preGeneratedPath->ShortenPathUntilDist(G3D::Vector3(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()), objSize); // move back
6233 }
6234 if (Player* player = m_caster->ToPlayer())
6235 player->SetCanTeleport(true);
6236 break;
6237 }
6239 {
6242
6245
6246 Creature* creature = m_targets.GetUnitTarget()->ToCreature();
6247 if (!creature->IsCritter() && !creature->loot.isLooted())
6249
6250 uint32 skill = creature->GetCreatureTemplate()->GetRequiredLootSkill();
6251
6252 int32 skillValue = m_caster->ToPlayer()->GetSkillValue(skill);
6253 int32 TargetLevel = m_targets.GetUnitTarget()->GetLevel();
6254 int32 ReqValue = (skillValue < 100 ? (TargetLevel - 10) * 10 : TargetLevel * 5);
6255 if (ReqValue > skillValue)
6257
6258 break;
6259 }
6261 {
6262 if (m_spellInfo->Effects[i].TargetA.GetTarget() != TARGET_GAMEOBJECT_TARGET &&
6263 m_spellInfo->Effects[i].TargetA.GetTarget() != TARGET_GAMEOBJECT_ITEM_TARGET)
6264 break;
6265
6266 if (m_caster->GetTypeId() != TYPEID_PLAYER // only players can open locks, gather etc.
6267 // we need a go target in case of TARGET_GAMEOBJECT_TARGET
6268 || (m_spellInfo->Effects[i].TargetA.GetTarget() == TARGET_GAMEOBJECT_TARGET && !m_targets.GetGOTarget()))
6270
6271 Item* pTempItem = nullptr;
6273 {
6274 if (TradeData* pTrade = m_caster->ToPlayer()->GetTradeData())
6275 pTempItem = pTrade->GetTraderData()->GetItem(TradeSlots(m_targets.GetItemTargetGUID().GetRawValue()));
6276 }
6279
6280 // we need a go target, or an openable item target in case of TARGET_GAMEOBJECT_ITEM_TARGET
6281 if (m_spellInfo->Effects[i].TargetA.GetTarget() == TARGET_GAMEOBJECT_ITEM_TARGET &&
6283 (!pTempItem || !pTempItem->GetTemplate()->LockID || !pTempItem->IsLocked()))
6285
6286 // We must also ensure the gameobject we are opening is still closed by the time the spell finishes.
6287 if (GameObject* go = m_targets.GetGOTarget())
6288 {
6289 if (go->GetGoType() == GAMEOBJECT_TYPE_DOOR && go->GetGoState() != GO_STATE_READY)
6290 {
6292 }
6293 }
6294 if (m_spellInfo->Id != 1842 || (m_targets.GetGOTarget() &&
6296 {
6297 if (m_targets.GetGOTarget() && m_targets.GetGOTarget()->GetEntry() == 179697)
6298 {
6299 if (!m_caster->ToPlayer()->CanUseBattlegroundObject(nullptr))
6301 }
6302 else if (m_caster->ToPlayer()->InBattleground() && // In Battleground players can use only flags and banners, or Gurubashi chest
6305 }
6306
6307 // get the lock entry
6308 uint32 lockId = 0;
6309 if (GameObject* go = m_targets.GetGOTarget())
6310 {
6311 lockId = go->GetGOInfo()->GetLockId();
6312 if (!lockId)
6314 }
6315 else if (Item* itm = m_targets.GetItemTarget())
6316 lockId = itm->GetTemplate()->LockID;
6317
6318 SkillType skillId = SKILL_NONE;
6319 int32 reqSkillValue = 0;
6320 int32 skillValue = 0;
6321
6322 // check lock compatibility
6323 SpellCastResult res = CanOpenLock(i, lockId, skillId, reqSkillValue, skillValue);
6324 if (res != SPELL_CAST_OK)
6325 return res;
6326
6327 // chance for fail at lockpicking attempt
6328 // second check prevent fail at rechecks
6329 // herbalism and mining cannot fail as of patch 3.1.0
6330 if (skillId != SKILL_NONE && skillId != SKILL_HERBALISM && skillId != SKILL_MINING && (!m_selfContainer || ((*m_selfContainer) != this)))
6331 {
6332 // chance for failure in orange lockpick
6333 if (skillId == SKILL_LOCKPICKING && reqSkillValue > irand(skillValue - 25, skillValue + 37))
6334 {
6336 }
6337 }
6338 break;
6339 }
6341 {
6342 Unit* unitCaster = m_caster->ToUnit();
6343 if (!unitCaster)
6344 {
6346 }
6347
6348 Creature* pet = unitCaster->GetGuardianPet();
6349 if (pet)
6350 {
6351 if (pet->IsAlive())
6352 {
6354 }
6355 }
6356 else if (Player* playerCaster = m_caster->ToPlayer())
6357 {
6358 PetStable& petStable = playerCaster->GetOrInitPetStable();
6359 if (!petStable.CurrentPet && petStable.UnslottedPets.empty())
6360 {
6361 return SPELL_FAILED_NO_PET;
6362 }
6363 }
6364
6365 break;
6366 }
6367 // This is generic summon effect
6369 {
6370 SummonPropertiesEntry const* SummonProperties = sSummonPropertiesStore.LookupEntry(m_spellInfo->Effects[i].MiscValueB);
6371 if (!SummonProperties || m_spellInfo->HasAttribute(SPELL_ATTR1_DISMISS_PET_FIRST))
6372 break;
6373 switch (SummonProperties->Category)
6374 {
6376 if (m_caster->GetPetGUID())
6378 [[fallthrough]];
6380 if (m_caster->GetCharmGUID())
6382 break;
6383 }
6384 break;
6385 }
6387 {
6389 {
6394 }
6395 break;
6396 }
6398 {
6399 Unit* unitCaster = m_caster->ToUnit();
6400 if (!unitCaster)
6402
6404 {
6405 if (m_caster->GetPetGUID())
6407 if (m_caster->GetCharmGUID())
6409 }
6410
6411 if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->getClass() == CLASS_WARLOCK && strict)
6412 if (Pet* pet = m_caster->ToPlayer()->GetPet())
6413 pet->CastSpell(pet, 32752, true, nullptr, nullptr, pet->GetGUID()); //starting cast, trigger pet stun (cast by pet so it doesn't attack player)
6414
6415 Player* playerCaster = unitCaster->ToPlayer();
6416 if (playerCaster && playerCaster->GetPetStable())
6417 {
6418 std::pair<PetStable::PetInfo const*, PetSaveMode> info = Pet::GetLoadPetInfo(*playerCaster->GetPetStable(), m_spellInfo->Effects[i].MiscValue, 0, false);
6419 if (info.first)
6420 {
6421 if (info.first->Type == HUNTER_PET)
6422 {
6423 if (!info.first->Health)
6424 {
6425 playerCaster->SendTameFailure(PET_TAME_DEAD);
6427 }
6428
6429 CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(info.first->CreatureId);
6430 if (!creatureInfo || !creatureInfo->IsTameable(playerCaster->CanTameExoticPets()))
6431 {
6432 // if problem in exotic pet
6433 if (creatureInfo && creatureInfo->IsTameable(true))
6435 else
6437
6439 }
6440 }
6441 }
6442 else if (!m_spellInfo->Effects[i].MiscValue) // when miscvalue is present it is allowed to create new pets
6443 {
6446 }
6447 }
6448 break;
6449 }
6451 {
6454 if (!m_caster->GetTarget())
6456
6458 if (!target || m_caster->ToPlayer() == target || (!target->IsInSameRaidWith(m_caster->ToPlayer()) && m_spellInfo->Id != 48955)) // refer-a-friend spell
6460
6461 // Xinef: Implement summon pending error
6462 if (target->GetSummonExpireTimer() > GameTime::GetGameTime().count())
6464
6465 // check if our map is dungeon
6466 MapEntry const* map = sMapStore.LookupEntry(m_caster->GetMapId());
6467 if (map->IsDungeon())
6468 {
6469 uint32 mapId = m_caster->GetMap()->GetId();
6470 Difficulty difficulty = m_caster->GetMap()->GetDifficulty();
6471 /*if (map->IsRaid())
6472 if (InstancePlayerBind* targetBind = target->GetBoundInstance(mapId, difficulty))
6473 if (targetBind->perm && targetBind != m_caster->ToPlayer()->GetBoundInstance(mapId, difficulty))
6474 return SPELL_FAILED_TARGET_LOCKED_TO_RAID_INSTANCE;*/
6475
6476 InstanceTemplate const* instance = sObjectMgr->GetInstanceTemplate(mapId);
6477 if (!instance)
6479 if (!target->Satisfy(sObjectMgr->GetAccessRequirement(mapId, difficulty), mapId))
6481 }
6482 break;
6483 }
6484 // RETURN HERE
6486 {
6489
6490 Player* playerCaster = m_caster->ToPlayer();
6491 //
6492 if (!(playerCaster->GetTarget()))
6494
6496
6497 if (!target ||
6498 !(target->GetSession()->GetRecruiterId() == playerCaster->GetSession()->GetAccountId() || target->GetSession()->GetAccountId() == playerCaster->GetSession()->GetRecruiterId()))
6500
6501 // Xinef: Implement summon pending error
6502 if (target->GetSummonExpireTimer() > GameTime::GetGameTime().count())
6504
6505 break;
6506 }
6507 case SPELL_EFFECT_LEAP:
6509 {
6510 //Do not allow to cast it before BG starts.
6512 if (Battleground const* bg = m_caster->ToPlayer()->GetBattleground())
6513 if (bg->GetStatus() != STATUS_IN_PROGRESS)
6515 break;
6516 }
6518 {
6521
6522 bool found = false;
6524 for(Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin(); itr != visibleAuras->end(); ++itr)
6525 {
6526 if( itr->second->GetBase()->IsPassive() )
6527 continue;
6528
6529 if( !itr->second->IsPositive() )
6530 continue;
6531
6532 found = true;
6533 break;
6534 }
6535
6536 if( !found )
6538
6539 break;
6540 }
6542 {
6544 {
6546 return SPELL_FAILED_ROOTED;
6547 else
6549 }
6550 break;
6551 }
6552 // xinef: do not allow to use leaps while rooted
6553 case SPELL_EFFECT_JUMP:
6555 {
6557 return SPELL_FAILED_ROOTED;
6558 break;
6559 }
6561 if (!sScriptMgr->CanSelectSpecTalent(this))
6563 // can't change during already started arena/battleground
6565 if (Battleground const* bg = m_caster->ToPlayer()->GetBattleground())
6566 if (bg->GetStatus() == STATUS_IN_PROGRESS)
6568 break;
6569 default:
6570 break;
6571 }
6572 }
6573
6574 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
6575 {
6576 switch (m_spellInfo->Effects[i].ApplyAuraName)
6577 {
6578 case SPELL_AURA_DUMMY:
6579 break;
6581 {
6583 return SPELL_FAILED_NO_PET;
6584
6585 Pet* pet = m_caster->ToPlayer()->GetPet();
6586 if (!pet)
6587 return SPELL_FAILED_NO_PET;
6588
6589 if (pet->GetCharmerGUID())
6590 return SPELL_FAILED_CHARMED;
6591 break;
6592 }
6596 {
6597 if (m_caster->GetCharmerGUID())
6598 return SPELL_FAILED_CHARMED;
6599
6600 // Xinef: allow SPELL_AURA_MOD_POSSESS to posses target if caster has some pet
6602 {
6603 if (m_caster->GetPetGUID())
6605
6606 if (m_caster->GetCharmGUID())
6608 }
6609 else if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_POSSESS)
6610 {
6611 if (m_caster->GetCharmGUID())
6613 }
6614
6615 if (Unit* target = m_targets.GetUnitTarget())
6616 {
6617 if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsVehicle())
6619
6620 if (target->IsMounted())
6622
6623 if (target->GetCharmerGUID())
6624 return SPELL_FAILED_CHARMED;
6625
6626 if (target->GetOwnerGUID() && target->GetOwnerGUID().IsPlayer())
6628
6629 if (target->IsPet() && (!target->GetOwner() || target->GetOwner()->ToPlayer()))
6631
6632 int32 damage = CalculateSpellDamage(i, target);
6633 if (damage && int32(target->GetLevel()) > damage)
6635 }
6636
6637 break;
6638 }
6639 case SPELL_AURA_MOUNTED:
6640 {
6641 // Disallow casting flying mounts in water
6644
6645 // Ignore map check if spell have AreaId. AreaId already checked and this prevent special mount spells
6646 bool allowMount = !m_caster->GetMap()->IsDungeon() || m_caster->GetMap()->IsBattlegroundOrArena();
6647 InstanceTemplate const* it = sObjectMgr->GetInstanceTemplate(m_caster->GetMapId());
6648 if (it)
6649 allowMount = it->AllowMount;
6650 if (m_caster->GetTypeId() == TYPEID_PLAYER && !allowMount && !m_spellInfo->AreaGroupId)
6652
6655
6656 // xinef: dont allow to cast mounts in specific transforms
6657 if (m_caster->getTransForm())
6658 if (SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(m_caster->getTransForm()))
6659 if (transformSpellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) &&
6660 !transformSpellInfo->HasAttribute(SpellAttr0(SPELL_ATTR0_ALLOW_WHILE_MOUNTED | SPELL_ATTR0_AURA_IS_DEBUFF)))
6662
6663 break;
6664 }
6666 {
6667 if (!m_targets.GetUnitTarget())
6669
6670 // can be casted at non-friendly unit or own pet/charm
6673
6674 break;
6675 }
6676 case SPELL_AURA_FLY:
6678 {
6679 // Xinef: added water check
6680 if (m_caster->IsInWater())
6682
6683 // not allow cast fly spells if not have req. skills (all spells is self target)
6684 // allow always ghost flight spells
6686 {
6687 Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(m_originalCaster->GetZoneId());
6688 if (AreaTableEntry const* pArea = sAreaTableStore.LookupEntry(m_originalCaster->GetAreaId()))
6689 if ((pArea->flags & AREA_FLAG_NO_FLY_ZONE) || (Bf && !Bf->CanFlyIn()))
6690 return SPELL_FAILED_NOT_HERE;
6691 }
6692 break;
6693 }
6695 {
6696 if (m_spellInfo->Effects[i].IsTargetingArea())
6697 break;
6698
6700 break;
6701
6702 if (!m_targets.GetUnitTarget())
6704
6707
6708 break;
6709 }
6710 case SPELL_AURA_HOVER:
6711 {
6713 {
6715 }
6716 break;
6717 }
6719 {
6720 if (m_caster && m_caster->HasAura(23397)) // Nefarian Class Call (Warrior): Berserk -- Nefertum: I don't really like this but I didn't find another way.
6721 {
6723 }
6724 break;
6725 }
6726 default:
6727 break;
6728 }
6729 }
6730
6731 // check trade slot case (last, for allow catch any another cast problems)
6733 {
6734 if (m_CastItem)
6736
6739
6740 TradeData* my_trade = m_caster->ToPlayer()->GetTradeData();
6741
6742 if (!my_trade)
6744
6746 if (slot != TRADE_SLOT_NONTRADED)
6748
6749 if (!IsTriggered())
6750 if (my_trade->GetSpell())
6752 }
6753
6754 // check if caster has at least 1 combo point on target for spells that require combo points
6756 {
6758 {
6760 {
6762 }
6763 }
6764 else
6765 {
6766 if (!m_caster->GetComboPoints())
6767 {
6769 }
6770 }
6771 }
6772
6773 // xinef: check relic cooldown
6777
6778 // all ok
6779 return SPELL_CAST_OK;
6780}
constexpr auto IN_MILLISECONDS
Definition: Common.h:55
constexpr auto MINUTE
Definition: Common.h:49
std::int32_t int32
Definition: Define.h:104
std::uint16_t uint16
Definition: Define.h:109
int32 irand(int32 min, int32 max)
Definition: Random.cpp:37
#define SPECTATOR_SPELL_BINDSIGHT
Definition: ArenaSpectator.h:38
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:77
@ STATUS_WAIT_LEAVE
Definition: Battleground.h:198
@ STATUS_IN_PROGRESS
Definition: Battleground.h:197
#define sConditionMgr
Definition: ConditionMgr.h:289
@ CONDITION_SOURCE_TYPE_SPELL
Definition: ConditionMgr.h:139
std::list< Condition * > ConditionList
Definition: ConditionMgr.h:236
DBCStorage< SpellShapeshiftEntry > sSpellShapeshiftStore(SpellShapeshiftfmt)
DBCStorage< SummonPropertiesEntry > sSummonPropertiesStore(SummonPropertiesfmt)
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
DBCStorage< GlyphPropertiesEntry > sGlyphPropertiesStore(GlyphPropertiesfmt)
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
@ GO_STATE_READY
Definition: GameObjectData.h:691
@ INVTYPE_RELIC
Definition: ItemTemplate.h:293
@ HUNTER_PET
Definition: PetDefines.h:32
@ PLAYER_ALLOW_ONLY_ABILITY
Definition: Player.h:498
TradeSlots
Definition: TradeData.h:28
@ TRADE_SLOT_NONTRADED
Definition: TradeData.h:31
@ MOVEMENTFLAG_FALLING_FAR
Definition: Unit.h:565
#define WORLD_TRIGGER
Definition: Unit.h:36
@ UNIT_FLAG2_ALLOW_CHEAT_SPELLS
Definition: Unit.h:505
std::list< std::pair< Aura *, uint8 > > DispelChargesList
Definition: Unit.h:241
@ UNIT_STATE_ROOT
Definition: Unit.h:335
@ UNIT_STATE_CHARGING
Definition: Unit.h:342
@ UNIT_FLAG_SKINNABLE
Definition: Unit.h:474
LineOfSightChecks
Definition: Map.h:191
@ LINEOFSIGHT_ALL_CHECKS
Definition: Map.h:198
@ PATHFIND_NOPATH
Definition: PathGenerator.h:51
@ PATHFIND_SHORT
Definition: PathGenerator.h:53
@ PATHFIND_INCOMPLETE
Definition: PathGenerator.h:50
@ SPELL_AURA_ABILITY_IGNORE_AURASTATE
Definition: SpellAuraDefines.h:325
@ SPELL_AURA_MOD_SHAPESHIFT
Definition: SpellAuraDefines.h:99
@ SPELL_AURA_MOD_IGNORE_SHAPESHIFT
Definition: SpellAuraDefines.h:338
@ SPELL_AURA_PERIODIC_MANA_LEECH
Definition: SpellAuraDefines.h:127
@ SPELL_AURA_MOD_POSSESS_PET
Definition: SpellAuraDefines.h:191
@ SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS
Definition: SpellAuraDefines.h:190
@ SPELL_AURA_DUMMY
Definition: SpellAuraDefines.h:67
@ SPELL_AURA_FLY
Definition: SpellAuraDefines.h:264
@ SPELL_AURA_HOVER
Definition: SpellAuraDefines.h:169
@ SPELL_AURA_MOUNTED
Definition: SpellAuraDefines.h:141
@ SPELL_AURA_AOE_CHARM
Definition: SpellAuraDefines.h:240
@ SPELL_AURA_MOD_POSSESS
Definition: SpellAuraDefines.h:65
@ SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED
Definition: SpellAuraDefines.h:270
@ SPELL_AURA_BLOCK_SPELL_FAMILY
Definition: SpellAuraDefines.h:360
@ SPELL_FLAG_REDIRECTED
Definition: Spell.h:83
@ AURA_INTERRUPT_FLAG_NOT_SEATED
Definition: SpellDefines.h:62
@ AURA_INTERRUPT_FLAG_MOUNT
Definition: SpellDefines.h:61
@ TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD
Will ignore GCD.
Definition: SpellDefines.h:133
@ TRIGGERED_IGNORE_CASTER_AURASTATE
Will ignore shapeshift checks.
Definition: SpellDefines.h:143
@ TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE
Will ignore caster aura states including combat requirements and death state.
Definition: SpellDefines.h:144
@ TRIGGERED_IGNORE_SHAPESHIFT
Will not adjust facing to target (if any)
Definition: SpellDefines.h:142
@ TRIGGERED_IGNORE_GCD
Not triggered.
Definition: SpellDefines.h:132
@ TRIGGERED_IGNORE_CASTER_AURAS
Will ignore mounted/on vehicle restrictions.
Definition: SpellDefines.h:145
std::vector< SpellImmune > SpellImmuneList
Definition: SpellDefines.h:179
@ TARGET_FLAG_UNIT_ENEMY
Definition: SpellInfo.h:53
@ TARGET_FLAG_ITEM
Definition: SpellInfo.h:50
@ SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER
Definition: SpellInfo.h:192
@ SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET
Definition: SpellInfo.h:193
#define SPELL_RELIC_COOLDOWN
Definition: SpellMgr.h:34
@ VEHICLE_SEAT_FLAG_CAN_CAST_MOUNT_SPELL
Definition: DBCEnums.h:464
@ VEHICLE_SEAT_FLAG_UNCONTROLLED
Definition: DBCEnums.h:465
@ VEHICLE_SEAT_FLAG_CAN_ATTACK
Definition: DBCEnums.h:466
Difficulty
Definition: DBCEnums.h:274
@ AREA_FLAG_NO_FLY_ZONE
Definition: DBCEnums.h:270
@ GAMEOBJECT_TYPE_TRAP
Definition: SharedDefines.h:1566
@ GAMEOBJECT_TYPE_DOOR
Definition: SharedDefines.h:1560
Powers
Definition: SharedDefines.h:268
@ POWER_MANA
Definition: SharedDefines.h:269
@ SPELL_ATTR7_DEBUG_SPELL
Definition: SharedDefines.h:644
@ SPELL_EFFECT_LEAP
Definition: SharedDefines.h:807
@ SPELL_EFFECT_POWER_BURN
Definition: SharedDefines.h:840
@ SPELL_EFFECT_STUCK
Definition: SharedDefines.h:862
@ SPELL_EFFECT_SUMMON_RAF_FRIEND
Definition: SharedDefines.h:930
@ SPELL_EFFECT_APPLY_GLYPH
Definition: SharedDefines.h:852
@ SPELL_EFFECT_FEED_PET
Definition: SharedDefines.h:879
@ SPELL_EFFECT_SUMMON_PLAYER
Definition: SharedDefines.h:863
@ SPELL_EFFECT_JUMP_DEST
Definition: SharedDefines.h:820
@ SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER
Definition: SharedDefines.h:821
@ SPELL_EFFECT_RESURRECT_PET
Definition: SharedDefines.h:887
@ SPELL_EFFECT_LEAP_BACK
Definition: SharedDefines.h:916
@ SPELL_EFFECT_SUMMON
Definition: SharedDefines.h:806
@ SPELL_EFFECT_POWER_DRAIN
Definition: SharedDefines.h:786
@ SPELL_EFFECT_RESURRECT
Definition: SharedDefines.h:796
@ SPELL_EFFECT_CHARGE
Definition: SharedDefines.h:874
@ SPELL_EFFECT_RESURRECT_NEW
Definition: SharedDefines.h:891
@ SPELL_EFFECT_TALENT_SPEC_SELECT
Definition: SharedDefines.h:940
@ SPELL_EFFECT_LEARN_SPELL
Definition: SharedDefines.h:814
@ SPELL_EFFECT_JUMP
Definition: SharedDefines.h:819
@ SPELL_EFFECT_SKINNING
Definition: SharedDefines.h:873
@ SPELL_EFFECT_CREATE_TAMED_PET
Definition: SharedDefines.h:931
@ SPELL_EFFECT_OPEN_LOCK
Definition: SharedDefines.h:811
@ SPELL_EFFECT_STEAL_BENEFICIAL_BUFF
Definition: SharedDefines.h:904
@ SPELL_EFFECT_LEARN_PET_SPELL
Definition: SharedDefines.h:835
@ SPELL_PREVENTION_TYPE_NONE
Definition: SharedDefines.h:1553
@ SPELL_ATTR5_ALWAYS_AOE_LINE_OF_SIGHT
Definition: SharedDefines.h:593
@ TARGET_UNIT_PET
Definition: SharedDefines.h:1414
@ TARGET_GAMEOBJECT_TARGET
Definition: SharedDefines.h:1427
@ SPELL_ATTR2_IGNORE_LINE_OF_SIGHT
Definition: SharedDefines.h:458
@ SPELL_ATTR1_INITIATE_COMBAT
Definition: SharedDefines.h:428
@ SPELL_ATTR3_ONLY_BATTLEGROUNDS
Definition: SharedDefines.h:504
@ PET_TAME_NOPET_AVAILABLE
Definition: SharedDefines.h:3683
@ PET_TAME_DEAD
Definition: SharedDefines.h:3686
@ PET_TAME_CANT_CONTROL_EXOTIC
Definition: SharedDefines.h:3688
@ CLASS_WARLOCK
Definition: SharedDefines.h:149
@ IMMUNITY_MECHANIC
Definition: SharedDefines.h:1399
@ SPELLFAMILY_WARRIOR
Definition: SharedDefines.h:3532
SpellCustomErrors
Definition: SharedDefines.h:1142
@ SPELL_CUSTOM_ERROR_GM_ONLY
Definition: SharedDefines.h:1208
SpellAttr0
Definition: SharedDefines.h:381
@ SPELL_ATTR0_ONLY_INDOORS
Definition: SharedDefines.h:396
@ SPELL_ATTR0_AURA_IS_DEBUFF
Definition: SharedDefines.h:408
@ SPELL_ATTR0_ONLY_OUTDOORS
Definition: SharedDefines.h:397
@ SPELL_ATTR0_ALLOW_WHILE_MOUNTED
Definition: SharedDefines.h:406
@ SPELL_ATTR0_PASSIVE
Definition: SharedDefines.h:388
@ SPELL_ATTR0_ALLOW_CAST_WHILE_DEAD
Definition: SharedDefines.h:405
@ SPELL_ATTR0_ONLY_STEALTHED
Definition: SharedDefines.h:399
AuraStateType
Definition: SharedDefines.h:1288
DispelType
Definition: SharedDefines.h:1371
@ SPELL_FAILED_TARGET_NOT_LOOTED
Definition: SharedDefines.h:1070
@ SPELL_FAILED_NOT_INFRONT
Definition: SharedDefines.h:1010
@ SPELL_FAILED_MOVING
Definition: SharedDefines.h:1000
@ SPELL_FAILED_NOT_MOUNTED
Definition: SharedDefines.h:1013
@ SPELL_FAILED_AFFECTING_COMBAT
Definition: SharedDefines.h:950
@ SPELL_FAILED_CASTER_AURASTATE
Definition: SharedDefines.h:971
@ SPELL_FAILED_NOTHING_TO_DISPEL
Definition: SharedDefines.h:1035
@ SPELL_FAILED_NOT_KNOWN
Definition: SharedDefines.h:1012
@ SPELL_FAILED_FOOD_LOWLEVEL
Definition: SharedDefines.h:984
@ SPELL_FAILED_NOT_HERE
Definition: SharedDefines.h:1009
@ SPELL_FAILED_ROOTED
Definition: SharedDefines.h:1052
@ SPELL_FAILED_WRONG_PET_FOOD
Definition: SharedDefines.h:1084
@ SPELL_FAILED_CUSTOM_ERROR
Definition: SharedDefines.h:1121
@ SPELL_FAILED_SUMMON_PENDING
Definition: SharedDefines.h:1132
@ SPELL_FAILED_DAMAGE_IMMUNE
Definition: SharedDefines.h:1095
@ SPELL_FAILED_BAD_IMPLICIT_TARGETS
Definition: SharedDefines.h:960
@ SPELL_FAILED_TRY_AGAIN
Definition: SharedDefines.h:1081
@ SPELL_FAILED_NO_COMBO_POINTS
Definition: SharedDefines.h:1027
@ SPELL_FAILED_ALREADY_HAVE_SUMMON
Definition: SharedDefines.h:956
@ SPELL_FAILED_ALREADY_OPEN
Definition: SharedDefines.h:957
@ SPELL_FAILED_NOT_TRADING
Definition: SharedDefines.h:1020
@ SPELL_FAILED_NOTHING_TO_STEAL
Definition: SharedDefines.h:1036
@ SPELL_FAILED_NO_MOUNTS_ALLOWED
Definition: SharedDefines.h:1032
@ SPELL_FAILED_NOT_IN_BATTLEGROUND
Definition: SharedDefines.h:1115
@ SPELL_FAILED_NOT_BEHIND
Definition: SharedDefines.h:1006
@ SPELL_FAILED_ALREADY_HAVE_CHARM
Definition: SharedDefines.h:955
@ SPELL_FAILED_TARGET_NOT_IN_INSTANCE
Definition: SharedDefines.h:1086
@ SPELL_FAILED_HIGHLEVEL
Definition: SharedDefines.h:985
@ SPELL_FAILED_LOWLEVEL
Definition: SharedDefines.h:997
@ SPELL_FAILED_NOT_READY
Definition: SharedDefines.h:1016
@ SPELL_FAILED_ONLY_BATTLEGROUNDS
Definition: SharedDefines.h:1091
@ SPELL_FAILED_NOT_IN_ARENA
Definition: SharedDefines.h:1100
@ SPELL_FAILED_ITEM_ALREADY_ENCHANTED
Definition: SharedDefines.h:991
@ SPELL_FAILED_ONLY_STEALTHED
Definition: SharedDefines.h:1044
@ SPELL_FAILED_TARGET_IS_PLAYER_CONTROLLED
Definition: SharedDefines.h:1067
@ SPELL_FAILED_ONLY_ABOVEWATER
Definition: SharedDefines.h:1037
@ SPELL_FAILED_CANT_BE_CHARMED
Definition: SharedDefines.h:962
@ SPELL_FAILED_CASTER_DEAD
Definition: SharedDefines.h:972
@ SPELL_FAILED_NOT_ON_MOUNTED
Definition: SharedDefines.h:1104
@ SPELL_FAILED_ITEM_ENCHANT_TRADE_WINDOW
Definition: SharedDefines.h:1131
@ SPELL_FAILED_TARGET_CANNOT_BE_RESURRECTED
Definition: SharedDefines.h:1135
@ SPELL_FAILED_TARGET_UNSKINNABLE
Definition: SharedDefines.h:1075
@ SPELL_FAILED_NOT_SHAPESHIFT
Definition: SharedDefines.h:1017
@ SPELL_FAILED_UNIQUE_GLYPH
Definition: SharedDefines.h:1125
@ SPELL_FAILED_ONLY_OUTDOORS
Definition: SharedDefines.h:1042
@ SPELL_FAILED_CHARMED
Definition: SharedDefines.h:973
@ SPELL_FAILED_LINE_OF_SIGHT
Definition: SharedDefines.h:996
@ SPELL_FAILED_SPELL_IN_PROGRESS
Definition: SharedDefines.h:1054
@ SPELL_FAILED_NO_PET
Definition: SharedDefines.h:1033
@ SPELL_FAILED_NOPATH
Definition: SharedDefines.h:1005
@ SPELL_FAILED_SPELL_UNAVAILABLE
Definition: SharedDefines.h:1056
@ SPELL_FAILED_ONLY_INDOORS
Definition: SharedDefines.h:1039
@ SPELL_FAILED_NOT_ON_TAXI
Definition: SharedDefines.h:1014
@ SPELL_FAILED_TARGET_FRIENDLY
Definition: SharedDefines.h:1064
@ SPELL_ATTR4_IGNORE_DEFAULT_ARENA_RESTRICTIONS
Definition: SharedDefines.h:547
@ SPELL_ATTR4_NOT_IN_ARENA_OR_RATED_BATTLEGROUND
Definition: SharedDefines.h:546
@ SUMMON_CATEGORY_PET
Definition: SharedDefines.h:3285
@ SUMMON_CATEGORY_PUPPET
Definition: SharedDefines.h:3286
SkillType
Definition: SharedDefines.h:2863
@ SKILL_MINING
Definition: SharedDefines.h:2919
@ SKILL_HERBALISM
Definition: SharedDefines.h:2915
@ SPELL_ATTR6_ALLOW_WHILE_RIDING_VEHICLE
Definition: SharedDefines.h:616
bool IsPathfindingEnabled(const Map *map)
Definition: DisableMgr.cpp:411
Player * FindPlayer(ObjectGuid const guid)
Definition: ObjectAccessor.cpp:248
Seconds GetGameTime()
Definition: GameTime.cpp:38
Definition: Battlefield.h:206
bool CanFlyIn()
Return if we can use mount in battlefield.
Definition: Battlefield.h:342
Definition: Battleground.h:298
Definition: ConditionMgr.h:181
Condition * mLastFailedCondition
Definition: ConditionMgr.h:183
WorldObject * mConditionTargets[MAX_CONDITION_TARGETS]
Definition: ConditionMgr.h:182
uint32 ErrorType
Definition: ConditionMgr.h:204
uint8 ConditionTarget
Definition: ConditionMgr.h:208
uint32 ErrorTextId
Definition: ConditionMgr.h:205
Loot loot
Definition: Creature.h:220
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:199
bool IsSpellProhibited(SpellSchoolMask idSchoolMask) const
Definition: Creature.cpp:2749
SkillType GetRequiredLootSkill() const
Definition: CreatureData.h:246
bool IsTameable(bool exotic) const
Definition: CreatureData.h:263
Definition: TemporarySummon.h:40
Definition: GameObject.h:122
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:138
uint32 type
Definition: GameObjectData.h:34
bool IsLocked() const
Definition: Item.h:247
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:545
bool IsPotion() const
Definition: Item.h:328
uint32 ItemLevel
Definition: ItemTemplate.h:644
uint32 LockID
Definition: ItemTemplate.h:678
uint32 InventoryType
Definition: ItemTemplate.h:641
Unit * ToUnit()
Definition: Object.h:200
Map * GetMap() const
Definition: Object.h:517
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1192
bool IsWithinLOSInMap(WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
Definition: Object.cpp:1347
bool IsOutdoors() const
Definition: Object.cpp:3125
bool IsWithinLOS(float x, float y, float z, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS) const
Definition: Object.cpp:1326
float GetVisibilityRange() const
Definition: Object.cpp:1645
uint32 GetAreaId() const
Definition: Object.cpp:3108
uint32 GetZoneId() const
Definition: Object.cpp:3100
void GetZoneAndAreaId(uint32 &zoneid, uint32 &areaid) const
Definition: Object.cpp:3116
uint64 GetRawValue() const
Definition: ObjectGuid.h:144
bool IsPlayer() const
Definition: ObjectGuid.h:170
bool IsGameObject() const
Definition: ObjectGuid.h:173
void GetPosition(float &x, float &y) const
Definition: Position.h:122
uint32 GetMapId() const
Definition: Position.h:276
Player * GetOwner() const
Definition: Pet.cpp:2487
bool HaveInDiet(ItemTemplate const *item) const
Definition: Pet.cpp:1430
uint32 GetCurrentFoodBenefitLevel(uint32 itemlevel) const
Definition: Pet.cpp:1448
static std::pair< PetStable::PetInfo const *, PetSaveMode > GetLoadPetInfo(PetStable const &stable, uint32 petEntry, uint32 petnumber, bool current)
Definition: Pet.cpp:161
Definition: PetDefines.h:202
Optional< PetInfo > CurrentPet
Definition: PetDefines.h:225
std::vector< PetInfo > UnslottedPets
Definition: PetDefines.h:228
void SetCanTeleport(bool value)
Definition: Player.h:2461
bool IsInSameRaidWith(Player const *p) const
Definition: Player.h:1849
bool CanTameExoticPets() const
Definition: Player.h:2151
bool CanUseBattlegroundObject(GameObject *gameobject) const
Definition: Player.cpp:13135
bool InBattleground() const
Definition: Player.h:2214
PetStable * GetPetStable()
Definition: Player.h:1190
Battleground * GetBattleground(bool create=false) const
Definition: Player.cpp:12117
WorldSession * GetSession() const
Definition: Player.h:1961
bool HasSpellCooldown(uint32 spell_id) const override
Definition: Player.cpp:16251
uint32 GetLastPotionId()
Definition: Player.h:1775
Group * GetGroup()
Definition: Player.h:2431
bool IsGameMaster() const
Definition: Player.h:1148
time_t GetSummonExpireTimer() const
Definition: Player.h:1093
bool Satisfy(DungeonProgressionRequirements const *ar, uint32 target_map, bool report=false)
Definition: PlayerStorage.cpp:6727
bool HasPlayerFlag(PlayerFlags flags) const
Definition: Player.h:1100
std::unique_ptr< DuelInfo > duel
Definition: Player.h:1841
Item * GetItemByGuid(ObjectGuid guid) const
Definition: PlayerStorage.cpp:435
uint32 GetSpell() const
Definition: TradeData.h:49
bool IsVehicle() const
Definition: Unit.h:1428
Vehicle * GetVehicle() const
Definition: Unit.h:2368
Unit * GetOwner() const
Definition: Unit.cpp:10599
Pet * ToPet()
Definition: Unit.h:2412
virtual bool HasSpellCooldown(uint32) const
Definition: Unit.h:2432
ShapeshiftForm GetShapeshiftForm() const
Definition: Unit.h:2085
virtual bool HasSpellItemCooldown(uint32, uint32) const
Definition: Unit.h:2433
bool IsInDisallowedMountForm() const
Definition: Unit.cpp:21526
void CombatStart(Unit *target, bool initialAggro=true)
Definition: Unit.cpp:13619
bool HasUnitFlag2(UnitFlags2 flags) const
Definition: Unit.h:1500
bool IsInSanctuary() const
Definition: Unit.h:1530
uint8 getClass() const
Definition: Unit.h:1438
AuraEffect * IsScriptOverriden(SpellInfo const *spell, int32 script) const
Definition: Unit.cpp:5747
float GetCombatReach() const override
Definition: Unit.h:1359
UnitFlags GetUnitFlags() const
Definition: Unit.h:1493
TempSummon * ToTempSummon()
Definition: Unit.h:2414
bool HasStealthAura() const
Definition: Unit.h:1720
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5636
std::map< uint8, AuraApplication * > VisibleAuraMap
Definition: Unit.h:1324
bool IsInFlight() const
Definition: Unit.h:1690
SpellImmuneList m_spellImmune[MAX_SPELL_IMMUNITY]
Definition: Unit.h:2150
void SendTameFailure(uint8 result)
Definition: Unit.cpp:20270
bool HasUnitMovementFlag(uint32 f) const
Definition: Unit.h:2288
virtual bool IsInWater() const
Definition: Unit.cpp:4291
bool HasAuraState(AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
Definition: Unit.cpp:10546
bool isMoving() const
Definition: Unit.h:2394
ObjectGuid GetCharmGUID() const
Definition: Unit.h:1836
VisibleAuraMap const * GetVisibleAuras()
Definition: Unit.h:2165
bool IsMounted() const
Definition: Unit.h:1556
Unit * GetVictim() const
Definition: Unit.h:1398
bool IsCritter() const
Definition: Unit.h:1688
ObjectGuid GetOwnerGUID() const
Definition: Unit.h:1828
uint8 GetComboPoints(Unit const *who=nullptr) const
--------—Combo point system----------------—
Definition: Unit.h:2304
ObjectGuid GetCharmerGUID() const
Definition: Unit.h:1834
uint32 getTransForm() const
Definition: Unit.h:2188
Powers getPowerType() const
Definition: Unit.h:1473
void RemoveMovementImpairingAuras(bool withRoot)
Definition: Unit.cpp:5169
bool IsTotem() const
Definition: Unit.h:1427
Guardian * GetGuardianPet() const
Definition: Unit.cpp:10650
ObjectGuid GetTarget() const
Definition: Unit.h:2447
bool IsInCombat() const
Definition: Unit.h:1702
ObjectGuid GetPetGUID() const
Definition: Unit.h:1838
Definition: Vehicle.h:30
VehicleSeatEntry const * GetSeatForPassenger(Unit const *passenger)
Definition: Vehicle.cpp:582
Definition: Group.h:169
Definition: GroupReference.h:27
GroupReference * next()
Definition: GroupReference.h:36
Definition: InstanceScript.h:141
bool isLooted() const
Definition: LootMgr.h:368
Definition: Map.h:274
bool AllowMount
Definition: Map.h:277
bool IsDungeon() const
Definition: Map.h:448
bool IsBattlegroundOrArena() const
Definition: Map.h:456
GameObject * GetGameObject(ObjectGuid const guid)
Definition: Map.cpp:3312
uint32 GetId() const
Definition: Map.h:379
Difficulty GetDifficulty() const
Definition: Map.h:443
uint32 GetRecruiterId() const
Definition: WorldSession.h:527
uint32 GetAccountId() const
Definition: WorldSession.h:363
GameObject * GetGOTarget() const
Definition: Spell.cpp:263
ObjectGuid GetItemTargetGUID() const
Definition: Spell.h:138
std::unique_ptr< PathGenerator > m_preGeneratedPath
Definition: Spell.h:775
SpellCastResult CheckSpellFocus()
Definition: Spell.cpp:7714
SpellCastResult CanOpenLock(uint32 effIndex, uint32 lockid, SkillType &skillid, int32 &reqSkillValue, int32 &skillValue)
Definition: Spell.cpp:8317
SpellCastResult CheckItems()
Definition: Spell.cpp:7146
int32 CalculateSpellDamage(uint8 i, Unit const *target) const
Definition: Spell.h:477
SpellCastResult CheckPower()
Definition: Spell.cpp:7101
SpellCastResult CheckCasterAuras(bool preventionOnly) const
Definition: Spell.cpp:6818
SpellCastResult CallScriptCheckCastHandlers()
Definition: Spell.cpp:8516
bool IsTriggered() const
Definition: Spell.h:552
SpellCastResult CheckRange(bool strict)
Definition: Spell.cpp:7015
bool HasGlobalCooldown() const
Definition: Spell.cpp:8788
Definition: SpellInfo.h:247
int32 MiscValue
Definition: SpellInfo.h:261
uint32 ApplyAuraName
Definition: SpellInfo.h:252
uint32 PreventionType
Definition: SpellInfo.h:388
uint32 CasterAuraSpell
Definition: SpellInfo.h:341
SpellCastResult CheckShapeshift(uint32 form) const
Definition: SpellInfo.cpp:1421
uint32 Mechanic
Definition: SpellInfo.h:321
uint32 GetDispelMask() const
Definition: SpellInfo.cpp:2028
uint32 GetRecoveryTime() const
Definition: SpellInfo.cpp:2382
bool IsSelfCast() const
Definition: SpellInfo.cpp:1077
uint32 CasterAuraState
Definition: SpellInfo.h:337
bool CanBeUsedInCombat() const
Definition: SpellInfo.cpp:1219
uint32 CasterAuraStateNot
Definition: SpellInfo.h:339
SpellCastResult CheckLocation(uint32 map_id, uint32 zone_id, uint32 area_id, Player *player=nullptr, bool strict=true) const
Definition: SpellInfo.cpp:1476
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:1974
int32 AreaGroupId
Definition: SpellInfo.h:389
float GetMaxRange(bool positive=false, Unit *caster=nullptr, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:2309
uint32 GetExplicitTargetMask() const
Definition: SpellInfo.cpp:2042
bool NeedsExplicitUnitTarget() const
Definition: SpellInfo.cpp:1020
uint32 ExcludeCasterAuraSpell
Definition: SpellInfo.h:343
uint32 SpellFamilyName
Definition: SpellInfo.h:385
uint32 AuraInterruptFlags
Definition: SpellInfo.h:351
SpellCastResult CheckExplicitTarget(Unit const *caster, WorldObject const *target, Item const *itemTarget=nullptr) const
Definition: SpellInfo.cpp:1924
Definition: DBCStructure.h:519
Definition: DBCStructure.h:1012
Definition: DBCStructure.h:1323
bool IsDungeon() const
Definition: DBCStructure.h:1349
Definition: DBCStructure.h:1817
uint32 flags1
Definition: DBCStructure.h:1822
Definition: DBCStructure.h:1910
uint32 Category
Definition: DBCStructure.h:1912
Definition: DBCStructure.h:2065
uint32 m_flags
Definition: DBCStructure.h:2067

References _triggeredCastFlags, InstanceTemplate::AllowMount, SpellEffectInfo::ApplyAuraName, AREA_FLAG_NO_FLY_ZONE, SpellInfo::AreaGroupId, AURA_INTERRUPT_FLAG_MOUNT, AURA_INTERRUPT_FLAG_NOT_SEATED, SpellInfo::AuraInterruptFlags, CalculateSpellDamage(), CallScriptCheckCastHandlers(), SpellInfo::CanBeUsedInCombat(), Battlefield::CanFlyIn(), CanOpenLock(), Player::CanTameExoticPets(), Player::CanUseBattlegroundObject(), SpellInfo::CasterAuraSpell, SpellInfo::CasterAuraState, SpellInfo::CasterAuraStateNot, SummonPropertiesEntry::Category, CheckCasterAuras(), SpellInfo::CheckExplicitTarget(), CheckItems(), SpellInfo::CheckLocation(), CheckPower(), CheckRange(), SpellInfo::CheckShapeshift(), CheckSpellFocus(), SpellInfo::CheckTarget(), CLASS_WARLOCK, Unit::CombatStart(), CONDITION_SOURCE_TYPE_SPELL, Condition::ConditionTarget, PetStable::CurrentPet, damage, Player::duel, EFFECT_0, SpellInfo::Effects, Condition::ErrorTextId, Condition::ErrorType, SpellInfo::ExcludeCasterAuraSpell, WorldObject::FindMap(), ObjectAccessor::FindPlayer(), SpellShapeshiftEntry::flags1, GAMEOBJECT_TYPE_DOOR, GAMEOBJECT_TYPE_TRAP, WorldSession::GetAccountId(), WorldObject::GetAreaId(), Unit::GetAuraEffectsByType(), Player::GetBattleground(), Unit::GetCharm(), Unit::GetCharmerGUID(), Unit::GetCharmGUID(), Unit::getClass(), Unit::GetCombatReach(), Unit::GetComboPoints(), Creature::GetCreatureTemplate(), Pet::GetCurrentFoodBenefitLevel(), Map::GetDifficulty(), SpellInfo::GetDispelMask(), WorldObject::GetDistance(), SpellCastTargets::GetDstPos(), Object::GetEntry(), SpellInfo::GetExplicitTargetMask(), Map::GetGameObject(), GameTime::GetGameTime(), GameObject::GetGOInfo(), SpellCastTargets::GetGOTarget(), Player::GetGroup(), Unit::GetGuardianPet(), Map::GetId(), WorldObject::GetInstanceScript(), Player::GetItemByGuid(), SpellCastTargets::GetItemTarget(), SpellCastTargets::GetItemTargetGUID(), Player::GetLastPotionId(), Unit::GetLevel(), Pet::GetLoadPetInfo(), WorldObject::GetMap(), WorldLocation::GetMapId(), SpellInfo::GetMaxRange(), SpellCastTargets::GetObjectTarget(), Pet::GetOwner(), Player::GetPet(), Unit::GetPetGUID(), Player::GetPetStable(), Position::GetPosition(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Unit::getPowerType(), ObjectGuid::GetRawValue(), SpellInfo::GetRecoveryTime(), WorldSession::GetRecruiterId(), CreatureTemplate::GetRequiredLootSkill(), SpellInfo::GetSchoolMask(), Vehicle::GetSeatForPassenger(), Player::GetSession(), Unit::GetShapeshiftForm(), Player::GetSkillValue(), TradeData::GetSpell(), Player::GetSummonExpireTimer(), Unit::GetTarget(), SpellCastTargets::GetTargetMask(), Item::GetTemplate(), Player::GetTradeData(), Unit::getTransForm(), Object::GetTypeId(), Unit::GetUnitFlags(), SpellCastTargets::GetUnitTarget(), Unit::GetVehicle(), Unit::GetVictim(), WorldObject::GetVisibilityRange(), Unit::GetVisibleAuras(), WorldObject::GetZoneAndAreaId(), WorldObject::GetZoneId(), GO_STATE_READY, SpellInfo::HasAttribute(), SpellInfo::HasAura(), Unit::HasAura(), Unit::HasAuraState(), SpellCastTargets::HasDst(), SpellInfo::HasEffect(), HasGlobalCooldown(), Player::HasPlayerFlag(), Player::HasSpellCooldown(), Unit::HasSpellCooldown(), Unit::HasSpellItemCooldown(), Unit::HasStealthAura(), Unit::HasUnitFlag2(), Unit::HasUnitMovementFlag(), Unit::HasUnitState(), Pet::HaveInDiet(), HUNTER_PET, SpellInfo::Id, IMMUNITY_MECHANIC, IN_MILLISECONDS, Player::InBattleground(), ItemTemplate::InventoryType, INVTYPE_RELIC, irand(), Unit::IsAlive(), IsAutoRepeat(), Map::IsBattlegroundOrArena(), SpellInfo::IsCooldownStartedOnEvent(), Unit::IsCritter(), Map::IsDungeon(), MapEntry::IsDungeon(), Unit::IsFriendlyTo(), Player::IsGameMaster(), ObjectGuid::IsGameObject(), Unit::IsInCombat(), Unit::IsInDisallowedMountForm(), Unit::IsInFlight(), Player::IsInSameRaidWith(), Unit::IsInSanctuary(), Unit::IsInWater(), Item::IsLocked(), Loot::isLooted(), Unit::IsMounted(), Unit::isMoving(), WorldObject::IsOutdoors(), SpellInfo::IsPassive(), DisableMgr::IsPathfindingEnabled(), SpellInfo::IsPositive(), Item::IsPotion(), Unit::IsScriptOverriden(), SpellInfo::IsSelfCast(), Creature::IsSpellProhibited(), CreatureTemplate::IsTameable(), Unit::IsTotem(), IsTriggered(), WorldObject::IsWithinLOS(), WorldObject::IsWithinLOSInMap(), ItemTemplate::ItemLevel, LINEOFSIGHT_ALL_CHECKS, ItemTemplate::LockID, Creature::loot, VMAP::M2, m_caster, m_CastItem, m_customError, VehicleSeatEntry::m_flags, m_needComboPoints, m_originalCaster, m_originalCasterGUID, m_preGeneratedPath, m_selfContainer, m_spellFlags, Unit::m_spellImmune, m_spellInfo, m_targets, m_triggeredByAuraSpell, MAX_SPELL_EFFECTS, ConditionSourceInfo::mConditionTargets, SpellInfo::Mechanic, MINUTE, SpellEffectInfo::MiscValue, ConditionSourceInfo::mLastFailedCondition, MOVEMENTFLAG_FALLING_FAR, SpellInfo::NeedsExplicitUnitTarget(), GroupReference::next(), PATHFIND_INCOMPLETE, PATHFIND_NOPATH, PATHFIND_SHORT, PET_TAME_CANT_CONTROL_EXOTIC, PET_TAME_DEAD, PET_TAME_NOPET_AVAILABLE, PLAYER_ALLOW_ONLY_ABILITY, POWER_MANA, SpellInfo::PreventionType, Unit::RemoveMovementImpairingAuras(), sAreaTableStore, Player::Satisfy(), sBattlefieldMgr, sConditionMgr, Unit::SendTameFailure(), sGlyphPropertiesStore, SKILL_HERBALISM, SKILL_LOCKPICKING, SKILL_MINING, SKILL_NONE, sMapStore, sObjectMgr, SPECTATOR_SPELL_BINDSIGHT, SPELL_ATTR0_ALLOW_CAST_WHILE_DEAD, SPELL_ATTR0_ALLOW_WHILE_MOUNTED, SPELL_ATTR0_AURA_IS_DEBUFF, SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET, SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR0_ONLY_INDOORS, SPELL_ATTR0_ONLY_OUTDOORS, SPELL_ATTR0_ONLY_STEALTHED, SPELL_ATTR0_PASSIVE, SPELL_ATTR1_DISMISS_PET_FIRST, SPELL_ATTR1_INITIATE_COMBAT, SPELL_ATTR2_IGNORE_LINE_OF_SIGHT, SPELL_ATTR3_ONLY_BATTLEGROUNDS, SPELL_ATTR4_IGNORE_DEFAULT_ARENA_RESTRICTIONS, SPELL_ATTR4_NOT_IN_ARENA_OR_RATED_BATTLEGROUND, SPELL_ATTR5_ALWAYS_AOE_LINE_OF_SIGHT, SPELL_ATTR6_ALLOW_WHILE_RIDING_VEHICLE, SPELL_ATTR7_DEBUG_SPELL, SPELL_AURA_ABILITY_IGNORE_AURASTATE, SPELL_AURA_AOE_CHARM, SPELL_AURA_BLOCK_SPELL_FAMILY, SPELL_AURA_DUMMY, SPELL_AURA_FLY, SPELL_AURA_HOVER, SPELL_AURA_MOD_CHARM, SPELL_AURA_MOD_IGNORE_SHAPESHIFT, SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, SPELL_AURA_MOD_POSSESS, SPELL_AURA_MOD_POSSESS_PET, SPELL_AURA_MOD_SHAPESHIFT, SPELL_AURA_MOUNTED, SPELL_AURA_PERIODIC_MANA_LEECH, SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS, SPELL_CAST_OK, SPELL_CUSTOM_ERROR_GM_ONLY, SPELL_EFFECT_APPLY_GLYPH, SPELL_EFFECT_CHARGE, SPELL_EFFECT_CREATE_TAMED_PET, SPELL_EFFECT_DISPEL, SPELL_EFFECT_FEED_PET, SPELL_EFFECT_JUMP, SPELL_EFFECT_JUMP_DEST, SPELL_EFFECT_LEAP, SPELL_EFFECT_LEAP_BACK, SPELL_EFFECT_LEARN_PET_SPELL, SPELL_EFFECT_LEARN_SPELL, SPELL_EFFECT_OPEN_LOCK, SPELL_EFFECT_POWER_BURN, SPELL_EFFECT_POWER_DRAIN, SPELL_EFFECT_RESURRECT, SPELL_EFFECT_RESURRECT_NEW, SPELL_EFFECT_RESURRECT_PET, SPELL_EFFECT_SKINNING, SPELL_EFFECT_STEAL_BENEFICIAL_BUFF, SPELL_EFFECT_STUCK, SPELL_EFFECT_SUMMON, SPELL_EFFECT_SUMMON_PET, SPELL_EFFECT_SUMMON_PLAYER, SPELL_EFFECT_SUMMON_RAF_FRIEND, SPELL_EFFECT_TALENT_SPEC_SELECT, SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER, SPELL_FAILED_AFFECTING_COMBAT, SPELL_FAILED_ALREADY_HAVE_CHARM, SPELL_FAILED_ALREADY_HAVE_SUMMON, SPELL_FAILED_ALREADY_OPEN, SPELL_FAILED_BAD_IMPLICIT_TARGETS, SPELL_FAILED_BAD_TARGETS, SPELL_FAILED_CANT_BE_CHARMED, SPELL_FAILED_CASTER_AURASTATE, SPELL_FAILED_CASTER_DEAD, SPELL_FAILED_CHARMED, SPELL_FAILED_CUSTOM_ERROR, SPELL_FAILED_DAMAGE_IMMUNE, SPELL_FAILED_DONT_REPORT, SPELL_FAILED_FOOD_LOWLEVEL, SPELL_FAILED_HIGHLEVEL, SPELL_FAILED_ITEM_ALREADY_ENCHANTED, SPELL_FAILED_ITEM_ENCHANT_TRADE_WINDOW, SPELL_FAILED_LINE_OF_SIGHT, SPELL_FAILED_LOW_CASTLEVEL, SPELL_FAILED_LOWLEVEL, SPELL_FAILED_MOVING, SPELL_FAILED_NO_COMBO_POINTS, SPELL_FAILED_NO_MOUNTS_ALLOWED, SPELL_FAILED_NO_PET, SPELL_FAILED_NOPATH, SPELL_FAILED_NOT_BEHIND, SPELL_FAILED_NOT_HERE, SPELL_FAILED_NOT_IN_ARENA, SPELL_FAILED_NOT_IN_BATTLEGROUND, SPELL_FAILED_NOT_INFRONT, SPELL_FAILED_NOT_KNOWN, SPELL_FAILED_NOT_MOUNTED, SPELL_FAILED_NOT_ON_MOUNTED, SPELL_FAILED_NOT_ON_TAXI, SPELL_FAILED_NOT_READY, SPELL_FAILED_NOT_SHAPESHIFT, SPELL_FAILED_NOT_TRADING, SPELL_FAILED_NOTHING_TO_DISPEL, SPELL_FAILED_NOTHING_TO_STEAL, SPELL_FAILED_ONLY_ABOVEWATER, SPELL_FAILED_ONLY_BATTLEGROUNDS, SPELL_FAILED_ONLY_INDOORS, SPELL_FAILED_ONLY_OUTDOORS, SPELL_FAILED_ONLY_STEALTHED, SPELL_FAILED_ROOTED, SPELL_FAILED_SPELL_IN_PROGRESS, SPELL_FAILED_SPELL_UNAVAILABLE, SPELL_FAILED_SUMMON_PENDING, SPELL_FAILED_TARGET_CANNOT_BE_RESURRECTED, SPELL_FAILED_TARGET_FRIENDLY, SPELL_FAILED_TARGET_IS_PLAYER_CONTROLLED, SPELL_FAILED_TARGET_NOT_IN_INSTANCE, SPELL_FAILED_TARGET_NOT_LOOTED, SPELL_FAILED_TARGET_UNSKINNABLE, SPELL_FAILED_TRY_AGAIN, SPELL_FAILED_UNIQUE_GLYPH, SPELL_FAILED_WRONG_PET_FOOD, SPELL_FLAG_REDIRECTED, SPELL_PREVENTION_TYPE_NONE, SPELL_RELIC_COOLDOWN, SPELLFAMILY_WARRIOR, SpellInfo::SpellFamilyName, TriggeredByAuraSpellData::spellInfo, SpellInfo::SpellLevel, sScriptMgr, sSpellMgr, sSpellShapeshiftStore, sSummonPropertiesStore, STATUS_IN_PROGRESS, STATUS_WAIT_LEAVE, SUMMON_CATEGORY_PET, SUMMON_CATEGORY_PUPPET, TARGET_FLAG_ITEM, TARGET_FLAG_TRADE_ITEM, TARGET_FLAG_UNIT_ENEMY, TARGET_GAMEOBJECT_ITEM_TARGET, TARGET_GAMEOBJECT_TARGET, TARGET_UNIT_PET, Object::ToCreature(), Unit::ToPet(), Object::ToPlayer(), Unit::ToTempSummon(), Object::ToUnit(), TRADE_SLOT_NONTRADED, TRIGGERED_IGNORE_CASTER_AURAS, TRIGGERED_IGNORE_CASTER_AURASTATE, TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE, TRIGGERED_IGNORE_GCD, TRIGGERED_IGNORE_POWER_AND_REAGENT_COST, TRIGGERED_IGNORE_SHAPESHIFT, TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD, GameObjectTemplate::type, TYPEID_PLAYER, TYPEID_UNIT, UNIT_FLAG2_ALLOW_CHEAT_SPELLS, UNIT_FLAG_SKINNABLE, UNIT_STATE_CHARGING, UNIT_STATE_ROOT, unitTarget, PetStable::UnslottedPets, VEHICLE_SEAT_FLAG_CAN_ATTACK, VEHICLE_SEAT_FLAG_CAN_CAST_MOUNT_SPELL, VEHICLE_SEAT_FLAG_UNCONTROLLED, and WORLD_TRIGGER.

Referenced by _cast(), Unit::_UpdateAutoRepeatSpell(), Unit::AttackerStateUpdate(), Player::CastItemUseSpell(), CheckPetCast(), WorldSession::HandleAcceptTradeOpcode(), prepare(), and go_wind_stone::go_wind_stoneAI::SummonNPC().

◆ CheckCasterAuras()

SpellCastResult Spell::CheckCasterAuras ( bool  preventionOnly) const
6819{
6820 // spells totally immuned to caster auras (wsg flag drop, give marks etc)
6822 return SPELL_CAST_OK;
6823
6824 uint8 school_immune = 0;
6825 uint32 mechanic_immune = 0;
6826 uint32 dispel_immune = 0;
6827
6828 // Check if the spell grants school or mechanic immunity.
6829 // We use bitmasks so the loop is done only once and not on every aura check below.
6831 {
6832 for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
6833 {
6834 if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_SCHOOL_IMMUNITY)
6835 school_immune |= uint32(m_spellInfo->Effects[i].MiscValue);
6836 else if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MECHANIC_IMMUNITY)
6837 mechanic_immune |= 1 << uint32(m_spellInfo->Effects[i].MiscValue);
6838 else if (m_spellInfo->Effects[i].ApplyAuraName ==