From 68dbe8758c9d2c218fdc2b737b15308248af2693 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sat, 7 May 2022 15:08:15 -0400 Subject: [PATCH] Scripts/Spells: Fixed Divine Purpose Port From (https://github.com/TrinityCore/TrinityCore/commit/9e7f465fc28858fb832bc8b3cde8330d43004973) --- Source/Scripts/Spells/Paladin.cs | 35 +++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/Source/Scripts/Spells/Paladin.cs b/Source/Scripts/Spells/Paladin.cs index be31dbdc8..6e03ef7db 100644 --- a/Source/Scripts/Spells/Paladin.cs +++ b/Source/Scripts/Spells/Paladin.cs @@ -45,7 +45,7 @@ namespace Scripts.Spells.Paladin public const uint Consecration = 26573; public const uint ConsecrationDamage = 81297; public const uint ConsecrationProtectionAura = 188370; - public const uint DivinePurposeProc = 90174; + public const uint DivinePurposeTriggerred = 223819; public const uint DivineSteedHuman = 221883; public const uint DivineSteedDwarf = 276111; public const uint DivineSteedDraenei = 221887; @@ -316,6 +316,39 @@ namespace Scripts.Spells.Paladin } } + [Script] // 223817 - Divine Purpose + class spell_pal_divine_purpose : AuraScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.DivinePurposeTriggerred); + } + + bool CheckProc(AuraEffect aurEff, ProcEventInfo eventInfo) + { + Spell procSpell = eventInfo.GetProcSpell(); + if (!procSpell) + return false; + + if (!procSpell.HasPowerTypeCost(PowerType.HolyPower)) + return false; + + return RandomHelper.randChance(aurEff.GetAmount()); + } + + void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo) + { + eventInfo.GetActor().CastSpell(eventInfo.GetActor(), SpellIds.DivinePurposeTriggerred, + new CastSpellExtraArgs(TriggerCastFlags.IgnoreCastInProgress).SetTriggeringSpell(eventInfo.GetProcSpell())); + } + + public override void Register() + { + DoCheckEffectProc.Add(new CheckEffectProcHandler(CheckProc, 0, AuraType.Dummy)); + OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy)); + } + } + [Script] // 642 - Divine Shield class spell_pal_divine_shield : SpellScript {