32 struct SpellCastRequest;
33 struct SpellTargetData;
47 #define SPELL_CHANNEL_UPDATE_INTERVAL (1 * IN_MILLISECONDS)
122 SpellDestination(
Position const& pos);
126 void RelocateOffset(
Position const& offset);
185 void SetOrigUnitTarget(
Unit* target);
188 Unit* GetUnitTarget()
const;
189 void SetUnitTarget(
Unit* target);
196 Corpse* GetCorpseTarget()
const;
200 void RemoveObjectTarget();
205 void SetItemTarget(
Item* item);
206 void SetTradeItemTarget(
Player* caster);
207 void UpdateTradeSlotItem();
211 void SetSrc(
float x,
float y,
float z);
237 float GetDist2d()
const {
return m_src._position.GetExactDist2d(&m_dst._position); }
238 float GetSpeedXY()
const {
return m_speed * std::cos(m_pitch); }
239 float GetSpeedZ()
const {
return m_speed * std::sin(m_pitch); }
242 void OutDebug()
const;
414 void EffectGameObjectSetDestructionState(
SpellEffIndex effIndex);
449 void SelectExplicitTargets();
451 void SelectSpellTargets();
465 void SelectEffectTypeImplicitTargets(
uint32 effIndex);
468 template<
class SEARCHER>
void SearchTargets(SEARCHER& searcher,
uint32 containerMask,
Unit* referer,
Position const* pos,
float radius);
478 void update(
uint32 difftime);
479 void cast(
bool skipCheck =
false);
480 void finish(
bool ok =
true);
483 void TakeRunePower(
bool didHit);
491 void handle_immediate();
494 void _handle_immediate_phase();
495 void _handle_finish_phase();
504 int32 CalculateDamage(
uint8 i,
Unit const* target,
float*
var =
nullptr)
const {
return m_caster->CalculateSpellDamage(target, m_spellInfo, i, &m_spellValue->EffectBasePoints[i],
var, m_castItemLevel); }
506 bool HaveTargetsForEffect(
uint8 effect)
const;
508 void DelayedChannel();
512 void DoCreateItem(
uint32 i,
uint32 itemtype, std::vector<int32>
const& bonusListIDs = std::vector<int32>());
517 bool CanAutoCast(
Unit* target);
518 void CheckSrc() {
if (!m_targets.HasSrc()) m_targets.SetSrc(*m_caster); }
519 void CheckDst() {
if (!m_targets.HasDst()) m_targets.SetDst(*m_caster); }
524 void SendSpellStart();
526 void SendSpellCooldown();
527 void SendSpellExecuteLog();
528 void ExecuteLogEffectTakeTargetPower(
uint8 effIndex,
Unit* target,
uint32 powerType,
uint32 points,
float amplitude);
529 void ExecuteLogEffectExtraAttacks(
uint8 effIndex,
Unit* victim,
uint32 numAttacks);
530 void ExecuteLogEffectInterruptCast(
uint8 effIndex,
Unit* victim,
uint32 spellId);
531 void ExecuteLogEffectDurabilityDamage(
uint8 effIndex,
Unit* victim,
int32 itemId,
int32 amount);
532 void ExecuteLogEffectOpenLock(
uint8 effIndex,
Object* obj);
533 void ExecuteLogEffectCreateItem(
uint8 effIndex,
uint32 entry);
534 void ExecuteLogEffectDestroyItem(
uint8 effIndex,
uint32 entry);
537 void ExecuteLogEffectResurrect(
uint8 effIndex,
Unit* target);
538 void CleanupExecuteLogList();
539 void SendInterrupted(
uint8 result);
540 void SendChannelUpdate(
uint32 time);
541 void SendChannelStart(
uint32 duration);
542 void SendResurrectRequest(
Player* target);
545 void HandleThreatSpells();
593 void ReSetTimer() { m_timer = m_casttime > 0 ? m_casttime : 0; }
594 bool IsNextMeleeSwingSpell()
const;
598 bool IsAutoActionResetSpell()
const;
600 bool IsDeletable()
const {
return !m_referencedFromCurrentSpell && !m_executedCurrently; }
608 bool IsNeedSendToClient()
const;
615 std::vector<SpellInfo::CostData>
GetPowerCost()
const {
return m_powerCost; }
617 bool UpdatePointers();
619 void CleanupTargetList();
626 if (index >= _effects.size())
629 return _effects[index];
641 bool HasGlobalCooldown()
const;
642 void TriggerGlobalCooldown();
643 void CancelGlobalCooldown();
670 if (m_delayAtDamageCount >= 2)
673 m_delayAtDamageCount++;
687 float m_damageMultipliers[3];
718 void prepareDataForTriggerSystem(
AuraEffect const* triggeredByAura);
760 void AddUnitTarget(
Unit* target,
uint32 effectMask,
bool checkIfValid =
true,
bool implicit =
true,
Position const* losPosition =
nullptr);
762 void AddItemTarget(
Item* item,
uint32 effectMask);
767 void DoTriggersOnSpellHit(
Unit* unit,
uint8 effMask);
770 bool UpdateChanneledTargetList();
771 bool IsValidDeadOrAliveTarget(
Unit const* target)
const;
772 void HandleLaunchPhase();
773 void DoAllEffectOnLaunchTarget(
TargetInfo& targetInfo,
float* multiplier);
775 void PrepareTargetProcessing();
776 void FinishTargetProcessing();
780 void CallScriptBeforeCastHandlers();
781 void CallScriptOnCastHandlers();
782 void CallScriptAfterCastHandlers();
784 void PrepareScriptHitHandlers();
787 void CallScriptBeforeHitHandlers();
788 void CallScriptOnHitHandlers();
789 void CallScriptAfterHitHandlers();
793 bool CheckScriptEffectImplicitTargets(
uint32 effIndex,
uint32 effIndexToCheck);
804 bool CanExecuteTriggersOnHit(
uint8 effMask,
SpellInfo const* triggeredByAura =
NULL)
const;
805 void PrepareTriggersExecutedOnHit();
811 void CalculateJumpSpeeds(
SpellEffectInfo const* effInfo,
float dist,
float& speedxy,
float& speedz);
839 #ifdef MAP_BASED_RAND_GEN
bool isDelayableNoMore()
Definition: Spell.h:668
GameObject * focusObject
Definition: Spell.h:706
Definition: SpellAuraEffects.h:30
uint32 m_itemTargetEntry
Definition: Spell.h:256
GameObject * gameObjTarget
Definition: Spell.h:692
SpellInfo const *const m_spellInfo
Definition: Spell.h:547
Unit *const m_caster
Definition: Spell.h:647
uint32 m_spellState
Definition: Spell.h:818
SpellInfo const * _spellInfo
Definition: Spell.h:859
Difficulty
Definition: DBCEnums.h:402
std::vector< SpellInfo::CostData > GetPowerCost() const
Definition: Spell.h:615
uint64 timeDelay
Definition: Spell.h:729
Definition: Position.h:228
SpellEffectInfo const * effectInfo
Definition: Spell.h:697
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
Definition: ByteBuffer.h:70
float _range
Definition: Spell.h:881
int8_t int8
Definition: Define.h:148
static void var(TextOutput &t, const std::string &name, const std::string &val)
Definition: System.cpp:1582
Position _transportOffset
Definition: Spell.h:130
bool processed
Definition: Spell.h:747
SpellCastFlags
Definition: Spell.h:49
uint32 m_channelTargetEffectMask
Definition: Spell.h:740
Map * GetMap() const
Definition: Object.h:543
int32 m_casttime
Definition: Spell.h:660
DiminishingLevels m_diminishLevel
Definition: Spell.h:702
int8 m_comboPointGain
Definition: Spell.h:585
void SetCurrentCastSpell(Spell *pSpell)
Definition: Unit.cpp:2773
bool m_canReflect
Definition: Spell.h:662
CurrentSpellTypes
Definition: Unit.h:1106
Points
Definition: ScriptedEscortAI.cpp:31
SpellInfo const * GetTriggeredByAuraSpell() const
Definition: Spell.h:636
SpellSchoolMask
Definition: SharedDefines.h:285
SpellCastFlagsEx
Definition: Spell.h:86
SpellCustomErrors
Definition: SharedDefines.h:1541
Definition: SpellInfo.h:326
SpellDestination m_src
Definition: Spell.h:258
Unit * GetCaster() const
Definition: Spell.h:612
~TargetInfo()
Definition: Spell.h:727
Unit * _caster
Definition: Spell.h:857
float Amplitude
Definition: Spell.h:139
uint32 getState() const
Definition: Spell.h:509
float m_speed
Definition: Spell.h:261
uint64 m_delayStart
Definition: Spell.h:678
SpellCastTargets m_targets
Definition: Spell.h:584
UsedSpellMods m_appliedMods
Definition: Spell.h:588
WorldLocation _position
Definition: Spell.h:128
Position const * _position
Definition: Spell.h:882
Spells
Definition: BattlegroundIC.h:707
std::list< SpellScript * > m_loadedScripts
Definition: Spell.h:794
uint32 MaxAffectedTargets
Definition: Spell.h:269
Item * GetItemTarget() const
Definition: Spell.h:203
void(Spell::* pEffect)(SpellEffIndex effIndex)
Definition: Spell.h:903
Definition: SpellInfo.h:53
uint32 m_SpellVisual
Definition: Spell.h:582
SpellInfo const * m_triggeredByAuraSpell
Definition: Spell.h:826
SpellValueMod
Definition: Unit.h:127
int32 CalculateDamage(uint8 i, Unit const *target, float *var=nullptr) const
Definition: Spell.h:504
ObjectGuid Victim
Definition: Spell.h:136
Definition: SpellScript.h:152
SpellEffectName
Definition: SharedDefines.h:1009
uint32 effectMask
Definition: Spell.h:732
Position const * _position
Definition: Spell.h:873
bool IsAutoRepeat() const
Definition: Spell.h:591
SpellTargetObjectTypes
Definition: SpellInfo.h:102
DiminishingGroup
Definition: SharedDefines.h:4369
ObjectGuid m_objectTargetGUID
Definition: Spell.h:254
bool m_skipCheck
Definition: Spell.h:828
bool IsInterruptable() const
Definition: Spell.h:602
void setState(uint32 state)
Definition: Spell.h:510
SpellEffectInfo const * GetEffect(uint32 index) const
Definition: Spell.h:624
uint32 ItemId
Definition: Spell.h:575
float GetDist2d() const
Definition: Spell.h:237
arena_t NULL
Definition: jemalloc_internal.h:624
virtual void Abort(uint64)
Definition: EventProcessor.h:46
Will ignore most target checks (mostly DBC target checks)
Definition: Unit.h:479
uint32 m_castItemEntry
Definition: Spell.h:550
WorldLocation * destTarget
Definition: Spell.h:693
ObjectGuid targetGUID
Definition: Spell.h:744
SpellEffectHandleMode
Definition: Spell.h:284
int32 ItemID
Definition: Spell.h:167
int32 m_timer
Definition: Spell.h:819
bool m_immediateHandled
Definition: Spell.h:680
Item * m_CastItem
Definition: Spell.h:548
bool IsChannelActive() const
Definition: Spell.h:597
SpellValue *const m_spellValue
Definition: Spell.h:649
Will ignore GCD.
Definition: Unit.h:462
ObjectGuid targetGUID
Definition: Spell.h:728
bool HasSrc() const
Definition: Spell.h:228
std::string GetTargetString() const
Definition: Spell.h:243
int32 GetTimer() const
Definition: Spell.h:638
uint32 m_auraScaleMask
Definition: Spell.h:829
Definition: Opcodes.h:872
void CheckSrc()
Definition: Spell.h:518
double rand_chance()
Definition: Random.cpp:74
T max(const T &x, const T &y)
Definition: g3dmath.h:320
ObjectGuid m_origObjectTargetGUID
Definition: Spell.h:253
uint64 GetDelayMoment() const
Definition: Spell.h:606
void SetExecutedCurrently(bool yes)
Definition: Spell.h:603
uint32 m_procVictim
Definition: Spell.h:716
SpellInfo const * triggeredSpell
Definition: Spell.h:798
bool m_autoRepeat
Definition: Spell.h:663
SpellEffectInfoVector _effects
Definition: Spell.h:850
bool HasTraj() const
Definition: Spell.h:230
Definition: SharedDefines.h:1543
float _range
Definition: Spell.h:872
Aura * m_spellAura
Definition: Spell.h:699
int32 irand(int32 min, int32 max)
Definition: Random.cpp:39
Definition: DynamicObject.h:35
void SetPitch(float pitch)
Definition: Spell.h:233
ObjectGuid Victim
Definition: Spell.h:150
std::vector< TargetInfo > m_UniqueTargetInfo
Definition: Spell.h:739
SpellDestination m_dst
Definition: Spell.h:259
T min(const T &x, const T &y)
Definition: g3dmath.h:305
SpellInfo const * triggeredByAura
Definition: Spell.h:799
uint8 AuraStackAmount
Definition: Spell.h:271
std::vector< SpellEffectInfo const * > SpellEffectInfoVector
Definition: SpellInfo.h:315
std::vector< ItemTargetInfo > m_UniqueItemInfo
Definition: Spell.h:756
Unit * unitTarget
Definition: Spell.h:690
ObjectGuid _transportGUID
Definition: Spell.h:129
Unit * m_originalCaster
Definition: Spell.h:653
int32 damage
Definition: Spell.h:694
Item * m_itemTarget
Definition: Spell.h:250
ObjectGuid m_castItemGUID
Definition: Spell.h:549
bool HasDst() const
Definition: Spell.h:229
PathGenerator m_preGeneratedPath
Definition: Spell.h:830
LootType
Definition: LootMgr.h:86
OpcodeServer
Definition: Opcodes.h:725
ConditionSourceInfo * _condSrcInfo
Definition: Spell.h:861
G3D::int16 z
Definition: Vector3int16.h:46
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
HitTriggerSpellList m_hitTriggerSpells
Definition: Spell.h:807
TriggerCastFlags
Definition: Unit.h:458
int32 ItemID
Definition: Spell.h:162
Unit * GetOriginalCaster() const
Definition: Spell.h:613
uint64 m_delayMoment
Definition: Spell.h:679
uint32 GetItemTargetEntry() const
Definition: Spell.h:204
SpellEffIndex
Definition: SharedDefines.h:26
bool IsTriggered() const
Definition: Spell.h:595
Definition: SpellInfo.h:238
uint32 AbilityId
Definition: Spell.h:568
Vector2int16 & operator=(const Any &a)
int32_t int32
Definition: Define.h:146
uint32 m_targetMask
Definition: Spell.h:246
uint32_t uint32
Definition: Define.h:150
uint32 m_procAttacker
Definition: Spell.h:715
uint64_t uint64
Definition: Define.h:149
int32 Amount
Definition: Spell.h:152
std::set< Aura * > UsedSpellMods
Definition: Spell.h:443
G3D::int16 y
Definition: Vector2int16.h:38
Definition: ConditionMgr.h:181
uint64 GetDelayStart() const
Definition: Spell.h:604
SpellInfo const * GetSpellInfo() const
Definition: Spell.h:614
Item * itemTarget
Definition: Spell.h:691
Definition: GameObject.h:880
SpellMissInfo
Definition: SharedDefines.h:2019
uint32 m_preCastSpell
Definition: Spell.h:583
Definition: SpellPackets.h:223
int32 damage
Definition: Spell.h:737
int32 m_damage
Definition: Spell.h:709
Definition: PathGenerator.h:52
SpellEffectInfoVector const & GetEffects() const
Definition: Spell.h:623
int32 chance
Definition: Spell.h:801
bool m_isDelayedInstantCast
Definition: Spell.h:664
float GetSpeed() const
Definition: Spell.h:234
float variance
Definition: Spell.h:695
DiminishingLevels
Definition: SharedDefines.h:4874
Definition: SpellInfo.h:54
WeaponAttackType m_attackType
Definition: Spell.h:657
Unit * _referer
Definition: Spell.h:858
std::vector< SpellInfo::CostData > m_powerCost
Definition: Spell.h:659
int32 ItemID
Definition: Spell.h:151
uint32 m_procEx
Definition: Spell.h:717
virtual bool Execute(uint64, uint32)
Definition: EventProcessor.h:42
Definition: BattlegroundMgr.h:57
uint32 effectMask
Definition: Spell.h:746
void ReSetTimer()
Definition: Spell.h:593
std::list< HitTriggerSpell > HitTriggerSpellList
Definition: Spell.h:806
ObjectGuid m_originalCasterGUID
Definition: Spell.h:651
Definition: SpellInfo.h:207
void SetSpeed(float speed)
Definition: Spell.h:235
std::vector< GOTargetInfo > m_UniqueGOTargetInfo
Definition: Spell.h:749
Definition: EventProcessor.h:28
void SetTargetMask(uint32 newMask)
Definition: Spell.h:180
void SetDelayStart(uint64 m_time)
Definition: Spell.h:605
bool IsDeletable() const
Definition: Spell.h:600
bool m_executedCurrently
Definition: Spell.h:684
ObjectGuid Victim
Definition: Spell.h:157
double rand_norm()
Definition: Random.cpp:69
uint32 GetTargetMask() const
Definition: Spell.h:179
void SetTargetFlag(SpellCastTargetFlags flag)
Definition: Spell.h:182
void CheckDst()
Definition: Spell.h:519
std::list< std::pair< uint32, ObjectGuid > > DispelList
Definition: Spell.h:292
#define TC_GAME_API
Definition: Define.h:134
uint8 m_runesState
Definition: Spell.h:665
float GetSpeedZ() const
Definition: Spell.h:239
float RadiusMod
Definition: Spell.h:270
SpellRangeFlag
Definition: Spell.h:111
int32_t int32
Definition: g3dmath.h:167
uint8 m_applyMultiplierMask
Definition: Spell.h:686
uint32 rand32()
Definition: Random.cpp:64
ObjectGuid GetItemTargetGUID() const
Definition: Spell.h:202
ObjectGuid m_itemTargetGUID
Definition: Spell.h:255
Definition: SpellPackets.h:247
uint32 m_castFlagsEx
Definition: Spell.h:553
uint8_t uint8
Definition: Define.h:152
SpellValue(Difficulty diff, SpellInfo const *proto)
Definition: Spell.cpp:487
Definition: Position.h:27
#define MAPID_INVALID
Definition: Position.h:226
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1026
uint64 timeDelay
Definition: Spell.h:745
int32 EffectBasePoints[MAX_SPELL_EFFECTS]
Definition: Spell.h:268
uint8 m_delayAtDamageCount
Definition: Spell.h:667
Definition: UpdateFields.h:93
Item * item
Definition: Spell.h:753
SpellSchoolMask m_spellSchoolMask
Definition: Spell.h:656
WorldObject * m_objectTarget
Definition: Spell.h:249
Spell * m_Spell
Definition: Spell.h:915
SpellCastResult
Definition: SharedDefines.h:1265
int32 m_channeledDuration
Definition: Spell.h:661
SkillType
Definition: SharedDefines.h:3881
const FieldDescriptor value
Definition: descriptor.h:1522
DiminishingGroup m_diminishGroup
Definition: Spell.h:703
int32 m_castItemLevel
Definition: Spell.h:551
SpellTargetCheckTypes
Definition: SpellInfo.h:118
ConditionContainer * _condList
Definition: Spell.h:862
Definition: ObjectGuid.h:189
void SetReferencedFromCurrent(bool yes)
Definition: Spell.h:601
SpellCustomErrors m_customError
Definition: Spell.h:586
G3D::int16 x
Definition: Vector2int16.h:37
virtual bool IsDeletable() const
Definition: EventProcessor.h:44
float GetSpeedXY() const
Definition: Spell.h:238
bool IsIgnoringCooldowns() const
Definition: Spell.h:596
uint32 effectMask
Definition: Spell.h:754
SpellState
Definition: Spell.h:274
uint32 GlyphSlot
Definition: Spell.h:558
Definition: SpellAuras.h:116
uint8 m_cast_count
Definition: Spell.h:552
uint32 TalentId
Definition: Spell.h:557
SpellTargetCheckTypes _targetSelectionType
Definition: Spell.h:860
std::vector< Condition * > ConditionContainer
Definition: ConditionMgr.h:239
TriggerCastFlags _triggeredCastFlags
Definition: Spell.h:821
WeaponAttackType
Definition: Unit.h:615
Spell ** m_selfContainer
Definition: Spell.h:634
Definition: SpellPackets.h:339
int32 GetCastTime() const
Definition: Spell.h:590
uint32 Id
Definition: Spell.h:567
int32 m_healing
Definition: Spell.h:710
void SetAutoRepeat(bool rep)
Definition: Spell.h:592
SpellCastTargetFlags
Definition: SpellInfo.h:45
bool m_referencedFromCurrentSpell
Definition: Spell.h:683
bool m_needComboPoints
Definition: Spell.h:685
Data
Definition: molten_core.h:69
std::string m_strTarget
Definition: Spell.h:262
void Update(uint32 diff)
Definition: WeatherMgr.cpp:150
PowerType
Definition: VehicleDefines.h:28
float GetPitch() const
Definition: Spell.h:232
float _coneAngle
Definition: Spell.h:890
Definition: DBCStructure.h:1242
SpellEffectHandleMode effectHandleMode
Definition: Spell.h:696
uint32 GarrMissionId
Definition: Spell.h:572