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