From fa07f74db26bacf05745284038b4526435dfae7e Mon Sep 17 00:00:00 2001 From: PolarCookie Date: Mon, 31 Dec 2018 11:50:16 +0100 Subject: Spell/Script: Scourge Disguise and Haunting Phantoms (#22727) (cherry picked from commit 66720e5fd94015e9884060bb66c3093484855880) --- .../EasternKingdoms/Stratholme/stratholme.cpp | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src/server/scripts/EasternKingdoms') diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp index ac11c7eea34..0e3bed8db8f 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp @@ -40,6 +40,7 @@ EndContentData */ #include "ScriptedCreature.h" #include "SpellInfo.h" #include "SpellScript.h" +#include "SpellAuraEffects.h" #include "stratholme.h" /*###### @@ -331,10 +332,48 @@ class spell_ysida_saved_credit : public SpellScript } }; +enum HauntingPhantoms +{ + SPELL_SUMMON_SPITEFUL_PHANTOM = 16334, + SPELL_SUMMON_WRATH_PHANTOM = 16335 +}; + +class spell_stratholme_haunting_phantoms : public AuraScript +{ + PrepareAuraScript(spell_stratholme_haunting_phantoms); + + void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) + { + isPeriodic = true; + amplitude = irand(30, 90) * IN_MILLISECONDS; + } + + void HandleDummyTick(AuraEffect const* /*aurEff*/) + { + if (roll_chance_i(50)) + GetTarget()->CastSpell(nullptr, SPELL_SUMMON_SPITEFUL_PHANTOM, true); + else + GetTarget()->CastSpell(nullptr, SPELL_SUMMON_WRATH_PHANTOM, true); + } + + void HandleUpdatePeriodic(AuraEffect* aurEff) + { + aurEff->CalculatePeriodic(GetCaster()); + } + + void Register() override + { + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_stratholme_haunting_phantoms::CalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_stratholme_haunting_phantoms::HandleDummyTick, EFFECT_0, SPELL_AURA_DUMMY); + OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_stratholme_haunting_phantoms::HandleUpdatePeriodic, EFFECT_0, SPELL_AURA_DUMMY); + } +}; + void AddSC_stratholme() { new go_gauntlet_gate(); new npc_restless_soul(); new npc_spectral_ghostly_citizen(); RegisterSpellScript(spell_ysida_saved_credit); + RegisterAuraScript(spell_stratholme_haunting_phantoms); } -- cgit v1.2.3