From 5a4fdc7de4c829078feedfc9f818aa33c8a74710 Mon Sep 17 00:00:00 2001 From: Andrew <47818697+Nyeriah@users.noreply.github.com> Date: Tue, 14 Nov 2023 12:27:37 -0300 Subject: [PATCH] fix(Core/Spells): Banish should only be dispelled by Mass Dispel (#17703) * fix(Core/Spells): Banish should only be dispelled by Mass Dispel * Update Unit.cpp * Update Unit.cpp --- src/server/game/Entities/Unit/Unit.cpp | 8 +++++++- src/server/game/Entities/Unit/Unit.h | 2 +- src/server/game/Spells/Spell.cpp | 3 ++- src/server/game/Spells/SpellEffects.cpp | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index ae20ad666..8d1a42411 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -5529,7 +5529,7 @@ Aura* Unit::GetAuraOfRankedSpell(uint32 spellId, ObjectGuid casterGUID, ObjectGu return aurApp ? aurApp->GetBase() : nullptr; } -void Unit::GetDispellableAuraList(Unit* caster, uint32 dispelMask, DispelChargesList& dispelList) +void Unit::GetDispellableAuraList(Unit* caster, uint32 dispelMask, DispelChargesList& dispelList, SpellInfo const* dispelSpell) { // we should not be able to dispel diseases if the target is affected by unholy blight if (dispelMask & (1 << DISPEL_DISEASE) && HasAura(50536)) @@ -5575,6 +5575,12 @@ void Unit::GetDispellableAuraList(Unit* caster, uint32 dispelMask, DispelCharges continue; } + // Banish should only be dispelled by Mass Dispel + if (aura->GetSpellInfo()->Mechanic == MECHANIC_BANISH && !dispelSpell->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES)) + { + continue; + } + // The charges / stack amounts don't count towards the total number of auras that can be dispelled. // Ie: A dispel on a target with 5 stacks of Winters Chill and a Polymorph has 1 / (1 + 1) -> 50% chance to dispell // Polymorph instead of 1 / (5 + 1) -> 16%. diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index d2948aa7b..28200fc5a 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1995,7 +1995,7 @@ public: AuraApplication* GetAuraApplicationOfRankedSpell(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0, AuraApplication* except = nullptr) const; [[nodiscard]] Aura* GetAuraOfRankedSpell(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0) const; - void GetDispellableAuraList(Unit* caster, uint32 dispelMask, DispelChargesList& dispelList); + void GetDispellableAuraList(Unit* caster, uint32 dispelMask, DispelChargesList& dispelList, SpellInfo const* dispelSpell); [[nodiscard]] bool HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster = ObjectGuid::Empty) const; [[nodiscard]] uint32 GetAuraCount(uint32 spellId) const; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 5649bcdbf..e35decd6b 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -6077,7 +6077,8 @@ SpellCastResult Spell::CheckCast(bool strict) } DispelChargesList dispelList; - target->GetDispellableAuraList(m_caster, dispelMask, dispelList); + target->GetDispellableAuraList(m_caster, dispelMask, dispelList, m_spellInfo); + if (dispelList.empty()) return SPELL_FAILED_NOTHING_TO_DISPEL; } diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 8583f057c..c65bd99c6 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -2574,7 +2574,7 @@ void Spell::EffectDispel(SpellEffIndex effIndex) uint32 dispelMask = SpellInfo::GetDispelMask(DispelType(dispel_type)); DispelChargesList dispel_list; - unitTarget->GetDispellableAuraList(m_caster, dispelMask, dispel_list); + unitTarget->GetDispellableAuraList(m_caster, dispelMask, dispel_list, m_spellInfo); if (dispel_list.empty()) return;