72#define SPELL_CHANNEL_UPDATE_INTERVAL (1 * IN_MILLISECONDS)
73#define MAX_SPELL_RANGE_TOLERANCE 3.0f
74#define TRAJECTORY_MISSILE_SIZE 3.0f
75#define AOE_DAMAGE_TARGET_CAP SI64LIT(20)
238typedef std::vector<std::pair<uint32, ObjectGuid>>
DispelList;
249 void EffectDistract();
250 void EffectSchoolDMG();
251 void EffectEnvironmentalDMG();
252 void EffectInstaKill();
254 void EffectTeleportUnits();
255 void EffectTeleportUnitsWithVisualLoadingScreen();
256 void EffectApplyAura();
257 void EffectSendEvent();
258 void EffectPowerBurn();
259 void EffectPowerDrain();
262 void EffectTeleportToReturnPoint();
263 void EffectIncreaseCurrencyCap();
264 void EffectHealthLeech();
265 void EffectQuestComplete();
266 void EffectCreateItem();
267 void EffectCreateItem2();
268 void EffectCreateRandomItem();
269 void EffectPersistentAA();
270 void EffectEnergize();
271 void EffectOpenLock();
272 void EffectSummonChangeItem();
273 void EffectProficiency();
274 void EffectSummonType();
275 void EffectLearnSpell();
277 void EffectDualWield();
278 void EffectPickPocket();
279 void EffectAddFarsight();
280 void EffectUntrainTalents();
281 void EffectHealMechanical();
283 void EffectJumpDest();
284 void EffectLeapBack();
285 void EffectQuestClear();
286 void EffectTeleUnitsFaceCaster();
287 void EffectLearnSkill();
288 void EffectPlayMovie();
289 void EffectTradeSkill();
290 void EffectEnchantItemPerm();
291 void EffectEnchantItemTmp();
292 void EffectTameCreature();
293 void EffectSummonPet();
294 void EffectLearnPetSpell();
295 void EffectWeaponDmg();
296 void EffectForceCast();
297 void EffectTriggerSpell();
298 void EffectTriggerMissileSpell();
300 void EffectHealMaxHealth();
301 void EffectInterruptCast();
302 void EffectSummonObjectWild();
303 void EffectScriptEffect();
304 void EffectSanctuary();
307 void EffectSummonPlayer();
308 void EffectActivateObject();
309 void EffectApplyGlyph();
310 void EffectEnchantHeldItem();
311 void EffectSummonObject();
312 void EffectChangeRaidMarker();
313 void EffectResurrect();
317 void EffectTransmitted();
318 void EffectDisEnchant();
319 void EffectInebriate();
320 void EffectFeedPet();
321 void EffectDismissPet();
322 void EffectReputation();
323 void EffectForceDeselect();
324 void EffectSelfResurrect();
325 void EffectSkinning();
327 void EffectChargeDest();
328 void EffectProspecting();
329 void EffectMilling();
330 void EffectRenamePet();
331 void EffectSendTaxi();
332 void EffectKnockBack();
333 void EffectPullTowards();
334 void EffectPullTowardsDest();
335 void EffectDispelMechanic();
336 void EffectResurrectPet();
337 void EffectDestroyAllTotems();
338 void EffectDurabilityDamage();
341 void EffectDurabilityDamagePCT();
342 void EffectModifyThreatPercent();
343 void EffectResurrectNew();
344 void EffectAddExtraAttacks();
345 void EffectSpiritHeal();
346 void EffectSkinPlayerCorpse();
347 void EffectStealBeneficialBuff();
348 void EffectUnlearnSpecialization();
349 void EffectHealPct();
350 void EffectEnergizePct();
351 void EffectTriggerRitualOfSummoning();
352 void EffectSummonRaFFriend();
353 void EffectUnlockGuildVaultTab();
354 void EffectKillCreditPersonal();
355 void EffectKillCredit();
356 void EffectQuestFail();
357 void EffectQuestStart();
358 void EffectRedirectThreat();
359 void EffectGameObjectDamage();
360 void EffectGameObjectRepair();
361 void EffectGameObjectSetDestructionState();
362 void EffectCreateTamedPet();
363 void EffectDiscoverTaxi();
364 void EffectTitanGrip();
365 void EffectEnchantItemPrismatic();
366 void EffectPlayMusic();
367 void EffectActivateSpec();
368 void EffectPlaySound();
369 void EffectRemoveAura();
370 void EffectDamageFromMaxHealthPCT();
371 void EffectCastButtons();
372 void EffectRechargeItem();
373 void EffectGiveCurrency();
374 void EffectSummonPersonalGameObject();
375 void EffectResurrectWithAura();
376 void EffectCreateAreaTrigger();
377 void EffectRemoveTalent();
378 void EffectDestroyItem();
379 void EffectLearnGarrisonBuilding();
380 void EffectRemoveAuraBySpellLabel();
381 void EffectCreateGarrison();
382 void EffectCreateConversation();
383 void EffectCancelConversation();
384 void EffectAddGarrisonFollower();
385 void EffectActivateGarrisonBuilding();
386 void EffectGrantBattlePetLevel();
387 void EffectGiveExperience();
388 void EffectGiveRestedExperience();
389 void EffectHealBattlePetPct();
390 void EffectEnableBattlePets();
391 void EffectChangeBattlePetQuality();
392 void EffectLaunchQuestChoice();
393 void EffectUncageBattlePet();
394 void EffectCreateHeirloomItem();
395 void EffectUpgradeHeirloom();
396 void EffectApplyEnchantIllusion();
397 void EffectUpdatePlayerPhase();
398 void EffectUpdateZoneAurasAndPhases();
399 void EffectGiveArtifactPower();
400 void EffectGiveArtifactPowerNoBonus();
401 void EffectPlaySceneScriptPackage();
402 void EffectCreateSceneObject();
403 void EffectCreatePrivateSceneObject();
404 void EffectPlayScene();
405 void EffectGiveHonor();
406 void EffectJumpCharge();
407 void EffectLearnTransmogSet();
408 void EffectRespecAzeriteEmpoweredItem();
409 void EffectLearnAzeriteEssencePower();
410 void EffectCreatePrivateConversation();
411 void EffectSendChatMessage();
412 void EffectGrantBattlePetExperience();
413 void EffectLearnTransmogIllusion();
414 void EffectModifyAuraStacks();
415 void EffectModifyCooldown();
416 void EffectModifyCooldowns();
417 void EffectModifyCooldownsByCategory();
418 void EffectModifySpellCharges();
419 void EffectCreateTraitTreeConfig();
420 void EffectChangeActiveCombatTraitConfig();
421 void EffectTeleportGraveyard();
429 void SelectExplicitTargets();
431 void SelectSpellTargets();
446 void SelectEffectTypeImplicitTargets(
SpellEffectInfo const& spellEffectInfo);
449 template<
class SEARCHER>
void SearchTargets(SEARCHER& searcher,
uint32 containerMask,
WorldObject* referer,
Position const* pos,
float radius);
459 void update(
uint32 difftime);
460 void cast(
bool skipCheck =
false);
464 void TakeRunePower(
bool didHit);
472 void handle_immediate();
475 void _handle_immediate_phase();
476 void _handle_finish_phase();
486 bool CheckSpellCancelsAuraEffect(
AuraType auraType,
int32* param1)
const;
487 bool CheckSpellCancelsCharm(
int32* param1)
const;
488 bool CheckSpellCancelsStun(
int32* param1)
const;
489 bool CheckSpellCancelsSilence(
int32* param1)
const;
490 bool CheckSpellCancelsPacify(
int32* param1)
const;
491 bool CheckSpellCancelsFear(
int32* param1)
const;
492 bool CheckSpellCancelsConfuse(
int32* param1)
const;
493 bool CheckSpellCancelsNoActions(
int32* param1)
const;
498 void DelayedChannel();
502 void DoCreateItem(
uint32 itemId,
ItemContext context = ItemContext::NONE, std::vector<int32>
const* bonusListIDs =
nullptr);
507 bool CanAutoCast(
Unit* target);
515 void SendSpellStart();
517 void SendSpellCooldown();
518 void SendSpellExecuteLog();
538 void SendSpellInterruptLog(
Unit* victim,
uint32 spellId);
539 void SendInterrupted(
uint8 result);
540 void SendChannelUpdate(
uint32 time);
541 void SendChannelStart(
uint32 duration);
542 void SendResurrectRequest(
Player* target);
545 void HandleThreatSpells();
600 void ReSetTimer() { m_timer = m_casttime > 0 ? m_casttime : 0; }
601 bool IsTriggered()
const;
602 bool IsIgnoringCooldowns()
const;
603 bool IsFocusDisabled()
const;
604 bool IsProcDisabled()
const;
605 bool IsChannelActive()
const;
606 bool IsAutoActionResetSpell()
const;
607 bool IsPositive()
const;
613 bool IsDeletable()
const {
return !m_referencedFromCurrentSpell && !m_executedCurrently; }
620 uint64 CalculateDelayMomentForDst(
float launchDelay)
const;
621 void RecalculateDelayMomentForDst();
622 void UpdateDelayMomentForDst(
uint64 hitDelay);
623 void UpdateDelayMomentForUnitTarget(
Unit* unit,
uint64 hitDelay);
627 bool IsNeedSendToClient()
const;
636 std::vector<SpellPowerCost>
const&
GetPowerCost()
const {
return m_powerCost; }
637 bool HasPowerTypeCost(
Powers power)
const;
640 bool UpdatePointers();
642 void CleanupTargetList();
658 void CallScriptOnResistAbsorbCalculateHandlers(
DamageInfo const& damageInfo,
uint32& resistAmount,
int32& absorbAmount);
664 bool HasGlobalCooldown()
const;
665 void TriggerGlobalCooldown();
666 void CancelGlobalCooldown();
667 void _cast(
bool skipCheck =
false);
669 std::pair<float, float> GetMinMaxRange(
bool strict)
const;
693 if (m_delayAtDamageCount >= 2)
696 ++m_delayAtDamageCount;
724 Unit* GetUnitCasterForEffectHandlers()
const;
742 void prepareDataForTriggerSystem();
763 void PreprocessTarget(
Spell* spell)
override;
765 void DoDamageAndTriggers(
Spell* spell)
override;
775 bool IsAlive =
false;
782 bool Positive =
true;
786 Unit* _spellHitTarget =
nullptr;
787 bool _enablePVP =
false;
818 template <
class Container>
819 void DoProcessTargetContainer(Container& targetContainer);
825 void AddUnitTarget(
Unit* target,
uint32 effectMask,
bool checkIfValid =
true,
bool implicit =
true,
Position const* losPosition =
nullptr);
827 void AddItemTarget(
Item* item,
uint32 effectMask);
828 void AddCorpseTarget(
Corpse* target,
uint32 effectMask);
831 void PreprocessSpellLaunch(
TargetInfo& targetInfo);
835 void DoTriggersOnSpellHit(
Unit* unit);
836 bool UpdateChanneledTargetList();
837 bool IsValidDeadOrAliveTarget(
Unit const* target)
const;
838 void HandleLaunchPhase();
841 void PrepareTargetProcessing();
842 void FinishTargetProcessing();
846 void CallScriptOnPrecastHandler();
847 void CallScriptBeforeCastHandlers();
848 void CallScriptOnCastHandlers();
849 void CallScriptAfterCastHandlers();
851 int32 CallScriptCalcCastTimeHandlers(
int32 originalCastTime);
855 void CallScriptOnHitHandlers();
856 void CallScriptAfterHitHandlers();
858 void CallScriptCalcCritChanceHandlers(
Unit const* victim,
float& chance);
859 void CallScriptCalcDamageHandlers(
Unit* victim,
int32& damage,
int32& flatMod,
float& pctMod);
860 void CallScriptCalcHealingHandlers(
Unit* victim,
int32& healing,
int32& flatMod,
float& pctMod);
865 bool CheckScriptEffectImplicitTargets(
uint32 effIndex,
uint32 effIndexToCheck);
871 triggeredSpell(spellInfo), triggeredByAura(auraSpellInfo), chance(procChance) { }
879 bool CanExecuteTriggersOnHit(
Unit* unit,
SpellInfo const* triggeredByAura =
nullptr)
const;
880 void PrepareTriggersExecutedOnHit();
886 void CalculateJumpSpeeds(
SpellEffectInfo const* effInfo,
float dist,
float& speedXY,
float& speedZ);
889 int32 GetSpellCastDataAmmo();
std::vector< Condition * > ConditionContainer
#define MAX_SPELL_EFFECTS
std::string GetDebugInfo()
std::optional< T > Optional
Optional helper class to wrap optional values within.
@ SPELL_CUSTOM_ERROR_NONE
@ SPELL_CAST_SOURCE_SPELL
@ SPELL_CAST_SOURCE_PLAYER
@ SPELL_CAST_SOURCE_PASSIVE
@ SPELL_CAST_SOURCE_NORMAL
std::vector< std::pair< uint32, ObjectGuid > > DispelList
void(Spell::*)() SpellEffectHandlerFn
@ CAST_FLAG_EX_DELAY_STARTING_COOLDOWNS
@ CAST_FLAG_EX_UNKNOWN_15
@ CAST_FLAG_EX_UNKNOWN_17
@ CAST_FLAG_EX_DONT_CONSUME_CHARGES
@ CAST_FLAG_EX_USE_TOY_SPELL
@ CAST_FLAG_EX_UNKNOWN_11
@ CAST_FLAG_EX_UNKNOWN_14
@ CAST_FLAG_EX_UNKNOWN_12
@ CAST_FLAG_EX_UNKNOWN_19
@ CAST_FLAG_EX_IGNORE_COOLDOWN
@ CAST_FLAG_EX_UNKNOWN_13
@ CAST_FLAG_EX_UNKNOWN_18
@ CAST_FLAG_EX_IGNORE_PET_COOLDOWN
@ CAST_FLAG_EX_UNKNOWN_20
@ CAST_FLAG_EX_TRIGGER_COOLDOWN_ON_SPELL_START
@ SPELL_EFFECT_HANDLE_LAUNCH_TARGET
@ SPELL_EFFECT_HANDLE_LAUNCH
@ SPELL_EFFECT_HANDLE_HIT
@ SPELL_EFFECT_HANDLE_HIT_TARGET
static const uint32 SPELL_INTERRUPT_NONPLAYER
@ CAST_FLAG_ADJUST_MISSILE
@ CAST_FLAG_HEAL_PREDICTION
@ CAST_FLAG_POWER_LEFT_SELF
@ CAST_FLAG_TRIGGER_PET_COOLDOWN
@ CAST_FLAG_HAS_TRAJECTORY
static ObjectGuid const Empty
SpellInfo const * GetSpellInfo() const
std::vector< HitTriggerSpell > HitTriggerSpellList
std::vector< SpellPowerCost > m_powerCost
std::vector< SpellScript * > m_loadedScripts
GameObject * gameObjTarget
SpellMissInfo targetMissInfo
bool m_referencedFromCurrentSpell
uint32 m_channelTargetEffectMask
SpellCastTargets m_targets
void setState(uint32 state)
std::unique_ptr< PathGenerator > m_preGeneratedPath
TriggerCastFlags _triggeredCastFlags
bool IsAutoRepeat() const
SpellEffectHandleMode effectHandleMode
int32 m_channeledDuration
std::vector< TargetInfo > m_UniqueTargetInfo
bool IsInterruptable() const
void SetExecutedCurrently(bool yes)
ObjectGuid m_originalCastId
uint8 m_delayAtDamageCount
ProcFlagsSpellType m_procSpellType
WeaponAttackType m_attackType
ObjectGuid m_originalCasterGUID
WorldObject *const m_caster
int32 GetCastTime() const
std::vector< CorpseTargetInfo > m_UniqueCorpseTargetInfo
std::unordered_set< Aura * > UsedSpellMods
ObjectGuid GetOriginalCasterGUID() const
SpellCustomErrors m_customError
Spell(Spell const &right)=delete
std::vector< GOTargetInfo > m_UniqueGOTargetInfo
int32 GetProcChainLength() const
HitTriggerSpellList m_hitTriggerSpells
void SetDelayStart(uint64 m_time)
SpellEffectInfo const * effectInfo
SpellInfo const * m_triggeredByAuraSpell
uint32 m_applyMultiplierMask
SpellSchoolMask m_spellSchoolMask
WorldObject * GetCaster() const
Unit * GetOriginalCaster() const
void SetAutoRepeat(bool rep)
WorldLocation * destTarget
std::vector< SpellPowerCost > const & GetPowerCost() const
bool IsTriggeredByAura(SpellInfo const *auraSpellInfo) const
void SetReferencedFromCurrent(bool yes)
uint64 GetDelayStart() const
ProcFlagsInit m_procVictim
void SetRuneState(uint8 value)
std::vector< SpellLogEffect > _executeLogEffects
uint64 GetDelayMoment() const
UsedSpellMods m_appliedMods
SpellValue *const m_spellValue
uint8 GetRuneState() const
std::vector< ItemTargetInfo > m_UniqueItemInfo
SpellInfo const * GetTriggeredByAuraSpell() const
ProcFlagsInit m_procAttacker
ObjectGuid m_castItemGUID
SpellCastVisual m_SpellVisual
Spell & operator=(Spell const &right)=delete
SpellInfo const *const m_spellInfo
std::vector< T > & GetExecuteLogEffectTargets(SpellEffectName effect, Optional< std::vector< T > > SpellLogEffect::*member)
void SelectRandomInjuredTargets(std::list< WorldObject * > &targets, size_t maxTargets, bool prioritizePlayers, Unit const *prioritizeGroupMembersOf)
Optional< std::vector< SpellLogEffectTradeSkillItemParams > > TradeSkillTargets
Optional< std::vector< SpellLogEffectFeedPetParams > > FeedPetTargets
Optional< std::vector< SpellLogEffectPowerDrainParams > > PowerDrainTargets
Optional< std::vector< SpellLogEffectDurabilityDamageParams > > DurabilityDamageTargets
Optional< std::vector< SpellLogEffectGenericVictimParams > > GenericVictimTargets
Optional< std::vector< SpellLogEffectExtraAttacksParams > > ExtraAttacksTargets
Optional< int32 > Duration
Optional< int32 > ParentSpellTargetIndex
int32 EffectBasePoints[MAX_SPELL_EFFECTS]
uint32 CustomBasePointsMask
uint32 MaxAffectedTargets
Optional< int32 > ParentSpellTargetCount
SpellInfo const * triggeredSpell
HitTriggerSpell(SpellInfo const *spellInfo, SpellInfo const *auraSpellInfo, int32 procChance)
SpellInfo const * triggeredByAura
virtual void DoTargetSpellHit(Spell *spell, SpellEffectInfo const &spellEffectInfo)=0
virtual void PreprocessTarget(Spell *)
virtual ~TargetInfoBase()
virtual void DoDamageAndTriggers(Spell *)
Position const * _position
Position const * _position
SpellTargetCheckTypes _targetSelectionType
std::unique_ptr< ConditionSourceInfo > _condSrcInfo
SpellInfo const * _spellInfo
ConditionContainer const * _condList
SpellTargetObjectTypes _objectType
Position const * _position