Core/Spells: add correct checking for dispeling errors. Fixes spammable cleanse.
This commit is contained in:
1 parent
84891377b5
commit
01bc6c483b
4 files changed
+62
-39
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user