TrinityCore
spell_dk.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_DEATHKNIGHT and SPELLFAMILY_GENERIC spells used by deathknight players.
20 * Ordered alphabetically using scriptname.
21 * Scriptnames of files in this file should be prefixed with "spell_dk_".
22 */
23
24#include "AreaTrigger.h"
25#include "AreaTriggerAI.h"
26#include "ScriptMgr.h"
27#include "Containers.h"
28#include "ObjectMgr.h"
29#include "Player.h"
30#include "Spell.h"
31#include "SpellAuraEffects.h"
32#include "SpellHistory.h"
33#include "SpellMgr.h"
34#include "SpellScript.h"
35#include <numeric>
36
38{
79 SPELL_DK_DEATH_STRIKE_ENABLER = 89832, // Server Side
81 //SPELL_DK_TIGHTENING_GRASP_SLOW = 143375, // dropped in BfA
88};
89
90enum Misc
91{
93};
94
95// 70656 - Advantage (T10 4P Melee Bonus)
97{
98 bool CheckProc(ProcEventInfo& eventInfo)
99 {
100 if (Unit* caster = eventInfo.GetActor())
101 {
102 Player* player = caster->ToPlayer();
103 if (!player || caster->GetClass() != CLASS_DEATH_KNIGHT)
104 return false;
105
106 for (uint8 i = 0; i < player->GetMaxPower(POWER_RUNES); ++i)
107 if (player->GetRuneCooldown(i) == 0)
108 return false;
109
110 return true;
111 }
112
113 return false;
114 }
115
116 void Register() override
117 {
119 }
120};
121
122// 48707 - Anti-Magic Shell
124{
125public:
127 {
128 absorbPct = 0;
129 maxHealth = 0;
130 absorbedAmount = 0;
131 }
132
133 bool Validate(SpellInfo const* spellInfo) override
134 {
136 && ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } });
137 }
138
139 bool Load() override
140 {
143 absorbedAmount = 0;
144 return true;
145 }
146
147 void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
148 {
150
151 if (Player const* player = GetUnitOwner()->ToPlayer())
152 AddPct(amount, player->GetRatingBonusValue(CR_VERSATILITY_DAMAGE_DONE) + player->GetTotalAuraModifier(SPELL_AURA_MOD_VERSATILITY));
153 }
154
155 void Trigger(AuraEffect* aurEff, DamageInfo& /*dmgInfo*/, uint32& absorbAmount)
156 {
157 absorbedAmount += absorbAmount;
158
160 {
161 CastSpellExtraArgs args(aurEff);
162 args.AddSpellMod(SPELLVALUE_BASE_POINT0, CalculatePct(absorbAmount, 2 * absorbAmount * 100 / maxHealth));
164 }
165 }
166
167 void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
168 {
169 if (AuraEffect const* volatileShielding = GetTarget()->GetAuraEffect(SPELL_DK_VOLATILE_SHIELDING, EFFECT_1))
170 {
171 CastSpellExtraArgs args(volatileShielding);
172 args.AddSpellMod(SPELLVALUE_BASE_POINT0, CalculatePct(absorbedAmount, volatileShielding->GetAmount()));
174 }
175 }
176
177 void Register() override
178 {
182 }
183
184private:
188};
189
190static uint32 const ArmyTransforms[]
191{
198};
199
200// 127517 - Army Transform
203{
204 bool Validate(SpellInfo const* /*spellInfo*/) override
205 {
207 }
208
209 bool Load() override
210 {
211 return GetCaster()->IsGuardian();
212 }
213
215 {
216 if (Unit* owner = GetCaster()->GetOwner())
217 if (owner->HasAura(SPELL_DK_GLYPH_OF_FOUL_MENAGERIE))
218 return SPELL_CAST_OK;
219
221 }
222
223 void HandleDummy(SpellEffIndex /*effIndex*/)
224 {
226 }
227
228 void Register() override
229 {
232 }
233};
234
235// 207167 - Blinding Sleet
237{
238 bool Validate(SpellInfo const* /*spellInfo*/) override
239 {
241 }
242
243 void HandleOnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
244 {
245 if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
247 }
248
249 void Register() override
250 {
252 }
253};
254
255// 50842 - Blood Boil
257{
258 bool Validate(SpellInfo const* /*spellInfo*/) override
259 {
261 }
262
264 {
266 }
267
268 void Register() override
269 {
271 }
272};
273
274// 49028 - Dancing Rune Weapon
277{
278 bool Validate(SpellInfo const* /*spellInfo*/) override
279 {
280 if (!sObjectMgr->GetCreatureTemplate(NPC_DK_DANCING_RUNE_WEAPON))
281 return false;
282 return true;
283 }
284
285 // This is a port of the old switch hack in Unit.cpp, it's not correct
286 void HandleProc(AuraEffect* /*aurEff*/, ProcEventInfo& eventInfo)
287 {
289 Unit* caster = GetCaster();
290 if (!caster)
291 return;
292
293 Unit* drw = nullptr;
294 for (Unit* controlled : caster->m_Controlled)
295 {
296 if (controlled->GetEntry() == NPC_DK_DANCING_RUNE_WEAPON)
297 {
298 drw = controlled;
299 break;
300 }
301 }
302
303 if (!drw || !drw->GetVictim())
304 return;
305
306 SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
307 if (!spellInfo)
308 return;
309
310 DamageInfo* damageInfo = eventInfo.GetDamageInfo();
311 if (!damageInfo || !damageInfo->GetDamage())
312 return;
313
314 int32 amount = static_cast<int32>(damageInfo->GetDamage()) / 2;
315 SpellNonMeleeDamage log(drw, drw->GetVictim(), spellInfo, { spellInfo->GetSpellXSpellVisualId(drw), 0 }, spellInfo->GetSchoolMask());
316 log.damage = amount;
317 Unit::DealDamage(drw, drw->GetVictim(), amount, nullptr, SPELL_DIRECT_DAMAGE, spellInfo->GetSchoolMask(), spellInfo, true);
319 }
320
321 void Register() override
322 {
324 }
325};
326
327// 43265 - Death and Decay (Aura)
329{
330 void HandleDummyTick(AuraEffect const* aurEff)
331 {
332 if (Unit* caster = GetCaster())
333 caster->CastSpell(GetTarget(), SPELL_DK_DEATH_AND_DECAY_DAMAGE, aurEff);
334 }
335
336 void Register() override
337 {
339 }
340};
341
342// 47541 - Death Coil
344{
345 bool Validate(SpellInfo const* /*spell*/) override
346 {
348 }
349
350 void HandleDummy(SpellEffIndex /*effIndex*/)
351 {
352 Unit* caster = GetCaster();
354 if (AuraEffect const* unholyAura = caster->GetAuraEffect(SPELL_DK_UNHOLY, EFFECT_6)) // can be any effect, just here to send SPELL_FAILED_DONT_REPORT on failure
355 caster->CastSpell(caster, SPELL_DK_UNHOLY_VIGOR, unholyAura);
356 }
357
358 void Register() override
359 {
361 }
362};
363
364// 52751 - Death Gate
366{
368 {
369 if (GetCaster()->GetClass() != CLASS_DEATH_KNIGHT)
370 {
373 }
374
375 return SPELL_CAST_OK;
376 }
377
379 {
380 PreventHitDefaultEffect(effIndex);
381 if (Unit* target = GetHitUnit())
382 target->CastSpell(target, GetEffectValue(), false);
383 }
384
385 void Register() override
386 {
389 }
390};
391
392// 49576 - Death Grip Initial
394{
395 bool Validate(SpellInfo const* /*spellInfo*/) override
396 {
397 return ValidateSpellInfo(
398 {
403 });
404 }
405
407 {
408 Unit* caster = GetCaster();
409 // Death Grip should not be castable while jumping/falling
411 return SPELL_FAILED_MOVING;
412
413 return SPELL_CAST_OK;
414 }
415
416 void HandleDummy(SpellEffIndex /*effIndex*/)
417 {
422 }
423
424 void Register() override
425 {
428 }
429};
430
431// 48743 - Death Pact
433{
434 bool Validate(SpellInfo const* spellInfo) override
435 {
436 return ValidateSpellEffect({ { spellInfo->Id, EFFECT_2 } });
437 }
438
439 void HandleCalcAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
440 {
441 if (Unit* caster = GetCaster())
442 amount = int32(caster->CountPctFromMaxHealth(GetEffectInfo(EFFECT_2).CalcValue(caster)));
443 }
444
445 void Register() override
446 {
448 }
449};
450
451// 49998 - Death Strike
453{
454 bool Validate(SpellInfo const* spellInfo) override
455 {
456 return ValidateSpellInfo(
457 {
464 })
465 && ValidateSpellEffect({ { spellInfo->Id, EFFECT_2 } });
466 }
467
468 void HandleDummy(SpellEffIndex /*effIndex*/)
469 {
470 Unit* caster = GetCaster();
471
472 if (AuraEffect* enabler = caster->GetAuraEffect(SPELL_DK_DEATH_STRIKE_ENABLER, EFFECT_0, GetCaster()->GetGUID()))
473 {
474 // Heals you for 25% of all damage taken in the last 5 sec,
475 int32 heal = CalculatePct(enabler->CalculateAmount(GetCaster()), GetEffectInfo(EFFECT_1).CalcValue(GetCaster()));
476 // minimum 7.0% of maximum health.
477 int32 pctOfMaxHealth = CalculatePct(GetEffectInfo(EFFECT_2).CalcValue(GetCaster()), caster->GetMaxHealth());
478 heal = std::max(heal, pctOfMaxHealth);
479
481
484
485 if (caster->HasAura(SPELL_DK_FROST))
487 }
488 }
489
491 {
493 }
494
495 void Register() override
496 {
499 }
500};
501
502// 89832 - Death Strike Enabler - SPELL_DK_DEATH_STRIKE_ENABLER
504{
505 // Amount of seconds we calculate damage over
506 constexpr static uint8 LAST_SECONDS = 5;
507
508 bool CheckProc(ProcEventInfo& eventInfo)
509 {
510 return eventInfo.GetDamageInfo() != nullptr;
511 }
512
513 void Update(AuraEffect* /*aurEff*/)
514 {
515 // Move backwards all datas by one from [23][0][0][0][0] -> [0][23][0][0][0]
516 std::move_backward(_damagePerSecond.begin(), std::next(_damagePerSecond.begin(), LAST_SECONDS - 1), _damagePerSecond.end());
517 _damagePerSecond[0] = 0;
518 }
519
520 void HandleCalcAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated)
521 {
522 canBeRecalculated = true;
523 amount = int32(std::accumulate(_damagePerSecond.begin(), _damagePerSecond.end(), 0u));
524 }
525
526 void HandleProc(AuraEffect* /*aurEff*/, ProcEventInfo& eventInfo)
527 {
528 _damagePerSecond[0] += eventInfo.GetDamageInfo()->GetDamage();
529 }
530
531 void Register() override
532 {
537 }
538
539private:
540 std::array<uint32, LAST_SECONDS> _damagePerSecond = { };
541};
542
543// 85948 - Festering Strike
545{
546 bool Validate(SpellInfo const* /*spellInfo*/) override
547 {
549 }
550
552 {
554 }
555
556 void Register() override
557 {
559 }
560};
561
562// 47496 - Explode, Ghoul spell for Corpse Explosion
564{
565 bool Validate(SpellInfo const* spellInfo) override
566 {
568 }
569
570 void HandleDamage(SpellEffIndex /*effIndex*/)
571 {
572 SetHitDamage(GetCaster()->CountPctFromMaxHealth(GetEffectInfo(EFFECT_2).CalcValue(GetCaster())));
573 }
574
575 void Suicide(SpellEffIndex /*effIndex*/)
576 {
577 if (Unit* unitTarget = GetHitUnit())
578 {
579 // Corpse Explosion (Suicide)
580 unitTarget->CastSpell(unitTarget, SPELL_DK_CORPSE_EXPLOSION_TRIGGERED, true);
581 }
582 }
583
584 void Register() override
585 {
588 }
589};
590
591// 69961 - Glyph of Scourge Strike
593{
595 {
596 Unit* caster = GetCaster();
597 Unit* target = GetHitUnit();
598
600 for (Unit::AuraEffectList::const_iterator i = mPeriodic.begin(); i != mPeriodic.end(); ++i)
601 {
602 AuraEffect const* aurEff = *i;
603 SpellInfo const* spellInfo = aurEff->GetSpellInfo();
604 // search our Blood Plague and Frost Fever on target
605 if (spellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && spellInfo->SpellFamilyFlags[2] & 0x2 &&
606 aurEff->GetCasterGUID() == caster->GetGUID())
607 {
608 uint32 countMin = aurEff->GetBase()->GetMaxDuration();
609 uint32 countMax = spellInfo->GetMaxDuration();
610
611 // this Glyph
612 countMax += 9000;
613
614 if (countMin < countMax)
615 {
616 aurEff->GetBase()->SetDuration(aurEff->GetBase()->GetDuration() + 3000);
617 aurEff->GetBase()->SetMaxDuration(countMin + 3000);
618 }
619 }
620 }
621 }
622
623 void Register() override
624 {
626 }
627};
628
629// 49184 - Howling Blast
631{
632 bool Validate(SpellInfo const* /*spellInfo*/) override
633 {
635 }
636
638 {
640 }
641
642 void Register() override
643 {
645 }
646};
647
648// 206940 - Mark of Blood
650{
651 bool Validate(SpellInfo const* /*spellInfo*/) override
652 {
654 }
655
656 void HandleProc(AuraEffect* /*aurEff*/, ProcEventInfo& eventInfo)
657 {
659 if (Unit* caster = GetCaster())
660 caster->CastSpell(eventInfo.GetProcTarget(), SPELL_DK_MARK_OF_BLOOD_HEAL, true);
661 }
662
663 void Register() override
664 {
666 }
667};
668
669// 207346 - Necrosis
671{
672 bool Validate(SpellInfo const* /*spellInfo*/) override
673 {
675 }
676
677 void HandleProc(AuraEffect* /*aurEff*/, ProcEventInfo& eventInfo)
678 {
681 }
682
683 void Register() override
684 {
686 }
687};
688
689// 207256 - Obliteration
691{
692 bool Validate(SpellInfo const* /*spellInfo*/) override
693 {
696 }
697
698 void HandleProc(AuraEffect* aurEff, ProcEventInfo& /*eventInfo*/)
699 {
700 Unit* target = GetTarget();
701 target->CastSpell(target, SPELL_DK_KILLING_MACHINE_PROC, aurEff);
702
703 if (AuraEffect const* oblitaration = target->GetAuraEffect(SPELL_DK_OBLITERATION, EFFECT_1))
704 if (roll_chance_i(oblitaration->GetAmount()))
705 target->CastSpell(target, SPELL_DK_OBLITERATION_RUNE_ENERGIZE, aurEff);
706 }
707
708 void Register() override
709 {
711 }
712};
713
714// 207200 - Permafrost
716{
717 bool Validate(SpellInfo const* /*spellInfo*/) override
718 {
720 }
721
722 void HandleEffectProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
723 {
724 CastSpellExtraArgs args(aurEff);
727 }
728
729 void Register() override
730 {
732 }
733};
734
735// 121916 - Glyph of the Geist (Unholy)
738{
739 bool Validate(SpellInfo const* /*spellInfo*/) override
740 {
742 }
743
744 bool Load() override
745 {
746 return GetCaster()->IsPet();
747 }
748
750 {
751 if (Unit* owner = GetCaster()->GetOwner())
752 if (owner->HasAura(SPELL_DK_GLYPH_OF_THE_GEIST))
753 return SPELL_CAST_OK;
754
756 }
757
758 void Register() override
759 {
761 }
762};
763
764// 147157 Glyph of the Skeleton (Unholy)
767{
768 bool Validate(SpellInfo const* /*spellInfo*/) override
769 {
771 }
772
774 {
775 if (Unit* owner = GetCaster()->GetOwner())
776 if (owner->HasAura(SPELL_DK_GLYPH_OF_THE_SKELETON))
777 return SPELL_CAST_OK;
778
780 }
781
782 void Register() override
783 {
785 }
786};
787
788// 61257 - Runic Power Back on Snare/Root
791{
792 bool Validate(SpellInfo const* /*spellInfo*/) override
793 {
795 }
796
797 bool CheckProc(ProcEventInfo& eventInfo)
798 {
799 SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
800 if (!spellInfo)
801 return false;
802
803 return (spellInfo->GetAllEffectsMechanicMask() & ((1 << MECHANIC_ROOT) | (1 << MECHANIC_SNARE))) != 0;
804 }
805
806 void HandleProc(AuraEffect* /*aurEff*/, ProcEventInfo& eventInfo)
807 {
809 eventInfo.GetActionTarget()->CastSpell(nullptr, SPELL_DK_RUNIC_RETURN, true);
810 }
811
812 void Register() override
813 {
816 }
817};
818
819// 46584 - Raise Dead
821{
822 bool Validate(SpellInfo const* /*spellInfo*/) override
823 {
825 }
826
827 void HandleDummy(SpellEffIndex /*effIndex*/)
828 {
832
833 GetCaster()->CastSpell(nullptr, spellId, true);
834 }
835
836 void Register() override
837 {
839 }
840};
841
842// 59057 - Rime
844{
845 bool Validate(SpellInfo const* spellInfo) override
846 {
847 return ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } }) && ValidateSpellInfo({ SPELL_DK_FROST_SCYTHE });
848 }
849
850 bool CheckProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
851 {
852 float chance = static_cast<float>(GetSpellInfo()->GetEffect(EFFECT_1).CalcValue(GetTarget()));
853 if (eventInfo.GetSpellInfo()->Id == SPELL_DK_FROST_SCYTHE)
854 chance /= 2.f;
855
856 return roll_chance_f(chance);
857 }
858
859 void Register() override
860 {
862 }
863};
864
865// 242057 - Rune Empowered
867{
868 bool Validate(SpellInfo const* /*spellInfo*/) override
869 {
871 }
872
873 void HandleProc(AuraEffect* /*aurEff*/, ProcEventInfo& procInfo)
874 {
875 Spell const* procSpell = procInfo.GetProcSpell();
876 if (!procSpell)
877 return;
878
879 Aura* pillarOfFrost = GetTarget()->GetAura(SPELL_DK_PILLAR_OF_FROST);
880 if (!pillarOfFrost)
881 return;
882
884 // Breath of Sindragosa special case
885 SpellInfo const* breathOfSindragosa = sSpellMgr->AssertSpellInfo(SPELL_DK_BREATH_OF_SINDRAGOSA, DIFFICULTY_NONE);
886 if (procSpell->IsTriggeredByAura(breathOfSindragosa))
887 {
888 auto powerItr = std::find_if(breathOfSindragosa->PowerCosts.begin(), breathOfSindragosa->PowerCosts.end(),
889 [](SpellPowerEntry const* power) { return power->PowerType == POWER_RUNIC_POWER && power->PowerPctPerSecond > 0.0f; });
890 if (powerItr != breathOfSindragosa->PowerCosts.end())
891 _runicPowerSpent += CalculatePct(GetTarget()->GetMaxPower(POWER_RUNIC_POWER), (*powerItr)->PowerPctPerSecond);
892 }
893
894 if (_runicPowerSpent >= 600)
895 {
896 pillarOfFrost->SetDuration(pillarOfFrost->GetDuration() + 1000);
897 _runicPowerSpent -= 600;
898 }
899 }
900
901 void Register() override
902 {
904 }
905
907};
908
909// 55233 - Vampiric Blood
911{
912 void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
913 {
914 amount = GetUnitOwner()->CountPctFromMaxHealth(amount);
915 }
916
917 void Register() override
918 {
920 }
921};
922
923// 43265 - Death and Decay
925{
926 at_dk_death_and_decay(AreaTrigger* areatrigger) : AreaTriggerAI(areatrigger) { }
927
928 void OnUnitEnter(Unit* unit) override
929 {
930 if (Unit* caster = at->GetCaster())
931 {
932 if (caster == unit)
933 {
934 if (caster->HasAura(SPELL_DK_UNHOLY_GROUND_TALENT))
935 caster->CastSpell(caster, SPELL_DK_UNHOLY_GROUND_HASTE);
936 }
937 }
938 }
939
940 void OnUnitExit(Unit* unit) override
941 {
943 }
944};
945
947{
976
978}
@ DIFFICULTY_NONE
Definition: DBCEnums.h:874
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
#define sObjectMgr
Definition: ObjectMgr.h:1946
bool roll_chance_f(float chance)
Definition: Random.h:53
bool roll_chance_i(int chance)
Definition: Random.h:59
#define RegisterAreaTriggerAI(ai_name)
Definition: ScriptMgr.h:1416
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_6
Definition: SharedDefines.h:36
@ EFFECT_1
Definition: SharedDefines.h:31
@ EFFECT_0
Definition: SharedDefines.h:30
@ EFFECT_2
Definition: SharedDefines.h:32
@ CLASS_DEATH_KNIGHT
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_EFFECT_SCHOOL_DAMAGE
@ MECHANIC_ROOT
@ MECHANIC_SNARE
@ SPELL_CUSTOM_ERROR_MUST_BE_DEATH_KNIGHT
@ POWER_RUNIC_POWER
@ POWER_RUNES
SpellCastResult
@ SPELL_FAILED_MOVING
@ SPELL_FAILED_CUSTOM_ERROR
@ SPELL_CAST_OK
@ SPELL_FAILED_SPELL_UNAVAILABLE
@ SPELLFAMILY_DEATHKNIGHT
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_EXPIRE
@ SPELL_AURA_PERIODIC_DAMAGE
@ SPELL_AURA_PROC_TRIGGER_SPELL
@ SPELL_AURA_SCHOOL_HEAL_ABSORB
@ SPELL_AURA_DUMMY
@ SPELL_AURA_MOD_INCREASE_HEALTH_2
@ SPELL_AURA_MOD_VERSATILITY
@ SPELL_AURA_SCHOOL_ABSORB
@ SPELL_AURA_MOD_CONFUSE
@ SPELL_AURA_PERIODIC_DUMMY
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
Definition: SpellDefines.h:266
@ SPELLVALUE_AURA_STACK
Definition: SpellDefines.h:231
@ SPELLVALUE_BASE_POINT0
Definition: SpellDefines.h:196
#define sSpellMgr
Definition: SpellMgr.h:849
#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 AuraEffectPeriodicFn(F, I, N)
Definition: SpellScript.h:2046
#define AuraCheckEffectProcFn(F, I, N)
Definition: SpellScript.h:2136
#define AuraEffectUpdatePeriodicFn(F, I, N)
Definition: SpellScript.h:2052
#define SpellCastFn(F)
Definition: SpellScript.h:825
#define AuraEffectAbsorbFn(F, I)
Definition: SpellScript.h:2090
#define AuraCheckProcFn(F)
Definition: SpellScript.h:2130
#define SpellHitFn(F)
Definition: SpellScript.h:854
#define AuraEffectRemoveFn(F, I, N, M)
Definition: SpellScript.h:2040
@ MOVEMENTFLAG_FALLING
Definition: UnitDefines.h:369
@ SPELL_DIRECT_DAMAGE
Definition: UnitDefines.h:133
@ UNIT_STATE_JUMPING
Definition: Unit.h:273
@ CR_VERSATILITY_DAMAGE_DONE
Definition: Unit.h:339
T AddPct(T &base, U pct)
Definition: Util.h:85
T CalculatePct(T base, U pct)
Definition: Util.h:72
AreaTrigger *const at
Definition: AreaTriggerAI.h:33
Unit * GetCaster() const
SpellInfo const * GetSpellInfo() const
Aura * GetBase() const
ObjectGuid GetCasterGUID() const
int32 GetAmount() const
void PreventDefaultAction()
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
Definition: SpellScript.h:2039
HookList< CheckEffectProcHandler > DoCheckEffectProc
Definition: SpellScript.h:2135
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition: SpellScript.h:2045
SpellInfo const * GetSpellInfo() const
HookList< EffectProcHandler > AfterEffectProc
Definition: SpellScript.h:2159
HookList< EffectAbsorbHandler > AfterEffectAbsorb
Definition: SpellScript.h:2096
HookList< EffectCalcAmountHandler > DoEffectCalcAmount
Definition: SpellScript.h:2057
Unit * GetCaster() const
HookList< EffectUpdatePeriodicHandler > OnEffectUpdatePeriodic
Definition: SpellScript.h:2051
SpellEffectInfo const & GetEffectInfo(SpellEffIndex effIndex) const
Unit * GetTarget() const
HookList< CheckProcHandler > DoCheckProc
Definition: SpellScript.h:2129
HookList< EffectProcHandler > OnEffectProc
Definition: SpellScript.h:2155
Unit * GetUnitOwner() const
int32 GetMaxDuration() const
Definition: SpellAuras.h:168
int32 GetDuration() const
Definition: SpellAuras.h:173
void SetDuration(int32 duration, bool withMods=false)
Definition: SpellAuras.cpp:892
void SetMaxDuration(int32 duration)
Definition: SpellAuras.h:169
uint32 GetDamage() const
Definition: Unit.h:446
uint32 GetEntry() const
Definition: Object.h:161
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
static Player * ToPlayer(Object *o)
Definition: Object.h:213
uint32 GetRuneCooldown(uint8 index) const
Definition: Player.h:2643
Unit * GetActionTarget() const
Definition: Unit.h:494
Spell const * GetProcSpell() const
Definition: Unit.h:508
SpellInfo const * GetSpellInfo() const
Definition: Unit.cpp:280
DamageInfo * GetDamageInfo() const
Definition: Unit.h:505
Unit * GetProcTarget() const
Definition: Unit.h:495
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
std::array< SpellPowerEntry const *, MAX_POWERS_PER_SPELL > PowerCosts
Definition: SpellInfo.h:386
uint64 GetAllEffectsMechanicMask() const
Definition: SpellInfo.cpp:2470
uint32 const Id
Definition: SpellInfo.h:325
int32 GetMaxDuration() const
Definition: SpellInfo.cpp:3798
flag128 SpellFamilyFlags
Definition: SpellInfo.h:409
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:2465
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition: SpellInfo.h:577
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
Unit * GetCaster() const
HookList< HitHandler > OnHit
Definition: SpellScript.h:850
void PreventHitDefaultEffect(SpellEffIndex effIndex)
Unit * GetHitUnit() const
int32 GetEffectValue() const
SpellEffectInfo const & GetEffectInfo() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
void SetCustomCastResultMessage(SpellCustomErrors result)
void SetHitDamage(int32 damage)
HookList< EffectHandler > OnEffectLaunch
Definition: SpellScript.h:837
Definition: Spell.h:255
Optional< int32 > GetPowerTypeCostAmount(Powers power) const
Definition: Spell.cpp:7958
bool IsTriggeredByAura(SpellInfo const *auraSpellInfo) const
Definition: Spell.h:625
Definition: Unit.h:627
static uint32 DealDamage(Unit *attacker, Unit *victim, uint32 damage, CleanDamage const *cleanDamage=nullptr, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=nullptr, bool durabilityLoss=true)
Definition: Unit.cpp:769
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1321
uint8 GetClass() const
Definition: Unit.h:752
std::forward_list< AuraEffect * > AuraEffectList
Definition: Unit.h:644
bool IsPet() const
Definition: Unit.h:740
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:4464
int32 GetMaxPower(Powers power) const
Definition: Unit.cpp:9410
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage const *log)
Definition: Unit.cpp:5378
ControlList m_Controlled
Definition: Unit.h:1211
uint64 GetMaxHealth() const
Definition: Unit.h:777
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4560
bool HasUnitMovementFlag(uint32 f) const
Definition: Unit.h:1663
bool IsGuardian() const
Definition: Unit.h:739
Unit * GetVictim() const
Definition: Unit.h:715
uint64 CountPctFromMaxHealth(int32 pct) const
Definition: Unit.h:785
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
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
bool CheckProc(ProcEventInfo &eventInfo)
Definition: spell_dk.cpp:98
void Register() override
Definition: spell_dk.cpp:116
bool Load() override
Definition: spell_dk.cpp:139
void CalculateAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_dk.cpp:147
void Trigger(AuraEffect *aurEff, DamageInfo &, uint32 &absorbAmount)
Definition: spell_dk.cpp:155
void HandleEffectRemove(AuraEffect const *, AuraEffectHandleModes)
Definition: spell_dk.cpp:167
bool Validate(SpellInfo const *spellInfo) override
Definition: spell_dk.cpp:133
void Register() override
Definition: spell_dk.cpp:177
6.x, does this belong here or in spell_generic? where do we cast this? sniffs say this is only cast w...
Definition: spell_dk.cpp:203
void Register() override
Definition: spell_dk.cpp:228
void HandleDummy(SpellEffIndex)
Definition: spell_dk.cpp:223
bool Validate(SpellInfo const *) override
Definition: spell_dk.cpp:204
SpellCastResult CheckCast()
Definition: spell_dk.cpp:214
bool Load() override
Definition: spell_dk.cpp:209
void HandleOnRemove(AuraEffect const *, AuraEffectHandleModes)
Definition: spell_dk.cpp:243
void Register() override
Definition: spell_dk.cpp:249
bool Validate(SpellInfo const *) override
Definition: spell_dk.cpp:238
void Register() override
Definition: spell_dk.cpp:268
bool Validate(SpellInfo const *) override
Definition: spell_dk.cpp:258
bool Validate(SpellInfo const *) override
Definition: spell_dk.cpp:278
void Register() override
Definition: spell_dk.cpp:321
void HandleProc(AuraEffect *, ProcEventInfo &eventInfo)
Definition: spell_dk.cpp:286
void Register() override
Definition: spell_dk.cpp:336
void HandleDummyTick(AuraEffect const *aurEff)
Definition: spell_dk.cpp:330
bool Validate(SpellInfo const *) override
Definition: spell_dk.cpp:345
void Register() override
Definition: spell_dk.cpp:358
void HandleDummy(SpellEffIndex)
Definition: spell_dk.cpp:350
void HandleScript(SpellEffIndex effIndex)
Definition: spell_dk.cpp:378
SpellCastResult CheckClass()
Definition: spell_dk.cpp:367
void Register() override
Definition: spell_dk.cpp:385
SpellCastResult CheckCast()
Definition: spell_dk.cpp:406
void Register() override
Definition: spell_dk.cpp:424
bool Validate(SpellInfo const *) override
Definition: spell_dk.cpp:395
void HandleDummy(SpellEffIndex)
Definition: spell_dk.cpp:416
void Register() override
Definition: spell_dk.cpp:445
void HandleCalcAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_dk.cpp:439
bool Validate(SpellInfo const *spellInfo) override
Definition: spell_dk.cpp:434
std::array< uint32, LAST_SECONDS > _damagePerSecond
Definition: spell_dk.cpp:540
void HandleCalcAmount(AuraEffect const *, int32 &amount, bool &canBeRecalculated)
Definition: spell_dk.cpp:520
void Update(AuraEffect *)
Definition: spell_dk.cpp:513
bool CheckProc(ProcEventInfo &eventInfo)
Definition: spell_dk.cpp:508
void HandleProc(AuraEffect *, ProcEventInfo &eventInfo)
Definition: spell_dk.cpp:526
static constexpr uint8 LAST_SECONDS
Definition: spell_dk.cpp:506
void TriggerRecentlyUsedDeathStrike()
Definition: spell_dk.cpp:490
bool Validate(SpellInfo const *spellInfo) override
Definition: spell_dk.cpp:454
void HandleDummy(SpellEffIndex)
Definition: spell_dk.cpp:468
void Register() override
Definition: spell_dk.cpp:495
void Register() override
Definition: spell_dk.cpp:556
void HandleScriptEffect(SpellEffIndex)
Definition: spell_dk.cpp:551
bool Validate(SpellInfo const *) override
Definition: spell_dk.cpp:546
void HandleDamage(SpellEffIndex)
Definition: spell_dk.cpp:570
bool Validate(SpellInfo const *spellInfo) override
Definition: spell_dk.cpp:565
void Suicide(SpellEffIndex)
Definition: spell_dk.cpp:575
void Register() override
Definition: spell_dk.cpp:584
void HandleScriptEffect(SpellEffIndex)
Definition: spell_dk.cpp:594
void HandleFrostFever(SpellEffIndex)
Definition: spell_dk.cpp:637
bool Validate(SpellInfo const *) override
Definition: spell_dk.cpp:632
void Register() override
Definition: spell_dk.cpp:642
void Register() override
Definition: spell_dk.cpp:663
bool Validate(SpellInfo const *) override
Definition: spell_dk.cpp:651
void HandleProc(AuraEffect *, ProcEventInfo &eventInfo)
Definition: spell_dk.cpp:656
void HandleProc(AuraEffect *, ProcEventInfo &eventInfo)
Definition: spell_dk.cpp:677
void Register() override
Definition: spell_dk.cpp:683
bool Validate(SpellInfo const *) override
Definition: spell_dk.cpp:672
void HandleProc(AuraEffect *aurEff, ProcEventInfo &)
Definition: spell_dk.cpp:698
bool Validate(SpellInfo const *) override
Definition: spell_dk.cpp:692
void Register() override
Definition: spell_dk.cpp:708
bool Validate(SpellInfo const *) override
Definition: spell_dk.cpp:717
void Register() override
Definition: spell_dk.cpp:729
void HandleEffectProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
Definition: spell_dk.cpp:722
6.x, does this belong here or in spell_generic? apply this in creature_template_addon?...
Definition: spell_dk.cpp:738
void Register() override
Definition: spell_dk.cpp:758
bool Validate(SpellInfo const *) override
Definition: spell_dk.cpp:739
SpellCastResult CheckCast()
Definition: spell_dk.cpp:749
6.x, does this belong here or in spell_generic? apply this in creature_template_addon?...
Definition: spell_dk.cpp:767
bool Validate(SpellInfo const *) override
Definition: spell_dk.cpp:768
SpellCastResult CheckCast()
Definition: spell_dk.cpp:773
void HandleProc(AuraEffect *, ProcEventInfo &eventInfo)
Definition: spell_dk.cpp:806
bool CheckProc(ProcEventInfo &eventInfo)
Definition: spell_dk.cpp:797
void Register() override
Definition: spell_dk.cpp:812
bool Validate(SpellInfo const *) override
Definition: spell_dk.cpp:792
bool Validate(SpellInfo const *) override
Definition: spell_dk.cpp:822
void Register() override
Definition: spell_dk.cpp:836
void HandleDummy(SpellEffIndex)
Definition: spell_dk.cpp:827
void Register() override
Definition: spell_dk.cpp:859
bool CheckProc(AuraEffect const *, ProcEventInfo &eventInfo)
Definition: spell_dk.cpp:850
bool Validate(SpellInfo const *spellInfo) override
Definition: spell_dk.cpp:845
void HandleProc(AuraEffect *, ProcEventInfo &procInfo)
Definition: spell_dk.cpp:873
bool Validate(SpellInfo const *) override
Definition: spell_dk.cpp:868
void Register() override
Definition: spell_dk.cpp:917
void CalculateAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_dk.cpp:912
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition: Containers.h:109
DeathKnightSpells
Definition: pet_dk.cpp:30
@ NPC_DK_DANCING_RUNE_WEAPON
Definition: spell_dk.cpp:92
static uint32 const ArmyTransforms[]
Definition: spell_dk.cpp:191
@ SPELL_DK_DEATH_STRIKE_OFFHAND
Definition: spell_dk.cpp:58
@ SPELL_DK_FROST_SHIELD
Definition: spell_dk.cpp:63
@ SPELL_DK_UNHOLY_GROUND_TALENT
Definition: spell_dk.cpp:84
@ SPELL_DK_RUNIC_RETURN
Definition: spell_dk.cpp:76
@ SPELL_DK_ARMY_SPIKED_GHOUL_TRANSFORM
Definition: spell_dk.cpp:43
@ SPELL_DK_UNHOLY_VIGOR
Definition: spell_dk.cpp:85
@ SPELL_DK_OBLITERATION
Definition: spell_dk.cpp:70
@ SPELL_DK_ARMY_NORTHREND_SKELETON_TRANSFORM
Definition: spell_dk.cpp:41
@ SPELL_DK_ARMY_FLESH_BEAST_TRANSFORM
Definition: spell_dk.cpp:39
@ SPELL_DK_ARMY_SKELETON_TRANSFORM
Definition: spell_dk.cpp:42
@ SPELL_DK_BLOOD_PLAGUE
Definition: spell_dk.cpp:47
@ SPELL_DK_MARK_OF_BLOOD_HEAL
Definition: spell_dk.cpp:68
@ SPELL_DK_UNHOLY
Definition: spell_dk.cpp:82
@ SPELL_DK_FESTERING_WOUND
Definition: spell_dk.cpp:59
@ SPELL_DK_VOLATILE_SHIELDING_DAMAGE
Definition: spell_dk.cpp:87
@ SPELL_DK_DEATH_AND_DECAY_DAMAGE
Definition: spell_dk.cpp:52
@ SPELL_DK_TIGHTENING_GRASP
Definition: spell_dk.cpp:80
@ SPELL_DK_UNHOLY_GROUND_HASTE
Definition: spell_dk.cpp:83
@ SPELL_DK_RAISE_DEAD_SUMMON
Definition: spell_dk.cpp:73
@ SPELL_DK_VOLATILE_SHIELDING
Definition: spell_dk.cpp:86
@ SPELL_DK_DEATH_GRIP_JUMP
Definition: spell_dk.cpp:55
@ SPELL_DK_BLOOD_SHIELD_ABSORB
Definition: spell_dk.cpp:48
@ SPELL_DK_DEATH_GRIP_DUMMY
Definition: spell_dk.cpp:54
@ SPELL_DK_FROST_FEVER
Definition: spell_dk.cpp:61
@ SPELL_DK_KILLING_MACHINE_PROC
Definition: spell_dk.cpp:67
@ SPELL_DK_DEATH_GRIP_TAUNT
Definition: spell_dk.cpp:56
@ SPELL_DK_FROST
Definition: spell_dk.cpp:60
@ SPELL_DK_PILLAR_OF_FROST
Definition: spell_dk.cpp:72
@ SPELL_DK_BLOOD_SHIELD_MASTERY
Definition: spell_dk.cpp:49
@ SPELL_DK_GLYPH_OF_FOUL_MENAGERIE
Definition: spell_dk.cpp:64
@ SPELL_DK_DEATH_STRIKE_HEAL
Definition: spell_dk.cpp:57
@ SPELL_DK_SLUDGE_BELCHER
Definition: spell_dk.cpp:77
@ SPELL_DK_NECROSIS_EFFECT
Definition: spell_dk.cpp:69
@ SPELL_DK_GLYPH_OF_THE_SKELETON
Definition: spell_dk.cpp:66
@ SPELL_DK_RUNIC_POWER_ENERGIZE
Definition: spell_dk.cpp:75
@ SPELL_DK_BLINDING_SLEET_SLOW
Definition: spell_dk.cpp:45
@ SPELL_DK_ARMY_SUPER_ZOMBIE_TRANSFORM
Definition: spell_dk.cpp:44
@ SPELL_DK_RECENTLY_USED_DEATH_STRIKE
Definition: spell_dk.cpp:74
@ SPELL_DK_SLUDGE_BELCHER_SUMMON
Definition: spell_dk.cpp:78
@ SPELL_DK_DEATH_STRIKE_ENABLER
Definition: spell_dk.cpp:79
@ SPELL_DK_ARMY_GEIST_TRANSFORM
Definition: spell_dk.cpp:40
@ SPELL_DK_GLYPH_OF_THE_GEIST
Definition: spell_dk.cpp:65
@ SPELL_DK_OBLITERATION_RUNE_ENERGIZE
Definition: spell_dk.cpp:71
@ SPELL_DK_BREATH_OF_SINDRAGOSA
Definition: spell_dk.cpp:50
@ SPELL_DK_DEATH_COIL_DAMAGE
Definition: spell_dk.cpp:53
@ SPELL_DK_BLOOD
Definition: spell_dk.cpp:46
@ SPELL_DK_FROST_SCYTHE
Definition: spell_dk.cpp:62
@ SPELL_DK_CORPSE_EXPLOSION_TRIGGERED
Definition: spell_dk.cpp:51
void AddSC_deathknight_spell_scripts()
Definition: spell_dk.cpp:946
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)
Definition: SpellDefines.h:474
uint32 damage
Definition: Unit.h:556
void OnUnitEnter(Unit *unit) override
Definition: spell_dk.cpp:928
void OnUnitExit(Unit *unit) override
Definition: spell_dk.cpp:940
at_dk_death_and_decay(AreaTrigger *areatrigger)
Definition: spell_dk.cpp:926