mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-21 15:27:47 -04:00
Core/Spells: Fixed warlock's Banish cancel if target was already banished (#23697)
* Core/Spells: Add SpellMissInfo argument to BeforeHit hooks and call them also when the spell doesn't hit. (#17613) (cherry picked from commit8ff5b35be1) # Conflicts: # src/server/game/Spells/Spell.cpp # src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp # src/server/scripts/Spells/spell_warlock.cpp * Core/Spells: Fixed warlock's Banish cancel if target was already banished (#17614) (cherry picked from commit4587b5d880) # Conflicts: # src/server/scripts/Spells/spell_warlock.cpp
This commit is contained in:
committed by
Giacomo Pozzoni
parent
10f6e38185
commit
448facc5e7
@@ -148,40 +148,26 @@ class spell_warl_banish : public SpellScriptLoader
|
||||
PrepareSpellScript(spell_warl_banish_SpellScript);
|
||||
|
||||
public:
|
||||
spell_warl_banish_SpellScript()
|
||||
{
|
||||
_removed = false;
|
||||
}
|
||||
spell_warl_banish_SpellScript() {}
|
||||
|
||||
private:
|
||||
void HandleBanish()
|
||||
void HandleBanish(SpellMissInfo missInfo)
|
||||
{
|
||||
if (missInfo != SPELL_MISS_IMMUNE)
|
||||
return;
|
||||
|
||||
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;
|
||||
}
|
||||
// Casting Banish on a banished target will remove applied aura
|
||||
if (Aura * banishAura = target->GetAura(GetSpellInfo()->Id, GetCaster()->GetGUID()))
|
||||
banishAura->Remove();
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveAura()
|
||||
{
|
||||
if (_removed)
|
||||
PreventHitAura();
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
BeforeHit += SpellHitFn(spell_warl_banish_SpellScript::HandleBanish);
|
||||
AfterHit += SpellHitFn(spell_warl_banish_SpellScript::RemoveAura);
|
||||
BeforeHit += BeforeSpellHitFn(spell_warl_banish_SpellScript::HandleBanish);
|
||||
}
|
||||
|
||||
bool _removed;
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
|
||||
Reference in New Issue
Block a user