From 2f1a4b5ba37e8bed39825d3085721882e9433c97 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 4 Aug 2022 18:14:41 -0400 Subject: [PATCH] Scripts/Spells: Priest - Sins of the Many fixed Port From (https://github.com/TrinityCore/TrinityCore/commit/f20135696b28775449a2e6e9d6ef4fd8b422a74f) --- Source/Scripts/Spells/Priest.cs | 46 ++++++++++++++++++- .../world/master/2022_08_02_01_world.sql | 3 ++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 sql/updates/world/master/2022_08_02_01_world.sql diff --git a/Source/Scripts/Spells/Priest.cs b/Source/Scripts/Spells/Priest.cs index bd073964a..2e2e97f08 100644 --- a/Source/Scripts/Spells/Priest.cs +++ b/Source/Scripts/Spells/Priest.cs @@ -74,6 +74,7 @@ namespace Scripts.Spells.Priest public const uint ShadowMendPeriodicDummy = 187464; public const uint ShieldDisciplineEnergize = 47755; public const uint ShieldDisciplinePassive = 197045; + public const uint SinsOfTheMany = 280398; public const uint Smite = 585; public const uint SpiritOfRedemption = 27827; public const uint StrengthOfSoul = 197535; @@ -191,7 +192,9 @@ namespace Scripts.Spells.Priest public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.AtonementHeal) && spellInfo.GetEffects().Count > 1; + return ValidateSpellInfo(SpellIds.AtonementHeal, SpellIds.SinsOfTheMany) + && spellInfo.GetEffects().Count > 1 + && Global.SpellMgr.GetSpellInfo(SpellIds.SinsOfTheMany, Difficulty.None).GetEffects().Count > 2; } bool CheckProc(ProcEventInfo eventInfo) @@ -227,11 +230,27 @@ namespace Scripts.Spells.Priest public void AddAtonementTarget(ObjectGuid target) { _appliedAtonements.Add(target); + + UpdateSinsOfTheManyValue(); } public void RemoveAtonementTarget(ObjectGuid target) { _appliedAtonements.Remove(target); + + UpdateSinsOfTheManyValue(); + } + + void UpdateSinsOfTheManyValue() + { + float[] damageByStack = { 12.0f, 12.0f, 10.0f, 8.0f, 7.0f, 6.0f, 5.0f, 5.0f, 4.0f, 4.0f, 3.0f }; + + foreach (uint effectIndex in new[] { 0, 1, 2 }) + { + AuraEffect sinOfTheMany = GetTarget().GetAuraEffect(SpellIds.SinsOfTheMany, effectIndex); + if (sinOfTheMany != null) + sinOfTheMany.ChangeAmount((int)damageByStack[Math.Min(_appliedAtonements.Count, damageByStack.Length - 1)]); + } } } @@ -927,6 +946,31 @@ namespace Scripts.Spells.Priest AfterCast.Add(new CastHandler(HandleAfterCast)); } } + + [Script] // 280391 - Sins of the Many + class spell_pri_sins_of_the_many : AuraScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.SinsOfTheMany); + } + + void HandleOnApply(AuraEffect aurEff, AuraEffectHandleModes mode) + { + GetTarget().CastSpell(GetTarget(), SpellIds.SinsOfTheMany, true); + } + + void HandleOnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) + { + GetTarget().RemoveAura(SpellIds.SinsOfTheMany); + } + + public override void Register() + { + OnEffectApply.Add(new EffectApplyHandler(HandleOnApply, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + OnEffectRemove.Add(new EffectApplyHandler(HandleOnRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + } + } [Script] // 20711 - Spirit of Redemption class spell_pri_spirit_of_redemption : AuraScript diff --git a/sql/updates/world/master/2022_08_02_01_world.sql b/sql/updates/world/master/2022_08_02_01_world.sql new file mode 100644 index 000000000..02e10aff6 --- /dev/null +++ b/sql/updates/world/master/2022_08_02_01_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_pri_sins_of_the_many'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(280391, 'spell_pri_sins_of_the_many');