From 6433ed6014d199ffe381f5fbc5ee5ec5b85da962 Mon Sep 17 00:00:00 2001 From: Sorikoff <46191832+Sorikoff@users.noreply.github.com> Date: Sat, 1 Feb 2020 15:55:16 +0200 Subject: Scripts/Spells: Gift of the Harvester (#24111) * Scripts/Spells: Gift of the Harvester * Scripts/Spells: nopch * Scripts/Spells: nopch * Scripts/Spells: validate * Rename 9999_99_99_99_world.sql to 2020_02_01_03_world.sql Co-authored-by: Giacomo Pozzoni (cherry picked from commit e10239311c95866f9316521b570f8600c08a2ff5) --- .../EasternKingdoms/ScarletEnclave/chapter1.cpp | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src/server/scripts/EasternKingdoms') diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 6b6343e9830..c5a7b89293d 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -15,6 +15,7 @@ * with this program. If not, see . */ +#include "CreatureAIImpl.h" #include "ScriptMgr.h" #include "CombatAI.h" #include "CreatureTextMgr.h" @@ -1072,6 +1073,40 @@ public: }; +enum GiftOfTheHarvester +{ + SPELL_GHOUL_TRANFORM = 52490, + SPELL_GHOST_TRANSFORM = 52505 +}; + +class spell_gift_of_the_harvester : public SpellScript +{ + PrepareSpellScript(spell_gift_of_the_harvester); + + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo( + { + SPELL_GHOUL_TRANFORM, + SPELL_GHOST_TRANSFORM + }); + } + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + Unit* originalCaster = GetOriginalCaster(); + Unit* target = GetHitUnit(); + + if (originalCaster && target) + originalCaster->CastSpell(target, RAND(SPELL_GHOUL_TRANFORM, SPELL_GHOST_TRANSFORM), true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_gift_of_the_harvester::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + /*#### ## npc_scarlet_miner_cart ####*/ @@ -1314,6 +1349,7 @@ void AddSC_the_scarlet_enclave_c1() new npc_ros_dark_rider(); new npc_dkc1_gothik(); new npc_scarlet_ghoul(); + RegisterSpellScript(spell_gift_of_the_harvester); new npc_scarlet_miner(); new npc_scarlet_miner_cart(); } -- cgit v1.2.3