Created
May 31, 2011 20:59
-
-
Save tobmaps/1001277 to your computer and use it in GitHub Desktop.
Dispel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp | |
index c602a07..bd21a58 100755 | |
--- a/src/server/game/Spells/Spell.cpp | |
+++ b/src/server/game/Spells/Spell.cpp | |
@@ -5006,6 +5006,48 @@ SpellCastResult Spell::CheckCast(bool strict) | |
break; | |
} | |
+ case SPELL_EFFECT_DISPEL: | |
+ { | |
+ Unit* target = m_targets.GetUnitTarget(); | |
+ if (!target || i != 0 || m_spellInfo->DmgClass != SPELL_DAMAGE_CLASS_MAGIC) | |
+ break; | |
+ | |
+ bool dispelAura = false; | |
+ | |
+ // Create dispel mask by dispel type | |
+ uint32 dispelMask; | |
+ for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) | |
+ if (m_spellInfo->Effects[j].Effect == SPELL_EFFECT_DISPEL) | |
+ dispelMask |= SpellInfo::GetDispelMask(DispelType(m_spellInfo->Effects[j].MiscValue)); | |
+ // we should not be able to dispel diseases if the target is affected by unholy blight | |
+ if (dispelMask & (1 << DISPEL_DISEASE) && target->HasAura(50536)) | |
+ dispelMask &= ~(1 << DISPEL_DISEASE); | |
+ | |
+ Unit::AuraMap const& auras = target->GetOwnedAuras(); | |
+ for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) | |
+ { | |
+ Aura* aura = itr->second; | |
+ | |
+ // don't try to remove passive auras | |
+ if (aura->IsPassive()) | |
+ continue; | |
+ | |
+ if (aura->GetSpellInfo()->GetDispelMask() & dispelMask) | |
+ { | |
+ // do not remove positive auras if friendly target | |
+ // negative auras if non-friendly target | |
+ if (aura->GetSpellInfo()->IsPositive() == target->IsFriendlyTo(m_caster)) | |
+ continue; | |
+ | |
+ dispelAura = true; | |
+ break; | |
+ } | |
+ } | |
+ | |
+ if (!dispelAura) | |
+ return SPELL_FAILED_NOTHING_TO_DISPEL; | |
+ break; | |
+ } | |
case SPELL_EFFECT_POWER_BURN: | |
case SPELL_EFFECT_POWER_DRAIN: | |
{ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment