aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
authorKandera <KanderaDev@gmail.com>2012-03-13 13:03:41 -0400
committerKandera <KanderaDev@gmail.com>2012-03-15 10:56:56 -0400
commit01bc6c483bc0756850ee8853f98bd8de4a2316bc (patch)
tree738b39dbad51ac87dec69b6caee1947f9f760437 /src/server/game/Spells/Spell.cpp
parent84891377b5f11c93ba75a925703a654c3778b162 (diff)
Core/Spells: add correct checking for dispeling errors. Fixes spammable cleanse.
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 38e66a218f8..6587ce71b61 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -4938,6 +4938,24 @@ SpellCastResult Spell::CheckCast(bool strict)
if (castResult != SPELL_CAST_OK)
return castResult;
+ bool hasDispellableAura = false;
+ for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
+ if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_DISPEL)
+ if (Unit* target = m_targets.GetUnitTarget())
+ {
+ DispelChargesList dispelList;
+ uint32 dispelMask = SpellInfo::GetDispelMask(DispelType(m_spellInfo->Effects[i].MiscValue));
+ target->GetDispellableAuraList(m_caster, dispelMask, dispelList);
+ if (!dispelList.empty())
+ {
+ hasDispellableAura = true;
+ break;
+ }
+ }
+
+ if (!hasDispellableAura)
+ return SPELL_FAILED_NOTHING_TO_DISPEL;
+
for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
{
// for effects of spells that have only one target