From 78a6d8468960c88279515e8c59423f2db5832b0f Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sun, 2 Oct 2022 17:59:06 +0200 Subject: [PATCH] Core/Spells: fixed Dark Simulacrum --- .../world/4.3.4/2022_10_02_00_world.sql | 8 ++++ src/server/scripts/Spells/spell_dk.cpp | 44 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 sql/updates/world/4.3.4/2022_10_02_00_world.sql diff --git a/sql/updates/world/4.3.4/2022_10_02_00_world.sql b/sql/updates/world/4.3.4/2022_10_02_00_world.sql new file mode 100644 index 0000000000..67a7c02aaf --- /dev/null +++ b/sql/updates/world/4.3.4/2022_10_02_00_world.sql @@ -0,0 +1,8 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`= 'spell_dk_dark_simulacrum'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(77606, 'spell_dk_dark_simulacrum'); + +DELETE FROM `spell_proc` WHERE `SpellId` IN (77606, 77616); +INSERT INTO `spell_proc` (`SpellId`, `SpellTypeMask`, `SpellPhaseMask`) VALUES +(77606 , 0x1 | 0x2 | 0x4, 0x1), +(77616 , 0x1 | 0x2 | 0x4, 0x1); diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index e13af415a3..15846a9f0a 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -48,6 +48,7 @@ enum DeathKnightSpells SPELL_DK_BUTCHERY = 50163, SPELL_DK_CORPSE_EXPLOSION_TRIGGERED = 43999, SPELL_DK_DANCING_RUNE_WEAPON_PARRY_BONUS = 81256, + SPELL_DK_DARK_SIMULACRUM_OVERRIDE_BAR = 77616, SPELL_DK_DARK_TRANSFORMATION = 63560, SPELL_DK_DARK_TRANSFORMATION_DUMMY = 93426, SPELL_DK_DEATH_AND_DECAY_DAMAGE = 52212, @@ -1779,6 +1780,48 @@ class spell_dk_dancing_rune_weapon : public AuraScript } }; +// 77606 - Dark Simulacrum +class spell_dk_dark_simulacrum : public AuraScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_DK_DARK_SIMULACRUM_OVERRIDE_BAR }); + } + + bool CheckProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + { + // Spells with the attribute or player spells can be copied. Other abilities will have their damage negated + if (eventInfo.GetSpellInfo()->HasAttribute(SPELL_ATTR9_ALLOW_DARK_SIMULACRUM) || eventInfo.GetActor()->IsPlayer()) + { + if (eventInfo.GetActor()->IsPlayer()) + { + Spell const* spell = eventInfo.GetProcSpell(); + if (!spell || !spell->GetPowerCost() || !eventInfo.GetSpellInfo()->PowerType != POWER_MANA || spell->IsTriggered()) + return false; + } + else // Creature spells are simply defined by the attribute + return true; + } + + return false; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + + if (int32 spellId = eventInfo.GetSpellInfo()->Id) + if (Unit* caster = GetCaster()) + caster->CastSpell(nullptr, SPELL_DK_DARK_SIMULACRUM_OVERRIDE_BAR, CastSpellExtraArgs(aurEff).AddSpellBP0(spellId)); + } + + void Register() override + { + DoCheckEffectProc.Register(&spell_dk_dark_simulacrum::CheckProc, EFFECT_0, SPELL_AURA_DUMMY); + OnEffectProc.Register(&spell_dk_dark_simulacrum::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } +}; + void AddSC_deathknight_spell_scripts() { RegisterSpellScript(spell_dk_anti_magic_shell); @@ -1790,6 +1833,7 @@ void AddSC_deathknight_spell_scripts() RegisterSpellScript(spell_dk_butchery); RegisterSpellScript(spell_dk_crimson_scourge); RegisterSpellScript(spell_dk_dancing_rune_weapon); + RegisterSpellScript(spell_dk_dark_simulacrum); RegisterSpellScript(spell_dk_dark_transformation); RegisterSpellScript(spell_dk_dark_transformation_aura); RegisterSpellScript(spell_dk_death_and_decay);