Core/Spells: Fix Banish removal behavior

Closes #143 & #1173
This commit is contained in:
tehmarto
2011-05-15 22:26:54 +07:00
committed by tobmaps
parent bfe61c7998
commit b135ef0f62
2 changed files with 54 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
DELETE FROM `spell_script_names` WHERE `spell_id` IN (710,18647);
INSERT INTO `spell_script_names` VALUES (710,"spell_warl_banish"),(18647,"spell_warl_banish");

View File

@@ -230,10 +230,62 @@ class spell_warl_seed_of_corruption : public SpellScriptLoader
}
};
class spell_warl_banish : public SpellScriptLoader
{
public:
spell_warl_banish() : SpellScriptLoader("spell_warl_banish") { }
class spell_warl_banish_SpellScript : public SpellScript
{
PrepareSpellScript(spell_warl_banish_SpellScript);
bool Load()
{
_removed = false;
return true;
}
void HandleBanish()
{
if (Unit* target = GetHitUnit())
{
if (target->GetAuraEffect(SPELL_AURA_SCHOOL_IMMUNITY, SPELLFAMILY_WARLOCK, 0, 0x08000000, 0))
{
//No need to remove old aura since its removed due to not stack by current Banish aura
PreventHitDefaultEffect(EFFECT_0);
PreventHitDefaultEffect(EFFECT_1);
PreventHitDefaultEffect(EFFECT_2);
_removed = true;
}
}
}
void RemoveAura()
{
if (_removed)
PreventHitAura();
}
void Register()
{
BeforeHit += SpellHitFn(spell_warl_banish_SpellScript::HandleBanish);
AfterHit += SpellHitFn(spell_warl_banish_SpellScript::RemoveAura);
}
bool _removed;
};
SpellScript* GetSpellScript() const
{
return new spell_warl_banish_SpellScript();
}
};
void AddSC_warlock_spell_scripts()
{
new spell_warl_demonic_empowerment();
new spell_warl_create_healthstone();
new spell_warl_everlasting_affliction();
new spell_warl_seed_of_corruption();
new spell_warl_banish();
}