From a4dfc261a4e321c09c2ebc6d037be862d41ff5c5 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 4 May 2022 10:24:13 -0400 Subject: [PATCH] Scripts/Spells: Implemented Ashen Hallow script Port From (https://github.com/TrinityCore/TrinityCore/commit/3fa4c049193a756873be2bf49c1ce467c7396082) --- Source/Scripts/Spells/Paladin.cs | 61 ++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/Source/Scripts/Spells/Paladin.cs b/Source/Scripts/Spells/Paladin.cs index 6c32055a5..ed10076ea 100644 --- a/Source/Scripts/Spells/Paladin.cs +++ b/Source/Scripts/Spells/Paladin.cs @@ -28,6 +28,10 @@ namespace Scripts.Spells.Paladin { struct SpellIds { + public const uint AshenHallow = 316958; + public const uint AshenHallowDamage = 317221; + public const uint AshenHallowHeal = 317223; + public const uint AshenHallowAllowHammer = 330382; public const uint AvengersShield = 31935; public const uint AvengingWrath = 31884; public const uint BeaconOfLight = 53563; @@ -96,6 +100,63 @@ namespace Scripts.Spells.Paladin public const uint HolyShockHealCrit = 83880; } + [Script] // 19042 - Ashen Hallow + class areatrigger_pal_ashen_hallow : AreaTriggerAI + { + TimeSpan _refreshTimer; + TimeSpan _period; + + public areatrigger_pal_ashen_hallow(AreaTrigger areatrigger) : base(areatrigger) { } + + void RefreshPeriod() + { + Unit caster = at.GetCaster(); + if (caster != null) + { + AuraEffect ashen = caster.GetAuraEffect(SpellIds.AshenHallow, 1); + if (ashen != null) + _period = TimeSpan.FromMilliseconds(ashen.GetPeriod()); + } + } + + public override void OnCreate() + { + RefreshPeriod(); + _refreshTimer = _period; + } + + public override void OnUpdate(uint diff) + { + _refreshTimer -= TimeSpan.FromMilliseconds(diff); + + while (_refreshTimer <= TimeSpan.Zero) + { + Unit caster = at.GetCaster(); + if (caster != null) + { + caster.CastSpell(at.GetPosition(), SpellIds.AshenHallowHeal, new CastSpellExtraArgs()); + caster.CastSpell(at.GetPosition(), SpellIds.AshenHallowDamage, new CastSpellExtraArgs()); + } + + RefreshPeriod(); + + _refreshTimer += _period; + } + } + + public override void OnUnitEnter(Unit unit) + { + if (unit.GetGUID() == at.GetCasterGuid()) + unit.CastSpell(unit, SpellIds.AshenHallowAllowHammer, true); + } + + public override void OnUnitExit(Unit unit) + { + if (unit.GetGUID() == at.GetCasterGuid()) + unit.RemoveAura(SpellIds.AshenHallowAllowHammer); + } + } + // 1022 - Blessing of Protection [Script] // 204018 - Blessing of Spellwarding class spell_pal_blessing_of_protection : SpellScript