From 7cd5c1dedbcd99ffc52c789327f845e8081fb906 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sat, 3 Feb 2024 22:07:14 -0500 Subject: [PATCH] Scripts/Spells: Implement Unholy Ground and drop outdated Tightened Grasp talent Port From (https://github.com/TrinityCore/TrinityCore/commit/1567c34a3e4b4226dff6de5349d03e6402d63975) --- Source/Scripts/Spells/DeathKnight.cs | 57 +++++++++++++++------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/Source/Scripts/Spells/DeathKnight.cs b/Source/Scripts/Spells/DeathKnight.cs index e27fbc973..3764a9e1e 100644 --- a/Source/Scripts/Spells/DeathKnight.cs +++ b/Source/Scripts/Spells/DeathKnight.cs @@ -2,6 +2,7 @@ // Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. using Framework.Constants; +using Game.AI; using Game.Entities; using Game.Networking.Packets; using Game.Scripting; @@ -56,8 +57,10 @@ namespace Scripts.Spells.DeathKnight public const uint SludgeBelcherSummon = 212027; public const uint DeathStrikeEnabler = 89832; // Server Side public const uint TighteningGrasp = 206970; - public const uint TighteningGraspSlow = 143375; + //public const uint TighteningGraspSlow = 143375; // dropped in BfA public const uint Unholy = 137007; + public const uint UnholyGroundHaste = 374271; + public const uint UnholyGroundTalent = 374265; public const uint UnholyVigor = 196263; public const uint VolatileShielding = 207188; public const uint VolatileShieldingDamage = 207194; @@ -300,31 +303,7 @@ namespace Scripts.Spells.DeathKnight } [Script] // 43265 - Death and Decay - class spell_dk_death_and_decay : SpellScript - { - public override bool Validate(SpellInfo spellInfo) - { - return ValidateSpellInfo(SpellIds.TighteningGrasp, SpellIds.TighteningGraspSlow); - } - - void HandleDummy() - { - if (GetCaster().HasAura(SpellIds.TighteningGrasp)) - { - WorldLocation pos = GetExplTargetDest(); - if (pos != null) - GetCaster().CastSpell(pos, SpellIds.TighteningGraspSlow, true); - } - } - - public override void Register() - { - OnCast.Add(new(HandleDummy)); - } - } - - [Script] // 43265 - Death and Decay (Aura) - class spell_dk_death_and_decay_AuraScript : AuraScript + class spell_dk_death_and_decay : AuraScript { void HandleDummyTick(AuraEffect aurEff) { @@ -335,7 +314,7 @@ namespace Scripts.Spells.DeathKnight public override void Register() { - OnEffectPeriodic.Add(new(HandleDummyTick, 2, AuraType.PeriodicDummy)); + OnEffectPeriodic.Add(new EffectPeriodicHandler(HandleDummyTick, 2, AuraType.PeriodicDummy)); } } @@ -891,4 +870,28 @@ namespace Scripts.Spells.DeathKnight DoEffectCalcAmount.Add(new(CalculateAmount, 1, AuraType.ModIncreaseHealth2)); } } + + [Script] // 43265 - Death and Decay + class at_dk_death_and_decay : AreaTriggerAI + { + public at_dk_death_and_decay(AreaTrigger areatrigger) : base(areatrigger) { } + + public override void OnUnitEnter(Unit unit) + { + Unit caster = at.GetCaster(); + if (caster != null) + { + if (caster == unit) + { + if (caster.HasAura(SpellIds.UnholyGroundTalent)) + caster.CastSpell(caster, SpellIds.UnholyGroundHaste); + } + } + } + + public override void OnUnitExit(Unit unit) + { + unit.RemoveAurasDueToSpell(SpellIds.UnholyGroundHaste); + } + } } \ No newline at end of file