fix(Core/Spell): Warlock Banish (#7832)

This commit is contained in:
IntelligentQuantum
2021-09-16 19:40:54 +04:30
committed by GitHub
parent c962833bf4
commit fec27d8d8a

View File

@@ -551,45 +551,27 @@ public:
{
PrepareSpellScript(spell_warl_banish_SpellScript);
bool Load() override
{
_removed = false;
return true;
}
void HandleBanish(SpellMissInfo missInfo)
{
if (missInfo != SPELL_MISS_NONE)
if (missInfo != SPELL_MISS_IMMUNE)
{
return;
}
if (Unit* target = GetHitUnit())
{
if (target->GetAuraEffect(SPELL_AURA_SCHOOL_IMMUNITY, SPELLFAMILY_WARLOCK, 0, 0x08000000, 0))
// Casting Banish on a banished target will remove applied aura
if (Aura* banishAura = target->GetAura(GetSpellInfo()->Id, GetCaster()->GetGUID()))
{
// 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;
banishAura->Remove();
}
}
}
void RemoveAura()
{
if (_removed)
PreventHitAura();
}
void Register() override
{
BeforeHit += BeforeSpellHitFn(spell_warl_banish_SpellScript::HandleBanish);
AfterHit += SpellHitFn(spell_warl_banish_SpellScript::RemoveAura);
}
bool _removed;
};
SpellScript* GetSpellScript() const override