Welcome to the Builder Academy

Question Dispel Magic - Compiles but doesn't seem to work.

More
12 Aug 2025 19:55 #10859 by wlessard1
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.
As I said it does compile with out any errors or warnings.
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 */     } }

Any thoughts on why it does not seem to stop any affects?

I would pull out my hair but it is already gone gone gone....

Please Log in or Create an account to join the conversation.

More
13 Aug 2025 18:33 #10860 by thomas
How does it behave? I see you have some log statements. Do they trigger?

Please Log in or Create an account to join the conversation.

More
14 Aug 2025 17:13 #10861 by wlessard1
No, I am not seeing the log statements I put in.

Been looking through the code to find something similar but so far, nothing that I can find.

Please Log in or Create an account to join the conversation.

Time to create page: 0.192 seconds