fix(Scripts/Items): Powerful Anti-venom (#7854)

This commit is contained in:
jestermaniac
2021-09-18 22:45:55 +02:00
committed by GitHub
parent 0dffcb5aca
commit a8ca50fc47
2 changed files with 52 additions and 0 deletions

View File

@@ -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<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 > 60 || 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_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();