From 395eed40450f396b7e81924282c39db202478e2c Mon Sep 17 00:00:00 2001 From: IntelligentQuantum Date: Fri, 1 Apr 2022 14:30:45 +0430 Subject: [PATCH] feat(Scripts/Spells): Move to spell scripts Deathbolt (#11100) * . * Update zone_sholazar_basin.cpp * Update SpellEffects.cpp --- .../rev_1647862471388543345.sql | 4 ++ src/server/game/Spells/SpellEffects.cpp | 13 ----- .../scripts/Northrend/zone_sholazar_basin.cpp | 47 ++++++++++++++----- 3 files changed, 38 insertions(+), 26 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1647862471388543345.sql diff --git a/data/sql/updates/pending_db_world/rev_1647862471388543345.sql b/data/sql/updates/pending_db_world/rev_1647862471388543345.sql new file mode 100644 index 000000000..e029a2245 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1647862471388543345.sql @@ -0,0 +1,4 @@ +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1647862471388543345'); + +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_q12611_deathbolt'; +INSERT INTO `spell_script_names` VALUES (51854,'spell_q12611_deathbolt'); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 864214c00..5398e1dd1 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3923,19 +3923,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) m_caster->TextEmote(buf); break; } - // Deathbolt from Thalgran Blightbringer - // reflected by Freya's Ward - // Retribution by Sevenfold Retribution - case 51854: - { - if (!unitTarget) - return; - if (unitTarget->HasAura(51845)) - unitTarget->CastSpell(m_caster, 51856, true); - else - m_caster->CastSpell(unitTarget, 51855, true); - break; - } case 52173: // Coyote Spirit Despawn case 60243: // Blood Parrot Despawn if (unitTarget->GetTypeId() == TYPEID_UNIT && unitTarget->ToCreature()->IsSummon()) diff --git a/src/server/scripts/Northrend/zone_sholazar_basin.cpp b/src/server/scripts/Northrend/zone_sholazar_basin.cpp index 5ae2f647a..8d460bed6 100644 --- a/src/server/scripts/Northrend/zone_sholazar_basin.cpp +++ b/src/server/scripts/Northrend/zone_sholazar_basin.cpp @@ -15,19 +15,6 @@ * with this program. If not, see . */ -/* ScriptData -SDName: Sholazar_Basin -SD%Complete: 100 -SDComment: Quest support: 12570, 12573, 12621. -SDCategory: Sholazar_Basin -EndScriptData */ - -/* ContentData -npc_injured_rainspeaker_oracle -npc_vekjik -avatar_of_freya -EndContentData */ - #include "CombatAI.h" #include "PassiveAI.h" #include "Player.h" @@ -1505,6 +1492,38 @@ public: } }; +enum ReturnedSevenfold +{ + SPELL_FREYAS_WARD = 51845, + SPELL_SEVENFOLD_RETRIBUTION = 51856, + SPELL_DEATHBOLT = 51855 +}; + +class spell_q12611_deathbolt : public SpellScript +{ + PrepareSpellScript(spell_q12611_deathbolt); + + void HandleScriptEffect(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + Unit* target = GetHitUnit(); + + if (target->HasAura(SPELL_FREYAS_WARD)) + { + target->CastSpell(caster, SPELL_SEVENFOLD_RETRIBUTION, true); + } + else + { + caster->CastSpell(target, SPELL_DEATHBOLT, true); + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_q12611_deathbolt::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + void AddSC_sholazar_basin() { // Ours @@ -1526,4 +1545,6 @@ void AddSC_sholazar_basin() new spell_q12589_shoot_rjr(); new npc_vics_flying_machine(); new spell_shango_tracks(); + + RegisterSpellScript(spell_q12611_deathbolt); }