diff --git a/data/sql/updates/pending_db_world/rev_1631557649018772603.sql b/data/sql/updates/pending_db_world/rev_1631557649018772603.sql new file mode 100644 index 000000000..bacf9ddb1 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1631557649018772603.sql @@ -0,0 +1,5 @@ +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1631557649018772603'); + +DELETE FROM `spell_script_names` WHERE `spell_id` = 23786 AND `ScriptName` = 'spell_item_poweful_anti_venom'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (23786, 'spell_item_poweful_anti_venom'); + diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 386deec83..06330a308 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -865,6 +865,52 @@ public: } }; +class spell_item_poweful_anti_venom : public SpellScriptLoader +{ +public: + spell_item_poweful_anti_venom() : SpellScriptLoader("spell_item_poweful_anti_venom") {} + + class spell_item_powerful_anti_venom_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_powerful_anti_venom_SpellScript); + + void HandleDummy(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + { + std::list removeList; + Unit::AuraMap const& auras = target->GetOwnedAuras(); + for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + { + Aura* aura = itr->second; + if (aura->GetSpellInfo()->SpellLevel > 60 || aura->GetSpellInfo()->Dispel != DISPEL_POISON) + { + continue; + } + + removeList.push_back(aura->GetId()); + } + + for (std::list::const_iterator itr = removeList.begin(); itr != removeList.end(); ++itr) + { + target->RemoveAurasDueToSpell(*itr); + } + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_powerful_anti_venom_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_item_powerful_anti_venom_SpellScript(); + } +}; + class spell_item_strong_anti_venom : public SpellScriptLoader { public: @@ -4351,6 +4397,7 @@ void AddSC_item_spell_scripts() new spell_item_skull_of_impeding_doom(); new spell_item_feast(); new spell_item_gnomish_universal_remote(); + new spell_item_poweful_anti_venom(); new spell_item_strong_anti_venom(); new spell_item_anti_venom(); new spell_item_gnomish_shrink_ray();