From 9293b4ee17cb3156c5b279a1bb1fe1acc0a2d96f Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 4 Mar 2021 21:09:05 -0500 Subject: [PATCH] Scripts/Spells: Fixed various paladin spell scripts and removed outdated ones Port From (https://github.com/TrinityCore/TrinityCore/commit/1086007f98c8d120f353650d7567d82f6b9aa0f8) --- Source/Game/Spells/Spell.cs | 2 +- Source/Game/Spells/SpellInfo.cs | 4 +- Source/Scripts/Spells/Paladin.cs | 302 ++++++++++++------ .../2021_03_04_00_world_paladin_spells.sql | 49 +++ 4 files changed, 259 insertions(+), 98 deletions(-) create mode 100644 sql/updates/world/master/2021_03_04_00_world_paladin_spells.sql diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index b6b462748..bb16465fb 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -6502,7 +6502,7 @@ namespace Game.Spells SendChannelUpdate((uint)m_timer); } - bool HasPowerTypeCost(PowerType power) + public bool HasPowerTypeCost(PowerType power) { return m_powerCost.Any(cost => cost.Power == power); } diff --git a/Source/Game/Spells/SpellInfo.cs b/Source/Game/Spells/SpellInfo.cs index 79e1e4505..9e287aa8b 100644 --- a/Source/Game/Spells/SpellInfo.cs +++ b/Source/Game/Spells/SpellInfo.cs @@ -2675,7 +2675,7 @@ namespace Game.Spells return RecoveryTime > CategoryRecoveryTime ? RecoveryTime : CategoryRecoveryTime; } - SpellPowerCost CalcPowerCost(PowerType powerType, bool optionalCost, Unit caster, SpellSchoolMask schoolMask, Spell spell = null) + public SpellPowerCost CalcPowerCost(PowerType powerType, bool optionalCost, Unit caster, SpellSchoolMask schoolMask, Spell spell = null) { var spellPowerRecord = PowerCosts.First(spellPowerEntry => spellPowerEntry?.PowerType == powerType); if (spellPowerRecord == null) @@ -2684,7 +2684,7 @@ namespace Game.Spells return CalcPowerCost(spellPowerRecord, optionalCost, caster, schoolMask, spell); } - SpellPowerCost CalcPowerCost(SpellPowerRecord power, bool optionalCost, Unit caster, SpellSchoolMask schoolMask, Spell spell = null) + public SpellPowerCost CalcPowerCost(SpellPowerRecord power, bool optionalCost, Unit caster, SpellSchoolMask schoolMask, Spell spell = null) { if (power.RequiredAuraSpellID != 0 && !caster.HasAura(power.RequiredAuraSpellID)) return null; diff --git a/Source/Scripts/Spells/Paladin.cs b/Source/Scripts/Spells/Paladin.cs index b4d86a439..52f17d822 100644 --- a/Source/Scripts/Spells/Paladin.cs +++ b/Source/Scripts/Spells/Paladin.cs @@ -22,13 +22,14 @@ using Game.Spells; using System; using System.Collections.Generic; using System.Linq; +using Game.DataStorage; namespace Scripts.Spells.Paladin { struct SpellIds { public const uint AvengersShield = 31935; - public const uint AuraMasteryImmune = 64364; + public const uint AvengingWrath = 31884; public const uint BeaconOfLight = 53563; public const uint BeaconOfLightHeal = 53652; public const uint BlessingOfLowerCityDruid = 37878; @@ -50,6 +51,8 @@ namespace Scripts.Spells.Paladin public const uint FinalStand = 204077; public const uint FinalStandEffect = 204079; public const uint Forbearance = 25771; + public const uint GuardianOfAcientKings = 86659; + public const uint HammerOfJustice = 853; public const uint HandOfSacrifice = 6940; public const uint HolyMending = 64891; public const uint HolyPowerArmor = 28790; @@ -61,10 +64,18 @@ namespace Scripts.Spells.Paladin public const uint HolyShockR1Healing = 25914; public const uint ImmuneShieldMarker = 61988; public const uint ItemHealingTrance = 37706; - public const uint JudgementDamage = 54158; + public const uint JudementGainHolyPower = 220637; + public const uint JudgementProtRetR3 = 315867; public const uint RighteousDefenseTaunt = 31790; - public const uint SealOfCommand = 105361; + public const uint RighteousVerdictAura = 267611; public const uint SealOfRighteousness = 25742; + public const uint TemplarVerdictDamage = 224266; + public const uint ZealAura = 269571; + } + + struct SpellVisualKits + { + public const uint DivineStorm = 73892; } // 37877 - Blessing of Faith @@ -167,6 +178,25 @@ namespace Scripts.Spells.Paladin } } + [Script] // 196926 - Crusader Might + class spell_pal_crusader_might : AuraScript + { + bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.HolyShockR1); + } + + void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo) + { + GetTarget().GetSpellHistory().ModifyCooldown(SpellIds.HolyShockR1, aurEff.GetAmount()); + } + + void Register() + { + OnEffectProc .Add(new EffectProcHandler(HandleEffectProc, 0, AuraType.Dummy)); + } + } + [Script] // 642 - Divine Shield class spell_pal_divine_shield : SpellScript { @@ -248,34 +278,53 @@ namespace Scripts.Spells.Paladin { public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.DivineStormDamage); + return CliDB.SpellVisualKitStorage.HasRecord(SpellVisualKits.DivineStorm); } void HandleOnCast() { - Unit caster = GetCaster(); - caster.SendPlaySpellVisualKit(73892, 0, 0); - } - - void HandleDummy(uint effIndex) - { - Unit caster = GetCaster(); - Unit target = GetHitUnit(); - if (!target) - return; - - caster.CastSpell(target, SpellIds.DivineStormDamage, true); + GetCaster().SendPlaySpellVisualKit(SpellVisualKits.DivineStorm, 0, 0); } public override void Register() { OnCast.Add(new CastHandler(HandleOnCast)); - OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); } } - // -75806 - Grand Crusader - [Script] + [Script] // 234299 - Fist of Justice + class spell_pal_fist_of_justice : AuraScript + { + bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.HammerOfJustice); + } + + bool CheckEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo) + { + Spell procSpell = eventInfo.GetProcSpell(); + if (procSpell != null) + return procSpell.HasPowerTypeCost(PowerType.HolyPower); + + return false; + } + + void HandleEffectProc(AuraEffect aurEff, ProcEventInfo procInfo) + { + int value = aurEff.GetAmount() / 10; + + GetTarget().GetSpellHistory().ModifyCooldown(SpellIds.HammerOfJustice, -value); + } + + void Register() + { + DoCheckEffectProc .Add(new CheckEffectProcHandler(CheckEffectProc, 0, AuraType.Dummy)); + OnEffectProc .Add(new EffectProcHandler(HandleEffectProc, 0, AuraType.Dummy)); + } + } + + + [Script] // -85043 - Grand Crusader class spell_pal_grand_crusader : AuraScript { public override bool Validate(SpellInfo spellInfo) @@ -354,6 +403,46 @@ namespace Scripts.Spells.Paladin } } + [Script] // 327193 - Moment of Glory + class spell_pal_moment_of_glory : SpellScript + { + bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.AvengersShield); + } + + void HandleOnHit() + { + GetCaster().GetSpellHistory().ResetCooldown(SpellIds.AvengersShield); + } + + void Register() + { + OnHit .Add(new HitHandler(HandleOnHit)); + } + } + + [Script] // 20271/275779 - Judgement Ret/Prot + class spell_pal_judgement : SpellScript + { + bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.JudgementProtRetR3, SpellIds.JudementGainHolyPower); + } + + void HandleOnHit() + { + Unit caster = GetCaster(); + if (caster.HasSpell(SpellIds.JudgementProtRetR3)) + caster.CastSpell(caster, SpellIds.JudementGainHolyPower, TriggerCastFlags.FullMask); + } + + void Register() + { + OnHit .Add(new HitHandler(HandleOnHit)); + } + } + // 20473 - Holy Shock [Script] class spell_pal_holy_shock : SpellScript @@ -480,43 +569,6 @@ namespace Scripts.Spells.Paladin } } - // 20271 - Judgement - // Updated 4.3.4 - [Script] - class spell_pal_judgement : SpellScript - { - public override bool Validate(SpellInfo spellInfo) - { - return ValidateSpellInfo(SpellIds.JudgementDamage); - } - - void HandleScriptEffect(uint effIndex) - { - uint spellId = SpellIds.JudgementDamage; - - // some seals have SPELL_AURA_DUMMY in EFFECT_2 - var auras = GetCaster().GetAuraEffectsByType(AuraType.Dummy); - foreach (var eff in auras) - { - if (eff.GetSpellInfo().GetSpellSpecific() == SpellSpecificType.Seal && eff.GetEffIndex() == 2) - { - if (Global.SpellMgr.HasSpellInfo((uint)eff.GetAmount(), GetCastDifficulty())) - { - spellId = (uint)eff.GetAmount(); - break; - } - } - } - - GetCaster().CastSpell(GetHitUnit(), spellId, true); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, 0, SpellEffectName.Dummy)); - } - } - // 633 - Lay on Hands [Script] class spell_pal_lay_on_hands : SpellScript @@ -601,56 +653,94 @@ namespace Scripts.Spells.Paladin } } - // 85256 - Templar's Verdict - // Updated 4.3.4 - [Script] - class spell_pal_templar_s_verdict : SpellScript + // 204074 - Righteous Protector + class spell_pal_righteous_protector : AuraScript { - public override bool Validate(SpellInfo spellEntry) + SpellPowerCost _baseHolyPowerCost; + + public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.DivinePurposeProc); + return ValidateSpellInfo(SpellIds.AvengingWrath, SpellIds.GuardianOfAcientKings); } - public override bool Load() + bool CheckEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo) { - if (!GetCaster().IsTypeId(TypeId.Player)) - return false; - - if (GetCaster().ToPlayer().GetClass() != Class.Paladin) - return false; - - return true; - } - - void ChangeDamage(uint effIndex) - { - Unit caster = GetCaster(); - float damage = GetHitDamage(); - - if (caster.HasAura(SpellIds.DivinePurposeProc)) - damage *= 7.5f; // 7.5*30% = 225% + SpellInfo procSpell = eventInfo.GetSpellInfo(); + if (procSpell != null) + _baseHolyPowerCost = procSpell.CalcPowerCost(PowerType.HolyPower, false, eventInfo.GetActor(), eventInfo.GetSchoolMask()); else - { - switch (caster.GetPower(PowerType.HolyPower)) - { - case 0: // 1 Holy Power - //damage = damage; - break; - case 1: // 2 Holy Power - damage *= 3; // 3*30 = 90% - break; - case 2: // 3 Holy Power - damage *= 7.5f; // 7.5*30% = 225% - break; - } - } + _baseHolyPowerCost = null; - SetHitDamage((int)damage); + return _baseHolyPowerCost != null; + } + + void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo) + { + int value = aurEff.GetAmount() * 100 * _baseHolyPowerCost.Amount; + + GetTarget().GetSpellHistory().ModifyCooldown(SpellIds.AvengingWrath, -value); + GetTarget().GetSpellHistory().ModifyCooldown(SpellIds.GuardianOfAcientKings, -value); } public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(ChangeDamage, 0, SpellEffectName.WeaponPercentDamage)); + DoCheckEffectProc .Add(new CheckEffectProcHandler(CheckEffectProc, 0, AuraType.Dummy)); + OnEffectProc .Add(new EffectProcHandler(HandleEffectProc, 0, AuraType.Dummy)); + } + } + + [Script] // 267610 - Righteous Verdict + class spell_pal_righteous_verdict : AuraScript + { + bool Validate(SpellInfo spellEntry) + { + return ValidateSpellInfo(SpellIds.RighteousVerdictAura); + } + void HandleEffectProc(AuraEffect aurEff, ProcEventInfo procInfo) + { + procInfo.GetActor().CastSpell(procInfo.GetActor(), SpellIds.RighteousVerdictAura, true); + } + + void Register() + { + OnEffectProc .Add(new EffectProcHandler(HandleEffectProc, 0, AuraType.Dummy)); + } + } + + // 85804 - Selfless Healer + class spell_pal_selfless_healer : AuraScript + { + bool CheckEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo) + { + Spell procSpell = eventInfo.GetProcSpell(); + if (procSpell != null) + return procSpell.HasPowerTypeCost(PowerType.HolyPower); + + return false; + } + + void Register() + { + DoCheckEffectProc .Add(new CheckEffectProcHandler(CheckEffectProc, 0, AuraType.ProcTriggerSpell)); + } + } + + // 85256 - Templar's Verdict + class spell_pal_templar_s_verdict : SpellScript + { + bool Validate(SpellInfo spellEntry) + { + return ValidateSpellInfo(SpellIds.TemplarVerdictDamage); + } + + void HandleHitTarget(uint effIndex) + { + GetCaster().CastSpell(GetHitUnit(), SpellIds.TemplarVerdictDamage, true); + } + + void Register() + { + OnEffectHitTarget.Add(new EffectHandler(HandleHitTarget, 0, SpellEffectName.Dummy)); } } @@ -735,4 +825,26 @@ namespace Scripts.Spells.Paladin OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy)); } } + + // 269569 - Zeal + class spell_pal_zeal : AuraScript + { + bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.ZealAura); + } + + void HandleEffectProc(AuraEffect aurEff, ProcEventInfo procInfo) + { + Unit target = GetTarget(); + target.CastCustomSpell(SpellIds.ZealAura, SpellValueMod.AuraStack, aurEff.GetAmount(), target, true); + + PreventDefaultAction(); + } + + void Register() + { + OnEffectProc.Add(new EffectProcHandler(HandleEffectProc, 0, AuraType.ProcTriggerSpell)); + } + } } diff --git a/sql/updates/world/master/2021_03_04_00_world_paladin_spells.sql b/sql/updates/world/master/2021_03_04_00_world_paladin_spells.sql new file mode 100644 index 000000000..1a423ce6c --- /dev/null +++ b/sql/updates/world/master/2021_03_04_00_world_paladin_spells.sql @@ -0,0 +1,49 @@ +-- Spell Scripts +DELETE FROM `spell_script_names` WHERE `ScriptName` IN +('spell_pal_judgement', + 'spell_pal_zeal', + 'spell_pal_selfless_healer', + 'spell_pal_crusader_might', + 'spell_pal_righteous_protector', + 'spell_pal_moment_of_glory'); +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(20271, 'spell_pal_judgement'), -- Judgement Ret (20271) +(275779, 'spell_pal_judgement'), -- Judgement Prot (275779) +(269569, 'spell_pal_zeal'), -- Zeal (269569) +(85804, 'spell_pal_selfless_healer'), -- Selfless Healer (85804) +(196926, 'spell_pal_crusader_might'), -- Cruader's Might (196926) +(204074, 'spell_pal_righteous_protector'), -- Righteous Protector (204074) +(327193, 'spell_pal_moment_of_glory'), -- Moment of Glory (327193) +(267610, 'spell_pal_righteous_verdict'); -- Righteous Verdict (267610) + +-- Spell Procs -- +DELETE FROM `spell_proc` WHERE `SpellId` IN +(269569, -- Zeal (269569) + 269571, -- Zeal (269571) + 326732, -- Empyrean Power (326732) + 326733, -- Empyrean Power (326733) + 85804, -- Selfless Healer (85804) + 114250, -- Selfless Healer (114250) + 280373, -- Redoubt (280373) + 327193, -- Moment of Glory (327193) + 183778, -- Judgment of Light (183778) + 196926, -- Cruader's Might (196926) + 267610 -- Righteous Verdict (267610) +); +INSERT INTO `spell_proc` (`SpellId`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`SpellFamilyMask3`,`ProcFlags`,`SpellTypeMask`,`SpellPhaseMask`,`HitMask`,`AttributesMask`,`DisableEffectsMask`,`ProcsPerMinute`,`Chance`,`Cooldown`,`Charges`) VALUES +(269569,0,10,0x00800000,0x0,0x0,0x0,0x10,1,2,0x403,0,0,0,0,0,0), -- Zeal (269569), Proc on judgement trigger zeal effect +(269571,1,0,0x0,0x0,0x0,0x0,0x4,1,1,0x403,0x10,14,0,0,0,0), -- Zeal (269571), Proc on auto attack to consume zeal effect +(326732,0,10,0x0,0x00008000,0x0,0x0,0x10,1,2,0x403,0,0,0,15,0,0), -- Empyrean Power (326732), Proc to trigger only on crusader strike +(326733,0,10,0x0,0x00020000,0x0,0x0,0x10,1,2,0x403,0x8,0,0,0,0,0), -- Empyrean Power (326733), Proc to consume Empryean Power (Divine Storm 53385) +(85804,0,10,0x0,0x0,0x0,0x0,0x15510,7,1,0x403,0x4,0,0,0,0,0), -- Selfless Healer (85804), Proc on power spending abilitis +(114250,0,10,0x40000000,0x0,0x0,0x0,0x4000,2,2,0x403,0,0,0,0,0,1), -- Selfless Healer (114250), Proc to consume on Flash of Light (19750) +(280373,0,10,0x0,0x00100000,0x0,0x0,0x10,1,1,0,0,0,0,0,0,0), -- Redoubt (280373), proc to trigge from Shield of the Righteous (53600) +(327193,0,10,0x00004000,0x0,0x0,0x0,0x10000,1,1,0x403,0,0,0,0,0,0), -- Moment of Glory (327193), proc to consume on Avenger's Shield (31935) +(183778,0,10,0x00800000,0x0,0x0,0x0,0x10,1,2,0x403,0,0,0,0,0,0), -- Judgment of Light (183778), proc to trigger from Judgement +(196926,0,10,0x0,0x00008000,0x0,0x0,0x10,1,2,0x403,0,0,0,0,0,0), -- Cruader's Might (196926), proc to trigger from Crusader Strike +(267610,0,10,0x0,0x00001000,0x0,0x0,0x10,1,2,0x403,0,0,0,0,0,0); -- Righteous Verdict (267610), proc to trigger from Templar's Verdict (224266) + +-- Spell Areatriggers -- +DELETE FROM `spell_areatrigger` WHERE (`AreaTriggerId`=9228); +INSERT INTO `spell_areatrigger` (`SpellMiscId`, `AreaTriggerId`, `MoveCurveId`, `ScaleCurveId`, `MorphCurveId`, `FacingCurveId`, `AnimId`, `AnimKitId`, `DecalPropertiesId`, `TimeToTarget`, `TimeToTargetScale`, `VerifiedBuild`) VALUES +(4488, 9228, 0, 0, 0, 0, 0, 0, 0, 0, 12000, 37474); -- for Consecration (26573)