diff --git a/zone/mob.h b/zone/mob.h index cdf67df66..e5ce8f513 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -939,6 +939,7 @@ public: void TrySympatheticProc(Mob *target, uint32 spell_id); uint16 GetSympatheticFocusEffect(focusType type, uint16 spell_id); bool TryFadeEffect(int slot); + void DispelMagic(Mob* casterm, uint16 spell_id, int effect_value); uint16 GetSpellEffectResistChance(uint16 spell_id); int32 GetVulnerability(Mob *caster, uint32 spell_id, uint32 ticsremaining, bool from_buff_tic = false); int64 GetFcDamageAmtIncoming(Mob *caster, int32 spell_id, bool from_buff_tic = false); diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 80c9e439b..2c45b5486 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -1094,22 +1094,13 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove snprintf(effect_desc, _EDLEN, "Cancel Magic: %d", effect_value); #endif if(GetSpecialAbility(UNDISPELLABLE)){ - if (caster) + if (caster) { caster->MessageString(Chat::SpellFailure, SPELL_NO_EFFECT, spells[spell_id].name); + } break; } - int buff_count = GetMaxTotalSlots(); - for(int slot = 0; slot < buff_count; slot++) { - if(IsValidSpell(buffs[slot].spellid) && - spells[buffs[slot].spellid].dispel_flag == 0 && - !IsDiscipline(buffs[slot].spellid)) - { - if (caster && TryDispel(caster->GetCasterLevel(spell_id), buffs[slot].casterlevel, effect_value)){ - BuffFadeBySlot(slot); - slot = buff_count; - } - } - } + + DispelMagic(caster, spell_id, effect_value); break; } @@ -7300,6 +7291,22 @@ bool Mob::PassLimitClass(uint32 Classes_, uint16 Class_) return false; } +void Mob::DispelMagic(Mob* caster, uint16 spell_id, int effect_value) +{ + for (int slot = 0; slot < GetMaxTotalSlots(); slot++) { + if ( + buffs[slot].spellid != SPELL_UNKNOWN && + spells[buffs[slot].spellid].dispel_flag == 0 && + !IsDiscipline(buffs[slot].spellid) + ) { + if (caster && TryDispel(caster->GetCasterLevel(spell_id), buffs[slot].casterlevel, effect_value)) { + BuffFadeBySlot(slot); + break; + } + } + } +} + uint16 Mob::GetSpellEffectResistChance(uint16 spell_id) {