From 3265d6ea1784274c2f809763f5aa3c968969fb45 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 24 Jun 2021 00:03:16 -0400 Subject: [PATCH] Core/Scripts: implemented Fungal Decay & Tail Sting Port From (https://github.com/TrinityCore/TrinityCore/commit/d36f8bb7547c5ebef067f834c79754c57ff66a34) --- Source/Game/Scripting/SpellScript.cs | 2 +- Source/Scripts/Spells/Generic.cs | 113 ++++++++++++++++-- ...021_06_22_02_world_2018_02_16_02_world.sql | 8 ++ 3 files changed, 111 insertions(+), 12 deletions(-) create mode 100644 sql/updates/world/master/2021_06_22_02_world_2018_02_16_02_world.sql diff --git a/Source/Game/Scripting/SpellScript.cs b/Source/Game/Scripting/SpellScript.cs index 033f9839f..7beff0f9f 100644 --- a/Source/Game/Scripting/SpellScript.cs +++ b/Source/Game/Scripting/SpellScript.cs @@ -1465,7 +1465,7 @@ namespace Game.Scripting void RefreshDuration() { m_aura.RefreshDuration(); } long GetApplyTime() { return m_aura.GetApplyTime(); } public int GetMaxDuration() { return m_aura.GetMaxDuration(); } - void SetMaxDuration(int duration) { m_aura.SetMaxDuration(duration); } + public void SetMaxDuration(int duration) { m_aura.SetMaxDuration(duration); } int CalcMaxDuration() { return m_aura.CalcMaxDuration(); } // expired - duration just went to 0 public bool IsExpired() { return m_aura.IsExpired(); } diff --git a/Source/Scripts/Spells/Generic.cs b/Source/Scripts/Spells/Generic.cs index c782cd051..c23b0091f 100644 --- a/Source/Scripts/Spells/Generic.cs +++ b/Source/Scripts/Spells/Generic.cs @@ -364,6 +364,12 @@ namespace Scripts.Spells.Generic public const uint A_ValiantOfSilvermoon = 13696; } + struct Misc + { + //FungalDecay + public const int AuraDuration = 12600; // found in sniffs, there is no duration entry we can possibly use + } + [Script] class spell_gen_absorb0_hitlimit1 : AuraScript { @@ -596,7 +602,7 @@ namespace Scripts.Spells.Generic OnEffectUpdatePeriodic.Add(new EffectUpdatePeriodicHandler(UpdatePeriodic, 1, AuraType.PeriodicDummy)); } } - + [Script] // 41337 Aura of Anger class spell_gen_aura_of_anger : AuraScript { @@ -636,7 +642,7 @@ namespace Scripts.Spells.Generic OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 0, AuraType.PeriodicTriggerSpell)); } } - + [Script] class spell_gen_aura_service_uniform : AuraScript { @@ -966,7 +972,7 @@ namespace Scripts.Spells.Generic OnEffectUpdatePeriodic.Add(new EffectUpdatePeriodicHandler(UpdatePeriodic, 1, AuraType.PeriodicDummy)); } } - + [Script] class spell_gen_chaos_blast : SpellScript { @@ -1270,6 +1276,91 @@ namespace Scripts.Spells.Generic } } + [Script] // 32065 - Fungal Decay + class spell_gen_decay_over_time_fungal_decay_SpellScript : SpellScript + { + void ModAuraStack() + { + Aura aur = GetHitAura(); + if (aur != null) + aur.SetStackAmount((byte)GetSpellInfo().StackAmount); + } + + public override void Register() + { + AfterHit.Add(new HitHandler(ModAuraStack)); + } + } + + [Script] // 32065 - Fungal Decay + class spell_gen_decay_over_time_fungal_decay_AuraScript : AuraScript + { + void ModDuration(AuraEffect aurEff, AuraEffectHandleModes mode) + { + // only on actual reapply, not on stack decay + if (GetDuration() == GetMaxDuration()) + { + SetMaxDuration(Misc.AuraDuration); + SetDuration(Misc.AuraDuration); + } + } + + bool CheckProc(ProcEventInfo eventInfo) + { + return eventInfo.GetSpellInfo() == GetSpellInfo(); + } + + void Decay(ProcEventInfo eventInfo) + { + PreventDefaultAction(); + ModStackAmount(-1); + } + + public override void Register() + { + DoCheckProc.Add(new CheckProcHandler(CheckProc)); + OnProc.Add(new AuraProcHandler(Decay)); + OnEffectApply.Add(new EffectApplyHandler(ModDuration, 0, AuraType.ModDecreaseSpeed, AuraEffectHandleModes.RealOrReapplyMask)); + } + } + + [Script] // 36659 - Tail Sting + class spell_gen_decay_over_time_tail_sting_SpellScript : SpellScript + { + void ModAuraStack() + { + Aura aur = GetHitAura(); + if (aur != null) + aur.SetStackAmount((byte)GetSpellInfo().StackAmount); + } + + public override void Register() + { + AfterHit.Add(new HitHandler(ModAuraStack)); + } + } + + [Script] // 36659 - Tail Sting + class spell_gen_decay_over_time_tail_sting_AuraScript : AuraScript + { + bool CheckProc(ProcEventInfo eventInfo) + { + return eventInfo.GetSpellInfo() == GetSpellInfo(); + } + + void Decay(ProcEventInfo eventInfo) + { + PreventDefaultAction(); + ModStackAmount(-1); + } + + public override void Register() + { + DoCheckProc.Add(new CheckProcHandler(CheckProc)); + OnProc.Add(new AuraProcHandler(Decay)); + } + } + [Script] class spell_gen_despawn_self : SpellScript { @@ -1742,7 +1833,7 @@ namespace Scripts.Spells.Generic OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 0, AuraType.PeriodicTriggerSpell)); } } - + [Script] // 28702 - Netherbloom class spell_gen_netherbloom : SpellScript { @@ -1825,10 +1916,10 @@ namespace Scripts.Spells.Generic public override void Register() { - OnEffectPeriodic .Add(new EffectPeriodicHandler(PeriodicTick, 1, AuraType.PeriodicTriggerSpell)); + OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 1, AuraType.PeriodicTriggerSpell)); } } - + [Script] // 27539 - Obsidian Armor class spell_gen_obsidian_armor : AuraScript { @@ -2010,7 +2101,7 @@ namespace Scripts.Spells.Generic OnProc.Add(new AuraProcHandler(HandleChargeDrop)); } } - + [Script] // 45472 Parachute class spell_gen_parachute : AuraScript { @@ -2240,7 +2331,7 @@ namespace Scripts.Spells.Generic public override void Register() { - OnEffectPeriodic .Add(new EffectPeriodicHandler(PeriodicTick, 0, AuraType.PeriodicDamage)); + OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 0, AuraType.PeriodicDamage)); } } @@ -2261,10 +2352,10 @@ namespace Scripts.Spells.Generic public override void Register() { - OnEffectPeriodic .Add(new EffectPeriodicHandler(PeriodicTick, 2, AuraType.PeriodicDamagePercent)); + OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 2, AuraType.PeriodicDamagePercent)); } } - + [Script] class spell_gen_replenishment : SpellScript { @@ -2472,7 +2563,7 @@ namespace Scripts.Spells.Generic [Script] class spell_gen_spectator_cheer_trigger : SpellScript - { + { readonly static Emote[] EmoteArray = { Emote.OneshotCheer, Emote.OneshotExclamation, Emote.OneshotApplaud }; void HandleDummy(uint effIndex) diff --git a/sql/updates/world/master/2021_06_22_02_world_2018_02_16_02_world.sql b/sql/updates/world/master/2021_06_22_02_world_2018_02_16_02_world.sql new file mode 100644 index 000000000..ac6733d10 --- /dev/null +++ b/sql/updates/world/master/2021_06_22_02_world_2018_02_16_02_world.sql @@ -0,0 +1,8 @@ +DELETE FROM `spell_proc` WHERE `SpellId` IN (32065, 36659); +INSERT INTO `spell_proc` (`SpellId`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `ProcFlags`, `SpellTypeMask`, `SpellPhaseMask`, `HitMask`, `AttributesMask`, `ProcsPerMinute`, `Chance`, `Cooldown`, `Charges`) VALUES +(32065, 0x0, 0, 0x00000000, 0x00000000, 0x00000000, 0x80000, 0x1, 0x0, 0x0, 0x0, 0, 0, 0, 0), +(36659, 0x0, 0, 0x00000000, 0x00000000, 0x00000000, 0x80000, 0x1, 0x0, 0x0, 0x0, 0, 0, 0, 0); +DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_gen_decay_over_time_fungal_decay','spell_gen_decay_over_time_tail_sting'); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(32065, 'spell_gen_decay_over_time_fungal_decay'), +(36659, 'spell_gen_decay_over_time_tail_sting');