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 
)
561 :
562 m_spellInfo(sSpellMgr->GetSpellForDifficultyFromSpell(info, caster)),
563 m_caster((info->HasAttribute(SPELL_ATTR6_ORIGINATE_FROM_CONTROLLER) && caster->GetCharmerOrOwner()) ? caster->GetCharmerOrOwner() : caster)
565{
567 m_skipCheck = skipCheck;
568 m_selfContainer = nullptr;
570 m_executedCurrently = false;
573 m_comboTarget = nullptr;
574 m_delayStart = 0;
576
578 m_auraScaleMask = 0;
579 memset(m_damageMultipliers, 0, sizeof(m_damageMultipliers));
580
581 // Get data for type of attack
582 switch (m_spellInfo->DmgClass)
583 {
587 else
589 break;
592 break;
593 default:
594 // Wands
597 else
599 break;
600 }
601
602 m_spellSchoolMask = info->GetSchoolMask(); // Can be override for some spell (wand shoot for example)
603
605 // wand case
608 m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetTemplate()->Damage[0].DamageType);
609
610 if (originalCasterGUID)
611 m_originalCasterGUID = originalCasterGUID;
612 else
614
617 else
618 {
621 m_originalCaster = nullptr;
622 }
623
625 _triggeredCastFlags = triggerFlags;
626 if (info->HasAttribute(SPELL_ATTR4_ALLOW_CAST_WHILE_CASTING))
628
629 m_CastItem = nullptr;
630
631 unitTarget = nullptr;
632 itemTarget = nullptr;
633 gameObjTarget = nullptr;
634 destTarget = nullptr;
635 damage = 0;
639 m_damage = 0;
640 m_healing = 0;
641 m_procAttacker = 0;
642 m_procVictim = 0;
643 m_procEx = 0;
644 focusObject = nullptr;
645 m_cast_count = 0;
646 m_glyphIndex = 0;
647 m_preCastSpell = 0;
648 m_spellAura = nullptr;
649 _scriptsLoaded = false;
650
651 //Auto Shot & Shoot (wand)
653
654 m_runesState = 0;
655 m_powerCost = 0; // setup to correct value in Spell::prepare, must not be used before.
656 m_casttime = 0; // setup to correct value in Spell::prepare, must not be used before.
657 m_timer = 0; // will set to castime in prepare
658 m_channeledDuration = 0; // will be setup in Spell::handle_immediate
659 m_immediateHandled = false;
660
662
664
665 // Determine if spell can be reflected back to the caster
666 // Patch 1.2 notes: Spell Reflection no longer reflects abilities
670
672 memset(m_effectExecuteData, 0, MAX_SPELL_EFFECTS * sizeof(ByteBuffer*));
673
674 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
676
677 // xinef:
678 _spellTargetsSelected = false;
679
680 m_weaponItem = nullptr;
681}
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:818
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1610
@ DIMINISHING_NONE
Definition: SharedDefines.h:3230
@ SPELL_EFFECT_DISPEL
Definition: SharedDefines.h:788
#define CLASSMASK_WAND_USERS
Definition: SharedDefines.h:146
@ SPELL_ATTR2_AUTO_REPEAT
Definition: SharedDefines.h:433
@ SPELL_ATTR1_NO_REFLECTION
Definition: SharedDefines.h:398
@ SPELL_ATTR3_REQUIRES_OFF_HAND_WEAPON
Definition: SharedDefines.h:489
@ SPELL_DAMAGE_CLASS_RANGED
Definition: SharedDefines.h:1520
@ SPELL_DAMAGE_CLASS_MAGIC
Definition: SharedDefines.h:1518
@ SPELL_DAMAGE_CLASS_MELEE
Definition: SharedDefines.h:1519
@ SPELL_CUSTOM_ERROR_NONE
Definition: SharedDefines.h:1115
@ SPELL_ATTR0_IS_ABILITY
Definition: SharedDefines.h:358
@ SPELL_ATTR0_NO_IMMUNITIES
Definition: SharedDefines.h:383
@ SPELL_ATTR4_ALLOW_CAST_WHILE_CASTING
Definition: SharedDefines.h:509
@ SPELL_ATTR6_ORIGINATE_FROM_CONTROLLER
Definition: SharedDefines.h:594
SpellSchoolMask
Definition: SharedDefines.h:267
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:204
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:519
Unit * GetCharmerOrOwner() const
Definition: Unit.h:1847
uint32 getClassMask() const
Definition: Unit.h:1427
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:2356
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:1082
bool NeedsComboPoints() const
Definition: SpellInfo.cpp:1250
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:412
bool HasEffect(SpellEffects effect) const
Definition: SpellInfo.cpp:869
bool IsPositive() const
Definition: SpellInfo.cpp:1221
bool IsAutoRepeatRangedSpell() const
Definition: SpellInfo.cpp:1267
uint32 DmgClass
Definition: SpellInfo.h:387
bool IsRangedWeaponSpell() const
Definition: SpellInfo.cpp:1260
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 ( )
684{
685 // unload scripts
686 while (!m_loadedScripts.empty())
687 {
688 std::list<SpellScript*>::iterator itr = m_loadedScripts.begin();
689 (*itr)->_Unload();
690 delete (*itr);
691 m_loadedScripts.erase(itr);
692 }
693
695 {
696 // Clean the reference to avoid later crash.
697 // If this error is repeating, we may have to add an ASSERT to better track down how we get into this case.
698 LOG_ERROR("spells", "Spell::~Spell: deleting spell for spell ID {}. However, spell still referenced.", m_spellInfo->Id);
699 *m_selfContainer = nullptr;
700 }
701
702 delete m_spellValue;
703
705}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:159
void CheckEffectExecuteData()
Definition: Spell.cpp:8450
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

