diff options
author | Aqua Deus <95978183+aquadeus@users.noreply.github.com> | 2023-12-08 02:12:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-08 02:12:59 +0100 |
commit | 1567c34a3e4b4226dff6de5349d03e6402d63975 (patch) | |
tree | d2ad946fa2ce6dcab254acc8dcc39c0e0f39eb45 /src | |
parent | 87f3ab11d3dd5d362657aaae9c02effa8ee95f21 (diff) |
Scripts/Spells: Implement Unholy Ground and drop outdated Tightened Grasp talent (#29465)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Spells/spell_dk.cpp | 66 |
1 files changed, 37 insertions, 29 deletions
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 1e8c2542f03..e950ba3c0e6 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -21,6 +21,8 @@ * Scriptnames of files in this file should be prefixed with "spell_dk_". */ +#include "AreaTrigger.h" +#include "AreaTriggerAI.h" #include "ScriptMgr.h" #include "Containers.h" #include "ObjectMgr.h" @@ -75,8 +77,10 @@ enum DeathKnightSpells SPELL_DK_SLUDGE_BELCHER_SUMMON = 212027, SPELL_DK_DEATH_STRIKE_ENABLER = 89832, // Server Side SPELL_DK_TIGHTENING_GRASP = 206970, - SPELL_DK_TIGHTENING_GRASP_SLOW = 143375, + //SPELL_DK_TIGHTENING_GRASP_SLOW = 143375, // dropped in BfA SPELL_DK_UNHOLY = 137007, + SPELL_DK_UNHOLY_GROUND_HASTE = 374271, + SPELL_DK_UNHOLY_GROUND_TALENT = 374265, SPELL_DK_UNHOLY_VIGOR = 196263, SPELL_DK_VOLATILE_SHIELDING = 207188, SPELL_DK_VOLATILE_SHIELDING_DAMAGE = 207194 @@ -319,42 +323,21 @@ class spell_dk_dancing_rune_weapon : public AuraScript } }; -// 43265 - Death and Decay -class spell_dk_death_and_decay : public SpellScript +// 43265 - Death and Decay (Aura) +class spell_dk_death_and_decay : public AuraScript { - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_DK_TIGHTENING_GRASP, SPELL_DK_TIGHTENING_GRASP_SLOW }); - } - - void HandleDummy() + void HandleDummyTick(AuraEffect const* aurEff) { - if (GetCaster()->HasAura(SPELL_DK_TIGHTENING_GRASP)) - if (WorldLocation const* pos = GetExplTargetDest()) - GetCaster()->CastSpell(*pos, SPELL_DK_TIGHTENING_GRASP_SLOW, true); + if (Unit* caster = GetCaster()) + caster->CastSpell(GetTarget(), SPELL_DK_DEATH_AND_DECAY_DAMAGE, aurEff); } void Register() override { - OnCast += SpellCastFn(spell_dk_death_and_decay::HandleDummy); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_dk_death_and_decay::HandleDummyTick, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY); } }; -// 43265 - Death and Decay (Aura) -class spell_dk_death_and_decay_AuraScript : public AuraScript - { - void HandleDummyTick(AuraEffect const* aurEff) - { - if (Unit* caster = GetCaster()) - caster->CastSpell(GetTarget(), SPELL_DK_DEATH_AND_DECAY_DAMAGE, aurEff); - } - - void Register() override - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_dk_death_and_decay_AuraScript::HandleDummyTick, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY); - } - }; - // 47541 - Death Coil class spell_dk_death_coil : public SpellScript { @@ -915,6 +898,29 @@ class spell_dk_vampiric_blood : public AuraScript } }; +// 43265 - Death and Decay +struct at_dk_death_and_decay : AreaTriggerAI +{ + at_dk_death_and_decay(AreaTrigger* areatrigger) : AreaTriggerAI(areatrigger) { } + + void OnUnitEnter(Unit* unit) override + { + if (Unit* caster = at->GetCaster()) + { + if (caster == unit) + { + if (caster->HasAura(SPELL_DK_UNHOLY_GROUND_TALENT)) + caster->CastSpell(caster, SPELL_DK_UNHOLY_GROUND_HASTE); + } + } + } + + void OnUnitExit(Unit* unit) override + { + unit->RemoveAurasDueToSpell(SPELL_DK_UNHOLY_GROUND_HASTE); + } +}; + void AddSC_deathknight_spell_scripts() { RegisterSpellScript(spell_dk_advantage_t10_4p); @@ -923,7 +929,7 @@ void AddSC_deathknight_spell_scripts() RegisterSpellScript(spell_dk_blinding_sleet); RegisterSpellScript(spell_dk_blood_boil); RegisterSpellScript(spell_dk_dancing_rune_weapon); - RegisterSpellAndAuraScriptPair(spell_dk_death_and_decay, spell_dk_death_and_decay_AuraScript); + RegisterSpellScript(spell_dk_death_and_decay); RegisterSpellScript(spell_dk_death_coil); RegisterSpellScript(spell_dk_death_gate); RegisterSpellScript(spell_dk_death_grip_initial); @@ -944,4 +950,6 @@ void AddSC_deathknight_spell_scripts() RegisterSpellScript(spell_dk_rime); RegisterSpellScript(spell_dk_t20_2p_rune_empowered); RegisterSpellScript(spell_dk_vampiric_blood); + + RegisterAreaTriggerAI(at_dk_death_and_decay); } |