diff options
| author | ForesterDev <11771800+ForesterDev@users.noreply.github.com> | 2019-08-23 21:24:56 +0400 |
|---|---|---|
| committer | Giacomo Pozzoni <giacomopoz@gmail.com> | 2019-08-23 19:24:56 +0200 |
| commit | 448facc5e794bde5068533825ebfd55435effb57 (patch) | |
| tree | 9df1c5ea6f2cb7f9b2e49d00fbaf0d66fc48cfc2 /src/server/scripts/Spells | |
| parent | 10f6e3818578410246750c6fce53d189ad05bee4 (diff) | |
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 commit 8ff5b35be1256d03b85438b130dcec7cd4cae6e1)
# 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 commit 4587b5d88082d2c6416fafaa2f5b9f5f15038520)
# Conflicts:
# src/server/scripts/Spells/spell_warlock.cpp
Diffstat (limited to 'src/server/scripts/Spells')
| -rw-r--r-- | src/server/scripts/Spells/spell_rogue.cpp | 7 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_warlock.cpp | 32 |
2 files changed, 14 insertions, 25 deletions
diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 597a746b816..4a13ceac980 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -255,8 +255,11 @@ class spell_rog_deadly_poison : public SpellScriptLoader return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCastItem(); } - void HandleBeforeHit() + void HandleBeforeHit(SpellMissInfo missInfo) { + if (missInfo != SPELL_MISS_NONE) + return; + if (Unit* target = GetHitUnit()) // Deadly Poison if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x10000, 0x80000, 0, GetCaster()->GetGUID())) @@ -319,7 +322,7 @@ class spell_rog_deadly_poison : public SpellScriptLoader void Register() override { - BeforeHit += SpellHitFn(spell_rog_deadly_poison_SpellScript::HandleBeforeHit); + BeforeHit += BeforeSpellHitFn(spell_rog_deadly_poison_SpellScript::HandleBeforeHit); AfterHit += SpellHitFn(spell_rog_deadly_poison_SpellScript::HandleAfterHit); } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 4195b828046..e14386ffa42 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -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 |
