I did a spell like this, but didn't bother to check it the food or drink was poisoned. I just had it blanket set value3 to zero, and you are always gaurenteed the end result will be non-poisoned edibles, no matter what the original status. Of course, I don't allow for a chance of food becoming poisoned as a result of this spell... ;-) Edward Glamkowski, Programmer Mathematica Policy Research EGlamkowski@mathematic-MPR.COM Princeton, NJ http://www.mathematica-mpr.com/ Two is not equal to three - not even for larger values of two. >---------- >From: Soren P. Skou[SMTP:serces@MUD.DK] >Sent: Wednesday, November 12, 1997 3:51 AM >To: CIRCLE@POST.QUEENSU.CA >Subject: [code] Spell Purify > >hi again.. Can't remember if this one has been up.. > >Otherwise, this is a purify spell.. Pretty much selfexplanatory, if >thing is poisoned, then it will remove the poison (Maybe) .. Please >note, that my value 3 (The poison) equals Level, this shouldn't do >anything for the normal Circle, since it just looks at poison as >either 0 or non-zero. > >As allways, should you choose to use this, then send me a mail, >corrections/improvements and so on are very much appreciated. > >---------snip---------- >ASPELL(spell_purify) >{ > > /* Check if it's food or Drink Container */ > if (GET_OBJ_TYPE(obj) != ITEM_FOOD && GET_OBJ_TYPE(obj) != > ITEM_DRINKCON) { > send_to_char("This cannot be purified further, purify your Eyes > instead!\r\n", ch); return; > } > > /* Is It poisoned? And are you a lower level? */ > if (GET_OBJ_VAL(obj, 3) <= GET_LEVEL(ch) && GET_OBJ_VAL(obj, 3)) { > if (GET_INT(ch) > number(0, 24) || GET_LEVEL(ch) >= LVL_IMMORT) { > GET_OBJ_VAL(obj, 3) = 0; /* No longer poisoned */ > } > } > /* Ok, not Poisoned, lets deal with Drink Containers first! */ > if (GET_OBJ_TYPE(obj) == ITEM_DRINKCON) { > if (GET_INT(ch) > number(0, 24) || GET_LEVEL(ch) >= LVL_IMMORT) { > if (GET_OBJ_VAL(obj, 2) > 0 && GET_OBJ_VAL(obj, 2) < 15) { > GET_OBJ_VAL(obj, 2) = GET_OBJ_VAL(obj, 2) - 1; > sprintf(buf, "%s seems to be purified.\r\n", > obj->short_description); send_to_char(buf, ch); return; > } else { > send_to_char("This cannot be purified any more.\r\n", ch); > return; > } > } else { > /* Ui.. a fumble.. */ > if (GET_OBJ_VAL(obj, 2) < 14) > GET_OBJ_VAL(obj, 2)++; > > if (!GET_OBJ_VAL(obj, 3) && number(0, 150) > GET_INT(ch) * 5) > GET_OBJ_VAL(obj, 3) = GET_LEVEL(ch); /* Oups, a poison? */ > > send_to_char("What a fumblefinger you are!\r\n", ch); > return; > } > } > else { > /* Since it's not a Drink container, it must be food! */ > if (GET_INT(ch) > number(0, 24) || GET_LEVEL(ch) >= LVL_IMMORT) { > if (GET_OBJ_VAL(obj, 0) >= 50) { > send_to_char("This cannot be purified any more!\r\n", ch); > return; > } > GET_OBJ_VAL(obj, 0) = GET_OBJ_VAL(obj, 0) + (GET_LEVEL(ch) >> 2); > sprintf(buf, "%s seems to be purified.\r\n", > obj->short_description); send_to_char(buf, ch); return; > } else { > if (GET_OBJ_VAL(obj, 0) > 3) > GET_OBJ_VAL(obj, 0) = GET_OBJ_VAL(obj, 0) - 3; > if (!GET_OBJ_VAL(obj, 3) && number(0, 150) > GET_INT(ch) * 5) > GET_OBJ_VAL(obj, 3) = GET_LEVEL(ch); /* Oups, That one got poison > */ > send_to_char("What a fumblefinger you are!\r\n", ch); > return; > } > } >} >-------------SNIP-------------------- > >/Serces > > > +------------------------------------------------------------+ > | Ensure that you have read the CircleMUD Mailing List FAQ: | > | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | > +------------------------------------------------------------+ > +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/08/00 PST