( Soren P. Skou: Purify Spell  )
Snippet Contributed by greerga on Wednesday August 12, @11:19PM, from the Skills dept.
Added Dec 8, 1997. Click the link below to read it or download it.
From: "Soren P. Skou" <serces@MUD.DK>
Subject: Spell Purify

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 always, 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;
  }
 }
}



<< Glenn Campbell: Portal Spell (Code) | Reply | Threaded | Leonardo Herrera: Push Code (for players) >>

 

Related Links
download
Related Articles
More by greerga
Features
This is the new CircleMUD News site. It is based off the Slashdot 0.2 Perl code and will resemble Slashdot.org site for awhile.
Quick Links
The CircleMUD home page Alex's Snippets