generic spell situation check (Snippet)

From: Angus Mezick (angus@EDGIL.CCMAIL.COMPUSERVE.COM)
Date: 09/05/98

1) Don't post to the list and complain about useless posts if yours is going to
be as useless.  F^(%!NG HYPOCRITS!

2) we really didn't need to see his huge annoying .sig again either.

now here is what you should have added:

OBCIRCLE: A way to have spells abort before they are done casting without
special cases. (kinda)

in spell_parser.c:call_magic() right before all the other mag_ checks:
   if (IS_SET(SINFO.routines, MAG_CHECK))
      if(!mag_check(level, caster, cvict, spellnum, savetype))
         return 0;

in magic.c add:
int mag_check(int level, struct char_data *ch, struct char_data *victim,
               int spellnum, int savetype)
   char *to_vict = NULL;
   char *to_room = NULL;
   char *to_char = NULL;
   int pass = TRUE;

   switch (spellnum)
       case SPELL_GOODBERRY:
             to_char = "You need to be outside to call on your powers!";
             pass= FALSE;
             to_char = "There is no storm to call the lightning from!";
             pass = FALSE;
          else if(!OUTSIDE(ch))
             to_char = "You need to be outside to call on the elements!";
             pass= FALSE;
      return pass;

      act(to_char, FALSE, ch, 0, victim, TO_CHAR);
   if (to_vict != NULL)
      act(to_vict, FALSE, victim, 0, ch, TO_CHAR);
   if (to_room != NULL)
      act(to_room, TRUE, victim, 0, ch, TO_ROOM);
   return pass;

in spells.h add:
#define MAG_CHECK       (1 << 11)

and then add MAG_CHECK and a case to the above switch statement to have the
spell abort early.

--Angus - now was that so hard?
malking twinks.

______________________________ Reply Separator _________________________________
Subject: Re:  [LONG] Avatar and decapitate code with graveyar
Date:    9/5/98 12:59 AM

        I have a bad habit of not deleting mail. So I looked thru it for
some info. I will bet, hmm, what could one bet, well check for yourself
my numbers are right. I may have missed some though.
The person below has posted 56 curse words to the post. Blah big deal I
suppose. Person below has posted 31 "flames" to this post with no
obcircle. (An example is below) The same person been involved in 45 posts
about stealing code.
        I know this means little just seems funny. Well a I said I dont
delete my mail but I skim it. I just deleted 3 months worth. I yes, these
numbers are in the past three months. I do not like having to wade thru
these. Waaa, yeah I know just frustrating that I had to ask a friend how
to filter this guys name.

On Fri, 4 Sep 1998, Matt Roach wrote:

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

This archive was generated by hypermail 2b30 : 12/15/00 PST