From 23fbdd0fe3b6d74816411feb4c00f88a5d54c08a Mon Sep 17 00:00:00 2001 From: IntelligentQuantum Date: Sat, 4 Mar 2023 12:22:22 +0330 Subject: [PATCH] fix(Core/Scripts): Zort's Protective Elixir (#14365) --- .../rev_1671948396193749028.sql | 3 ++ .../scripts/Northrend/zone_dragonblight.cpp | 35 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1671948396193749028.sql diff --git a/data/sql/updates/pending_db_world/rev_1671948396193749028.sql b/data/sql/updates/pending_db_world/rev_1671948396193749028.sql new file mode 100644 index 000000000..852260c1f --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1671948396193749028.sql @@ -0,0 +1,3 @@ +-- +DELETE FROM `spell_script_names` WHERE `ScriptName` = 'spell_dragonblight_corrosive_spit'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (47447, 'spell_dragonblight_corrosive_spit'); diff --git a/src/server/scripts/Northrend/zone_dragonblight.cpp b/src/server/scripts/Northrend/zone_dragonblight.cpp index 7b78d8d11..56905fbbe 100644 --- a/src/server/scripts/Northrend/zone_dragonblight.cpp +++ b/src/server/scripts/Northrend/zone_dragonblight.cpp @@ -26,6 +26,7 @@ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "SpellAuras.h" +#include "SpellAuraEffects.h" #include "SpellScript.h" #include "Vehicle.h" @@ -2258,6 +2259,38 @@ public: } }; +// 47447 - Corrosive Spit +class spell_dragonblight_corrosive_spit : public AuraScript +{ + PrepareAuraScript(spell_dragonblight_corrosive_spit); + + bool Validate(SpellInfo const* spellInfo) override + { + return ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_0).CalcValue()) }); + } + + void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (GetTarget()->HasAura(aurEff->GetSpellInfo()->GetEffect(EFFECT_0).CalcValue())) + GetAura()->Remove(); + } + + void PeriodicTick(AuraEffect const* aurEff) + { + if (GetTarget()->HasAura(aurEff->GetSpellInfo()->GetEffect(EFFECT_0).CalcValue())) + { + PreventDefaultAction(); + GetAura()->Remove(); + } + } + + void Register() override + { + AfterEffectApply += AuraEffectApplyFn(spell_dragonblight_corrosive_spit::AfterApply, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_dragonblight_corrosive_spit::PeriodicTick, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE); + } +}; + void AddSC_dragonblight() { // Ours @@ -2287,4 +2320,6 @@ void AddSC_dragonblight() new spell_q12096_q12092_dummy(); new spell_q12096_q12092_bark(); new npc_torturer_lecraft(); + + RegisterSpellScript(spell_dragonblight_corrosive_spit); }