From 720894241f87f7e57ebca4067870a4d53840df05 Mon Sep 17 00:00:00 2001 From: Nightprince Date: Wed, 15 Nov 2023 01:40:58 +0330 Subject: [PATCH] Core/Spell: Fix Mirror Image Mage Close #975 --- sql/updates/world/world_2023_11_15_01_36.sql | 6 ++++ src/server/scripts/Pet/pet_mage.cpp | 12 +++---- src/server/scripts/Spells/spell_mage.cpp | 37 ++++++++++++++++++++ 3 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 sql/updates/world/world_2023_11_15_01_36.sql diff --git a/sql/updates/world/world_2023_11_15_01_36.sql b/sql/updates/world/world_2023_11_15_01_36.sql new file mode 100644 index 00000000000..3367aa9ddd7 --- /dev/null +++ b/sql/updates/world/world_2023_11_15_01_36.sql @@ -0,0 +1,6 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_mage_mirror_image'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(55342, 'spell_mage_mirror_image'), +(63093, 'spell_mage_mirror_image'), +(88091, 'spell_mage_mirror_image'), +(88092, 'spell_mage_mirror_image'); diff --git a/src/server/scripts/Pet/pet_mage.cpp b/src/server/scripts/Pet/pet_mage.cpp index 88993b9f461..a50fd01cfb9 100644 --- a/src/server/scripts/Pet/pet_mage.cpp +++ b/src/server/scripts/Pet/pet_mage.cpp @@ -15,9 +15,9 @@ enum MageSpells { - SPELL_MAGE_CLONE_ME = 45204, - SPELL_MAGE_CLONE_WEAPONS = 41054, - SPELL_MAGE_MASTERS_THREAT_LIST = 58838 + SPELL_MIRROR_IMAGE_CLONE_ME = 45204, + SPELL_MIRROR_IMAGE_COPY_WEAPONS = 41054, + SPELL_MIRROR_IMAGE_MASTERS_THREAT_LIST = 58838, }; class npc_pet_mage_mirror_image : public CreatureScript @@ -36,12 +36,12 @@ class npc_pet_mage_mirror_image : public CreatureScript if (!owner) return; // Inherit Master's Threat List (not yet implemented) - owner->CastSpell((Unit*)NULL, SPELL_MAGE_MASTERS_THREAT_LIST, true); + me->CastSpell(me, SPELL_MIRROR_IMAGE_MASTERS_THREAT_LIST, true); // here mirror image casts on summoner spell (not present in client dbc) 49866 // here should be auras (not present in client dbc): 35657, 35658, 35659, 35660 selfcasted by mirror images (stats related?) // Clone Me! - owner->CastSpell(me, SPELL_MAGE_CLONE_ME, true); - owner->CastSpell(me, SPELL_MAGE_CLONE_WEAPONS, true); + owner->CastSpell(me, SPELL_MIRROR_IMAGE_CLONE_ME, true); + owner->CastSpell(me, SPELL_MIRROR_IMAGE_COPY_WEAPONS, true); } // Do not reload Creature templates on evade mode enter - prevent visual lost diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index fbd47d8ddfa..d0734498784 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -45,6 +45,11 @@ enum MageSpells // Pyroblast! SPELL_MAGE_PYROBLAST_CLEARCAST = 48108, + + // Mirror Image + SPELL_MAGE_SUMMON_IMAGES_FROST = 58832, + SPELL_MAGE_SUMMON_IMAGES_FIRE = 88092, + SPELL_MAGE_SUMMON_IMAGES_ARCANE = 88091, }; enum MageIcons @@ -900,6 +905,37 @@ class spell_mage_water_elemental_freeze : public SpellScriptLoader } }; +// 55342 - Mirror Image +class spell_mage_mirror_image : public SpellScriptLoader +{ +public: + spell_mage_mirror_image() : SpellScriptLoader("spell_mage_mirror_image") { } + + class spell_mage_mirror_image_SpellScript : public SpellScript + { + PrepareSpellScript(spell_mage_mirror_image_SpellScript); + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + + uint32 spellId = SPELL_MAGE_SUMMON_IMAGES_FROST; + + caster->CastSpell(caster, spellId, true); + } + + void Register() override + { + OnEffectHit += SpellEffectFn(spell_mage_mirror_image_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_mage_mirror_image_SpellScript(); + } +}; + void AddSC_mage_spell_scripts() { new spell_mage_frostjaw(); // 5.4.8 18414 @@ -918,4 +954,5 @@ void AddSC_mage_spell_scripts() new spell_mage_ring_of_frost(); new spell_mage_ring_of_frost_freeze(); new spell_mage_water_elemental_freeze(); + new spell_mage_mirror_image(); }