I tried the dispel magic I found here, after working through this one. It had a lot of compiler problems and I am sure it would have been a slog, so I kept what I have since I already went through the slog.
Commented out is a saving throw. Not really worth trying to fix if I cannot at least get it to remove spells at this time.
Code:
ASPELL(spell_dispel_magic)
{
struct affected_type *aff, *next_aff;
bool success = FALSE;
if (!victim)
victim = ch; /* Default to self if no target */
// Defensive cast: non-NPC caster on self, non-NPC, or charmed group member
if (!IS_NPC(ch) && (!IS_NPC(victim) || (IS_AFFECTED(victim, AFF_CHARM) && victim->master
&& GROUP(ch) && GROUP(victim->master) == GROUP(ch)))) {
for (aff = victim->affected; aff; aff = aff->next) {
next_aff = aff->next; /* Store next to avoid issues when removing */
if (aff->duration < 0) /* Skip permanent affects */
continue;
}
affect_remove(victim, aff);
success = TRUE;
}
if (success) {
if (victim == ch) {
send_to_char(ch, "You have removed all magic effects from yourself.\n\r");
act("$n has removed all magic effects from $mself.", FALSE, ch, NULL, ch, TO_ROOM);
} else {
send_to_char(ch, "You have removed all magic effects from %s.\n\r", GET_NAME(victim));
send_to_char(victim, "%s has removed all magic effects from you.\n\r", GET_NAME(ch));
act("$n has removed all magic effects from $N.", FALSE, ch, NULL, victim, TO_NOTVICT);
}
} else {
send_to_char(ch, "No magical effects to dispel.\n\r");
}
return;
/* Offensive cast: remove one affect + try sanctuary */
for (aff = victim->affected; aff; aff = aff->next) {
next_aff = aff->next;
if (aff->duration < 0) /* Skip permanent affects */
continue;
affect_remove(victim, aff);
log("Affect should have been removed");
/* if (mag_savingthrow(victim, SAVING_BREATH, 0)) { Circle's saving throw */
success = TRUE;
break; /* Only one affect removed */
/* } */
}
/* Always try to remove AFF_SANCTUARY */
if (IS_AFFECTED(victim, AFF_SANCTUARY)) {
if (mag_savingthrow(victim, SAVING_BREATH, 0)) /* Circle's saving throw */
REMOVE_BIT_AR(AFF_FLAGS(victim), AFF_SANCTUARY);
send_to_char(victim, "The white aura around your body fades.\n\r");
act("The white aura around $n's body fades.", FALSE, ch, NULL, victim, TO_ROOM);
success = TRUE;
}
if (success)
send_to_char(ch, "You successfully dispel magic!\n\r");
else
send_to_char(ch, "Your dispel magic fails.\n\r");
/* Trigger combat if not already fighting and not in same group */
if (victim != ch) {
set_fighting(victim, ch); /* Start combat */
if (ch != victim)
set_fighting(ch, victim); /* Mutual combat */
}
}
I would pull out my hair but it is already gone gone gone....