3783{
3784 // update pointers base at GUIDs to prevent access to non-existed already object
3785 if (!UpdatePointers())
3786 {
3787 // cancel the spell if UpdatePointers() returned false, something wrong happened there
3788 cancel();
3789 return;
3790 }
3791
3792 // cancel at lost explicit target during cast
3794 {
3795 cancel();
3796 return;
3797 }
3798
3799 // Xinef: implement attribute SPELL_ATTR1_DISMISS_PET_FIRST, on spell cast current pet is dismissed and charms are removed
3801 {
3803 if (Pet* pet = m_caster->ToPlayer()->GetPet())
3805
3806 if (Unit* charm = m_caster->GetCharm())
3807 charm->RemoveAurasByType(SPELL_AURA_MOD_CHARM, m_caster->GetGUID());
3808 }
3809
3810 if (Player* playerCaster = m_caster->ToPlayer())
3811 {
3812 // now that we've done the basic check, now run the scripts
3813 // should be done before the spell is actually executed
3814 sScriptMgr->OnPlayerSpellCast(playerCaster, this, skipCheck);
3815
3816 // As of 3.0.2 pets begin attacking their owner's target immediately
3817 // Let any pets know we've attacked something. Check DmgClass for harmful spells only
3818 // This prevents spells such as Hunter's Mark from triggering pet attack
3819 // xinef: take into account SPELL_ATTR3_SUPRESS_TARGET_PROCS
3821 if (!playerCaster->m_Controlled.empty())
3822 for (Unit::ControlSet::iterator itr = playerCaster->m_Controlled.begin(); itr != playerCaster->m_Controlled.end(); ++itr)
3823 if (Unit* pet = *itr)
3824 if (pet->IsAlive() && pet->GetTypeId() == TYPEID_UNIT)
3825 pet->ToCreature()->AI()->OwnerAttacked(m_targets.GetUnitTarget());
3826 }
3827
3829
3833
3835
3836 Player* modOwner = m_caster->GetSpellModOwner();
3837 // skip check if done already (for instant cast spells for example)
3838 if (!skipCheck)
3839 {
3840 SpellCastResult castResult = CheckCast(false);
3841 if (castResult != SPELL_CAST_OK)
3842 {
3843 SendCastResult(castResult);
3844 SendInterrupted(0);
3845
3846 finish(false);
3847 SetExecutedCurrently(false);
3848 return;
3849 }
3850
3851 // additional check after cast bar completes (must not be in CheckCast)
3852 // if trade not complete then remember it in trade data
3854 {
3856 {
3857 if (TradeData* my_trade = m_caster->ToPlayer()->GetTradeData())
3858 {
3859 if (!my_trade->IsInAcceptProcess())
3860 {
3861 // Spell will be casted at completing the trade. Silently ignore at this place
3862 my_trade->SetSpell(m_spellInfo->Id, m_CastItem);
3864 SendInterrupted(0);
3865
3866 finish(false);
3867 SetExecutedCurrently(false);
3868 return;
3869 }
3870 }
3871 }
3872 }
3873 }
3874
3875 if (modOwner)
3876 modOwner->SetSpellModTakingSpell(this, true);
3877
3880
3881 if (modOwner)
3882 modOwner->SetSpellModTakingSpell(this, false);
3883
3884 // Spell may be finished after target map check
3886 {
3887 SendInterrupted(0);
3888 finish(false);
3889 SetExecutedCurrently(false);
3890 return;
3891 }
3892
3893 if (modOwner)
3894 modOwner->SetSpellModTakingSpell(this, true);
3895
3897
3899
3900 if (modOwner)
3901 modOwner->SetSpellModTakingSpell(this, false);
3902
3903 // traded items have trade slot instead of guid in m_itemTargetGUID
3904 // set to real guid to be sent later to the client
3906
3908 {
3910 {
3913 }
3914
3916 }
3917
3919 {
3920 // Powers have to be taken before SendSpellGo
3921 TakePower();
3922 TakeReagents(); // we must remove reagents before HandleEffects to allow place crafted item in same slot
3923 }
3924 else if (Item* targetItem = m_targets.GetItemTarget())
3925 {
3927 if (targetItem->GetOwnerGUID() != m_caster->GetGUID())
3928 TakeReagents();
3929 }
3930
3932
3933 // CAST SPELL
3934 if (modOwner)
3935 modOwner->SetSpellModTakingSpell(this, true);
3936
3938
3940
3941 // we must send smsg_spell_go packet before m_castItem delete in TakeCastItem()...
3942 SendSpellGo();
3943
3944 if (modOwner)
3945 modOwner->SetSpellModTakingSpell(this, false);
3946
3947 if (m_originalCaster)
3948 {
3949 // Handle procs on cast
3950 uint32 procAttacker = m_procAttacker;
3951 if (!procAttacker)
3952 {
3953 bool IsPositive = m_spellInfo->IsPositive();
3955 {
3957 }
3958 else
3959 {
3961 }
3962 }
3963
3964 uint32 procEx = PROC_EX_NORMAL_HIT;
3965
3966 for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
3967 {
3968 if (ihit->missCondition != SPELL_MISS_NONE)
3969 {
3970 continue;
3971 }
3972
3973 if (!ihit->crit)
3974 {
3975 continue;
3976 }
3977
3978 procEx |= PROC_EX_CRITICAL_HIT;
3979 break;
3980 }
3981
3984 }
3985
3986 if (modOwner)
3987 modOwner->SetSpellModTakingSpell(this, true);
3988
3990 if (resetAttackTimers)
3991 {
3993 for (Unit::AuraEffectList::const_iterator i = vIgnoreReset.begin(); i != vIgnoreReset.end(); ++i)
3994 {
3995 if ((*i)->IsAffectedOnSpell(m_spellInfo))
3996 {
3997 resetAttackTimers = false;
3998 break;
3999 }
4000 }
4001 }
4002
4003 // Okay, everything is prepared. Now we need to distinguish between immediate and evented delayed spells
4004 if ((m_spellInfo->Speed > 0.0f && !m_spellInfo->IsChanneled())/* xinef: we dont need this || m_spellInfo->Id == 14157*/)
4005 {
4006 // Remove used for cast item if need (it can be already nullptr after TakeReagents call
4007 // in case delayed spell remove item at cast delay start
4008 TakeCastItem();
4009
4010 // Okay, maps created, now prepare flags
4011 m_immediateHandled = false;
4013 SetDelayStart(0);
4014
4017
4018 // remove all applied mods at this point
4019 // dont allow user to use them twice in case spell did not reach current target
4020 if (modOwner)
4021 modOwner->RemoveSpellMods(this);
4022
4023 // Xinef: why do we keep focus after spell is sent to air?
4024 // Xinef: Because of this, in the middle of some animation after setting targetguid to 0 etc
4025 // Xinef: we get focused to it out of nowhere...
4026 if (Creature* creatureCaster = m_caster->ToCreature())
4027 creatureCaster->ReleaseFocus(this);
4028 }
4029 else
4030 {
4031 // Immediate spell, no big deal
4033 }
4034
4035 if (resetAttackTimers)
4036 {
4037 if (m_casttime == 0 && m_spellInfo->CalcCastTime())
4038 {
4039 resetAttackTimers = false;
4040 }
4041
4042 if (resetAttackTimers)
4043 {
4045
4047 {
4049 }
4050
4052 }
4053 }
4054
4056
4057 if (modOwner)
4058 modOwner->SetSpellModTakingSpell(this, false);
4059
4060 if (const std::vector<int32>* spell_triggered = sSpellMgr->GetSpellLinked(m_spellInfo->Id))
4061 {
4062 for (std::vector<int32>::const_iterator i = spell_triggered->begin(); i != spell_triggered->end(); ++i)
4063 if (*i < 0)
4065 else
4067 }
4068
4069 // Interrupt Spell casting
4070 // handle this here, in other places SpellHitTarget can be set to nullptr, if there is an error in this function
4072 if (Unit* target = m_targets.GetUnitTarget())
4073 if (target->GetTypeId() == TYPEID_UNIT)
4074 m_caster->CastSpell(target, 32747, true);
4075
4076 // xinef: start combat at cast for delayed spells, only for explicit target
4077 if (Unit* target = m_targets.GetUnitTarget())
4080 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
4081
4085
4086 SetExecutedCurrently(false);
4087}
@ 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:2702
@ 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:121
@ ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM
Definition: DBCEnums.h:161
@ ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL
Definition: DBCEnums.h:149
@ SPELL_ATTR7_CAN_CAUSE_INTERRUPT
Definition: SharedDefines.h:624
@ SPELL_EFFECT_SUMMON_PET
Definition: SharedDefines.h:806
@ SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS
Definition: SharedDefines.h:445
@ SPELL_ATTR1_DISMISS_PET_FIRST
Definition: SharedDefines.h:391
@ SPELL_ATTR3_SUPRESS_TARGET_PROCS
Definition: SharedDefines.h:482
@ SPELL_DAMAGE_CLASS_NONE
Definition: SharedDefines.h:1517
@ SPELL_MISS_NONE
Definition: SharedDefines.h:1491
SpellCastResult
Definition: SharedDefines.h:920
@ SPELL_FAILED_DONT_REPORT
Definition: SharedDefines.h:948
@ SPELL_CAST_OK
Definition: SharedDefines.h:1110
Definition: Creature.h:46
uint32 GetEntry() const
Definition: Object.h:109
Creature * ToCreature()
Definition: Object.h:197
Definition: Pet.h:40
Definition: Player.h:1046
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
Definition: PlayerUpdates.cpp:2128
void SetSpellModTakingSpell(Spell *spell, bool apply)
Definition: Player.cpp:9975
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost=0)
Definition: Player.cpp:13803
void RemoveSpellMods(Spell *spell)
Definition: Player.cpp:9907
Pet * GetPet() const
Definition: Player.cpp:8784
bool GetCommandStatus(uint32 command) const
Definition: Player.h:1154
void RemovePet(Pet *pet, PetSaveMode mode, bool returnreagent=false)
Definition: Player.cpp:8935
TradeData * GetTradeData() const
Definition: Player.h:1344
void RemoveSpellCooldown(uint32 spell_id, bool update=false)
Definition: Player.cpp:3462
Definition: TradeData.h:36
Definition: Unit.h:1290
void ClearUnitState(uint32 f)
Definition: Unit.h:1399
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1967
Unit * GetCharm() const
Definition: Unit.cpp:10626
Player * GetSpellModOwner() const
Definition: Unit.cpp:16751
void CombatStartOnCast(Unit *target, bool initialAggro=true, uint32 duration=0)
Definition: Unit.cpp:13612
bool haveOffhandWeapon() const
Definition: Unit.cpp:540
bool IsPet() const
Definition: Unit.h:1413
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition: Unit.cpp:4039
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:4835
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:6290
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1398
bool IsFriendlyTo(Unit const *unit) const
Definition: Unit.cpp:10214
bool IsControlledByPlayer() const
Definition: Unit.h:1828
std::list< AuraEffect * > AuraEffectList
Definition: Unit.h:1306
void SetInFront(WorldObject const *target)
Definition: Unit.cpp:20776
void resetAttackTimer(WeaponAttackType type=BASE_ATTACK)
Definition: Unit.cpp:661
WorldObject * GetObjectTarget() const
Definition: Spell.cpp:305
void UpdateTradeSlotItem()
Definition: Spell.cpp:342
ObjectGuid GetObjectTargetGUID() const
Definition: Spell.cpp:310
Item * GetItemTarget() const
Definition: Spell.h:139
uint32 GetTargetMask() const
Definition: Spell.h:117
Unit * GetUnitTarget() const
Definition: Spell.cpp:226
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:8504
void PrepareTriggersExecutedOnHit()
Definition: Spell.cpp:8710
SpellCastTargets m_targets
Definition: Spell.h:527
TriggeredByAuraSpellData m_triggeredByAuraSpell
Definition: Spell.h:771
void handle_immediate()
Definition: Spell.cpp:4089
void SendSpellGo()
Definition: Spell.cpp:4759
void TakeReagents()
Definition: Spell.cpp:5493
void SetExecutedCurrently(bool yes)
Definition: Spell.h:560
void SendInterrupted(uint8 result)
Definition: Spell.cpp:5136
void PrepareScriptHitHandlers()
Definition: Spell.cpp:8536
void CallScriptOnCastHandlers()
Definition: Spell.cpp:8491
void cancel(bool bySelf=false)
Definition: Spell.cpp:3693
void SendSpellCooldown()
Definition: Spell.cpp:4326
void CallScriptBeforeCastHandlers()
Definition: Spell.cpp:8478
void HandleLaunchPhase()
Definition: Spell.cpp:8191
bool UpdatePointers()
Definition: Spell.cpp:7824
void SetDelayStart(uint64 m_time)
Definition: Spell.h:562
std::list< TargetInfo > m_UniqueTargetInfo
Definition: Spell.h:681
void SelectSpellTargets()
Definition: Spell.cpp:809
void TakePower()
Definition: Spell.cpp:5277
SpellCastResult CheckCast(bool strict)
Definition: Spell.cpp:5612
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, uint8 castCount, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE)
Definition: Spell.cpp:4631
uint64 GetDelayMoment() const
Definition: Spell.h:563
void TakeCastItem()
Definition: Spell.cpp:5214
bool IsAutoActionResetSpell() const
Definition: Spell.cpp:8038
void finish(bool ok=true)
Definition: Spell.cpp:4449
float Speed
Definition: SpellInfo.h:368
bool IsChanneled() const
Definition: SpellInfo.cpp:1240
uint32 CalcCastTime(Unit *caster=nullptr, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:2335
bool HasAura(AuraType aura) const
Definition: SpellInfo.cpp:877

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 ( )
4252{
4253 // Take for real after all targets are processed
4255 {
4257 }
4258
4259 // Real add combo points from effects
4261 {
4262 // remove Premed-like effects unless they were caused by ourselves
4263 // (this Aura removes the already-added CP when it expires from duration - now that we've added CP, this shouldn't happen anymore!)
4265 {
4267 }
4268
4270 }
4271
4273 {
4275 }
4276
4279 for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
4280 {
4281 // Xinef: Properly clear infinite cooldowns in some cases
4282 if (ihit->targetGUID == m_caster->GetGUID() && ihit->missCondition != SPELL_MISS_NONE)
4285 }
4286
4287 // Handle procs on finish
4288 if (m_originalCaster)
4289 {
4290 uint32 procAttacker = m_procAttacker;
4291 if (!procAttacker)
4292 {
4293 bool IsPositive = m_spellInfo->IsPositive();
4295 {
4297 }
4298 else
4299 {
4301 }
4302 }
4303
4304 uint32 procEx = PROC_EX_NORMAL_HIT;
4305 for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
4306 {
4307 if (ihit->missCondition != SPELL_MISS_NONE)
4308 {
4309 continue;
4310 }
4311
4312 if (!ihit->crit)
4313 {
4314 continue;
4315 }
4316
4317 procEx |= PROC_EX_CRITICAL_HIT;
4318 break;
4319 }
4320
4323 }
4324}
@ 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:769
void SendCooldownEvent(SpellInfo const *spellInfo, uint32 itemId=0, Spell *spell=nullptr, bool setCooldown=true)
Definition: Player.cpp:11003
void SetLastExtraAttackSpell(uint32 spellId)
Definition: Unit.h:1569
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition: Unit.cpp:10576
void ClearComboPoints()
Definition: Unit.cpp:17035
void AddComboPoints(Unit *target, int8 count)
Definition: Unit.cpp:17009
void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
Definition: Unit.cpp:5025
bool IsAutoRepeat() const
Definition: Spell.h:548
bool IsNextMeleeSwingSpell() const
Definition: Spell.cpp:8028
bool IsCooldownStartedOnEvent() const
Definition: SpellInfo.cpp:1196

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 ( )
4224{
4225 m_spellAura = nullptr;
4226 // initialize Diminishing Returns Data
4229
4230 // handle some immediate features of the spell here
4232
4234
4235 // handle effects with SPELL_EFFECT_HANDLE_HIT mode
4236 for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
4237 {
4238 // don't do anything for empty effect
4239 if (!m_spellInfo->Effects[j].IsEffect())
4240 continue;
4241
4242 // call effect handlers to handle destination hit
4243 HandleEffects(nullptr, nullptr, nullptr, j, SPELL_EFFECT_HANDLE_HIT);
4244 }
4245
4246 // process items
4247 for (std::list<ItemTargetInfo>::iterator ihit = m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit)
4248 DoAllEffectOnTarget(&(*ihit));
4249}
@ SPELL_EFFECT_HANDLE_HIT
Definition: Spell.h:235
void HandleThreatSpells()
Definition: Spell.cpp:5542
void HandleEffects(Unit *pUnitTarget, Item *pItemTarget, GameObject *pGOTarget, uint32 i, SpellEffectHandleMode mode)
Definition: Spell.cpp:5589
std::list< ItemTargetInfo > m_UniqueItemInfo
Definition: Spell.h:698
void DoAllEffectOnTarget(TargetInfo *target)
Definition: Spell.cpp:2594
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
2590{
2591 m_destTargets[effIndex] = dest;
2592}

References m_destTargets.

Referenced by SelectSpellTargets().

◆ AddGOTarget()

void Spell::AddGOTarget ( GameObject target,
uint32  effectMask 
)
protected
2499{
2500 for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
2501 {
2502 if (!m_spellInfo->Effects[effIndex].IsEffect())
2503 effectMask &= ~(1 << effIndex);
2504 else
2505 {
2506 switch (m_spellInfo->Effects[effIndex].Effect)
2507 {
2511 if (go->GetGoType() != GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING)
2512 effectMask &= ~(1 << effIndex);
2513 break;
2514 default:
2515 break;
2516 }
2517 }
2518 }
2519
2520 if (!effectMask)
2521 return;
2522
2523 ObjectGuid targetGUID = go->GetGUID();
2524
2525 // Lookup target in already in list
2526 for (std::list<GOTargetInfo>::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit)
2527 {
2528 if (targetGUID == ihit->targetGUID) // Found in list
2529 {
2530 ihit->effectMask |= effectMask; // Add only effect mask
2531 return;
2532 }
2533 }
2534
2535 // This is new target calculate data for him
2536
2537 GOTargetInfo target;
2538 target.targetGUID = targetGUID;
2539 target.effectMask = effectMask;
2540 target.processed = false; // Effects not apply on target
2541
2542 // Spell have speed - need calculate incoming time
2543 if (m_spellInfo->Speed > 0.0f)
2544 {
2545 // calculate spell incoming interval
2546 float dist = m_caster->GetDistance(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ());
2547 if (dist < 5.0f)
2548 dist = 5.0f;
2549 target.timeDelay = uint64(floor(dist / m_spellInfo->Speed * 1000.0f));
2550 if (m_delayMoment == 0 || m_delayMoment > target.timeDelay)
2551 m_delayMoment = target.timeDelay;
2552 }
2553 else
2554 target.timeDelay = 0LL;
2555
2556 // Add target to list
2557 m_UniqueGOTargetInfo.push_back(target);
2558}
std::uint64_t uint64
Definition: Define.h:107
@ GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING
Definition: SharedDefines.h:1565
@ SPELL_EFFECT_GAMEOBJECT_REPAIR
Definition: SharedDefines.h:838
@ SPELL_EFFECT_GAMEOBJECT_SET_DESTRUCTION_STATE
Definition: SharedDefines.h:839
@ SPELL_EFFECT_GAMEOBJECT_DAMAGE
Definition: SharedDefines.h:837
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
2561{
2562 for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
2563 if (!m_spellInfo->Effects[effIndex].IsEffect())
2564 effectMask &= ~(1 << effIndex);
2565
2566 // no effects left
2567 if (!effectMask)
2568 return;
2569
2570 // Lookup target in already in list
2571 for (std::list<ItemTargetInfo>::iterator ihit = m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit)
2572 {
2573 if (item == ihit->item) // Found in list
2574 {
2575 ihit->effectMask |= effectMask; // Add only effect mask
2576 return;
2577 }
2578 }
2579
2580 // This is new target add data
2581
2582 ItemTargetInfo target;
2583 target.item = item;
2584 target.effectMask = effectMask;
2585
2586 m_UniqueItemInfo.push_back(target);
2587}

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)
2366{
2367 for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
2368 if (!m_spellInfo->Effects[effIndex].IsEffect() || !CheckEffectTarget(target, effIndex))
2369 effectMask &= ~(1 << effIndex);
2370
2371 // no effects left
2372 if (!effectMask)
2373 return;
2374
2375 if (checkIfValid)
2376 {
2377 SpellCastResult res = m_spellInfo->CheckTarget(m_caster, target, implicit);
2378 if (res != SPELL_CAST_OK)
2379 return;
2380 }
2381
2382 // Check for effect immune skip if immuned
2383 for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
2384 if (target->IsImmunedToSpellEffect(m_spellInfo, effIndex))
2385 effectMask &= ~(1 << effIndex);
2386
2387 ObjectGuid targetGUID = target->GetGUID();
2388
2389 // Lookup target in already in list
2390 for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
2391 {
2392 if (targetGUID == ihit->targetGUID) // Found in list
2393 {
2394 ihit->effectMask |= effectMask; // Immune effects removed from mask
2395 ihit->scaleAura = false;
2396 if (m_auraScaleMask && ihit->effectMask == m_auraScaleMask && m_caster != target)
2397 {
2398 SpellInfo const* auraSpell = m_spellInfo->GetFirstRankSpell();
2399 if (uint32(target->GetLevel() + 10) >= auraSpell->SpellLevel)
2400 ihit->scaleAura = true;
2401 }
2402
2403 sScriptMgr->OnScaleAuraUnitAdd(this, target, effectMask, checkIfValid, implicit, m_auraScaleMask, *ihit);
2404 return;
2405 }
2406 }
2407
2408 // This is new target calculate data for him
2409
2410 // Get spell hit result on target
2411 TargetInfo targetInfo;
2412 targetInfo.targetGUID = targetGUID; // Store target GUID
2413 targetInfo.effectMask = effectMask; // Store all effects not immune
2414 targetInfo.processed = false; // Effects not apply on target
2415 targetInfo.alive = target->IsAlive();
2416 targetInfo.damage = 0;
2417 targetInfo.crit = false;
2418 targetInfo.scaleAura = false;
2419 if (m_auraScaleMask && targetInfo.effectMask == m_auraScaleMask && m_caster != target)
2420 {
2421 SpellInfo const* auraSpell = m_spellInfo->GetFirstRankSpell();
2422 if (uint32(target->GetLevel() + 10) >= auraSpell->SpellLevel)
2423 targetInfo.scaleAura = true;
2424 }
2425
2426 sScriptMgr->OnScaleAuraUnitAdd(this, target, effectMask, checkIfValid, implicit, m_auraScaleMask, targetInfo);
2427
2428 // Calculate hit result
2429 if (m_originalCaster)
2430 {
2431 targetInfo.missCondition = m_originalCaster->SpellHitResult(target, this, m_canReflect);
2432 if (m_skipCheck && targetInfo.missCondition != SPELL_MISS_IMMUNE)
2433 {
2434 targetInfo.missCondition = SPELL_MISS_NONE;
2435 }
2436 }
2437 else
2438 targetInfo.missCondition = SPELL_MISS_EVADE; //SPELL_MISS_NONE;
2439
2440 // Spell have speed - need calculate incoming time
2441 // Incoming time is zero for self casts. At least I think so.
2442 if (m_spellInfo->Speed > 0.0f && m_caster != target)
2443 {
2444 // calculate spell incoming interval
2446 float dist = m_caster->GetDistance(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
2447
2448 if (dist < 5.0f)
2449 dist = 5.0f;
2450 targetInfo.timeDelay = (uint64) floor(dist / m_spellInfo->Speed * 1000.0f);
2451
2452 // Calculate minimum incoming time
2453 if (m_delayMoment == 0 || m_delayMoment > targetInfo.timeDelay)
2454 m_delayMoment = targetInfo.timeDelay;
2455 }
2456 else
2457 targetInfo.timeDelay = 0LL;
2458
2459 // If target reflect spell back to caster
2460 if (targetInfo.missCondition == SPELL_MISS_REFLECT)
2461 {
2462 // Calculate reflected spell result on caster
2464
2465 if (targetInfo.reflectResult == SPELL_MISS_REFLECT) // Impossible reflect again, so simply deflect spell
2466 targetInfo.reflectResult = SPELL_MISS_PARRY;
2467
2468 // Increase time interval for reflected spells by 1.5
2470 targetInfo.timeDelay += targetInfo.timeDelay >> 1;
2471
2473
2474 // HACK: workaround check for succubus seduction case
2476 if (m_caster->IsPet())
2477 {
2478 CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(m_caster->GetEntry());
2479 switch (ci->family)
2480 {
2482 {
2483 if (m_spellInfo->SpellIconID != 694) // Soothing Kiss
2484 cancel();
2485 }
2486 break;
2487 return;
2488 }
2489 }
2490 }
2491 else
2492 targetInfo.reflectResult = SPELL_MISS_NONE;
2493
2494 // Add target to list
2495 m_UniqueTargetInfo.push_back(targetInfo);
2496}
#define sObjectMgr
Definition: ObjectMgr.h:1640
@ SPELL_FLAG_REFLECTED
Definition: Spell.h:82
@ CREATURE_FAMILY_SUCCUBUS
Definition: SharedDefines.h:2636
@ SPELL_MISS_PARRY
Definition: SharedDefines.h:1495
@ SPELL_MISS_IMMUNE
Definition: SharedDefines.h:1498
@ SPELL_MISS_EVADE
Definition: SharedDefines.h:1497
@ SPELL_MISS_REFLECT
Definition: SharedDefines.h:1502
void AddEvent(BasicEvent *Event, uint64 e_time, bool set_addtime=true)
Definition: EventProcessor.h:105
uint64 CalculateTime(uint64 t_offset) const
Definition: EventProcessor.cpp:158
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:1808
SpellMissInfo SpellHitResult(Unit *victim, SpellInfo const *spell, bool canReflect=false)
Definition: Unit.cpp:3424
EventProcessor m_Events
Definition: Unit.h:2094
virtual bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, uint32 index) const
Definition: Unit.cpp:12917
uint8 GetLevel() const
Definition: Unit.h:1420
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:7886
Definition: Spell.h:845
Definition: SpellInfo.h:314
uint32 SpellLevel
Definition: SpellInfo.h:358
SpellInfo const * GetFirstRankSpell() const
Definition: SpellInfo.cpp:2484
uint32 SpellIconID
Definition: SpellInfo.h:378
SpellCastResult CheckTarget(Unit const *caster, WorldObject const *target, bool implicit=true) const
Definition: SpellInfo.cpp:1744

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
890{
891 if (m_targets.HasDst())
892 {
893 if (m_targets.HasTraj())
894 {
895 float speed = m_targets.GetSpeedXY();
896 if (speed > 0.0f)
897 return (uint64)floor(m_targets.GetDist2d() / speed * 1000.0f);
898 }
899 else if (m_spellInfo->Speed > 0.0f)
900 {
901 // We should not subtract caster size from dist calculation (fixes execution time desync with animation on client, eg. Malleable Goo cast by PP)
902 float dist = m_caster->GetExactDist(*m_targets.GetDstPos());
903 return (uint64)std::floor(dist / m_spellInfo->Speed * 1000.0f);
904 }
905 }
906
907 return 0;
908}
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:395

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:14743
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
8505{
8506 for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
8507 {
8508 (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_AFTER_CAST);
8509 std::list<SpellScript::CastHandler>::iterator hookItrEnd = (*scritr)->AfterCast.end(), hookItr = (*scritr)->AfterCast.begin();
8510 for (; hookItr != hookItrEnd; ++hookItr)
8511 (*hookItr).Call(*scritr);
8512
8513 (*scritr)->_FinishScriptCall();
8514 }
8515}
@ 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
8617{
8618 for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
8619 {
8620 (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_AFTER_HIT);
8621 std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->AfterHit.end(), hookItr = (*scritr)->AfterHit.begin();
8622 for (; hookItr != hookItrEnd; ++hookItr)
8623 (*hookItr).Call(*scritr);
8624
8625 (*scritr)->_FinishScriptCall();
8626 }
8627}
@ 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
8479{
8480 for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
8481 {
8482 (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_BEFORE_CAST);
8483 std::list<SpellScript::CastHandler>::iterator hookItrEnd = (*scritr)->BeforeCast.end(), hookItr = (*scritr)->BeforeCast.begin();
8484 for (; hookItr != hookItrEnd; ++hookItr)
8485 (*hookItr).Call(*scritr);
8486
8487 (*scritr)->_FinishScriptCall();
8488 }
8489}
@ 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
8591{
8592 for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
8593 {
8594 (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_BEFORE_HIT);
8595 std::list<SpellScript::BeforeHitHandler>::iterator hookItrEnd = (*scritr)->BeforeHit.end(), hookItr = (*scritr)->BeforeHit.begin();
8596 for (; hookItr != hookItrEnd; ++hookItr)
8597 (*hookItr).Call(*scritr, missInfo);
8598
8599 (*scritr)->_FinishScriptCall();
8600 }
8601}
@ 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
8518{
8520 for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
8521 {
8522 (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_CHECK_CAST);
8523 std::list<SpellScript::CheckCastHandler>::iterator hookItrEnd = (*scritr)->OnCheckCast.end(), hookItr = (*scritr)->OnCheckCast.begin();
8524 for (; hookItr != hookItrEnd; ++hookItr)
8525 {
8526 SpellCastResult tempResult = (*hookItr).Call(*scritr);
8527 if (retVal == SPELL_CAST_OK)
8528 retVal = tempResult;
8529 }
8530
8531 (*scritr)->_FinishScriptCall();
8532 }
8533 return retVal;
8534}
@ 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
8658{
8659 for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
8660 {
8661 (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_DESTINATION_TARGET_SELECT);
8662 std::list<SpellScript::DestinationTargetSelectHandler>::iterator hookItrEnd = (*scritr)->OnDestinationTargetSelect.end(), hookItr = (*scritr)->OnDestinationTargetSelect.begin();
8663 for (; hookItr != hookItrEnd; ++hookItr)
8664 if (hookItr->IsEffectAffected(m_spellInfo, effIndex) && targetType.GetTarget() == hookItr->GetTarget())
8665 hookItr->Call(*scritr, target);
8666
8667 (*scritr)->_FinishScriptCall();
8668 }
8669}
@ 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
8543{
8544 // execute script effect handler hooks and check if effects was prevented
8545 bool preventDefault = false;
8546 for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
8547 {
8548 std::list<SpellScript::EffectHandler>::iterator effItr, effEndItr;
8549 SpellScriptHookType hookType;
8550 switch (mode)
8551 {
8553 effItr = (*scritr)->OnEffectLaunch.begin();
8554 effEndItr = (*scritr)->OnEffectLaunch.end();
8556 break;
8558 effItr = (*scritr)->OnEffectLaunchTarget.begin();
8559 effEndItr = (*scritr)->OnEffectLaunchTarget.end();
8561 break;
8563 effItr = (*scritr)->OnEffectHit.begin();
8564 effEndItr = (*scritr)->OnEffectHit.end();
8566 break;
8568 effItr = (*scritr)->OnEffectHitTarget.begin();
8569 effEndItr = (*scritr)->OnEffectHitTarget.end();
8571 break;
8572 default:
8573 ABORT();
8574 return false;
8575 }
8576 (*scritr)->_PrepareScriptCall(hookType);
8577 for (; effItr != effEndItr; ++effItr)
8578 // effect execution can be prevented
8579 if (!(*scritr)->_IsEffectPrevented(effIndex) && (*effItr).IsEffectAffected(m_spellInfo, effIndex))
8580 (*effItr).Call(*scritr, effIndex);
8581
8582 if (!preventDefault)
8583 preventDefault = (*scritr)->_IsDefaultEffectPrevented(effIndex);
8584
8585 (*scritr)->_FinishScriptCall();
8586 }
8587 return preventDefault;
8588}
#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
8630{
8631 for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
8632 {
8633 (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_OBJECT_AREA_TARGET_SELECT);
8634 std::list<SpellScript::ObjectAreaTargetSelectHandler>::iterator hookItrEnd = (*scritr)->OnObjectAreaTargetSelect.end(), hookItr = (*scritr)->OnObjectAreaTargetSelect.begin();
8635 for (; hookItr != hookItrEnd; ++hookItr)
8636 if (hookItr->IsEffectAffected(m_spellInfo, effIndex) && targetType.GetTarget() == hookItr->GetTarget())
8637 hookItr->Call(*scritr, targets);
8638
8639 (*scritr)->_FinishScriptCall();
8640 }
8641}
@ 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
8644{
8645 for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
8646 {
8647 (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_OBJECT_TARGET_SELECT);
8648 std::list<SpellScript::ObjectTargetSelectHandler>::iterator hookItrEnd = (*scritr)->OnObjectTargetSelect.end(), hookItr = (*scritr)->OnObjectTargetSelect.begin();
8649 for (; hookItr != hookItrEnd; ++hookItr)
8650 if (hookItr->IsEffectAffected(m_spellInfo, effIndex) && targetType.GetTarget() == hookItr->GetTarget())
8651 hookItr->Call(*scritr, target);
8652
8653 (*scritr)->_FinishScriptCall();
8654 }
8655}
@ 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
8492{
8493 for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
8494 {
8495 (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_ON_CAST);
8496 std::list<SpellScript::CastHandler>::iterator hookItrEnd = (*scritr)->OnCast.end(), hookItr = (*scritr)->OnCast.begin();
8497 for (; hookItr != hookItrEnd; ++hookItr)
8498 (*hookItr).Call(*scritr);
8499
8500 (*scritr)->_FinishScriptCall();
8501 }
8502}
@ 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
8604{
8605 for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
8606 {
8607 (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_HIT);
8608 std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->OnHit.end(), hookItr = (*scritr)->OnHit.begin();
8609 for (; hookItr != hookItrEnd; ++hookItr)
8610 (*hookItr).Call(*scritr);
8611
8612 (*scritr)->_FinishScriptCall();
8613 }
8614}
@ 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)
6977{
6978 ObjectGuid targetguid = target->GetGUID();
6979
6980 for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
6981 {
6983 {
6984 if (m_spellInfo->StackAmount <= 1)
6985 {
6986 if (target->HasAuraEffect(m_spellInfo->Id, j))
6987 return false;
6988 }
6989 else
6990 {
6991 if (AuraEffect* aureff = target->GetAuraEffect(m_spellInfo->Id, j))
6992 if (aureff->GetBase()->GetStackAmount() >= m_spellInfo->StackAmount)
6993 return false;
6994 }
6995 }
6996 else if (m_spellInfo->Effects[j].IsAreaAuraEffect())
6997 {
6998 if (target->HasAuraEffect(m_spellInfo->Id, j))
6999 return false;
7000 }
7001 }
7002
7003 SpellCastResult result = CheckPetCast(target);
7004
7005 if (result == SPELL_CAST_OK || result == SPELL_FAILED_UNIT_NOT_INFRONT)
7006 {
7008 //check if among target units, our WANTED target is as well (->only self cast spells return false)
7009 for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
7010 if (ihit->targetGUID == targetguid)
7011 return true;
7012 }
7013 return false; //target invalid
7014}
@ SPELL_EFFECT_APPLY_AURA
Definition: SharedDefines.h:756
@ SPELL_FAILED_UNIT_NOT_INFRONT
Definition: SharedDefines.h:1055
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:5412
bool HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
Definition: Unit.cpp:5580
Definition: SpellAuraEffects.h:39
SpellCastResult CheckPetCast(Unit *target)
Definition: Spell.cpp:6783
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.
3694{
3696 return;
3697
3698 uint32 oldState = m_spellState;
3699 bool autoRepeat = m_autoRepeat;
3701
3702 m_autoRepeat = false;
3703 switch (oldState)
3704 {
3708 {
3710 ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, bySelf ? 99998 : 99999);
3711 }
3712 [[fallthrough]];
3714 SendInterrupted(0);
3715 // xinef: fixes bugged gcd reset in some cases
3716 if (!autoRepeat)
3718 break;
3719
3721 if (!bySelf)
3722 {
3723 for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
3724 if ((*ihit).missCondition == SPELL_MISS_NONE)
3725 if (Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID))
3726 unit->RemoveOwnedAura(m_spellInfo->Id, m_originalCasterGUID, 0, AURA_REMOVE_BY_CANCEL);
3727
3729 SendInterrupted(0);
3731 }
3732
3734 ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, bySelf ? 99998 : 99999);
3735
3736 // spell is canceled-take mods and clear list
3737 if (Player* player = m_caster->GetSpellModOwner())
3738 player->RemoveSpellMods(this);
3739
3740 m_appliedMods.clear();
3741 break;
3742 default:
3743 break;
3744 }
3745
3747 if (m_selfContainer && *m_selfContainer == this)
3748 *m_selfContainer = nullptr;
3749
3750 // Do not remove current far sight object (already done in Spell::EffectAddFarsight) to prevent from reset viewpoint to player
3752 {
3754 }
3755
3756 if (m_spellInfo->IsChanneled()) // if not channeled then the object for the current cast wasn't summoned yet
3758
3759 //set state back so finish will be processed
3760 m_spellState = oldState;
3761
3762 finish(false);
3763}
@ 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:822
@ SPELL_FAILED_INTERRUPTED
Definition: SharedDefines.h:961
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:15282
void RemoveGameObject(GameObject *gameObj, bool del)
Definition: Unit.cpp:6109
bool RemoveDynObject(uint32 spellId)
Definition: Unit.cpp:6053
void SendChannelUpdate(uint32 time)
Definition: Spell.cpp:5153
void CancelGlobalCooldown()
Definition: Spell.cpp:8845
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
8846{
8848 return;
8849
8850 // Cancel global cooldown when interrupting current cast
8852 return;
8853
8854 // Only players or controlled units have global cooldown
8855 if (m_caster->GetCharmInfo())
8857 else if (m_caster->GetTypeId() == TYPEID_PLAYER)
8859}
@ CURRENT_GENERIC_SPELL
Definition: Unit.h:979
GlobalCooldownMgr & GetGlobalCooldownMgr()
Definition: Player.h:1755
void CancelGlobalCooldown(SpellInfo const *spellInfo)
Definition: Unit.cpp:352
GlobalCooldownMgr & GetGlobalCooldownMgr()
Definition: Unit.h:1127
CharmInfo * GetCharmInfo()
Definition: Unit.h:1883
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition: Unit.h:2061
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
8695{
8696 // Relentless strikes, proc only from first effect
8697 if (triggeredByAura && triggeredByAura->SpellIconID == 559)
8698 return effMask & (1 << EFFECT_0);
8699
8700 bool only_on_caster = (triggeredByAura && triggeredByAura->HasAttribute(SPELL_ATTR4_CLASS_TRIGGER_ONLY_ON_TARGET));
8701 // If triggeredByAura has SPELL_ATTR4_CLASS_TRIGGER_ONLY_ON_TARGET then it can only proc on a casted spell with TARGET_UNIT_CASTER
8702 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
8703 {
8704 if ((effMask & (1 << i)) && (!only_on_caster || (m_spellInfo->Effects[i].TargetA.GetTarget() == TARGET_UNIT_CASTER)))
8705 return true;
8706 }
8707 return effMask;
8708}
@ EFFECT_0
Definition: SharedDefines.h:30
@ TARGET_UNIT_CASTER
Definition: SharedDefines.h:1382
@ SPELL_ATTR4_CLASS_TRIGGER_ONLY_ON_TARGET
Definition: SharedDefines.h:503

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
8319{
8320 if (!lockId) // possible case for GO and maybe for items.
8321 return SPELL_CAST_OK;
8322
8323 // Get LockInfo
8324 LockEntry const* lockInfo = sLockStore.LookupEntry(lockId);
8325
8326 if (!lockInfo)
8328
8329 bool reqKey = false; // some locks not have reqs
8330
8331 for (int j = 0; j < MAX_LOCK_CASE; ++j)
8332 {
8333 switch (lockInfo->Type[j])
8334 {
8335 // check key item (many fit cases can be)
8336 case LOCK_KEY_ITEM:
8337 if (lockInfo->Index[j] && m_CastItem && m_CastItem->GetEntry() == lockInfo->Index[j])
8338 return SPELL_CAST_OK;
8339 reqKey = true;
8340 break;
8341 // check key skill (only single first fit case can be)
8342 case LOCK_KEY_SKILL:
8343 {
8344 reqKey = true;
8345
8346 // wrong locktype, skip
8347 if (uint32(m_spellInfo->Effects[effIndex].MiscValue) != lockInfo->Index[j])
8348 continue;
8349
8350 skillId = SkillByLockType(LockType(lockInfo->Index[j]));
8351
8352 if (skillId != SKILL_NONE)
8353 {
8354 reqSkillValue = lockInfo->Skill[j];
8355
8356 // castitem check: rogue using skeleton keys. the skill values should not be added in this case.
8357 skillValue = m_CastItem || m_caster->GetTypeId() != TYPEID_PLAYER ?
8358 0 : m_caster->ToPlayer()->GetSkillValue(skillId);
8359
8360 // skill bonus provided by casting spell (mostly item spells)
8361 // add the effect base points modifier from the spell casted (cheat lock / skeleton key etc.)
8362 if ((m_spellInfo->Effects[effIndex].TargetA.GetTarget() == TARGET_GAMEOBJECT_ITEM_TARGET || m_spellInfo->Effects[effIndex].TargetB.GetTarget() == TARGET_GAMEOBJECT_ITEM_TARGET)
8364 {
8365 skillValue += m_spellInfo->Effects[effIndex].CalcValue();
8366 }
8367
8368 if (skillValue < reqSkillValue)
8370 }
8371
8372 return SPELL_CAST_OK;
8373 }
8374 case LOCK_KEY_SPELL:
8375 {
8376 if (m_spellInfo->Id == lockInfo->Index[j])
8377 {
8378 return SPELL_CAST_OK;
8379 }
8380 reqKey = true;
8381 break;
8382 }
8383 }
8384 }
8385
8386 if (reqKey)
8388
8389 return SPELL_CAST_OK;
8390}
DBCStorage< LockEntry > sLockStore(LockEntryfmt)
#define MAX_LOCK_CASE
Definition: DBCStructure.h:1288
@ TARGET_GAMEOBJECT_ITEM_TARGET
Definition: SharedDefines.h:1402
LockType
Definition: SharedDefines.h:2563
@ LOCK_KEY_ITEM
Definition: SharedDefines.h:2557
@ LOCK_KEY_SKILL
Definition: SharedDefines.h:2558
@ LOCK_KEY_SPELL
Definition: SharedDefines.h:2559
@ SPELL_FAILED_BAD_TARGETS
Definition: SharedDefines.h:933
@ SPELL_FAILED_LOW_CASTLEVEL
Definition: SharedDefines.h:970
SkillType SkillByLockType(LockType locktype)
Definition: SharedDefines.h:2992
@ SKILL_NONE
Definition: SharedDefines.h:2836
@ SKILL_LOCKPICKING
Definition: SharedDefines.h:2947
uint16 GetSkillValue(uint32 skill) const
Definition: Player.cpp:5354
bool IsAbilityOfSkillType(uint32 skillType) const
Definition: SpellInfo.cpp:989
Definition: DBCStructure.h:1291
uint32 Type[MAX_LOCK_CASE]
Definition: DBCStructure.h:1293
uint32 Index[MAX_LOCK_CASE]
Definition: DBCStructure.h:1294
uint32 Skill[MAX_LOCK_CASE]
Definition: DBCStructure.h:1295

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)
3766{
3767 Player* modOwner = m_caster->GetSpellModOwner();
3768 Spell* lastMod = nullptr;
3769 if (modOwner)
3770 {
3771 lastMod = modOwner->m_spellModTakingSpell;
3772 if (lastMod)
3773 modOwner->SetSpellModTakingSpell(lastMod, false);
3774 }
3775
3776 _cast(skipCheck);
3777
3778 if (lastMod)
3779 modOwner->SetSpellModTakingSpell(lastMod, true);
3780}
Spell * m_spellModTakingSpell
Definition: Player.h:2499
Definition: Spell.h:284
void _cast(bool skipCheck)
Definition: Spell.cpp:3782

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
5613{
5614 // check death state
5617
5618 // Spectator check
5620 if (((Player const*)m_caster)->IsSpectator() && m_spellInfo->Id != SPECTATOR_SPELL_BINDSIGHT)
5621 return SPELL_FAILED_NOT_HERE;
5622
5624
5625 sScriptMgr->OnSpellCheckCast(this, strict, res);
5626
5627 if (res != SPELL_CAST_OK)
5628 return res;
5629
5630 // check cooldowns to prevent cheating
5632 {
5634 {
5635 //can cast triggered (by aura only?) spells while have this flag
5638
5640 {
5643 else
5645 }
5646
5647 // check if we are using a potion in combat for the 2nd+ time. Cooldown is added only after caster gets out of combat
5650 }
5653 }
5654
5656 {
5659 }
5660
5661 // Check global cooldown
5664
5665 // only triggered spells can be processed an ended battleground
5668 if (bg->GetStatus() == STATUS_WAIT_LEAVE)
5670
5671 if (m_caster->GetTypeId() == TYPEID_PLAYER /*&& VMAP::VMapFactory::createOrGetVMapMgr()->isLineOfSightCalcEnabled()*/) // pussywizard: optimization (commented)
5672 {
5674 !m_caster->IsOutdoors())
5676
5680 }
5681
5682 // only check at first call, Stealth auras are already removed at second call
5683 // for now, ignore triggered spells
5685 {
5686 bool checkForm = true;
5687 // Ignore form req aura
5689 for (Unit::AuraEffectList::const_iterator i = ignore.begin(); i != ignore.end(); ++i)
5690 {
5691 if (!(*i)->IsAffectedOnSpell(m_spellInfo))
5692 continue;
5693 checkForm = false;
5694 break;
5695 }
5696 if (checkForm)
5697 {
5698 // Cannot be used in this stance/form
5700 if (shapeError != SPELL_CAST_OK)
5701 return shapeError;
5702
5705 }
5706 }
5707
5709 for (Unit::AuraEffectList::const_iterator blockItr = blockSpells.begin(); blockItr != blockSpells.end(); ++blockItr)
5710 if (uint32((*blockItr)->GetMiscValue()) == m_spellInfo->SpellFamilyName)
5712
5713 bool reqCombat = true;
5715 for (Unit::AuraEffectList::const_iterator j = stateAuras.begin(); j != stateAuras.end(); ++j)
5716 {
5717 if ((*j)->IsAffectedOnSpell(m_spellInfo))
5718 {
5719 m_needComboPoints = false;
5720 if ((*j)->GetMiscValue() == 1)
5721 {
5722 reqCombat = false;
5723 break;
5724 }
5725 }
5726 }
5727
5728 // caster state requirements
5729 // not for triggered spells (needed by execute)
5731 {
5736
5737 // Note: spell 62473 requres CasterAuraSpell = triggering spell
5742
5743 if (reqCombat && m_caster->IsInCombat() && !m_spellInfo->CanBeUsedInCombat())
5745 }
5746
5747 // Xinef: exploit protection
5749 {
5751 if (InstanceScript* instanceScript = m_caster->GetInstanceScript())
5752 if (instanceScript->IsEncounterInProgress())
5753 {
5754 if (Group* group = m_caster->ToPlayer()->GetGroup())
5755 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
5756 if (Player* member = itr->GetSource())
5757 if (member->IsInMap(m_caster))
5758 if (Unit* victim = member->GetVictim())
5759 if (victim->IsInCombat() && m_caster->GetDistance(victim) < m_caster->GetVisibilityRange())
5760 {
5761 m_caster->CombatStart(victim);
5762 victim->AddThreat(m_caster, 1.0f);
5763 break;
5764 }
5766 }
5767 }
5768
5769 // cancel autorepeat spells if cast start when moving
5770 // (not wand currently autorepeat cast delayed to moving stop anyway in spell update code)
5772 {
5773 // skip stuck spell to allow use it in falling case and apply spell limitations at movement
5776 return SPELL_FAILED_MOVING;
5777 }
5778
5779 Vehicle* vehicle = m_caster->GetVehicle();
5781 {
5782 uint16 checkMask = 0;
5783 for (uint8 effIndex = EFFECT_0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
5784 {
5785 SpellEffectInfo const* effInfo = &m_spellInfo->Effects[effIndex];
5787 {
5788 SpellShapeshiftEntry const* shapeShiftEntry = sSpellShapeshiftStore.LookupEntry(effInfo->MiscValue);
5789 if (shapeShiftEntry && (shapeShiftEntry->flags1 & 1) == 0) // unk flag
5790 checkMask |= VEHICLE_SEAT_FLAG_UNCONTROLLED;
5791 break;
5792 }
5793 }
5794
5797
5798 if (!checkMask)
5799 checkMask = VEHICLE_SEAT_FLAG_CAN_ATTACK;
5800
5801 // All creatures should be able to cast as passengers freely, restriction and attribute are only for players
5802 VehicleSeatEntry const* vehicleSeat = vehicle->GetSeatForPassenger(m_caster);
5804 && (vehicleSeat->m_flags & checkMask) != checkMask && m_caster->GetTypeId() == TYPEID_PLAYER)
5806 }
5807
5808 // check spell cast conditions from database
5809 {
5812 ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL, m_spellInfo->Id);
5813 if (!conditions.empty() && !sConditionMgr->IsObjectMeetToConditions(condInfo, conditions))
5814 {
5815 // mLastFailedCondition can be nullptr if there was an error processing the condition in Condition::Meets (i.e. wrong data for ConditionTarget or others)
5816 if (condInfo.mLastFailedCondition && condInfo.mLastFailedCondition->ErrorType)
5817 {
5821 }
5822 if (!condInfo.mLastFailedCondition || !condInfo.mLastFailedCondition->ConditionTarget)
5825 }
5826 }
5827
5828 // Don't check explicit target for passive spells (workaround) (check should be skipped only for learn case)
5829 // those spells may have incorrect target entries or not filled at all (for example 15332)
5830 // such spells when learned are not targeting anyone using targeting system, they should apply directly to caster instead
5831 // also, such casts shouldn't be sent to client
5832 // Xinef: do not check explicit casts for self cast of triggered spells (eg. reflect case)
5834 {
5835 // Check explicit target for m_originalCaster - todo: get rid of such workarounds
5836 // Xinef: do not check explicit target for triggered spell casted on self with targetflag enemy
5838 {
5840 if (castResult != SPELL_CAST_OK)
5841 return castResult;
5842 }
5843 }
5844
5845 if (Unit* target = m_targets.GetUnitTarget())
5846 {
5847 SpellCastResult castResult = m_spellInfo->CheckTarget(m_caster, target, false);
5848 if (castResult != SPELL_CAST_OK)
5849 return castResult;
5850
5851 if (target != m_caster)
5852 {
5853 // Must be behind the target
5854 if (m_spellInfo->HasAttribute(SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET) && target->HasInArc(static_cast<float>(M_PI), m_caster))
5856
5857 // Target must be facing you
5858 if (m_spellInfo->HasAttribute(SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER) && !target->HasInArc(static_cast<float>(M_PI), m_caster))
5860
5863 {
5864 bool castedByGameobject = false;
5865 uint32 losChecks = LINEOFSIGHT_ALL_CHECKS;
5867 {
5868 castedByGameobject = m_caster->GetMap()->GetGameObject(m_originalCasterGUID) != nullptr;
5869 }
5870 else if (m_caster->GetEntry() == WORLD_TRIGGER)
5871 {
5872 if (TempSummon* tempSummon = m_caster->ToTempSummon())
5873 {
5874 castedByGameobject = tempSummon->GetSummonerGameObject() != nullptr;
5875 }
5876 }
5877
5878 if (castedByGameobject)
5879 {
5880 // If spell casted by gameobject then ignore M2 models
5881 losChecks &= ~LINEOFSIGHT_CHECK_GOBJECT_M2;
5882 }
5883
5885 {
5887 }
5888 }
5889 }
5890 }
5891
5892 // Check for line of sight for spells with dest
5893 if (m_targets.HasDst())
5894 {
5895 float x, y, z;
5896 m_targets.GetDstPos()->GetPosition(x, y, z);
5897
5900 {
5901 bool castedByGameobject = false;
5902 uint32 losChecks = LINEOFSIGHT_ALL_CHECKS;
5904 {
5905 castedByGameobject = m_caster->GetMap()->GetGameObject(m_originalCasterGUID) != nullptr;
5906 }
5907 else if (m_caster->GetEntry() == WORLD_TRIGGER)
5908 {
5909 if (TempSummon* tempSummon = m_caster->ToTempSummon())
5910 {
5911 castedByGameobject = tempSummon->GetSummonerGameObject() != nullptr;
5912 }
5913 }
5914
5915 if (castedByGameobject)
5916 {
5917 // If spell casted by gameobject then ignore M2 models
5918 losChecks &= ~LINEOFSIGHT_CHECK_GOBJECT_M2;
5919 }
5920
5922 {
5924 }
5925 }
5926 }
5927
5928 // check pet presence
5929 for (int j = 0; j < MAX_SPELL_EFFECTS; ++j)
5930 {
5931 if (m_spellInfo->Effects[j].TargetA.GetTarget() == TARGET_UNIT_PET)
5932 {
5934 {
5935 if (m_triggeredByAuraSpell.spellInfo) // not report pet not existence for triggered spells
5937 else
5938 return SPELL_FAILED_NO_PET;
5939 }
5940 break;
5941 }
5942 }
5943 // Spell casted only on battleground
5945 if (!m_caster->ToPlayer()->InBattleground())
5947
5948 // do not allow spells to be cast in arenas
5949 // - with greater than 10 min CD without SPELL_ATTR4_IGNORE_DEFAULT_ARENA_RESTRICTIONS flag
5950 // - with SPELL_ATTR4_NOT_IN_ARENA_OR_RATED_BATTLEGROUND flag
5953 if (MapEntry const* mapEntry = sMapStore.LookupEntry(m_caster->GetMapId()))
5954 if (mapEntry->IsBattleArena())
5956
5957 // zone check
5959 {
5960 uint32 zone, area;
5961 m_caster->GetZoneAndAreaId(zone, area);
5962
5964 m_caster->GetTypeId() == TYPEID_PLAYER ? m_caster->ToPlayer() : nullptr);
5965 if (locRes != SPELL_CAST_OK)
5966 return locRes;
5967 }
5968
5969 // not let players cast spells at mount (and let do it to creatures)
5972 {
5973 if (m_caster->IsInFlight())
5975 else
5977 }
5978
5979 SpellCastResult castResult = SPELL_CAST_OK;
5980
5981 // always (except passive spells) check items (focus object can be required for any type casts)
5982 if (!m_spellInfo->IsPassive())
5983 {
5984 // spell focus needs to be checked not only for players! there are vehicle spells that require spell focus
5985 castResult = CheckSpellFocus();
5986 if (castResult != SPELL_CAST_OK)
5987 return castResult;
5988
5989 castResult = CheckItems();
5990 if (castResult != SPELL_CAST_OK)
5991 return castResult;
5992 }
5993
5994 // Triggered spells also have range check
5996 castResult = CheckRange(strict);
5997 if (castResult != SPELL_CAST_OK)
5998 return castResult;
5999
6001 {
6002 castResult = CheckPower();
6003 if (castResult != SPELL_CAST_OK)
6004 return castResult;
6005 }
6006
6007 // xinef: do not skip triggered spells if they posses prevention type (eg. Bladestorm vs Hand of Protection)
6009 {
6011 if (castResult != SPELL_CAST_OK)
6012 return castResult;
6013
6014 // 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).
6016 {
6018 for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
6019 if (itr->type == m_spellInfo->Mechanic)
6021 }
6022 }
6023
6024 // script hook
6025 castResult = CallScriptCheckCastHandlers();
6026 if (castResult != SPELL_CAST_OK)
6027 return castResult;
6028
6029 bool hasDispellableAura = false;
6030 bool hasNonDispelEffect = false;
6031 uint32 dispelMask = 0;
6032 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
6033 if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_DISPEL)
6034 {
6036 {
6037 hasDispellableAura = true;
6038 break;
6039 }
6040
6041 dispelMask |= SpellInfo::GetDispelMask(DispelType(m_spellInfo->Effects[i].MiscValue));
6042 }
6043 else if (m_spellInfo->Effects[i].IsEffect())
6044 {
6045 hasNonDispelEffect = true;
6046 break;
6047 }
6048
6049 if (!hasNonDispelEffect && !hasDispellableAura && dispelMask && !IsTriggered())
6050 {
6051 if (Unit* target = m_targets.GetUnitTarget())
6052 {
6053 // Xinef: do not allow to cast on hostile targets in sanctuary
6054 if (!m_caster->IsFriendlyTo(target))
6055 {
6056 if (m_caster->IsInSanctuary() || target->IsInSanctuary())
6057 {
6058 // Xinef: fix for duels
6059 Player* player = m_caster->ToPlayer();
6060 if (!player || !player->duel || target != player->duel->Opponent)
6062 }
6063 }
6064
6065 DispelChargesList dispelList;
6066 target->GetDispellableAuraList(m_caster, dispelMask, dispelList);
6067 if (dispelList.empty())
6069 }
6070 }
6071
6072 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
6073 {
6074 // for effects of spells that have only one target
6075 switch (m_spellInfo->Effects[i].Effect)
6076 {
6077 case SPELL_EFFECT_DUMMY:
6078 {
6080 {
6081 // Raise Ally
6082 if( m_spellInfo->Id == 61999 )
6083 {
6084 Unit* target = m_targets.GetUnitTarget();
6085 if (!target)
6087
6088 if (target->IsAlive()) // not discovered attributeEx5?
6090 }
6091 }
6092 break;
6093 }
6095 {
6098
6099 if (m_spellInfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_PET)
6100 break;
6101
6102 Pet* pet = m_caster->ToPlayer()->GetPet();
6103
6104 if (!pet)
6105 return SPELL_FAILED_NO_PET;
6106
6107 SpellInfo const* learn_spellproto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[i].TriggerSpell);
6108
6109 if (!learn_spellproto)
6111
6112 if (m_spellInfo->SpellLevel > pet->GetLevel())
6113 return SPELL_FAILED_LOWLEVEL;
6114
6115 break;
6116 }
6118 {
6119 // check target only for unit target case
6121 {
6124
6125 Pet* pet = unitTarget->ToPet();
6126 if (!pet || pet->GetOwner() != m_caster)
6128
6129 SpellInfo const* learn_spellproto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[i].TriggerSpell);
6130
6131 if (!learn_spellproto)
6133
6134 if (m_spellInfo->SpellLevel > pet->GetLevel())
6135 return SPELL_FAILED_LOWLEVEL;
6136 }
6137 break;
6138 }
6140 {
6141 uint32 glyphId = m_spellInfo->Effects[i].MiscValue;
6142 if (GlyphPropertiesEntry const* gp = sGlyphPropertiesStore.LookupEntry(glyphId))
6143 if (m_caster->HasAura(gp->SpellId))
6145 break;
6146 }
6148 {
6151
6152 Item* foodItem = m_targets.GetItemTarget();
6153 if (!foodItem)
6155
6156 Pet* pet = m_caster->ToPlayer()->GetPet();
6157
6158 if (!pet)
6159 return SPELL_FAILED_NO_PET;
6160
6161 if (!pet->HaveInDiet(foodItem->GetTemplate()))
6163
6164 if (!pet->GetCurrentFoodBenefitLevel(foodItem->GetTemplate()->ItemLevel))
6166
6167 if (m_caster->IsInCombat() || pet->IsInCombat())
6169
6170 break;
6171 }
6174 {
6175 // Can be area effect, Check only for players and not check if target - caster (spell can have multiply drain/burn effects)
6177 if (Unit* target = m_targets.GetUnitTarget())
6178 if (target != m_caster && target->getPowerType() != Powers(m_spellInfo->Effects[i].MiscValue))
6180 break;
6181 }
6183 {
6185 {
6187 }
6188
6190 {
6191 // Warbringer - can't be handled in proc system - should be done before checkcast root check and charge effect process
6192 if (strict && m_caster->IsScriptOverriden(m_spellInfo, 6953))
6194 }
6196 {
6197 // Exception for Master's Call
6198 if (m_spellInfo->Id != 54216)
6199 {
6200 return SPELL_FAILED_ROOTED;
6201 }
6202 }
6204 if (Unit* target = m_targets.GetUnitTarget())
6205 if (!target->IsAlive())
6207 // Xinef: Pass only explicit unit target spells
6208 // pussywizard:
6210 {
6211 Unit* target = m_targets.GetUnitTarget();
6212 if (!target)
6214
6215 // first we must check to see if the target is in LoS. A path can usually be built but LoS matters for charge spells
6216 if (!target->IsWithinLOSInMap(m_caster)) //Do full LoS/Path check. Don't exclude m2
6218
6219 float objSize = target->GetCombatReach();
6220 float range = m_spellInfo->GetMaxRange(true, m_caster, this) * 1.5f + objSize; // can't be overly strict
6221
6222 m_preGeneratedPath = std::make_unique<PathGenerator>(m_caster);
6223 m_preGeneratedPath->SetPathLengthLimit(range);
6224
6225 // first try with raycast, if it fails fall back to normal path
6226 bool result = m_preGeneratedPath->CalculatePath(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), false);
6227 if (m_preGeneratedPath->GetPathType() & PATHFIND_SHORT)
6228 return SPELL_FAILED_NOPATH;
6229 else if (!result || m_preGeneratedPath->GetPathType() & (PATHFIND_NOPATH | PATHFIND_INCOMPLETE))
6230 return SPELL_FAILED_NOPATH;
6231 else if (m_preGeneratedPath->IsInvalidDestinationZ(target)) // Check position z, if not in a straight line
6232 return SPELL_FAILED_NOPATH;
6233
6234 m_preGeneratedPath->ShortenPathUntilDist(G3D::Vector3(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()), objSize); // move back
6235 }
6236 if (Player* player = m_caster->ToPlayer())
6237 player->SetCanTeleport(true);
6238 break;
6239 }
6241 {
6244
6247
6248 Creature* creature = m_targets.GetUnitTarget()->ToCreature();
6249 if (!creature->IsCritter() && !creature->loot.isLooted())
6251
6252 uint32 skill = creature->GetCreatureTemplate()->GetRequiredLootSkill();
6253
6254 int32 skillValue = m_caster->ToPlayer()->GetSkillValue(skill);
6255 int32 TargetLevel = m_targets.GetUnitTarget()->GetLevel();
6256 int32 ReqValue = (skillValue < 100 ? (TargetLevel - 10) * 10 : TargetLevel * 5);
6257 if (ReqValue > skillValue)
6259
6260 break;
6261 }
6263 {
6264 if (m_spellInfo->Effects[i].TargetA.GetTarget() != TARGET_GAMEOBJECT_TARGET &&
6265 m_spellInfo->Effects[i].TargetA.GetTarget() != TARGET_GAMEOBJECT_ITEM_TARGET)
6266 break;
6267
6268 if (m_caster->GetTypeId() != TYPEID_PLAYER // only players can open locks, gather etc.
6269 // we need a go target in case of TARGET_GAMEOBJECT_TARGET
6270 || (m_spellInfo->Effects[i].TargetA.GetTarget() == TARGET_GAMEOBJECT_TARGET && !m_targets.GetGOTarget()))
6272
6273 Item* pTempItem = nullptr;
6275 {
6276 if (TradeData* pTrade = m_caster->ToPlayer()->GetTradeData())
6277 pTempItem = pTrade->GetTraderData()->GetItem(TradeSlots(m_targets.GetItemTargetGUID().GetRawValue()));
6278 }
6281
6282 // we need a go target, or an openable item target in case of TARGET_GAMEOBJECT_ITEM_TARGET
6283 if (m_spellInfo->Effects[i].TargetA.GetTarget() == TARGET_GAMEOBJECT_ITEM_TARGET &&
6285 (!pTempItem || !pTempItem->GetTemplate()->LockID || !pTempItem->IsLocked()))
6287
6288 // We must also ensure the gameobject we are opening is still closed by the time the spell finishes.
6289 if (GameObject* go = m_targets.GetGOTarget())
6290 {
6291 if (go->GetGoType() == GAMEOBJECT_TYPE_DOOR && go->GetGoState() != GO_STATE_READY)
6292 {
6294 }
6295 }
6296 if (m_spellInfo->Id != 1842 || (m_targets.GetGOTarget() &&
6298 {
6299 if (m_targets.GetGOTarget() && m_targets.GetGOTarget()->GetEntry() == 179697)
6300 {
6301 if (!m_caster->ToPlayer()->CanUseBattlegroundObject(nullptr))
6303 }
6304 else if (m_caster->ToPlayer()->InBattleground() && // In Battleground players can use only flags and banners, or Gurubashi chest
6307 }
6308
6309 // get the lock entry
6310 uint32 lockId = 0;
6311 if (GameObject* go = m_targets.GetGOTarget())
6312 {
6313 lockId = go->GetGOInfo()->GetLockId();
6314 if (!lockId)
6316 }
6317 else if (Item* itm = m_targets.GetItemTarget())
6318 lockId = itm->GetTemplate()->LockID;
6319
6320 SkillType skillId = SKILL_NONE;
6321 int32 reqSkillValue = 0;
6322 int32 skillValue = 0;
6323
6324 // check lock compatibility
6325 SpellCastResult res = CanOpenLock(i, lockId, skillId, reqSkillValue, skillValue);
6326 if (res != SPELL_CAST_OK)
6327 return res;
6328
6329 // chance for fail at lockpicking attempt
6330 // second check prevent fail at rechecks
6331 if (skillId != SKILL_NONE && (!m_selfContainer || ((*m_selfContainer) != this)))
6332 {
6333 // chance for failure in orange lockpick
6334 if (skillId == SKILL_LOCKPICKING && reqSkillValue > irand(skillValue - 25, skillValue + 37))
6335 {
6337 }
6338 }
6339 break;
6340 }
6342 {
6343 Unit* unitCaster = m_caster->ToUnit();
6344 if (!unitCaster)
6345 {
6347 }
6348
6349 Creature* pet = unitCaster->GetGuardianPet();
6350 if (pet)
6351 {
6352 if (pet->IsAlive())
6353 {
6355 }
6356 }
6357 else if (Player* playerCaster = m_caster->ToPlayer())
6358 {
6359 PetStable& petStable = playerCaster->GetOrInitPetStable();
6360 if (!petStable.CurrentPet && petStable.UnslottedPets.empty())
6361 {
6362 return SPELL_FAILED_NO_PET;
6363 }
6364 }
6365
6366 break;
6367 }
6368 // This is generic summon effect
6370 {
6371 SummonPropertiesEntry const* SummonProperties = sSummonPropertiesStore.LookupEntry(m_spellInfo->Effects[i].MiscValueB);
6372 if (!SummonProperties || m_spellInfo->HasAttribute(SPELL_ATTR1_DISMISS_PET_FIRST))
6373 break;
6374 switch (SummonProperties->Category)
6375 {
6377 if (m_caster->GetPetGUID())
6379 [[fallthrough]];
6381 if (m_caster->GetCharmGUID())
6383 break;
6384 }
6385 break;
6386 }
6388 {
6390 {
6395 }
6396 break;
6397 }
6399 {
6400 Unit* unitCaster = m_caster->ToUnit();
6401 if (!unitCaster)
6403
6405 {
6406 if (m_caster->GetPetGUID())
6408 if (m_caster->GetCharmGUID())
6410 }
6411
6412 if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->getClass() == CLASS_WARLOCK && strict)
6413 if (Pet* pet = m_caster->ToPlayer()->GetPet())
6414 pet->CastSpell(pet, 32752, true, nullptr, nullptr, pet->GetGUID()); //starting cast, trigger pet stun (cast by pet so it doesn't attack player)
6415
6416 Player* playerCaster = unitCaster->ToPlayer();
6417 if (playerCaster && playerCaster->GetPetStable())
6418 {
6419 std::pair<PetStable::PetInfo const*, PetSaveMode> info = Pet::GetLoadPetInfo(*playerCaster->GetPetStable(), m_spellInfo->Effects[i].MiscValue, 0, false);
6420 if (info.first)
6421 {
6422 if (info.first->Type == HUNTER_PET)
6423 {
6424 if (!info.first->Health)
6425 {
6426 playerCaster->SendTameFailure(PET_TAME_DEAD);
6428 }
6429
6430 CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(info.first->CreatureId);
6431 if (!creatureInfo || !creatureInfo->IsTameable(playerCaster->CanTameExoticPets()))
6432 {
6433 // if problem in exotic pet
6434 if (creatureInfo && creatureInfo->IsTameable(true))
6436 else
6438
6440 }
6441 }
6442 }
6443 else if (!m_spellInfo->Effects[i].MiscValue) // when miscvalue is present it is allowed to create new pets
6444 {
6447 }
6448 }
6449 break;
6450 }
6452 {
6455 if (!m_caster->GetTarget())
6457
6459 if (!target || m_caster->ToPlayer() == target || (!target->IsInSameRaidWith(m_caster->ToPlayer()) && m_spellInfo->Id != 48955)) // refer-a-friend spell
6461
6462 // Xinef: Implement summon pending error
6463 if (target->GetSummonExpireTimer() > GameTime::GetGameTime().count())
6465
6466 // check if our map is dungeon
6467 MapEntry const* map = sMapStore.LookupEntry(m_caster->GetMapId());
6468 if (map->IsDungeon())
6469 {
6470 uint32 mapId = m_caster->GetMap()->GetId();
6471 Difficulty difficulty = m_caster->GetMap()->GetDifficulty();
6472 /*if (map->IsRaid())
6473 if (InstancePlayerBind* targetBind = target->GetBoundInstance(mapId, difficulty))
6474 if (targetBind->perm && targetBind != m_caster->ToPlayer()->GetBoundInstance(mapId, difficulty))
6475 return SPELL_FAILED_TARGET_LOCKED_TO_RAID_INSTANCE;*/
6476
6477 InstanceTemplate const* instance = sObjectMgr->GetInstanceTemplate(mapId);
6478 if (!instance)
6480 if (!target->Satisfy(sObjectMgr->GetAccessRequirement(mapId, difficulty), mapId))
6482 }
6483 break;
6484 }
6485 // RETURN HERE
6487 {
6490
6491 Player* playerCaster = m_caster->ToPlayer();
6492 //
6493 if (!(playerCaster->GetTarget()))
6495
6497
6498 if (!target ||
6499 !(target->GetSession()->GetRecruiterId() == playerCaster->GetSession()->GetAccountId() || target->GetSession()->GetAccountId() == playerCaster->GetSession()->GetRecruiterId()))
6501
6502 // Xinef: Implement summon pending error
6503 if (target->GetSummonExpireTimer() > GameTime::GetGameTime().count())
6505
6506 break;
6507 }
6508 case SPELL_EFFECT_LEAP:
6510 {
6511 //Do not allow to cast it before BG starts.
6513 if (Battleground const* bg = m_caster->ToPlayer()->GetBattleground())
6514 if (bg->GetStatus() != STATUS_IN_PROGRESS)
6516 break;
6517 }
6519 {
6522
6523 bool found = false;
6525 for(Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin(); itr != visibleAuras->end(); ++itr)
6526 {
6527 if( itr->second->GetBase()->IsPassive() )
6528 continue;
6529
6530 if( !itr->second->IsPositive() )
6531 continue;
6532
6533 found = true;
6534 break;
6535 }
6536
6537 if( !found )
6539
6540 break;
6541 }
6543 {
6545 {
6547 return SPELL_FAILED_ROOTED;
6548 else
6550 }
6551 break;
6552 }
6553 // xinef: do not allow to use leaps while rooted
6554 case SPELL_EFFECT_JUMP:
6556 {
6558 return SPELL_FAILED_ROOTED;
6559 break;
6560 }
6562 if (!sScriptMgr->CanSelectSpecTalent(this))
6564 // can't change during already started arena/battleground
6566 if (Battleground const* bg = m_caster->ToPlayer()->GetBattleground())
6567 if (bg->GetStatus() == STATUS_IN_PROGRESS)
6569 break;
6570 default:
6571 break;
6572 }
6573 }
6574
6575 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
6576 {
6577 switch (m_spellInfo->Effects[i].ApplyAuraName)
6578 {
6579 case SPELL_AURA_DUMMY:
6580 break;
6582 {
6584 return SPELL_FAILED_NO_PET;
6585
6586 Pet* pet = m_caster->ToPlayer()->GetPet();
6587 if (!pet)
6588 return SPELL_FAILED_NO_PET;
6589
6590 if (pet->GetCharmerGUID())
6591 return SPELL_FAILED_CHARMED;
6592 break;
6593 }
6597 {
6598 if (m_caster->GetCharmerGUID())
6599 return SPELL_FAILED_CHARMED;
6600
6601 // Xinef: allow SPELL_AURA_MOD_POSSESS to posses target if caster has some pet
6603 {
6604 if (m_caster->GetPetGUID())
6606
6607 if (m_caster->GetCharmGUID())
6609 }
6610 else if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_POSSESS)
6611 {
6612 if (m_caster->GetCharmGUID())
6614 }
6615
6616 if (Unit* target = m_targets.GetUnitTarget())
6617 {
6618 if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsVehicle())
6620
6621 if (target->IsMounted())
6623
6624 if (target->GetCharmerGUID())
6625 return SPELL_FAILED_CHARMED;
6626
6627 if (target->GetOwnerGUID() && target->GetOwnerGUID().IsPlayer())
6629
6630 if (target->IsPet() && (!target->GetOwner() || target->GetOwner()->ToPlayer()))
6632
6633 int32 damage = CalculateSpellDamage(i, target);
6634 if (damage && int32(target->GetLevel()) > damage)
6636 }
6637
6638 break;
6639 }
6640 case SPELL_AURA_MOUNTED:
6641 {
6642 // Xinef: disallow casting in water for mounts not increasing water movement Speed
6645
6646 // Ignore map check if spell have AreaId. AreaId already checked and this prevent special mount spells
6647 bool allowMount = !m_caster->GetMap()->IsDungeon() || m_caster->GetMap()->IsBattlegroundOrArena();
6648 InstanceTemplate const* it = sObjectMgr->GetInstanceTemplate(m_caster->GetMapId());
6649 if (it)
6650 allowMount = it->AllowMount;
6651 if (m_caster->GetTypeId() == TYPEID_PLAYER && !allowMount && !m_spellInfo->AreaGroupId)
6653
6656
6657 // xinef: dont allow to cast mounts in specific transforms
6658 if (m_caster->getTransForm())
6659 if (SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(m_caster->getTransForm()))
6660 if (transformSpellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) &&
6661 !transformSpellInfo->HasAttribute(SpellAttr0(SPELL_ATTR0_ALLOW_WHILE_MOUNTED | SPELL_ATTR0_AURA_IS_DEBUFF)))
6663
6664 break;
6665 }
6667 {
6668 if (!m_targets.GetUnitTarget())
6670
6671 // can be casted at non-friendly unit or own pet/charm
6674
6675 break;
6676 }
6677 case SPELL_AURA_FLY:
6679 {
6680 // Xinef: added water check
6681 if (m_caster->IsInWater())
6683
6684 // not allow cast fly spells if not have req. skills (all spells is self target)
6685 // allow always ghost flight spells
6687 {
6688 Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(m_originalCaster->GetZoneId());
6689 if (AreaTableEntry const* pArea = sAreaTableStore.LookupEntry(m_originalCaster->GetAreaId()))
6690 if ((pArea->flags & AREA_FLAG_NO_FLY_ZONE) || (Bf && !Bf->CanFlyIn()))
6691 return SPELL_FAILED_NOT_HERE;
6692 }
6693 break;
6694 }
6696 {
6697 if (m_spellInfo->Effects[i].IsTargetingArea())
6698 break;
6699
6701 break;
6702
6703 if (!m_targets.GetUnitTarget())
6705
6708
6709 break;
6710 }
6711 case SPELL_AURA_HOVER:
6712 {
6714 {
6716 }
6717 break;
6718 }
6720 {
6721 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.
6722 {
6724 }
6725 break;
6726 }
6727 default:
6728 break;
6729 }
6730 }
6731
6732 // check trade slot case (last, for allow catch any another cast problems)
6734 {
6735 if (m_CastItem)
6737
6740
6741 TradeData* my_trade = m_caster->ToPlayer()->GetTradeData();
6742
6743 if (!my_trade)
6745
6747 if (slot != TRADE_SLOT_NONTRADED)
6749
6750 if (!IsTriggered())
6751 if (my_trade->GetSpell())
6753 }
6754
6755 // check if caster has at least 1 combo point on target for spells that require combo points
6757 {
6759 {
6761 {
6763 }
6764 }
6765 else
6766 {
6767 if (!m_caster->GetComboPoints())
6768 {
6770 }
6771 }
6772 }
6773
6774 // xinef: check relic cooldown
6778
6779 // all ok
6780 return SPELL_CAST_OK;
6781}
constexpr auto IN_MILLISECONDS
Definition: Common.h:62
constexpr auto MINUTE
Definition: Common.h:56
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:190
@ LINEOFSIGHT_ALL_CHECKS
Definition: Map.h:197
@ 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_MOD_INCREASE_SWIM_SPEED
Definition: SpellAuraDefines.h:121
@ 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:461
@ VEHICLE_SEAT_FLAG_UNCONTROLLED
Definition: DBCEnums.h:462
@ VEHICLE_SEAT_FLAG_CAN_ATTACK
Definition: DBCEnums.h:463
Difficulty
Definition: DBCEnums.h:271
@ AREA_FLAG_NO_FLY_ZONE
Definition: DBCEnums.h:267
@ GAMEOBJECT_TYPE_TRAP
Definition: SharedDefines.h:1538
@ GAMEOBJECT_TYPE_DOOR
Definition: SharedDefines.h:1532
Powers
Definition: SharedDefines.h:240
@ POWER_MANA
Definition: SharedDefines.h:241
@ SPELL_ATTR7_DEBUG_SPELL
Definition: SharedDefines.h:616
@ SPELL_EFFECT_DUMMY
Definition: SharedDefines.h:753
@ SPELL_EFFECT_LEAP
Definition: SharedDefines.h:779
@ SPELL_EFFECT_POWER_BURN
Definition: SharedDefines.h:812
@ SPELL_EFFECT_STUCK
Definition: SharedDefines.h:834
@ SPELL_EFFECT_SUMMON_RAF_FRIEND
Definition: SharedDefines.h:902
@ SPELL_EFFECT_APPLY_GLYPH
Definition: SharedDefines.h:824
@ SPELL_EFFECT_FEED_PET
Definition: SharedDefines.h:851
@ SPELL_EFFECT_SUMMON_PLAYER
Definition: SharedDefines.h:835
@ SPELL_EFFECT_JUMP_DEST
Definition: SharedDefines.h:792
@ SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER
Definition: SharedDefines.h:793
@ SPELL_EFFECT_RESURRECT_PET
Definition: SharedDefines.h:859
@ SPELL_EFFECT_LEAP_BACK
Definition: SharedDefines.h:888
@ SPELL_EFFECT_SUMMON
Definition: SharedDefines.h:778
@ SPELL_EFFECT_POWER_DRAIN
Definition: SharedDefines.h:758
@ SPELL_EFFECT_RESURRECT
Definition: SharedDefines.h:768
@ SPELL_EFFECT_CHARGE
Definition: SharedDefines.h:846
@ SPELL_EFFECT_RESURRECT_NEW
Definition: SharedDefines.h:863
@ SPELL_EFFECT_TALENT_SPEC_SELECT
Definition: SharedDefines.h:912
@ SPELL_EFFECT_LEARN_SPELL
Definition: SharedDefines.h:786
@ SPELL_EFFECT_JUMP
Definition: SharedDefines.h:791
@ SPELL_EFFECT_SKINNING
Definition: SharedDefines.h:845
@ SPELL_EFFECT_CREATE_TAMED_PET
Definition: SharedDefines.h:903
@ SPELL_EFFECT_OPEN_LOCK
Definition: SharedDefines.h:783
@ SPELL_EFFECT_STEAL_BENEFICIAL_BUFF
Definition: SharedDefines.h:876
@ SPELL_EFFECT_LEARN_PET_SPELL
Definition: SharedDefines.h:807
@ SPELL_PREVENTION_TYPE_NONE
Definition: SharedDefines.h:1525
@ SPELL_ATTR5_ALWAYS_AOE_LINE_OF_SIGHT
Definition: SharedDefines.h:565
@ TARGET_UNIT_PET
Definition: SharedDefines.h:1386
@ TARGET_GAMEOBJECT_TARGET
Definition: SharedDefines.h:1399
@ SPELL_ATTR2_IGNORE_LINE_OF_SIGHT
Definition: SharedDefines.h:430
@ SPELL_ATTR1_INITIATE_COMBAT
Definition: SharedDefines.h:400
@ SPELL_ATTR3_ONLY_BATTLEGROUNDS
Definition: SharedDefines.h:476
@ PET_TAME_NOPET_AVAILABLE
Definition: SharedDefines.h:3655
@ PET_TAME_DEAD
Definition: SharedDefines.h:3658
@ PET_TAME_CANT_CONTROL_EXOTIC
Definition: SharedDefines.h:3660
@ CLASS_WARLOCK
Definition: SharedDefines.h:121
@ IMMUNITY_MECHANIC
Definition: SharedDefines.h:1371
@ SPELLFAMILY_WARRIOR
Definition: SharedDefines.h:3504
@ SPELLFAMILY_DEATHKNIGHT
Definition: SharedDefines.h:3515
SpellCustomErrors
Definition: SharedDefines.h:1114
@ SPELL_CUSTOM_ERROR_GM_ONLY
Definition: SharedDefines.h:1180
SpellAttr0
Definition: SharedDefines.h:353
@ SPELL_ATTR0_ONLY_INDOORS
Definition: SharedDefines.h:368
@ SPELL_ATTR0_AURA_IS_DEBUFF
Definition: SharedDefines.h:380
@ SPELL_ATTR0_ONLY_OUTDOORS
Definition: SharedDefines.h:369
@ SPELL_ATTR0_ALLOW_WHILE_MOUNTED
Definition: SharedDefines.h:378
@ SPELL_ATTR0_PASSIVE
Definition: SharedDefines.h:360
@ SPELL_ATTR0_ALLOW_CAST_WHILE_DEAD
Definition: SharedDefines.h:377
@ SPELL_ATTR0_ONLY_STEALTHED
Definition: SharedDefines.h:371
AuraStateType
Definition: SharedDefines.h:1260
DispelType
Definition: SharedDefines.h:1343
@ SPELL_FAILED_TARGET_NOT_LOOTED
Definition: SharedDefines.h:1042
@ SPELL_FAILED_NOT_INFRONT
Definition: SharedDefines.h:982
@ SPELL_FAILED_MOVING
Definition: SharedDefines.h:972
@ SPELL_FAILED_NOT_MOUNTED
Definition: SharedDefines.h:985
@ SPELL_FAILED_AFFECTING_COMBAT
Definition: SharedDefines.h:922
@ SPELL_FAILED_CASTER_AURASTATE
Definition: SharedDefines.h:943
@ SPELL_FAILED_NOTHING_TO_DISPEL
Definition: SharedDefines.h:1007
@ SPELL_FAILED_NOT_KNOWN
Definition: SharedDefines.h:984
@ SPELL_FAILED_FOOD_LOWLEVEL
Definition: SharedDefines.h:956
@ SPELL_FAILED_NOT_HERE
Definition: SharedDefines.h:981
@ SPELL_FAILED_ROOTED
Definition: SharedDefines.h:1024
@ SPELL_FAILED_TARGET_NOT_DEAD
Definition: SharedDefines.h:1040
@ SPELL_FAILED_WRONG_PET_FOOD
Definition: SharedDefines.h:1056
@ SPELL_FAILED_CUSTOM_ERROR
Definition: SharedDefines.h:1093
@ SPELL_FAILED_SUMMON_PENDING
Definition: SharedDefines.h:1104
@ SPELL_FAILED_DAMAGE_IMMUNE
Definition: SharedDefines.h:1067
@ SPELL_FAILED_BAD_IMPLICIT_TARGETS
Definition: SharedDefines.h:932
@ SPELL_FAILED_TRY_AGAIN
Definition: SharedDefines.h:1053
@ SPELL_FAILED_NO_COMBO_POINTS
Definition: SharedDefines.h:999
@ SPELL_FAILED_ALREADY_HAVE_SUMMON
Definition: SharedDefines.h:928
@ SPELL_FAILED_ALREADY_OPEN
Definition: SharedDefines.h:929
@ SPELL_FAILED_NOT_TRADING
Definition: SharedDefines.h:992
@ SPELL_FAILED_NOTHING_TO_STEAL
Definition: SharedDefines.h:1008
@ SPELL_FAILED_NO_MOUNTS_ALLOWED
Definition: SharedDefines.h:1004
@ SPELL_FAILED_NOT_IN_BATTLEGROUND
Definition: SharedDefines.h:1087
@ SPELL_FAILED_NOT_BEHIND
Definition: SharedDefines.h:978
@ SPELL_FAILED_ALREADY_HAVE_CHARM
Definition: SharedDefines.h:927
@ SPELL_FAILED_TARGET_NOT_IN_INSTANCE
Definition: SharedDefines.h:1058
@ SPELL_FAILED_HIGHLEVEL
Definition: SharedDefines.h:957
@ SPELL_FAILED_LOWLEVEL
Definition: SharedDefines.h:969
@ SPELL_FAILED_NOT_READY
Definition: SharedDefines.h:988
@ SPELL_FAILED_ONLY_BATTLEGROUNDS
Definition: SharedDefines.h:1063
@ SPELL_FAILED_NOT_IN_ARENA
Definition: SharedDefines.h:1072
@ SPELL_FAILED_ITEM_ALREADY_ENCHANTED
Definition: SharedDefines.h:963
@ SPELL_FAILED_ONLY_STEALTHED
Definition: SharedDefines.h:1016
@ SPELL_FAILED_TARGET_IS_PLAYER_CONTROLLED
Definition: SharedDefines.h:1039
@ SPELL_FAILED_ONLY_ABOVEWATER
Definition: SharedDefines.h:1009
@ SPELL_FAILED_CANT_BE_CHARMED
Definition: SharedDefines.h:934
@ SPELL_FAILED_CASTER_DEAD
Definition: SharedDefines.h:944
@ SPELL_FAILED_NOT_ON_MOUNTED
Definition: SharedDefines.h:1076
@ SPELL_FAILED_ITEM_ENCHANT_TRADE_WINDOW
Definition: SharedDefines.h:1103
@ SPELL_FAILED_TARGET_CANNOT_BE_RESURRECTED
Definition: SharedDefines.h:1107
@ SPELL_FAILED_TARGET_UNSKINNABLE
Definition: SharedDefines.h:1047
@ SPELL_FAILED_NOT_SHAPESHIFT
Definition: SharedDefines.h:989
@ SPELL_FAILED_UNIQUE_GLYPH
Definition: SharedDefines.h:1097
@ SPELL_FAILED_ONLY_OUTDOORS
Definition: SharedDefines.h:1014
@ SPELL_FAILED_CHARMED
Definition: SharedDefines.h:945
@ SPELL_FAILED_LINE_OF_SIGHT
Definition: SharedDefines.h:968
@ SPELL_FAILED_SPELL_IN_PROGRESS
Definition: SharedDefines.h:1026
@ SPELL_FAILED_NO_PET
Definition: SharedDefines.h:1005
@ SPELL_FAILED_NOPATH
Definition: SharedDefines.h:977
@ SPELL_FAILED_SPELL_UNAVAILABLE
Definition: SharedDefines.h:1028
@ SPELL_FAILED_ONLY_INDOORS
Definition: SharedDefines.h:1011
@ SPELL_FAILED_NOT_ON_TAXI
Definition: SharedDefines.h:986
@ SPELL_FAILED_TARGET_FRIENDLY
Definition: SharedDefines.h:1036
@ SPELL_ATTR4_IGNORE_DEFAULT_ARENA_RESTRICTIONS
Definition: SharedDefines.h:519
@ SPELL_ATTR4_NOT_IN_ARENA_OR_RATED_BATTLEGROUND
Definition: SharedDefines.h:518
@ SUMMON_CATEGORY_PET
Definition: SharedDefines.h:3257
@ SUMMON_CATEGORY_PUPPET
Definition: SharedDefines.h:3258
SkillType
Definition: SharedDefines.h:2835
@ SPELL_ATTR6_ALLOW_WHILE_RIDING_VEHICLE
Definition: SharedDefines.h:588
bool IsPathfindingEnabled(const Map *map)
Definition: DisableMgr.cpp:411
Player * FindPlayer(ObjectGuid const guid)
Definition: ObjectAccessor.cpp:250
Seconds GetGameTime()
Definition: GameTime.cpp:38
Definition: Battlefield.h:205
bool CanFlyIn()
Return if we can use mount in battlefield.
Definition: Battlefield.h:341
Definition: Battleground.h:293
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:218
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:197
bool IsSpellProhibited(SpellSchoolMask idSchoolMask) const
Definition: Creature.cpp:2740
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:546
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:3100
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:3083
uint32 GetZoneId() const
Definition: Object.cpp:3075
void GetZoneAndAreaId(uint32 &zoneid, uint32 &areaid) const
Definition: Object.cpp:3091
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:2436
bool HaveInDiet(ItemTemplate const *item) const
Definition: Pet.cpp:1401
uint32 GetCurrentFoodBenefitLevel(uint32 itemlevel) const
Definition: Pet.cpp:1419
static std::pair< PetStable::PetInfo const *, PetSaveMode > GetLoadPetInfo(PetStable const &stable, uint32 petEntry, uint32 petnumber, bool current)
Definition: Pet.cpp:162
Definition: PetDefines.h:197
Optional< PetInfo > CurrentPet
Definition: PetDefines.h:220
std::vector< PetInfo > UnslottedPets
Definition: PetDefines.h:223
void SetCanTeleport(bool value)
Definition: Player.h:2448
bool IsInSameRaidWith(Player const *p) const
Definition: Player.h:1836
bool CanTameExoticPets() const
Definition: Player.h:2138
bool CanUseBattlegroundObject(GameObject *gameobject) const
Definition: Player.cpp:13112
bool InBattleground() const
Definition: Player.h:2201
PetStable * GetPetStable()
Definition: Player.h:1178
Battleground * GetBattleground(bool create=false) const
Definition: Player.cpp:12097
WorldSession * GetSession() const
Definition: Player.h:1948
bool HasSpellCooldown(uint32 spell_id) const override
Definition: Player.cpp:16214
uint32 GetLastPotionId()
Definition: Player.h:1762
Group * GetGroup()
Definition: Player.h:2418
bool IsGameMaster() const
Definition: Player.h:1136
time_t GetSummonExpireTimer() const
Definition: Player.h:1083
bool Satisfy(DungeonProgressionRequirements const *ar, uint32 target_map, bool report=false)
Definition: PlayerStorage.cpp:6727
bool HasPlayerFlag(PlayerFlags flags) const
Definition: Player.h:1090
std::unique_ptr< DuelInfo > duel
Definition: Player.h:1828
Item * GetItemByGuid(ObjectGuid guid) const
Definition: PlayerStorage.cpp:438
uint32 GetSpell() const
Definition: TradeData.h:49
bool IsVehicle() const
Definition: Unit.h:1416
Vehicle * GetVehicle() const
Definition: Unit.h:2354
Unit * GetOwner() const
Definition: Unit.cpp:10560
Pet * ToPet()
Definition: Unit.h:2398
virtual bool HasSpellCooldown(uint32) const
Definition: Unit.h:2418
ShapeshiftForm GetShapeshiftForm() const
Definition: Unit.h:2071
virtual bool HasSpellItemCooldown(uint32, uint32) const
Definition: Unit.h:2419
bool IsInDisallowedMountForm() const
Definition: Unit.cpp:21407
void CombatStart(Unit *target, bool initialAggro=true)
Definition: Unit.cpp:13536
bool HasUnitFlag2(UnitFlags2 flags) const
Definition: Unit.h:1486
bool IsInSanctuary() const
Definition: Unit.h:1516
uint8 getClass() const
Definition: Unit.h:1426
AuraEffect * IsScriptOverriden(SpellInfo const *spell, int32 script) const
Definition: Unit.cpp:5721
float GetCombatReach() const override
Definition: Unit.h:1347
UnitFlags GetUnitFlags() const
Definition: Unit.h:1479
TempSummon * ToTempSummon()
Definition: Unit.h:2400
bool HasStealthAura() const
Definition: Unit.h:1706
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5610
std::map< uint8, AuraApplication * > VisibleAuraMap
Definition: Unit.h:1312
bool IsInFlight() const
Definition: Unit.h:1676
SpellImmuneList m_spellImmune[MAX_SPELL_IMMUNITY]
Definition: Unit.h:2136
void SendTameFailure(uint8 result)
Definition: Unit.cpp:20168
bool HasUnitMovementFlag(uint32 f) const
Definition: Unit.h:2274
virtual bool IsInWater() const
Definition: Unit.cpp:4279
bool HasAuraState(AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
Definition: Unit.cpp:10507
bool isMoving() const
Definition: Unit.h:2380
ObjectGuid GetCharmGUID() const
Definition: Unit.h:1822
VisibleAuraMap const * GetVisibleAuras()
Definition: Unit.h:2151
bool IsMounted() const
Definition: Unit.h:1542
Unit * GetVictim() const
Definition: Unit.h:1386
bool IsCritter() const
Definition: Unit.h:1674
ObjectGuid GetOwnerGUID() const
Definition: Unit.h:1814
uint8 GetComboPoints(Unit const *who=nullptr) const
--------—Combo point system----------------—
Definition: Unit.h:2290
ObjectGuid GetCharmerGUID() const
Definition: Unit.h:1820
uint32 getTransForm() const
Definition: Unit.h:2174
Powers getPowerType() const
Definition: Unit.h:1459
void RemoveMovementImpairingAuras(bool withRoot)
Definition: Unit.cpp:5149
bool IsTotem() const
Definition: Unit.h:1415
Guardian * GetGuardianPet() const
Definition: Unit.cpp:10611
ObjectGuid GetTarget() const
Definition: Unit.h:2433
bool IsInCombat() const
Definition: Unit.h:1688
ObjectGuid GetPetGUID() const
Definition: Unit.h:1824
Definition: Vehicle.h:30
VehicleSeatEntry const * GetSeatForPassenger(Unit const *passenger)
Definition: Vehicle.cpp:585
Definition: Group.h:168
Definition: GroupReference.h:27
GroupReference * next()
Definition: GroupReference.h:36
Definition: InstanceScript.h:140
bool isLooted() const
Definition: LootMgr.h:368
Definition: Map.h:273
bool AllowMount
Definition: Map.h:276
bool IsDungeon() const
Definition: Map.h:447
bool IsBattlegroundOrArena() const
Definition: Map.h:455
GameObject * GetGameObject(ObjectGuid const guid)
Definition: Map.cpp:3298
uint32 GetId() const
Definition: Map.h:378
Difficulty GetDifficulty() const
Definition: Map.h:442
uint32 GetRecruiterId() const
Definition: WorldSession.h:524
uint32 GetAccountId() const
Definition: WorldSession.h:360
GameObject * GetGOTarget() const
Definition: Spell.cpp:258
ObjectGuid GetItemTargetGUID() const
Definition: Spell.h:138
std::unique_ptr< PathGenerator > m_preGeneratedPath
Definition: Spell.h:775
SpellCastResult CheckSpellFocus()
Definition: Spell.cpp:7715
SpellCastResult CanOpenLock(uint32 effIndex, uint32 lockid, SkillType &skillid, int32 &reqSkillValue, int32 &skillValue)
Definition: Spell.cpp:8318
SpellCastResult CheckItems()
Definition: Spell.cpp:7147
int32 CalculateSpellDamage(uint8 i, Unit const *target) const
Definition: Spell.h:477
SpellCastResult CheckPower()
Definition: Spell.cpp:7102
SpellCastResult CheckCasterAuras(bool preventionOnly) const
Definition: Spell.cpp:6819
SpellCastResult CallScriptCheckCastHandlers()
Definition: Spell.cpp:8517
bool IsTriggered() const
Definition: Spell.h:552
SpellCastResult CheckRange(bool strict)
Definition: Spell.cpp:7016
bool HasGlobalCooldown() const
Definition: Spell.cpp:8789
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:1418
uint32 Mechanic
Definition: SpellInfo.h:321
uint32 GetDispelMask() const
Definition: SpellInfo.cpp:2026
uint32 GetRecoveryTime() const
Definition: SpellInfo.cpp:2379
bool IsSelfCast() const
Definition: SpellInfo.cpp:1074
uint32 CasterAuraState
Definition: SpellInfo.h:337
bool CanBeUsedInCombat() const
Definition: SpellInfo.cpp:1216
uint32 CasterAuraStateNot
Definition: SpellInfo.h:339
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:1972
int32 AreaGroupId
Definition: SpellInfo.h:389
float GetMaxRange(bool positive=false, Unit *caster=nullptr, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:2306
uint32 GetExplicitTargetMask() const
Definition: SpellInfo.cpp:2040
bool NeedsExplicitUnitTarget() const
Definition: SpellInfo.cpp:1017
SpellCastResult CheckLocation(uint32 map_id, uint32 zone_id, uint32 area_id, Player const *player=nullptr, bool strict=true) const
Definition: SpellInfo.cpp:1473
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:1922
Definition: DBCStructure.h:519
Definition: DBCStructure.h:1012
Definition: DBCStructure.h:1308
bool IsDungeon() const
Definition: DBCStructure.h:1334
Definition: DBCStructure.h:1792
uint32 flags1
Definition: DBCStructure.h:1797
Definition: DBCStructure.h:1885
uint32 Category
Definition: DBCStructure.h:1887
Definition: DBCStructure.h:2040
uint32 m_flags
Definition: DBCStructure.h:2042

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_LOCKPICKING, 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_INCREASE_SWIM_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_DUMMY, 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_DEAD, 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_DEATHKNIGHT, 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
6820{
6821 // spells totally immuned to caster auras (wsg flag drop, give marks etc)
6823 return SPELL_CAST_OK;
6824
6825 uint8 school_immune = 0;
6826 uint32 mechanic_immune = 0;
6827 uint32 dispe