TrinityCore
Spell.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __SPELL_H
19#define __SPELL_H
20
21#include "ConditionMgr.h"
22#include "DBCEnums.h"
23#include "ModelIgnoreFlags.h"
24#include "ObjectGuid.h"
25#include "Optional.h"
26#include "Position.h"
27#include "SharedDefines.h"
28#include "SpellDefines.h"
29#include "UniqueTrackablePtr.h"
30#include <memory>
31
33{
34struct SpellCastData;
35struct SpellHealPrediction;
36}
37
38class Aura;
39class AuraEffect;
40class BasicEvent;
41class Corpse;
42class DamageInfo;
43class DynamicObject;
44class DynObjAura;
45class GameObject;
46class Item;
47class Object;
48class PathGenerator;
49class Player;
50class SpellEffectInfo;
51class SpellEvent;
53class SpellInfo;
54class SpellScript;
55class Unit;
56class UnitAura;
57class WorldObject;
58struct SpellPowerCost;
60enum AuraType : uint32;
62enum LootType : uint8;
63enum ProcFlagsHit : uint32;
67enum SpellValueMod : uint8;
70
71namespace Trinity
72{
74}
75
76#define SPELL_CHANNEL_UPDATE_INTERVAL (1 * IN_MILLISECONDS)
77#define MAX_SPELL_RANGE_TOLERANCE 3.0f
78#define TRAJECTORY_MISSILE_SIZE 3.0f
79#define AOE_DAMAGE_TARGET_CAP SI64LIT(20)
80
82{
83 CAST_FLAG_NONE = 0x00000000,
84 CAST_FLAG_PENDING = 0x00000001, // aoe combat log?
86 CAST_FLAG_UNKNOWN_3 = 0x00000004,
87 CAST_FLAG_UNKNOWN_4 = 0x00000008, // ignore AOE visual
88 CAST_FLAG_UNKNOWN_5 = 0x00000010,
90 CAST_FLAG_UNKNOWN_7 = 0x00000040,
91 CAST_FLAG_UNKNOWN_8 = 0x00000080,
92 CAST_FLAG_UNKNOWN_9 = 0x00000100,
102 CAST_FLAG_NO_GCD = 0x00040000, // no GCD for spell casts from charm/summon (vehicle spells is an example)
110 CAST_FLAG_IMMUNITY = 0x04000000,
115 CAST_FLAG_TRIGGER_PET_COOLDOWN = 0x80000000 // causes the cooldown to be stored in pets SpellHistory on client
117
119{
125 CAST_FLAG_EX_DELAY_STARTING_COOLDOWNS = 0x00010, // makes client start cooldown after precalculated delay instead of immediately after SPELL_GO (used by empower spells)
129 CAST_FLAG_EX_IGNORE_PET_COOLDOWN = 0x00100, // makes client not automatically start cooldown for pets after SPELL_GO
130 CAST_FLAG_EX_IGNORE_COOLDOWN = 0x00200, // makes client not automatically start cooldown after SPELL_GO
136 CAST_FLAG_EX_USE_TOY_SPELL = 0x08000, // Starts cooldown on toy
142
144{
152};
153
155{
160};
161
163{
165 SPELL_RANGE_MELEE = 1, //melee
166 SPELL_RANGE_RANGED = 2 //hunter range and ranged weapon
168
170{
174 float Amplitude = 0;
175};
176
178{
181};
182
184{
188};
189
191{
193};
194
196{
198};
199
201{
203};
204
206{
208
215};
216
218{
219 explicit SpellValue(SpellInfo const* proto, WorldObject const* caster);
230};
231
233{
241
243{
249
250typedef std::vector<std::pair<uint32, ObjectGuid>> DispelList;
251
253
255{
256 friend class SpellScript;
257 public:
258
259 void EffectNULL();
260 void EffectUnused();
261 void EffectDistract();
262 void EffectSchoolDMG();
263 void EffectEnvironmentalDMG();
264 void EffectInstaKill();
265 void EffectDummy();
266 void EffectTeleportUnits();
267 void EffectTeleportUnitsWithVisualLoadingScreen();
268 void EffectApplyAura();
269 void EffectSendEvent();
270 void EffectPowerBurn();
271 void EffectPowerDrain();
272 void EffectHeal();
273 void EffectBind();
274 void EffectTeleportToReturnPoint();
275 void EffectIncreaseCurrencyCap();
276 void EffectHealthLeech();
277 void EffectQuestComplete();
278 void EffectCreateItem();
279 void EffectCreateItem2();
280 void EffectCreateRandomItem();
281 void EffectPersistentAA();
282 void EffectEnergize();
283 void EffectOpenLock();
284 void EffectSummonChangeItem();
285 void EffectProficiency();
286 void EffectSummonType();
287 void EffectLearnSpell();
288 void EffectDispel();
289 void EffectDualWield();
290 void EffectPickPocket();
291 void EffectAddFarsight();
292 void EffectUntrainTalents();
293 void EffectHealMechanical();
294 void EffectJump();
295 void EffectJumpDest();
296 void EffectLeapBack();
297 void EffectQuestClear();
298 void EffectTeleUnitsFaceCaster();
299 void EffectLearnSkill();
300 void EffectPlayMovie();
301 void EffectTradeSkill();
302 void EffectEnchantItemPerm();
303 void EffectEnchantItemTmp();
304 void EffectTameCreature();
305 void EffectSummonPet();
306 void EffectLearnPetSpell();
307 void EffectWeaponDmg();
308 void EffectForceCast();
309 void EffectTriggerSpell();
310 void EffectTriggerMissileSpell();
311 void EffectThreat();
312 void EffectHealMaxHealth();
313 void EffectInterruptCast();
314 void EffectSummonObjectWild();
315 void EffectScriptEffect();
316 void EffectSanctuary();
317 void EffectDuel();
318 void EffectStuck();
319 void EffectSummonPlayer();
320 void EffectActivateObject();
321 void EffectApplyGlyph();
322 void EffectEnchantHeldItem();
323 void EffectSummonObject();
324 void EffectChangeRaidMarker();
325 void EffectResurrect();
326 void EffectParry();
327 void EffectBlock();
328 void EffectLeap();
329 void EffectTransmitted();
330 void EffectDisEnchant();
331 void EffectInebriate();
332 void EffectFeedPet();
333 void EffectDismissPet();
334 void EffectReputation();
335 void EffectForceDeselect();
336 void EffectSelfResurrect();
337 void EffectSkinning();
338 void EffectCharge();
339 void EffectChargeDest();
340 void EffectProspecting();
341 void EffectMilling();
342 void EffectRenamePet();
343 void EffectSendTaxi();
344 void EffectKnockBack();
345 void EffectPullTowards();
346 void EffectPullTowardsDest();
347 void EffectDispelMechanic();
348 void EffectResurrectPet();
349 void EffectDestroyAllTotems();
350 void EffectDurabilityDamage();
351 void EffectSkill();
352 void EffectTaunt();
353 void EffectDurabilityDamagePCT();
354 void EffectModifyThreatPercent();
355 void EffectResurrectNew();
356 void EffectAddExtraAttacks();
357 void EffectSpiritHeal();
358 void EffectSkinPlayerCorpse();
359 void EffectStealBeneficialBuff();
360 void EffectUnlearnSpecialization();
361 void EffectHealPct();
362 void EffectEnergizePct();
363 void EffectTriggerRitualOfSummoning();
364 void EffectSummonRaFFriend();
365 void EffectUnlockGuildVaultTab();
366 void EffectKillCreditPersonal();
367 void EffectKillCredit();
368 void EffectQuestFail();
369 void EffectQuestStart();
370 void EffectRedirectThreat();
371 void EffectGameObjectDamage();
372 void EffectGameObjectRepair();
373 void EffectGameObjectSetDestructionState();
374 void EffectCreateTamedPet();
375 void EffectDiscoverTaxi();
376 void EffectTitanGrip();
377 void EffectEnchantItemPrismatic();
378 void EffectPlayMusic();
379 void EffectActivateSpec();
380 void EffectPlaySound();
381 void EffectRemoveAura();
382 void EffectDamageFromMaxHealthPCT();
383 void EffectCastButtons();
384 void EffectRechargeItem();
385 void EffectGiveCurrency();
386 void EffectSummonPersonalGameObject();
387 void EffectResurrectWithAura();
388 void EffectCreateAreaTrigger();
389 void EffectRemoveTalent();
390 void EffectDestroyItem();
391 void EffectLearnGarrisonBuilding();
392 void EffectRemoveAuraBySpellLabel();
393 void EffectCreateGarrison();
394 void EffectCreateConversation();
395 void EffectCancelConversation();
396 void EffectAddGarrisonFollower();
397 void EffectActivateGarrisonBuilding();
398 void EffectGrantBattlePetLevel();
399 void EffectGiveExperience();
400 void EffectGiveRestedExperience();
401 void EffectHealBattlePetPct();
402 void EffectEnableBattlePets();
403 void EffectChangeBattlePetQuality();
404 void EffectLaunchQuestChoice();
405 void EffectUncageBattlePet();
406 void EffectCreateHeirloomItem();
407 void EffectUpgradeHeirloom();
408 void EffectApplyEnchantIllusion();
409 void EffectUpdatePlayerPhase();
410 void EffectUpdateZoneAurasAndPhases();
411 void EffectGiveArtifactPower();
412 void EffectGiveArtifactPowerNoBonus();
413 void EffectPlaySceneScriptPackage();
414 void EffectCreateSceneObject();
415 void EffectCreatePrivateSceneObject();
416 void EffectPlayScene();
417 void EffectGiveHonor();
418 void EffectJumpCharge();
419 void EffectLearnTransmogSet();
420 void EffectRespecAzeriteEmpoweredItem();
421 void EffectLearnAzeriteEssencePower();
422 void EffectCreatePrivateConversation();
423 void EffectSendChatMessage();
424 void EffectGrantBattlePetExperience();
425 void EffectLearnTransmogIllusion();
426 void EffectModifyAuraStacks();
427 void EffectModifyCooldown();
428 void EffectModifyCooldowns();
429 void EffectModifyCooldownsByCategory();
430 void EffectModifySpellCharges();
431 void EffectCreateTraitTreeConfig();
432 void EffectChangeActiveCombatTraitConfig();
433 void EffectTeleportGraveyard();
434
435 typedef std::unordered_set<Aura*> UsedSpellMods;
436
437 Spell(WorldObject* caster, SpellInfo const* info, TriggerCastFlags triggerFlags, ObjectGuid originalCasterGUID = ObjectGuid::Empty, ObjectGuid originalCastId = ObjectGuid::Empty);
438 ~Spell();
439
440 void InitExplicitTargets(SpellCastTargets const& targets);
441 void SelectExplicitTargets();
442
443 void SelectSpellTargets();
444 void SelectEffectImplicitTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex, uint32& processedEffectMask);
445 void SelectImplicitChannelTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType);
446 void SelectImplicitNearbyTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex, uint32 effMask);
447 void SelectImplicitConeTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex, uint32 effMask);
448 void SelectImplicitAreaTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex, uint32 effMask);
449 void SelectImplicitCasterDestTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex);
450 void SelectImplicitTargetDestTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex);
451 void SelectImplicitDestDestTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex);
452 void SelectImplicitCasterObjectTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType);
453 void SelectImplicitTargetObjectTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType);
454 void SelectImplicitChainTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, WorldObject* target, uint32 effMask);
455 void SelectImplicitTrajTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType);
456 void SelectImplicitLineTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex, uint32 effMask);
457
458 void SelectEffectTypeImplicitTargets(SpellEffectInfo const& spellEffectInfo);
459
460 static uint32 GetSearcherTypeMask(SpellInfo const* spellInfo, SpellEffectInfo const& spellEffectInfo, SpellTargetObjectTypes objType, ConditionContainer const* condList);
461 template<class SEARCHER> static void SearchTargets(SEARCHER& searcher, uint32 containerMask, WorldObject* referer, Position const* pos, float radius);
462
463 WorldObject* SearchNearbyTarget(SpellEffectInfo const& spellEffectInfo, float range, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionContainer const* condList = nullptr);
464 void SearchAreaTargets(std::list<WorldObject*>& targets, SpellEffectInfo const& spellEffectInfo, float range, Position const* position, WorldObject* referer,
465 SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionContainer const* condList,
467 void SearchChainTargets(std::list<WorldObject*>& targets, uint32 chainTargets, WorldObject* target, SpellTargetObjectTypes objectType,
468 SpellTargetCheckTypes selectType, SpellEffectInfo const& spellEffectInfo, bool isChainHeal);
469
470 GameObject* SearchSpellFocus();
471
472 SpellCastResult prepare(SpellCastTargets const& targets, AuraEffect const* triggeredByAura = nullptr);
473 void cancel();
474 void update(uint32 difftime);
475 void cast(bool skipCheck = false);
476 void finish(SpellCastResult result = SPELL_CAST_OK);
477 void TakePower();
478
479 void TakeRunePower(bool didHit);
480 void TakeReagents();
481 void TakeCastItem();
482
483 SpellCastResult CheckCast(bool strict, int32* param1 = nullptr, int32* param2 = nullptr);
484 SpellCastResult CheckPetCast(Unit* target);
485
486 // handlers
487 void handle_immediate();
488 uint64 handle_delayed(uint64 t_offset);
489 // handler helpers
490 void _handle_immediate_phase();
491 void _handle_finish_phase();
492
493 SpellCastResult CheckItems(int32* param1, int32* param2) const;
494 SpellCastResult CheckRange(bool strict) const;
495 SpellCastResult CheckPower() const;
496 SpellCastResult CheckRuneCost() const;
497 SpellCastResult CheckCasterAuras(int32* param1) const;
498 SpellCastResult CheckArenaAndRatedBattlegroundCastRules();
499 SpellCastResult CheckMovement() const;
500
501 bool CheckSpellCancelsAuraEffect(AuraType auraType, int32* param1) const;
502 bool CheckSpellCancelsCharm(int32* param1) const;
503 bool CheckSpellCancelsStun(int32* param1) const;
504 bool CheckSpellCancelsSilence(int32* param1) const;
505 bool CheckSpellCancelsPacify(int32* param1) const;
506 bool CheckSpellCancelsFear(int32* param1) const;
507 bool CheckSpellCancelsConfuse(int32* param1) const;
508 bool CheckSpellCancelsNoActions(int32* param1) const;
509
510 int32 CalculateDamage(SpellEffectInfo const& spellEffectInfo, Unit const* target, float* var = nullptr) const;
511
512 void Delayed();
513 void DelayedChannel();
514 uint32 getState() const { return m_spellState; }
515 void setState(uint32 state) { m_spellState = state; }
516
517 void DoCreateItem(uint32 itemId, ItemContext context = ItemContext::NONE, std::vector<int32> const* bonusListIDs = nullptr);
518
519 bool CheckEffectTarget(Unit const* target, SpellEffectInfo const& spellEffectInfo, Position const* losPosition) const;
520 bool CheckEffectTarget(GameObject const* target, SpellEffectInfo const& spellEffectInfo) const;
521 bool CheckEffectTarget(Item const* target, SpellEffectInfo const& spellEffectInfo) const;
522 bool CanAutoCast(Unit* target);
523 void CheckSrc();
524 void CheckDst();
525
526 static void SendCastResult(Player* caster, SpellInfo const* spellInfo, SpellCastVisual spellVisual, ObjectGuid cast_count, SpellCastResult result, SpellCustomErrors customError = SPELL_CUSTOM_ERROR_NONE, int32* param1 = nullptr, int32* param2 = nullptr);
527 void SendCastResult(SpellCastResult result, int32* param1 = nullptr, int32* param2 = nullptr) const;
528 void SendPetCastResult(SpellCastResult result, int32* param1 = nullptr, int32* param2 = nullptr) const;
529 void SendMountResult(MountResult result);
530 void SendSpellStart();
531 void SendSpellGo();
532 void SendSpellCooldown();
533 void SendSpellExecuteLog();
534 SpellLogEffect& GetExecuteLogEffect(SpellEffectName effect);
535 template<typename T>
536 std::vector<T>& GetExecuteLogEffectTargets(SpellEffectName effect, Optional<std::vector<T>> SpellLogEffect::* member)
537 {
538 Optional<std::vector<T>>& opt = GetExecuteLogEffect(effect).*member;
539 if (!opt)
540 opt.emplace();
541
542 return *opt;
543 }
544 void ExecuteLogEffectTakeTargetPower(SpellEffectName effect, Unit* target, uint32 powerType, uint32 points, float amplitude);
545 void ExecuteLogEffectExtraAttacks(SpellEffectName effect, Unit* victim, uint32 numAttacks);
546 void ExecuteLogEffectDurabilityDamage(SpellEffectName effect, Unit* victim, int32 itemId, int32 amount);
547 void ExecuteLogEffectOpenLock(SpellEffectName effect, Object* obj);
548 void ExecuteLogEffectCreateItem(SpellEffectName effect, uint32 entry);
549 void ExecuteLogEffectDestroyItem(SpellEffectName effect, uint32 entry);
550 void ExecuteLogEffectSummonObject(SpellEffectName effect, WorldObject* obj);
551 void ExecuteLogEffectUnsummonObject(SpellEffectName effect, WorldObject* obj);
552 void ExecuteLogEffectResurrect(SpellEffectName effect, Unit* target);
553 void SendSpellInterruptLog(Unit* victim, uint32 spellId);
554 void SendInterrupted(uint8 result);
555 void SendChannelUpdate(uint32 time);
556 void SendChannelStart(uint32 duration);
557 void SendResurrectRequest(Player* target);
558
559 void HandleEffects(Unit* pUnitTarget, Item* pItemTarget, GameObject* pGoTarget, Corpse* pCorpseTarget, SpellEffectInfo const& spellEffectInfo, SpellEffectHandleMode mode);
560 void HandleThreatSpells();
561 static Spell const* ExtractSpellFromEvent(BasicEvent* event);
562
563 SpellInfo const* const m_spellInfo;
572 union
573 {
574 // Alternate names for this value
576
577 // SPELL_EFFECT_APPLY_GLYPH
579
580 // SPELL_EFFECT_TALENT_SPEC_SELECT
582
583 // SPELL_EFFECT_SET_FOLLOWER_QUALITY
584 // SPELL_EFFECT_INCREASE_FOLLOWER_ITEM_LEVEL
585 // SPELL_EFFECT_INCREASE_FOLLOWER_EXPERIENCE
586 // SPELL_EFFECT_RANDOMIZE_FOLLOWER_ABILITIES
587 // SPELL_EFFECT_LEARN_FOLLOWER_ABILITY
588 struct
589 {
591 uint32 AbilityId; // only SPELL_EFFECT_LEARN_FOLLOWER_ABILITY
592 } GarrFollower;
593
594 // SPELL_EFFECT_FINISH_GARRISON_MISSION
596
597 // SPELL_EFFECT_UPGRADE_HEIRLOOM
599
600 struct
601 {
603 } Raw;
604 } m_misc;
605 std::any m_customArg;
609
611
612 int32 GetCastTime() const { return m_casttime; }
613 int32 GetRemainingCastTime() const { return m_timer; }
614 bool IsAutoRepeat() const { return m_autoRepeat; }
615 void SetAutoRepeat(bool rep) { m_autoRepeat = rep; }
616 void ReSetTimer() { m_timer = m_casttime > 0 ? m_casttime : 0; }
617 bool IsTriggered() const;
618 bool IsIgnoringCooldowns() const;
619 bool IsFocusDisabled() const;
620 bool IsProcDisabled() const;
621 bool IsChannelActive() const;
622 bool IsAutoActionResetSpell() const;
623 bool IsPositive() const;
624
625 bool IsTriggeredByAura(SpellInfo const* auraSpellInfo) const { return (auraSpellInfo == m_triggeredByAuraSpell); }
626
627 int32 GetProcChainLength() const { return m_procChainLength; }
628
629 bool IsDeletable() const { return !m_referencedFromCurrentSpell && !m_executedCurrently; }
630 void SetReferencedFromCurrent(bool yes) { m_referencedFromCurrentSpell = yes; }
631 bool IsInterruptable() const { return !m_executedCurrently; }
632 void SetExecutedCurrently(bool yes) {m_executedCurrently = yes;}
633 uint64 GetDelayStart() const { return m_delayStart; }
634 void SetDelayStart(uint64 m_time) { m_delayStart = m_time; }
635 uint64 GetDelayMoment() const { return m_delayMoment; }
636 uint64 CalculateDelayMomentForDst(float launchDelay) const;
637 void RecalculateDelayMomentForDst();
638 void UpdateDelayMomentForDst(uint64 hitDelay);
639 void UpdateDelayMomentForUnitTarget(Unit* unit, uint64 hitDelay);
640 uint8 GetRuneState() const { return m_runesState; }
641 void SetRuneState(uint8 value) { m_runesState = value; }
642
643 bool IsNeedSendToClient() const;
644
645 CurrentSpellTypes GetCurrentContainer() const;
646
647 WorldObject* GetCaster() const { return m_caster; }
648 ObjectGuid GetOriginalCasterGUID() const { return m_originalCasterGUID; }
649 Unit* GetOriginalCaster() const { return m_originalCaster; }
650 SpellInfo const* GetSpellInfo() const { return m_spellInfo; }
652 std::vector<SpellPowerCost> const& GetPowerCost() const { return m_powerCost; }
653 bool HasPowerTypeCost(Powers power) const;
654 Optional<int32> GetPowerTypeCostAmount(Powers power) const;
655
656 bool UpdatePointers(); // must be used at call Spell code after time delay (non triggered spell cast/update spell call/etc)
657
658 void CleanupTargetList();
659
660 void SetSpellValue(SpellValueMod mod, int32 value);
661
662 Spell** m_selfContainer; // pointer to our spell container (if applicable)
663
664 SpellInfo const* GetTriggeredByAuraSpell() const { return m_triggeredByAuraSpell; }
665
666 int32 GetTimer() const { return m_timer; }
667
672
673 std::string GetDebugInfo() const;
674
675 Trinity::unique_weak_ptr<Spell> GetWeakPtr() const;
676
677 void CallScriptOnResistAbsorbCalculateHandlers(DamageInfo const& damageInfo, uint32& resistAmount, int32& absorbAmount);
678
679 bool IsWithinLOS(WorldObject const* source, WorldObject const* target, bool targetAsSourceLocation, VMAP::ModelIgnoreFlags ignoreFlags) const;
680 bool IsWithinLOS(WorldObject const* source, Position const& target, VMAP::ModelIgnoreFlags ignoreFlags) const;
681
682 protected:
683 bool HasGlobalCooldown() const;
684 void TriggerGlobalCooldown();
685 void CancelGlobalCooldown();
686 void _cast(bool skipCheck = false);
687
688 std::pair<float, float> GetMinMaxRange(bool strict) const;
689
691
693
694 ObjectGuid m_originalCasterGUID; // real source of cast (aura caster/etc), used for spell targets selection
695 // e.g. damage around area spell trigered by victim aura and damage enemies of aura caster
696 Unit* m_originalCaster; // cached pointer for m_originalCaster, updated at Spell::UpdatePointers()
697
698 // Spell data
699 SpellSchoolMask m_spellSchoolMask; // Spell school (can be overwrite for some spells (wand shoot for example)
700 WeaponAttackType m_attackType; // For weapon based attack
701
702 std::vector<SpellPowerCost> m_powerCost; // Calculated spell cost initialized only in Spell::prepare
703 int32 m_casttime; // Calculated spell cast time initialized only in Spell::prepare
704 int32 m_channeledDuration; // Calculated channeled spell duration in order to calculate correct pushback.
705 bool m_canReflect; // can reflect this spell?
708
711 {
712 if (m_delayAtDamageCount >= 2)
713 return true;
714
715 ++m_delayAtDamageCount;
716 return false;
717 }
718
719 // Delayed spells system
720 uint64 m_delayStart; // time of spell delay start, filled by event handler, zero = just started
721 uint64 m_delayMoment; // moment of next delay call, used internally
722 bool m_launchHandled; // were launch actions handled
723 bool m_immediateHandled; // were immediate actions handled? (used by delayed spells only)
724
725 // These vars are used in both delayed spell system and modified immediate spell system
726 bool m_referencedFromCurrentSpell; // mark as references to prevent deleted and access by dead pointers
727 bool m_executedCurrently; // mark as executed to prevent deleted and access by dead pointers
729 float m_damageMultipliers[MAX_SPELL_EFFECTS];
730
731 // Current targets, to be used in SpellEffects (MUST BE USED ONLY IN SPELL EFFECTS)
739 float variance;
742 // used in effects handlers
743 Unit* GetUnitCasterForEffectHandlers() const;
746
747 // -------------------------------------------
749
750 // Damage and healing in effects need just calculate
751 int32 m_damage; // Damage in effects count here
752 int32 m_healing; // Healing in effects count here
753
754 // ******************************************
755 // Spell trigger system
756 // ******************************************
757 ProcFlagsInit m_procAttacker; // Attacker trigger flags
758 ProcFlagsInit m_procVictim; // Victim trigger flags
761 void prepareDataForTriggerSystem();
762
763 // *****************************************
764 // Spell target subsystem
765 // *****************************************
766 // Targets store structures and data
768 {
769 virtual void PreprocessTarget(Spell* /*spell*/) { }
770 virtual void DoTargetSpellHit(Spell* spell, SpellEffectInfo const& spellEffectInfo) = 0;
771 virtual void DoDamageAndTriggers(Spell* /*spell*/) { }
772
773 uint32 EffectMask = 0;
774
775 protected:
777 virtual ~TargetInfoBase() { }
778 };
779
781 {
782 void PreprocessTarget(Spell* spell) override;
783 void DoTargetSpellHit(Spell* spell, SpellEffectInfo const& spellEffectInfo) override;
784 void DoDamageAndTriggers(Spell* spell) override;
785
787 uint64 TimeDelay = 0ULL;
789 int32 Healing = 0;
790
793
794 bool IsAlive = false;
795 bool IsCrit = false;
796
797 // info set at PreprocessTarget, used by DoTargetSpellHit
799 int32 AuraDuration = 0;
800 int32 AuraBasePoints[MAX_SPELL_EFFECTS] = { };
801 bool Positive = true;
802 UnitAura* HitAura = nullptr;
803
804 private:
805 Unit* _spellHitTarget = nullptr; // changed for example by reflect
806 bool _enablePVP = false; // need to enable PVP at DoDamageAndTriggers?
807 };
808 std::vector<TargetInfo> m_UniqueTargetInfo;
809 uint32 m_channelTargetEffectMask; // Mask req. alive targets
810
812 {
813 void DoTargetSpellHit(Spell* spell, SpellEffectInfo const& spellEffectInfo) override;
814
816 uint64 TimeDelay = 0ULL;
817 };
818 std::vector<GOTargetInfo> m_UniqueGOTargetInfo;
819
821 {
822 void DoTargetSpellHit(Spell* spell, SpellEffectInfo const& spellEffectInfo) override;
823
824 Item* TargetItem = nullptr;
825 };
826 std::vector<ItemTargetInfo> m_UniqueItemInfo;
827
829 {
830 void DoTargetSpellHit(Spell* spell, SpellEffectInfo const& spellEffectInfo) override;
831
833 uint64 TimeDelay = 0ULL;
834 };
835 std::vector<CorpseTargetInfo> m_UniqueCorpseTargetInfo;
836
837 template <class Container>
838 void DoProcessTargetContainer(Container& targetContainer);
839
841
842 int32 GetUnitTargetIndexForEffect(ObjectGuid const& target, SpellEffIndex effect) const;
843
844 void AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid = true, bool implicit = true, Position const* losPosition = nullptr);
845 void AddGOTarget(GameObject* target, uint32 effectMask);
846 void AddItemTarget(Item* item, uint32 effectMask);
847 void AddCorpseTarget(Corpse* target, uint32 effectMask);
848 void AddDestTarget(SpellDestination const& dest, uint32 effIndex);
849
850 void PreprocessSpellLaunch(TargetInfo& targetInfo);
851 SpellMissInfo PreprocessSpellHit(Unit* unit, TargetInfo& targetInfo);
852 void DoSpellEffectHit(Unit* unit, SpellEffectInfo const& spellEffectInfo, TargetInfo& targetInfo);
853
854 void DoTriggersOnSpellHit(Unit* unit);
855 bool UpdateChanneledTargetList();
856 bool IsValidDeadOrAliveTarget(Unit const* target) const;
857 void HandleLaunchPhase();
858 void DoEffectOnLaunchTarget(TargetInfo& targetInfo, float multiplier, SpellEffectInfo const& spellEffectInfo);
859 void ResetCombatTimers();
860
861 void PrepareTargetProcessing();
862 void FinishTargetProcessing();
863
864 // Scripting system
865 void LoadScripts();
866 void CallScriptOnPrecastHandler();
867 void CallScriptBeforeCastHandlers();
868 void CallScriptOnCastHandlers();
869 void CallScriptAfterCastHandlers();
870 SpellCastResult CallScriptCheckCastHandlers();
871 int32 CallScriptCalcCastTimeHandlers(int32 originalCastTime);
872 bool CallScriptEffectHandlers(SpellEffIndex effIndex, SpellEffectHandleMode mode);
873 void CallScriptSuccessfulDispel(SpellEffIndex effIndex);
874 void CallScriptBeforeHitHandlers(SpellMissInfo missInfo);
875 void CallScriptOnHitHandlers();
876 void CallScriptAfterHitHandlers();
877 public:
878 void CallScriptCalcCritChanceHandlers(Unit const* victim, float& chance);
879 void CallScriptCalcDamageHandlers(Unit* victim, int32& damage, int32& flatMod, float& pctMod);
880 void CallScriptCalcHealingHandlers(Unit* victim, int32& healing, int32& flatMod, float& pctMod);
881 protected:
882 void CallScriptObjectAreaTargetSelectHandlers(std::list<WorldObject*>& targets, SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType);
883 void CallScriptObjectTargetSelectHandlers(WorldObject*& target, SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType);
884 void CallScriptDestinationTargetSelectHandlers(SpellDestination& target, SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType);
885 bool CheckScriptEffectImplicitTargets(uint32 effIndex, uint32 effIndexToCheck);
886 std::vector<SpellScript*> m_loadedScripts;
887
889 {
890 HitTriggerSpell(SpellInfo const* spellInfo, SpellInfo const* auraSpellInfo, int32 procChance) :
891 triggeredSpell(spellInfo), triggeredByAura(auraSpellInfo), chance(procChance) { }
892
895 // uint8 triggeredByEffIdx This might be needed at a later stage - No need known for now
897 };
898
899 bool CanExecuteTriggersOnHit(Unit* unit, SpellInfo const* triggeredByAura = nullptr) const;
900 void PrepareTriggersExecutedOnHit();
901 typedef std::vector<HitTriggerSpell> HitTriggerSpellList;
903
904 // effect helpers
905 void SummonGuardian(SpellEffectInfo const* effect, uint32 entry, SummonPropertiesEntry const* properties, uint32 numSummons, ObjectGuid privateObjectOwner);
906 void CalculateJumpSpeeds(SpellEffectInfo const* effInfo, float dist, float& speedXY, float& speedZ);
907
908 void UpdateSpellCastDataTargets(WorldPackets::Spells::SpellCastData& data);
909 int32 GetSpellCastDataAmmo();
910 void UpdateSpellHealPrediction(WorldPackets::Spells::SpellHealPrediction& healPrediction, bool withPeriodic);
911
912 SpellCastResult CanOpenLock(SpellEffectInfo const& effect, uint32 lockid, SkillType& skillid, int32& reqSkillValue, int32& skillValue);
913 // -------------------------------------------
914
917
920
921 // if need this can be replaced by Aura copy
922 // we can't store original aura link to prevent access to deleted auras
923 // and in same time need aura data and after aura deleting.
926
927 std::unique_ptr<PathGenerator> m_preGeneratedPath;
928
929 std::vector<SpellLogEffect> _executeLogEffects;
930
931 Spell(Spell const& right) = delete;
932 Spell& operator=(Spell const& right) = delete;
933};
934
935namespace Trinity
936{
938 {
939 protected:
944 std::unique_ptr<ConditionSourceInfo> _condSrcInfo;
947
948 WorldObjectSpellTargetCheck(WorldObject* caster, WorldObject* referer, SpellInfo const* spellInfo,
949 SpellTargetCheckTypes selectionType, ConditionContainer const* condList, SpellTargetObjectTypes objectType);
951
952 bool operator()(WorldObject* target) const;
953 };
954
956 {
957 float _range;
959 WorldObjectSpellNearbyTargetCheck(float range, WorldObject* caster, SpellInfo const* spellInfo,
960 SpellTargetCheckTypes selectionType, ConditionContainer const* condList, SpellTargetObjectTypes objectType);
961
962 bool operator()(WorldObject* target);
963 };
964
966 {
967 Area,
968 Chain
969 };
970
972 {
973 float _range;
976 WorldObjectSpellAreaTargetCheck(float range, Position const* position, WorldObject* caster,
977 WorldObject* referer, SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer const* condList, SpellTargetObjectTypes objectType,
979
980 bool operator()(WorldObject* target) const;
981 };
982
984 {
988 WorldObjectSpellConeTargetCheck(Position const& coneSrc, float coneAngle, float lineWidth, float range, WorldObject* caster,
989 SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer const* condList, SpellTargetObjectTypes objectType);
990
991 bool operator()(WorldObject* target) const;
992 };
993
995 {
996 float _range;
998 WorldObjectSpellTrajTargetCheck(float range, Position const* position, WorldObject* caster,
999 SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer const* condList, SpellTargetObjectTypes objectType);
1000
1001 bool operator()(WorldObject* target) const;
1002 };
1003
1005 {
1008 WorldObjectSpellLineTargetCheck(Position const* srcPosition, Position const* dstPosition, float lineWidth, float range, WorldObject* caster,
1009 SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer const* condList, SpellTargetObjectTypes objectType);
1010
1011 bool operator()(WorldObject* target) const;
1012 };
1013
1014 TC_GAME_API void SelectRandomInjuredTargets(std::list<WorldObject*>& targets, size_t maxTargets, bool prioritizePlayers, Unit const* prioritizeGroupMembersOf = nullptr);
1015}
1016
1017using SpellEffectHandlerFn = void(Spell::*)();
1018
1019#endif
std::vector< Condition > ConditionContainer
Definition: ConditionMgr.h:290
Difficulty
Definition: DBCEnums.h:873
ItemContext
Definition: DBCEnums.h:1063
#define MAX_SPELL_EFFECTS
Definition: DBCEnums.h:1953
#define TC_GAME_API
Definition: Define.h:123
uint8_t uint8
Definition: Define.h:144
int64_t int64
Definition: Define.h:137
int32_t int32
Definition: Define.h:138
uint64_t uint64
Definition: Define.h:141
uint32_t uint32
Definition: Define.h:142
std::string GetDebugInfo()
Definition: Errors.cpp:157
LootType
Definition: Loot.h:98
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
SpellEffIndex
Definition: SharedDefines.h:29
MountResult
SpellTargetIndex
Definition: SharedDefines.h:65
SpellMissInfo
@ SPELL_MISS_NONE
SpellSchoolMask
SpellEffectName
WeaponAttackType
SpellCustomErrors
@ SPELL_CUSTOM_ERROR_NONE
Powers
DiminishingGroup
@ DIMINISHING_NONE
SpellCastResult
@ SPELL_CAST_OK
SkillType
AuraType
TriggerCastFlags
Definition: SpellDefines.h:245
SpellValueMod
Definition: SpellDefines.h:195
SpellTargetCheckTypes
Definition: SpellInfo.h:81
SpellTargetObjectTypes
Definition: SpellInfo.h:65
ProcFlagsSpellType
Definition: SpellMgr.h:250
ProcFlagsHit
Definition: SpellMgr.h:272
SpellCastSource
Definition: Spell.h:144
@ SPELL_CAST_SOURCE_AURA
Definition: Spell.h:150
@ SPELL_CAST_SOURCE_SPELL
Definition: Spell.h:151
@ SPELL_CAST_SOURCE_PET
Definition: Spell.h:149
@ SPELL_CAST_SOURCE_PLAYER
Definition: Spell.h:145
@ SPELL_CAST_SOURCE_PASSIVE
Definition: Spell.h:148
@ SPELL_CAST_SOURCE_NORMAL
Definition: Spell.h:146
@ SPELL_CAST_SOURCE_ITEM
Definition: Spell.h:147
SpellRangeFlag
Definition: Spell.h:163
@ SPELL_RANGE_MELEE
Definition: Spell.h:165
@ SPELL_RANGE_RANGED
Definition: Spell.h:166
@ SPELL_RANGE_DEFAULT
Definition: Spell.h:164
std::vector< std::pair< uint32, ObjectGuid > > DispelList
Definition: Spell.h:250
void(Spell::*)() SpellEffectHandlerFn
Definition: Spell.h:1017
SpellCastFlagsEx
Definition: Spell.h:119
@ CAST_FLAG_EX_DELAY_STARTING_COOLDOWNS
Definition: Spell.h:125
@ CAST_FLAG_EX_UNKNOWN_15
Definition: Spell.h:135
@ CAST_FLAG_EX_UNKNOWN_7
Definition: Spell.h:127
@ CAST_FLAG_EX_UNKNOWN_17
Definition: Spell.h:137
@ CAST_FLAG_EX_UNKNOWN_2
Definition: Spell.h:122
@ CAST_FLAG_EX_DONT_CONSUME_CHARGES
Definition: Spell.h:123
@ CAST_FLAG_EX_USE_TOY_SPELL
Definition: Spell.h:136
@ CAST_FLAG_EX_UNKNOWN_11
Definition: Spell.h:131
@ CAST_FLAG_EX_UNKNOWN_14
Definition: Spell.h:134
@ CAST_FLAG_EX_UNKNOWN_12
Definition: Spell.h:132
@ CAST_FLAG_EX_UNKNOWN_19
Definition: Spell.h:139
@ CAST_FLAG_EX_UNKNOWN_8
Definition: Spell.h:128
@ CAST_FLAG_EX_IGNORE_COOLDOWN
Definition: Spell.h:130
@ CAST_FLAG_EX_UNKNOWN_13
Definition: Spell.h:133
@ CAST_FLAG_EX_UNKNOWN_4
Definition: Spell.h:124
@ CAST_FLAG_EX_UNKNOWN_18
Definition: Spell.h:138
@ CAST_FLAG_EX_UNKNOWN_6
Definition: Spell.h:126
@ CAST_FLAG_EX_NONE
Definition: Spell.h:120
@ CAST_FLAG_EX_IGNORE_PET_COOLDOWN
Definition: Spell.h:129
@ CAST_FLAG_EX_UNKNOWN_20
Definition: Spell.h:140
@ CAST_FLAG_EX_TRIGGER_COOLDOWN_ON_SPELL_START
Definition: Spell.h:121
SpellEffectHandleMode
Definition: Spell.h:243
@ SPELL_EFFECT_HANDLE_LAUNCH_TARGET
Definition: Spell.h:245
@ SPELL_EFFECT_HANDLE_LAUNCH
Definition: Spell.h:244
@ SPELL_EFFECT_HANDLE_HIT
Definition: Spell.h:246
@ SPELL_EFFECT_HANDLE_HIT_TARGET
Definition: Spell.h:247
SpellState
Definition: Spell.h:233
@ SPELL_STATE_DELAYED
Definition: Spell.h:239
@ SPELL_STATE_NULL
Definition: Spell.h:234
@ SPELL_STATE_FINISHED
Definition: Spell.h:237
@ SPELL_STATE_PREPARING
Definition: Spell.h:235
@ SPELL_STATE_CASTING
Definition: Spell.h:236
@ SPELL_STATE_IDLE
Definition: Spell.h:238
static const uint32 SPELL_INTERRUPT_NONPLAYER
Definition: Spell.h:252
SpellCastFlags
Definition: Spell.h:82
@ CAST_FLAG_UNKNOWN_5
Definition: Spell.h:88
@ CAST_FLAG_UNKNOWN_10
Definition: Spell.h:93
@ CAST_FLAG_UNKNOWN_25
Definition: Spell.h:108
@ CAST_FLAG_VISUAL_CHAIN
Definition: Spell.h:103
@ CAST_FLAG_ADJUST_MISSILE
Definition: Spell.h:101
@ CAST_FLAG_UNKNOWN_8
Definition: Spell.h:91
@ CAST_FLAG_HEAL_PREDICTION
Definition: Spell.h:114
@ CAST_FLAG_UNKNOWN_9
Definition: Spell.h:92
@ CAST_FLAG_UNKNOWN_3
Definition: Spell.h:86
@ CAST_FLAG_UNKNOWN_26
Definition: Spell.h:109
@ CAST_FLAG_UNKNOWN_11
Definition: Spell.h:94
@ CAST_FLAG_UNKNOWN_30
Definition: Spell.h:113
@ CAST_FLAG_UNKNOWN_4
Definition: Spell.h:87
@ CAST_FLAG_NO_GCD
Definition: Spell.h:102
@ CAST_FLAG_UNKNOWN_23
Definition: Spell.h:106
@ CAST_FLAG_UNKNOWN_16
Definition: Spell.h:99
@ CAST_FLAG_PROJECTILE
Definition: Spell.h:89
@ CAST_FLAG_UNKNOWN_29
Definition: Spell.h:112
@ CAST_FLAG_UNKNOWN_7
Definition: Spell.h:90
@ CAST_FLAG_POWER_LEFT_SELF
Definition: Spell.h:95
@ CAST_FLAG_UNKNOWN_13
Definition: Spell.h:96
@ CAST_FLAG_UNKNOWN_28
Definition: Spell.h:111
@ CAST_FLAG_UNKNOWN_24
Definition: Spell.h:107
@ CAST_FLAG_TRIGGER_PET_COOLDOWN
Definition: Spell.h:115
@ CAST_FLAG_HAS_TRAJECTORY
Definition: Spell.h:85
@ CAST_FLAG_RUNE_LIST
Definition: Spell.h:105
@ CAST_FLAG_UNKNOWN_14
Definition: Spell.h:97
@ CAST_FLAG_UNKNOWN_15
Definition: Spell.h:98
@ CAST_FLAG_PENDING
Definition: Spell.h:84
@ CAST_FLAG_NONE
Definition: Spell.h:83
@ CAST_FLAG_UNKNOWN_17
Definition: Spell.h:100
@ CAST_FLAG_IMMUNITY
Definition: Spell.h:110
@ CAST_FLAG_UNKNOWN_21
Definition: Spell.h:104
SpellHealPredictionType
Definition: Spell.h:155
@ SPELL_HEAL_PREDICTION_TARGET_AND_BEACON
Definition: Spell.h:158
@ SPELL_HEAL_PREDICTION_TARGET
Definition: Spell.h:156
@ SPELL_HEAL_PREDICTION_TARGET_PARTY
Definition: Spell.h:159
@ SPELL_HEAL_PREDICTION_TARGET_AND_CASTER
Definition: Spell.h:157
CurrentSpellTypes
Definition: Unit.h:588
PowerType
Definition: Corpse.h:53
Definition: Item.h:170
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
Definition: Object.h:150
int64 GetCorpseTargetCountForEffect(SpellEffIndex effect) const
int64 GetUnitTargetCountForEffect(SpellEffIndex effect) const
int64 GetItemTargetCountForEffect(SpellEffIndex effect) const
Difficulty GetCastDifficulty() const
int64 GetGameObjectTargetCountForEffect(SpellEffIndex effect) const
Definition: Spell.h:255
SpellInfo const * GetSpellInfo() const
Definition: Spell.h:650
std::vector< HitTriggerSpell > HitTriggerSpellList
Definition: Spell.h:901
bool m_fromClient
Definition: Spell.h:570
std::vector< SpellPowerCost > m_powerCost
Definition: Spell.h:702
uint32 m_castFlagsEx
Definition: Spell.h:571
std::vector< SpellScript * > m_loadedScripts
Definition: Spell.h:886
GameObject * gameObjTarget
Definition: Spell.h:734
SpellMissInfo targetMissInfo
Definition: Spell.h:738
bool m_referencedFromCurrentSpell
Definition: Spell.h:726
bool m_canReflect
Definition: Spell.h:705
Unit * m_originalCaster
Definition: Spell.h:696
DynObjAura * _dynObjAura
Definition: Spell.h:745
uint32 m_channelTargetEffectMask
Definition: Spell.h:809
uint64 m_delayStart
Definition: Spell.h:720
SpellCastTargets m_targets
Definition: Spell.h:607
void setState(uint32 state)
Definition: Spell.h:515
std::unique_ptr< PathGenerator > m_preGeneratedPath
Definition: Spell.h:927
int32 m_procChainLength
Definition: Spell.h:925
TriggerCastFlags _triggeredCastFlags
Definition: Spell.h:919
bool IsAutoRepeat() const
Definition: Spell.h:614
int32 damage
Definition: Spell.h:737
SpellEffectHandleMode effectHandleMode
Definition: Spell.h:740
int32 m_channeledDuration
Definition: Spell.h:704
uint32 Id
Definition: Spell.h:590
std::vector< TargetInfo > m_UniqueTargetInfo
Definition: Spell.h:808
bool IsInterruptable() const
Definition: Spell.h:631
void SetExecutedCurrently(bool yes)
Definition: Spell.h:632
ObjectGuid m_originalCastId
Definition: Spell.h:569
uint8 m_delayAtDamageCount
Definition: Spell.h:709
ProcFlagsSpellType m_procSpellType
Definition: Spell.h:760
uint64 m_delayMoment
Definition: Spell.h:721
uint32 SpecializationId
Definition: Spell.h:581
WeaponAttackType m_attackType
Definition: Spell.h:700
bool m_immediateHandled
Definition: Spell.h:723
uint32 m_spellState
Definition: Spell.h:915
uint32 AbilityId
Definition: Spell.h:591
std::any m_customArg
Definition: Spell.h:605
ObjectGuid m_originalCasterGUID
Definition: Spell.h:694
WorldObject *const m_caster
Definition: Spell.h:690
int32 GetCastTime() const
Definition: Spell.h:612
bool IsDeletable() const
Definition: Spell.h:629
int32 m_timer
Definition: Spell.h:916
int32 m_casttime
Definition: Spell.h:703
Item * itemTarget
Definition: Spell.h:733
uint32 TalentId
Definition: Spell.h:575
float variance
Definition: Spell.h:739
int32 m_damage
Definition: Spell.h:751
std::vector< CorpseTargetInfo > m_UniqueCorpseTargetInfo
Definition: Spell.h:835
uint32 getState() const
Definition: Spell.h:514
bool m_executedCurrently
Definition: Spell.h:727
std::unordered_set< Aura * > UsedSpellMods
Definition: Spell.h:435
ObjectGuid GetOriginalCasterGUID() const
Definition: Spell.h:648
SpellCustomErrors m_customError
Definition: Spell.h:608
Spell(Spell const &right)=delete
std::vector< GOTargetInfo > m_UniqueGOTargetInfo
Definition: Spell.h:818
int32 GetProcChainLength() const
Definition: Spell.h:627
HitTriggerSpellList m_hitTriggerSpells
Definition: Spell.h:902
uint32 ItemId
Definition: Spell.h:598
int32 m_healing
Definition: Spell.h:752
void SetDelayStart(uint64 m_time)
Definition: Spell.h:634
SpellEffectInfo const * effectInfo
Definition: Spell.h:741
SpellInfo const * m_triggeredByAuraSpell
Definition: Spell.h:924
int32 m_castItemLevel
Definition: Spell.h:567
UnitAura * _spellAura
Definition: Spell.h:744
uint32 m_applyMultiplierMask
Definition: Spell.h:728
Unit * unitTarget
Definition: Spell.h:732
SpellSchoolMask m_spellSchoolMask
Definition: Spell.h:699
WorldObject * GetCaster() const
Definition: Spell.h:647
SpellEvent * _spellEvent
Definition: Spell.h:918
uint32 SpellId
Definition: Spell.h:578
Unit * GetOriginalCaster() const
Definition: Spell.h:649
Corpse * m_corpseTarget
Definition: Spell.h:735
void ReSetTimer()
Definition: Spell.h:616
void SetAutoRepeat(bool rep)
Definition: Spell.h:615
WorldLocation * destTarget
Definition: Spell.h:736
Spell ** m_selfContainer
Definition: Spell.h:662
uint32 GarrMissionId
Definition: Spell.h:595
std::vector< SpellPowerCost > const & GetPowerCost() const
Definition: Spell.h:652
bool IsTriggeredByAura(SpellInfo const *auraSpellInfo) const
Definition: Spell.h:625
void SetReferencedFromCurrent(bool yes)
Definition: Spell.h:630
bool IsDelayableNoMore()
Definition: Spell.h:710
uint64 GetDelayStart() const
Definition: Spell.h:633
ProcFlagsInit m_procVictim
Definition: Spell.h:758
void SetRuneState(uint8 value)
Definition: Spell.h:641
Item * m_CastItem
Definition: Spell.h:564
std::vector< SpellLogEffect > _executeLogEffects
Definition: Spell.h:929
uint32 m_castItemEntry
Definition: Spell.h:566
uint64 GetDelayMoment() const
Definition: Spell.h:635
UsedSpellMods m_appliedMods
Definition: Spell.h:610
SpellValue *const m_spellValue
Definition: Spell.h:692
uint8 GetRuneState() const
Definition: Spell.h:640
int32 GetTimer() const
Definition: Spell.h:666
std::vector< ItemTargetInfo > m_UniqueItemInfo
Definition: Spell.h:826
SpellInfo const * GetTriggeredByAuraSpell() const
Definition: Spell.h:664
ProcFlagsInit m_procAttacker
Definition: Spell.h:757
ObjectGuid m_castItemGUID
Definition: Spell.h:565
SpellCastVisual m_SpellVisual
Definition: Spell.h:606
GameObject * focusObject
Definition: Spell.h:748
ProcFlagsHit m_hitMask
Definition: Spell.h:759
Spell & operator=(Spell const &right)=delete
int32 GetRemainingCastTime() const
Definition: Spell.h:613
ObjectGuid m_castId
Definition: Spell.h:568
bool m_launchHandled
Definition: Spell.h:722
SpellInfo const *const m_spellInfo
Definition: Spell.h:563
std::vector< T > & GetExecuteLogEffectTargets(SpellEffectName effect, Optional< std::vector< T > > SpellLogEffect::*member)
Definition: Spell.h:536
uint8 m_runesState
Definition: Spell.h:707
bool m_autoRepeat
Definition: Spell.h:706
Trinity::unique_trackable_ptr companion class, replicating what std::weak_ptr is to std::shared_ptr.
Definition: Unit.h:627
WorldObjectSpellAreaTargetSearchReason
Definition: Spell.h:966
void SelectRandomInjuredTargets(std::list< WorldObject * > &targets, size_t maxTargets, bool prioritizePlayers, Unit const *prioritizeGroupMembersOf)
Definition: Spell.cpp:9306
Optional< std::vector< SpellLogEffectTradeSkillItemParams > > TradeSkillTargets
Definition: Spell.h:213
Optional< std::vector< SpellLogEffectFeedPetParams > > FeedPetTargets
Definition: Spell.h:214
Optional< std::vector< SpellLogEffectPowerDrainParams > > PowerDrainTargets
Definition: Spell.h:209
Optional< std::vector< SpellLogEffectDurabilityDamageParams > > DurabilityDamageTargets
Definition: Spell.h:211
int32 Effect
Definition: Spell.h:207
Optional< std::vector< SpellLogEffectGenericVictimParams > > GenericVictimTargets
Definition: Spell.h:212
Optional< std::vector< SpellLogEffectExtraAttacksParams > > ExtraAttacksTargets
Definition: Spell.h:210
float RadiusMod
Definition: Spell.h:223
Optional< int32 > Duration
Definition: Spell.h:227
Optional< int32 > ParentSpellTargetIndex
Definition: Spell.h:229
int32 EffectBasePoints[MAX_SPELL_EFFECTS]
Definition: Spell.h:220
uint32 CustomBasePointsMask
Definition: Spell.h:221
uint32 MaxAffectedTargets
Definition: Spell.h:222
int32 AuraStackAmount
Definition: Spell.h:224
float CriticalChance
Definition: Spell.h:226
Optional< int32 > ParentSpellTargetCount
Definition: Spell.h:228
float DurationMul
Definition: Spell.h:225
SpellValue(SpellInfo const *proto, WorldObject const *caster)
Definition: Spell.cpp:471
ObjectGuid TargetGUID
Definition: Spell.h:832
ObjectGuid TargetGUID
Definition: Spell.h:815
SpellInfo const * triggeredSpell
Definition: Spell.h:893
HitTriggerSpell(SpellInfo const *spellInfo, SpellInfo const *auraSpellInfo, int32 procChance)
Definition: Spell.h:890
SpellInfo const * triggeredByAura
Definition: Spell.h:894
virtual void DoTargetSpellHit(Spell *spell, SpellEffectInfo const &spellEffectInfo)=0
virtual void PreprocessTarget(Spell *)
Definition: Spell.h:769
virtual ~TargetInfoBase()
Definition: Spell.h:777
virtual void DoDamageAndTriggers(Spell *)
Definition: Spell.h:771
ObjectGuid TargetGUID
Definition: Spell.h:786
WorldObjectSpellAreaTargetSearchReason _searchReason
Definition: Spell.h:975
SpellTargetCheckTypes _targetSelectionType
Definition: Spell.h:943
std::unique_ptr< ConditionSourceInfo > _condSrcInfo
Definition: Spell.h:944
SpellInfo const * _spellInfo
Definition: Spell.h:942
ConditionContainer const * _condList
Definition: Spell.h:945
SpellTargetObjectTypes _objectType
Definition: Spell.h:946
int finish(char const *message, int returnValue)