TrinityCore
spell_warlock.cpp
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/*
19 * Scripts for spells with SPELLFAMILY_WARLOCK and SPELLFAMILY_GENERIC spells used by warlock players.
20 * Ordered alphabetically using scriptname.
21 * Scriptnames of files in this file should be prefixed with "spell_warl_".
22 */
23
24#include "ScriptMgr.h"
25#include "AreaTrigger.h"
26#include "Creature.h"
27#include "GameObject.h"
28#include "ObjectAccessor.h"
29#include "Pet.h"
30#include "Player.h"
31#include "Random.h"
32#include "SpellAuraEffects.h"
33#include "SpellAuras.h"
34#include "SpellMgr.h"
35#include "SpellScript.h"
36
38{
74};
75
77{
80};
81
82// 710 - Banish
84{
85public:
87
88private:
90 {
91 if (missInfo != SPELL_MISS_IMMUNE)
92 return;
93
94 if (Unit* target = GetHitUnit())
95 {
96 // Casting Banish on a banished target will remove applied aura
97 if (Aura * banishAura = target->GetAura(GetSpellInfo()->Id, GetCaster()->GetGUID()))
98 banishAura->Remove();
99 }
100 }
101
102 void Register() override
103 {
105 }
106};
107
108// 111400 - Burning Rush
110{
111 bool Validate(SpellInfo const* spellInfo) override
112 {
113 return ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } });
114 }
115
117 {
118 Unit* caster = GetCaster();
119
120 if (caster->GetHealthPct() <= float(GetEffectInfo(EFFECT_1).CalcValue(caster)))
121 {
124 }
125
126 return SPELL_CAST_OK;
127 }
128
129 void Register() override
130 {
132 }
133};
134
135// 111400 - Burning Rush
137{
138 void PeriodicTick(AuraEffect const* aurEff)
139 {
140 if (GetTarget()->GetHealthPct() <= float(aurEff->GetAmount()))
141 {
143 Remove();
144 }
145 }
146
147 void Register() override
148 {
150 }
151};
152
153// 116858 - Chaos Bolt
155{
156 bool Load() override
157 {
158 return GetCaster()->GetTypeId() == TYPEID_PLAYER;
159 }
160
161 void HandleDummy(SpellEffIndex /*effIndex*/)
162 {
163 SetHitDamage(GetHitDamage() + CalculatePct(GetHitDamage(), GetCaster()->ToPlayer()->m_activePlayerData->SpellCritPercentage));
164 }
165
166 void CalcCritChance(Unit const* /*victim*/, float& critChance)
167 {
168 critChance = 100.0f;
169 }
170
171 void Register() override
172 {
175 }
176};
177
178// 77220 - Mastery: Chaotic Energies
180{
181 void HandleAbsorb(AuraEffect* /*aurEff*/, DamageInfo& dmgInfo, uint32& absorbAmount)
182 {
183 AuraEffect const* effect1 = GetEffect(EFFECT_1);
184 if (!effect1 || !GetTargetApplication()->HasEffect(EFFECT_1))
185 {
187 return;
188 }
189
190 // You take ${$s2/3}% reduced damage
191 float damageReductionPct = float(effect1->GetAmount()) / 3;
192 // plus a random amount of up to ${$s2/3}% additional reduced damage
193 damageReductionPct += frand(0.0f, damageReductionPct);
194
195 absorbAmount = CalculatePct(dmgInfo.GetDamage(), damageReductionPct);
196 }
197
198 void Register() override
199 {
201 }
202};
203
204// 6201 - Create Healthstone
206{
207 bool Validate(SpellInfo const* /*spellInfo*/) override
208 {
210 }
211
212 bool Load() override
213 {
214 return GetCaster()->GetTypeId() == TYPEID_PLAYER;
215 }
216
218 {
220 }
221
222 void Register() override
223 {
225 }
226};
227
228// 108416 - Dark Pact
230{
231 bool Validate(SpellInfo const* spellInfo) override
232 {
233 return ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 }, { spellInfo->Id, EFFECT_2 } });
234 }
235
236 void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated)
237 {
238 canBeRecalculated = false;
239 if (Unit* caster = GetCaster())
240 {
241 float extraAmount = caster->SpellBaseDamageBonusDone(GetSpellInfo()->GetSchoolMask()) * 2.5f;
242 int32 absorb = caster->CountPctFromCurHealth(GetEffectInfo(EFFECT_1).CalcValue(caster));
243 caster->SetHealth(caster->GetHealth() - absorb);
244 amount = CalculatePct(absorb, GetEffectInfo(EFFECT_2).CalcValue(caster)) + extraAmount;
245 }
246 }
247
248 void Register() override
249 {
251 }
252};
253
254// 48018 - Demonic Circle: Summon
256{
257 void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes mode)
258 {
259 // If effect is removed by expire remove the summoned demonic circle too.
260 if (!(mode & AURA_EFFECT_HANDLE_REAPPLY))
261 GetTarget()->RemoveGameObject(GetId(), true);
262
264 }
265
266 void HandleDummyTick(AuraEffect const* /*aurEff*/)
267 {
268 if (GameObject* circle = GetTarget()->GetGameObject(GetId()))
269 {
270 // Here we check if player is in demonic circle teleport range, if so add
271 // WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST; allowing him to cast the WARLOCK_DEMONIC_CIRCLE_TELEPORT.
272 // If not in range remove the WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST.
273
274 SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_WARLOCK_DEMONIC_CIRCLE_TELEPORT, GetCastDifficulty());
275
276 if (GetTarget()->IsWithinDist(circle, spellInfo->GetMaxRange(true)))
277 {
280 }
281 else
283 }
284 }
285
286 void Register() override
287 {
290 }
291};
292
293// 48020 - Demonic Circle: Teleport
295{
296 void HandleTeleport(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
297 {
298 if (Player* player = GetTarget()->ToPlayer())
299 {
300 if (GameObject* circle = player->GetGameObject(SPELL_WARLOCK_DEMONIC_CIRCLE_SUMMON))
301 {
302 player->NearTeleportTo(circle->GetPositionX(), circle->GetPositionY(), circle->GetPositionZ(), circle->GetOrientation());
303 player->RemoveMovementImpairingAuras(false);
304 }
305 }
306 }
307
308 void Register() override
309 {
311 }
312};
313
314// 67518, 19505 - Devour Magic
316{
317 bool Validate(SpellInfo const* spellInfo) override
318 {
320 && ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } });
321 }
322
324 {
325 Unit* caster = GetCaster();
328 args.AddSpellBP0(GetEffectInfo(EFFECT_1).CalcValue(caster));
329
330 caster->CastSpell(caster, SPELL_WARLOCK_DEVOUR_MAGIC_HEAL, args);
331
332 // Glyph of Felhunter
333 if (Unit* owner = caster->GetOwner())
334 if (owner->GetAura(SPELL_WARLOCK_GLYPH_OF_DEMON_TRAINING))
335 owner->CastSpell(owner, SPELL_WARLOCK_DEVOUR_MAGIC_HEAL, args);
336 }
337
338 void Register() override
339 {
341 }
342};
343
344// 603 - Doom
346{
347 bool Validate(SpellInfo const* /*spellInfo*/) override
348 {
350 }
351
352 void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
353 {
354 if (Unit* caster = GetCaster())
355 caster->CastSpell(caster, SPELL_WARLOCK_DOOM_ENERGIZE, true);
356 }
357
358 void Register() override
359 {
361 }
362};
363
364// 198590 - Drain Soul
366{
367 bool Validate(SpellInfo const* /*spellInfo*/) override
368 {
370 }
371
372 void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
373 {
374 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
375 return;
376
377 if (Unit* caster = GetCaster())
378 caster->CastSpell(caster, SPELL_WARLOCK_DRAIN_SOUL_ENERGIZE, true);
379 }
380
381 void Register() override
382 {
384 }
385};
386
387// 48181 - Haunt
389{
391 {
392 if (Aura* aura = GetHitAura())
393 if (AuraEffect* aurEff = aura->GetEffect(EFFECT_1))
394 aurEff->SetAmount(CalculatePct(GetHitDamage(), aurEff->GetAmount()));
395 }
396
397 void Register() override
398 {
400 }
401};
402
403// 755 - Health Funnel
405{
406 void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
407 {
408 Unit* caster = GetCaster();
409 if (!caster)
410 return;
411
412 Unit* target = GetTarget();
417 }
418
419 void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
420 {
421 Unit* target = GetTarget();
424 }
425
426 void OnPeriodic(AuraEffect const* aurEff)
427 {
428 Unit* caster = GetCaster();
429 if (!caster)
430 return;
432 uint32 damage = caster->CountPctFromMaxHealth(aurEff->GetBaseAmount());
433
434 if (Player* modOwner = caster->GetSpellModOwner())
435 modOwner->ApplySpellMod(GetSpellInfo(), SpellModOp::PowerCost0, damage);
436
437 SpellNonMeleeDamage damageInfo(caster, caster, GetSpellInfo(), GetAura()->GetSpellVisual(), GetSpellInfo()->SchoolMask, GetAura()->GetCastId());
438 damageInfo.periodicLog = true;
439 damageInfo.damage = damage;
440 caster->DealSpellDamage(&damageInfo, false);
441 caster->SendSpellNonMeleeDamageLog(&damageInfo);
442 }
443
444 void Register() override
445 {
449 }
450};
451
452// 6262 - Healthstone
454{
456 {
457 int32 heal = int32(CalculatePct(GetCaster()->GetCreateHealth(), GetHitHeal()));
458 SetHitHeal(heal);
459 }
460
461 void Register() override
462 {
464 }
465};
466
467// 348 - Immolate
469{
470 bool Validate(SpellInfo const* /*spellInfo*/) override
471 {
473 }
474
476 {
478 }
479
480 void Register() override
481 {
483 }
484};
485
486// 366330 - Random Sayaad
488{
489 bool Validate(SpellInfo const* /*spellInfo*/) override
490 {
491 return ValidateSpellInfo
492 ({
495 });
496 }
497
498 void HandleDummy(SpellEffIndex /*effIndex*/)
499 {
500 Unit* caster = GetCaster();
501
504
505 Player* player = GetCaster()->ToPlayer();
506 if (!player)
507 return;
508
509 if (Pet* pet = player->GetPet())
510 {
511 if (pet->IsPetSayaad())
512 pet->DespawnOrUnsummon();
513 }
514 }
515
516 void Register() override
517 {
519 }
520};
521
522// 366323 - Strengthen Pact - Succubus
523// 366325 - Strengthen Pact - Incubus
524// 366222 - Summon Sayaad
526{
527 bool Validate(SpellInfo const* /*spellInfo*/) override
528 {
530 }
531
532 // Note: this is a special case in which the warlock's minion pet must also cast Summon Disorientation at the beginning since this is only handled by SPELL_EFFECT_SUMMON_PET in Spell::CheckCast.
533 void OnPrecast() override
534 {
535 Player* player = GetCaster()->ToPlayer();
536 if (!player)
537 return;
538
539 if (Pet* pet = player->GetPet())
541 .SetOriginalCaster(pet->GetGUID())
543 }
544
545 void Register() override
546 {
547 }
548};
549
550// 6358 - Seduction (Special Ability)
552{
553 bool Validate(SpellInfo const* /*spellInfo*/) override
554 {
556 }
557
559 {
560 Unit* caster = GetCaster();
561 if (Unit* target = GetHitUnit())
562 {
563 if (caster->GetOwner() && caster->GetOwner()->HasAura(SPELL_WARLOCK_GLYPH_OF_SUCCUBUS))
564 {
565 target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, ObjectGuid::Empty, target->GetAura(SPELL_PRIEST_SHADOW_WORD_DEATH)); // SW:D shall not be removed.
566 target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
567 target->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH);
568 }
569 }
570 }
571
572 void Register() override
573 {
575 }
576};
577
578// 27285 - Seed of Corruption
580{
581 void FilterTargets(std::list<WorldObject*>& targets)
582 {
583 if (GetExplTargetUnit())
584 targets.remove(GetExplTargetUnit());
585 }
586
587 void Register() override
588 {
590 }
591};
592
593// 27243 - Seed of Corruption
595{
596 bool Validate(SpellInfo const* /*spellInfo*/) override
597 {
599 }
600
601 void CalculateBuffer(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
602 {
603 Unit* caster = GetCaster();
604 if (!caster)
605 return;
606
607 amount = caster->SpellBaseDamageBonusDone(GetSpellInfo()->GetSchoolMask()) * GetEffectInfo(EFFECT_0).CalcValue(caster) / 100;
608 }
609
610 void HandleProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)
611 {
613 DamageInfo* damageInfo = eventInfo.GetDamageInfo();
614 if (!damageInfo || !damageInfo->GetDamage())
615 return;
616
617 int32 amount = aurEff->GetAmount() - damageInfo->GetDamage();
618 if (amount > 0)
619 {
620 const_cast<AuraEffect*>(aurEff)->SetAmount(amount);
621 if (!GetTarget()->HealthBelowPctDamaged(1, damageInfo->GetDamage()))
622 return;
623 }
624
625 Remove();
626
627 Unit* caster = GetCaster();
628 if (!caster)
629 return;
630
632 }
633
634 void Register() override
635 {
638 }
639};
640
641// 32863 - Seed of Corruption
642// 36123 - Seed of Corruption
643// 38252 - Seed of Corruption
644// 39367 - Seed of Corruption
645// 44141 - Seed of Corruption
646// 70388 - Seed of Corruption
647// Monster spells, triggered only on amount drop (not on death)
649{
650 bool Validate(SpellInfo const* /*spellInfo*/) override
651 {
653 }
654
655 void HandleProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)
656 {
658 DamageInfo* damageInfo = eventInfo.GetDamageInfo();
659 if (!damageInfo || !damageInfo->GetDamage())
660 return;
661
662 int32 amount = aurEff->GetAmount() - damageInfo->GetDamage();
663 if (amount > 0)
664 {
665 const_cast<AuraEffect*>(aurEff)->SetAmount(amount);
666 return;
667 }
668
669 Remove();
670
671 Unit* caster = GetCaster();
672 if (!caster)
673 return;
674
676 }
677
678 void Register() override
679 {
681 }
682};
683
684// 686 - Shadow Bolt
686{
687 bool Validate(SpellInfo const* /*spellInfo*/) override
688 {
690 }
691
693 {
695 }
696
697 void Register() override
698 {
700 }
701};
702
703// 86121 - Soul Swap
705{
706 bool Validate(SpellInfo const* /*spellInfo*/) override
707 {
708 return ValidateSpellInfo(
709 {
713 });
714 }
715
716 void HandleHit(SpellEffIndex /*effIndex*/)
717 {
720 }
721
722 void Register() override
723 {
725 }
726};
727
728// 86211 - Soul Swap Override - Also acts as a dot container
730{
732 void Register() override { }
733
734public:
735 void AddDot(uint32 id) { _dotList.push_back(id); }
736 std::list<uint32> const GetDotList() const { return _dotList; }
738 void SetOriginalSwapSource(Unit* victim) { _swapCaster = victim; }
739
740private:
741 std::list<uint32> _dotList;
742 Unit* _swapCaster = nullptr;
743};
744
747{
748 void HandleHit(SpellEffIndex /*effIndex*/)
749 {
750 Unit* swapVictim = GetCaster();
751 Unit* warlock = GetHitUnit();
752 if (!warlock || !swapVictim)
753 return;
754
755 Unit::AuraApplicationMap const& appliedAuras = swapVictim->GetAppliedAuras();
756 spell_warl_soul_swap_override* swapSpellScript = nullptr;
757 if (Aura* swapOverrideAura = warlock->GetAura(SPELL_WARLOCK_SOUL_SWAP_OVERRIDE))
758 swapSpellScript = swapOverrideAura->GetScript<spell_warl_soul_swap_override>();
759
760 if (!swapSpellScript)
761 return;
762
764
765 for (Unit::AuraApplicationMap::const_iterator itr = appliedAuras.begin(); itr != appliedAuras.end(); ++itr)
766 {
767 SpellInfo const* spellProto = itr->second->GetBase()->GetSpellInfo();
768 if (itr->second->GetBase()->GetCaster() == warlock)
769 if (spellProto->SpellFamilyName == SPELLFAMILY_WARLOCK && (spellProto->SpellFamilyFlags & classMask))
770 swapSpellScript->AddDot(itr->first);
771 }
772
773 swapSpellScript->SetOriginalSwapSource(swapVictim);
774 }
775
776 void Register() override
777 {
779 }
780};
781
782// 86213 - Soul Swap Exhale
784{
785 bool Validate(SpellInfo const* /*spellInfo*/) override
786 {
788 }
789
791 {
792 Unit* currentTarget = GetExplTargetUnit();
793 Unit* swapTarget = nullptr;
794 if (Aura const* swapOverride = GetCaster()->GetAura(SPELL_WARLOCK_SOUL_SWAP_OVERRIDE))
795 if (spell_warl_soul_swap_override* swapScript = swapOverride->GetScript<spell_warl_soul_swap_override>())
796 swapTarget = swapScript->GetOriginalSwapSource();
797
798 // Soul Swap Exhale can't be cast on the same target than Soul Swap
799 if (swapTarget && currentTarget && swapTarget == currentTarget)
801
802 return SPELL_CAST_OK;
803 }
804
805 void OnEffectHit(SpellEffIndex /*effIndex*/)
806 {
809
810 std::list<uint32> dotList;
811 Unit* swapSource = nullptr;
812 if (Aura const* swapOverride = GetCaster()->GetAura(SPELL_WARLOCK_SOUL_SWAP_OVERRIDE))
813 {
814 spell_warl_soul_swap_override* swapScript = swapOverride->GetScript<spell_warl_soul_swap_override>();
815 if (!swapScript)
816 return;
817 dotList = swapScript->GetDotList();
818 swapSource = swapScript->GetOriginalSwapSource();
819 }
820
821 if (dotList.empty())
822 return;
823
824 for (std::list<uint32>::const_iterator itr = dotList.begin(); itr != dotList.end(); ++itr)
825 {
826 GetCaster()->AddAura(*itr, GetHitUnit());
827 if (!hasGlyph && swapSource)
828 swapSource->RemoveAurasDueToSpell(*itr);
829 }
830
831 // Remove Soul Swap Exhale buff
833
834 if (hasGlyph) // Add a cooldown on Soul Swap if caster has the glyph
836 }
837
838 void Register() override
839 {
842 }
843};
844
845// 29858 - Soulshatter
847{
848 bool Validate(SpellInfo const* /*spellInfo*/) override
849 {
851 }
852
853 void HandleDummy(SpellEffIndex /*effIndex*/)
854 {
855 Unit* caster = GetCaster();
856 if (Unit* target = GetHitUnit())
857 if (target->GetThreatManager().IsThreatenedBy(caster, true))
858 caster->CastSpell(target, SPELL_WARLOCK_SOULSHATTER_EFFECT, true);
859 }
860
861 void Register() override
862 {
864 }
865};
866
867// 366323 - Strengthen Pact - Succubus
869{
870 bool Validate(SpellInfo const* /*spellInfo*/) override
871 {
872 return ValidateSpellInfo
873 ({
876 });
877 }
878
879 void HandleDummy(SpellEffIndex /*effIndex*/)
880 {
881 Unit* caster = GetCaster();
882
885 }
886
887 void Register() override
888 {
890 }
891};
892
893// 366325 - Strengthen Pact - Incubus
895{
896 bool Validate(SpellInfo const* /*spellInfo*/) override
897 {
898 return ValidateSpellInfo
899 ({
902 });
903 }
904
905 void HandleDummy(SpellEffIndex /*effIndex*/)
906 {
907 Unit* caster = GetCaster();
908
911 }
912
913 void Register() override
914 {
916 }
917};
918
919// 366222 - Summon Sayaad
921{
922 bool Validate(SpellInfo const* /*spellInfo*/) override
923 {
924 return ValidateSpellInfo
925 ({
928 });
929 }
930
931 void HandleDummy(SpellEffIndex /*effIndex*/)
932 {
934 }
935
936 void Register() override
937 {
939 }
940};
941
942// 37377 - Shadowflame
943// 39437 - Shadowflame Hellfire and RoF
944template <uint32 Trigger>
946{
947 bool Validate(SpellInfo const* /*spellInfo*/) override
948 {
949 return ValidateSpellInfo({ Trigger });
950 }
951
952 void HandleProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)
953 {
955 Unit* caster = eventInfo.GetActor();
956 caster->CastSpell(caster, Trigger, aurEff);
957 }
958
959 void Register() override
960 {
962 }
963};
964
965// 30108, 34438, 34439, 35183 - Unstable Affliction
967{
968 bool Validate(SpellInfo const* /*spellInfo*/) override
969 {
971 }
972
973 void HandleDispel(DispelInfo* dispelInfo)
974 {
975 if (Unit* caster = GetCaster())
976 {
977 if (AuraEffect const* aurEff = GetEffect(EFFECT_1))
978 {
979 if (Unit* target = dispelInfo->GetDispeller()->ToUnit())
980 {
981 int32 bp = aurEff->GetAmount();
982 bp = target->SpellDamageBonusTaken(caster, aurEff->GetSpellInfo(), bp, DOT);
983 bp *= 9;
984
985 // backfire damage and silence
986 CastSpellExtraArgs args(aurEff);
987 args.AddSpellBP0(bp);
988 caster->CastSpell(target, SPELL_WARLOCK_UNSTABLE_AFFLICTION_DISPEL, args);
989 }
990 }
991 }
992 }
993
994 void Register() override
995 {
997 }
998};
999
1000// 5740 - Rain of Fire
1003{
1004 void HandleDummyTick(AuraEffect const* /*aurEff*/)
1005 {
1006 std::vector<AreaTrigger*> rainOfFireAreaTriggers = GetTarget()->GetAreaTriggers(SPELL_WARLOCK_RAIN_OF_FIRE);
1007 GuidUnorderedSet targetsInRainOfFire;
1008
1009 for (AreaTrigger* rainOfFireAreaTrigger : rainOfFireAreaTriggers)
1010 {
1011 GuidUnorderedSet const& insideTargets = rainOfFireAreaTrigger->GetInsideUnits();
1012 targetsInRainOfFire.insert(insideTargets.begin(), insideTargets.end());
1013 }
1014
1015 for (ObjectGuid insideTargetGuid : targetsInRainOfFire)
1016 if (Unit* insideTarget = ObjectAccessor::GetUnit(*GetTarget(), insideTargetGuid))
1017 if (!GetTarget()->IsFriendlyTo(insideTarget))
1019 }
1020
1021 void Register() override
1022 {
1024 }
1025};
1026
1028{
1063}
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
std::unordered_set< ObjectGuid > GuidUnorderedSet
Definition: ObjectGuid.h:396
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
constexpr uint32 PET_SUMMONING_DISORIENTATION
Definition: PetDefines.h:131
float frand(float min, float max)
Definition: Random.cpp:55
bool roll_chance_i(int chance)
Definition: Random.h:59
#define RegisterSpellAndAuraScriptPair(script_1, script_2)
Definition: ScriptMgr.h:1371
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
#define RegisterSpellScriptWithArgs(spell_script, script_name,...)
Definition: ScriptMgr.h:1368
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_3
Definition: SharedDefines.h:33
@ EFFECT_1
Definition: SharedDefines.h:31
@ EFFECT_0
Definition: SharedDefines.h:30
@ EFFECT_2
Definition: SharedDefines.h:32
SpellMissInfo
@ SPELL_MISS_IMMUNE
@ TARGET_UNIT_DEST_AREA_ENEMY
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_EFFECT_DISPEL
@ SPELL_EFFECT_SCHOOL_DAMAGE
@ SPELL_EFFECT_APPLY_AURA
@ SPELL_CUSTOM_ERROR_YOU_DONT_HAVE_ENOUGH_HEALTH
SpellCastResult
@ SPELL_FAILED_CUSTOM_ERROR
@ SPELL_FAILED_BAD_TARGETS
@ SPELL_CAST_OK
@ SPELLFAMILY_WARLOCK
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK
@ AURA_EFFECT_HANDLE_REAPPLY
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_DEATH
@ SPELL_AURA_PERIODIC_DAMAGE
@ SPELL_AURA_OBS_MOD_HEALTH
@ SPELL_AURA_PERIODIC_DAMAGE_PERCENT
@ SPELL_AURA_DUMMY
@ SPELL_AURA_MECHANIC_IMMUNITY
@ SPELL_AURA_SCHOOL_ABSORB
@ SPELL_AURA_PERIODIC_LEECH
@ SPELL_AURA_PERIODIC_DUMMY
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
Definition: SpellDefines.h:266
#define sSpellMgr
Definition: SpellMgr.h:849
#define SpellOnCalcCritChanceFn(F)
Definition: SpellScript.h:859
#define BeforeSpellHitFn(F)
Definition: SpellScript.h:847
#define SpellCheckCastFn(F)
Definition: SpellScript.h:830
#define AuraEffectProcFn(F, I, N)
Definition: SpellScript.h:2160
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define AuraEffectCalcAmountFn(F, I, N)
Definition: SpellScript.h:2058
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition: SpellScript.h:864
#define AuraEffectPeriodicFn(F, I, N)
Definition: SpellScript.h:2046
#define SpellCastFn(F)
Definition: SpellScript.h:825
#define AuraEffectAbsorbFn(F, I)
Definition: SpellScript.h:2090
#define AuraEffectApplyFn(F, I, N, M)
Definition: SpellScript.h:2029
#define SpellHitFn(F)
Definition: SpellScript.h:854
#define AuraDispelFn(F)
Definition: SpellScript.h:2018
#define AuraEffectRemoveFn(F, I, N, M)
Definition: SpellScript.h:2040
@ DOT
Definition: UnitDefines.h:134
T CalculatePct(T base, U pct)
Definition: Util.h:72
int32 GetBaseAmount() const
int32 GetAmount() const
void PreventDefaultAction()
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
Definition: SpellScript.h:2039
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition: SpellScript.h:2045
SpellInfo const * GetSpellInfo() const
HookList< EffectCalcAmountHandler > DoEffectCalcAmount
Definition: SpellScript.h:2057
Unit * GetCaster() const
SpellEffectInfo const & GetEffectInfo(SpellEffIndex effIndex) const
AuraEffect * GetEffect(uint8 effIndex) const
HookList< EffectAbsorbHandler > OnEffectAbsorb
Definition: SpellScript.h:2089
Aura * GetAura() const
Unit * GetTarget() const
Difficulty GetCastDifficulty() const
HookList< EffectApplyHandler > OnEffectRemove
Definition: SpellScript.h:2035
HookList< AuraDispelHandler > AfterDispel
Definition: SpellScript.h:2017
void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
HookList< EffectProcHandler > OnEffectProc
Definition: SpellScript.h:2155
bool HasEffect(uint8 effIndex) const
HookList< EffectApplyHandler > OnEffectApply
Definition: SpellScript.h:2024
uint32 GetId() const
uint32 GetDamage() const
Definition: Unit.h:446
WorldObject * GetDispeller() const
Definition: Unit.h:390
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
static Unit * ToUnit(Object *o)
Definition: Object.h:225
TypeID GetTypeId() const
Definition: Object.h:173
static Player * ToPlayer(Object *o)
Definition: Object.h:213
Definition: Pet.h:40
Pet * GetPet() const
Definition: Player.cpp:21513
Unit * GetActionTarget() const
Definition: Unit.h:494
DamageInfo * GetDamageInfo() const
Definition: Unit.h:505
Unit * GetActor() const
Definition: Unit.h:493
int32 CalcValue(WorldObject const *caster=nullptr, int32 const *basePoints=nullptr, Unit const *target=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
Definition: SpellInfo.cpp:495
flag128 SpellClassMask
Definition: SpellInfo.h:238
float GetMaxRange(bool positive=false, WorldObject *caster=nullptr, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:3768
uint32 const Id
Definition: SpellInfo.h:325
flag128 SpellFamilyFlags
Definition: SpellInfo.h:409
uint32 SpellFamilyName
Definition: SpellInfo.h:408
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
static bool ValidateSpellEffect(std::initializer_list< std::pair< uint32, SpellEffIndex > > effects)
Definition: SpellScript.h:173
HookList< CastHandler > AfterCast
Definition: SpellScript.h:824
HookList< CheckCastHandler > OnCheckCast
Definition: SpellScript.h:829
int32 GetHitDamage() const
Unit * GetCaster() const
HookList< HitHandler > AfterHit
Definition: SpellScript.h:852
HookList< HitHandler > OnHit
Definition: SpellScript.h:850
HookList< EffectHandler > OnEffectHit
Definition: SpellScript.h:839
Unit * GetHitUnit() const
SpellEffectInfo const & GetEffectInfo() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
Aura * GetHitAura(bool dynObjAura=false) const
void SetCustomCastResultMessage(SpellCustomErrors result)
Spell * GetSpell() const
Definition: SpellScript.h:987
HookList< BeforeHitHandler > BeforeHit
Definition: SpellScript.h:846
int32 GetHitHeal() const
void SetHitDamage(int32 damage)
HookList< EffectHandler > OnEffectSuccessfulDispel
Definition: SpellScript.h:841
HookList< OnCalcCritChanceHandler > OnCalcCritChance
Definition: SpellScript.h:858
void SetHitHeal(int32 heal)
Unit * GetExplTargetUnit() const
SpellInfo const * GetSpellInfo() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:863
Definition: Unit.h:627
void RemoveGameObject(GameObject *gameObj, bool del)
Definition: Unit.cpp:5238
float GetHealthPct() const
Definition: Unit.h:784
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3685
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition: Unit.h:637
void DealSpellDamage(SpellNonMeleeDamage const *damageInfo, bool durabilityLoss)
Definition: Unit.cpp:1248
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:11618
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage const *log)
Definition: Unit.cpp:5378
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4560
uint64 CountPctFromMaxHealth(int32 pct) const
Definition: Unit.h:785
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition: Unit.h:781
AuraApplicationMap & GetAppliedAuras()
Definition: Unit.h:1274
std::vector< AreaTrigger * > GetAreaTriggers(uint32 spellId) const
Definition: Unit.cpp:5335
int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) const
Definition: Unit.cpp:6894
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
Unit * GetOwner() const
Definition: Object.cpp:2229
Player * GetSpellModOwner() const
Definition: Object.cpp:2272
void HandleBanish(SpellMissInfo missInfo)
void Register() override
void PeriodicTick(AuraEffect const *aurEff)
bool Validate(SpellInfo const *spellInfo) override
SpellCastResult CheckApplyAura()
void Register() override
void HandleDummy(SpellEffIndex)
void Register() override
bool Load() override
void CalcCritChance(Unit const *, float &critChance)
void HandleAbsorb(AuraEffect *, DamageInfo &dmgInfo, uint32 &absorbAmount)
bool Validate(SpellInfo const *) override
void HandleScriptEffect(SpellEffIndex)
bool Validate(SpellInfo const *spellInfo) override
void Register() override
void CalculateAmount(AuraEffect const *, int32 &amount, bool &canBeRecalculated)
void HandleRemove(AuraEffect const *, AuraEffectHandleModes mode)
void HandleDummyTick(AuraEffect const *)
void HandleTeleport(AuraEffect const *, AuraEffectHandleModes)
void Register() override
bool Validate(SpellInfo const *spellInfo) override
void OnSuccessfulDispel(SpellEffIndex)
bool Validate(SpellInfo const *) override
void Register() override
void HandleEffectPeriodic(AuraEffect const *)
void Register() override
void HandleRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
void Register() override
void ApplyEffect(AuraEffect const *, AuraEffectHandleModes)
void RemoveEffect(AuraEffect const *, AuraEffectHandleModes)
void OnPeriodic(AuraEffect const *aurEff)
bool Validate(SpellInfo const *) override
void Register() override
void HandleOnEffectHit(SpellEffIndex)
void HandleDummyTick(AuraEffect const *)
void HandleDummy(SpellEffIndex)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void Register() override
void HandleScriptEffect(SpellEffIndex)
void CalculateBuffer(AuraEffect const *, int32 &amount, bool &)
bool Validate(SpellInfo const *) override
void HandleProc(AuraEffect *aurEff, ProcEventInfo &eventInfo)
void HandleProc(AuraEffect *aurEff, ProcEventInfo &eventInfo)
bool Validate(SpellInfo const *) override
void FilterTargets(std::list< WorldObject * > &targets)
void Register() override
bool Validate(SpellInfo const *) override
Soul Swap Copy Spells - 92795 - Simply copies spell IDs.
bool Validate(SpellInfo const *) override
void OnEffectHit(SpellEffIndex)
void SetOriginalSwapSource(Unit *victim)
std::list< uint32 > _dotList
void Register() override
Forced to, pure virtual functions must have a body when linking.
std::list< uint32 > const GetDotList() const
bool Validate(SpellInfo const *) override
void Register() override
void HandleHit(SpellEffIndex)
void HandleDummy(SpellEffIndex)
bool Validate(SpellInfo const *) override
void Register() override
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void HandleDummy(SpellEffIndex)
void Register() override
bool Validate(SpellInfo const *) override
void HandleProc(AuraEffect *aurEff, ProcEventInfo &eventInfo)
void HandleDispel(DispelInfo *dispelInfo)
bool Validate(SpellInfo const *) override
TC_GAME_API void Trigger(uint32 gameEventId, WorldObject *source, WorldObject *target)
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
TC_GAME_API GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
void AddSC_warlock_spell_scripts()
@ SPELL_GEN_REPLENISHMENT
@ SPELL_PRIEST_SHADOW_WORD_DEATH
@ SPELL_WARLOCK_SOUL_SWAP_MOD_COST
@ SPELL_WARLOCK_STRENGTHEN_PACT_SUCCUBUS
@ SPELL_WARLOCK_DEMONIC_CIRCLE_TELEPORT
@ SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R2
@ SPELL_WARLOCK_SOUL_SWAP_DOT_MARKER
@ SPELL_WARLOCK_RAIN_OF_FIRE
@ SPELL_WARLOCK_SHADOWFLAME
@ SPELL_WARLOCK_GLYPH_OF_DEMON_TRAINING
@ SPELL_WARLOCK_RAIN_OF_FIRE_DAMAGE
@ SPELL_WARLOCK_GLYPH_OF_SOUL_SWAP
@ SPELL_WARLOCK_DRAIN_SOUL_ENERGIZE
@ SPELL_WARLOCK_SHADOW_BOLT_ENERGIZE
@ SPELL_WARLOCK_DEMONIC_CIRCLE_SUMMON
@ SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_R1
@ SPELL_WARLOCK_STRENGTHEN_PACT_INCUBUS
@ SPELL_WARLOCK_SOUL_SWAP_OVERRIDE
@ SPELL_WARLOCK_SUMMON_SUCCUBUS
@ SPELL_WARLOCK_SEED_OF_CORRUPTION_GENERIC
@ SPELL_WARLOCK_DEVOUR_MAGIC_HEAL
@ SPELL_WARLOCK_SEED_OF_CORRUPTION_DAMAGE
@ SPELL_WARLOCK_SUCCUBUS_PACT
@ SPELL_WARLOCK_SOULSHATTER_EFFECT
@ SPELL_WARLOCK_SOUL_SWAP_CD_MARKER
@ SPELL_WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST
@ SPELL_WARLOCK_CREATE_HEALTHSTONE
@ SPELL_WARLOCK_SUMMON_INCUBUS
@ SPELL_WARLOCK_UNSTABLE_AFFLICTION
@ SPELL_WARLOCK_GLYPH_OF_SUCCUBUS
@ SPELL_WARLOCK_INCUBUS_PACT
@ SPELL_WARLOCK_FLAMESHADOW
@ SPELL_WARLOCK_UNSTABLE_AFFLICTION_DISPEL
@ SPELL_WARLOCK_DOOM_ENERGIZE
@ SPELL_WARLOCK_IMMOLATE_PERIODIC
@ SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_R2
@ SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R1
CastSpellExtraArgs & SetTriggeringSpell(Spell const *triggeringSpell)
Definition: Spell.cpp:9403
TriggerCastFlags TriggerFlags
Definition: SpellDefines.h:478
CastSpellExtraArgs & AddSpellBP0(int32 val)
Definition: SpellDefines.h:475
uint32 damage
Definition: Unit.h:556
bool periodicLog
Definition: Unit.h:561
MiscSpells