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
@@ -4113,6 +4113,45 @@ Aura* Unit::GetAuraOfRankedSpell(uint32 spellId, uint64 casterGUID, uint64 itemC
|
||||
return aurApp ? aurApp->GetBase() : NULL;
|
||||
}
|
||||
|
||||
void Unit::GetDispellableAuraList(Unit* caster, uint32 dispelMask, DispelChargesList& dispelList)
|
||||
{
|
||||
// we should not be able to dispel diseases if the target is affected by unholy blight
|
||||
if (dispelMask & (1 << DISPEL_DISEASE) && HasAura(50536))
|
||||
dispelMask &= ~(1 << DISPEL_DISEASE);
|
||||
|
||||
AuraMap const& auras = GetOwnedAuras();
|
||||
for (AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
|
||||
{
|
||||
Aura* aura = itr->second;
|
||||
AuraApplication * aurApp = aura->GetApplicationOfTarget(GetGUID());
|
||||
if (!aurApp)
|
||||
continue;
|
||||
|
||||
// don't try to remove passive auras
|
||||
if (aura->IsPassive())
|
||||
continue;
|
||||
|
||||
if (aura->GetSpellInfo()->GetDispelMask() & dispelMask)
|
||||
{
|
||||
if (aura->GetSpellInfo()->Dispel == DISPEL_MAGIC)
|
||||
{
|
||||
// do not remove positive auras if friendly target
|
||||
// negative auras if non-friendly target
|
||||
if (aurApp->IsPositive() == IsFriendlyTo(caster))
|
||||
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%.
|
||||
bool dispel_charges = aura->GetSpellInfo()->AttributesEx7 & SPELL_ATTR7_DISPEL_CHARGES;
|
||||
uint8 charges = dispel_charges ? aura->GetCharges() : aura->GetStackAmount();
|
||||
if (charges > 0)
|
||||
dispelList.push_back(std::make_pair(aura, charges));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Unit::HasAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) const
|
||||
{
|
||||
for (AuraApplicationMap::const_iterator itr = m_appliedAuras.lower_bound(spellId); itr != m_appliedAuras.upper_bound(spellId); ++itr)
|
||||
|
||||
Reference in new issue
Block a user