fix(Core/Spell): Anti-Venom (#4711)

This commit is contained in:
Stifler82
2021-03-07 12:12:59 +00:00
committed by GitHub
parent 0d1712c31b
commit 08c2ddbee2
2 changed files with 51 additions and 0 deletions

View File

@@ -907,6 +907,52 @@ public:
}
};
class spell_item_anti_venom : public SpellScriptLoader
{
public:
spell_item_anti_venom() : SpellScriptLoader("spell_item_anti_venom") {}
class spell_item_anti_venom_SpellScript : public SpellScript
{
PrepareSpellScript(spell_item_anti_venom_SpellScript);
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit())
{
std::list<uint32> 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 > 25 || aura->GetSpellInfo()->Dispel != DISPEL_POISON)
{
continue;
}
removeList.push_back(aura->GetId());
}
for (std::list<uint32>::const_iterator itr = removeList.begin(); itr != removeList.end(); ++itr)
{
target->RemoveAurasDueToSpell(*itr);
}
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_item_anti_venom_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_item_anti_venom_SpellScript();
}
};
enum GnomishShrinkRay
{
SPELL_GNOMISH_SHRINK_RAY_SELF = 13004,
@@ -4272,6 +4318,7 @@ void AddSC_item_spell_scripts()
new spell_item_feast();
new spell_item_gnomish_universal_remote();
new spell_item_strong_anti_venom();
new spell_item_anti_venom();
new spell_item_gnomish_shrink_ray();
new spell_item_goblin_weather_machine();
new spell_item_light_lamp();