Re: [NEWBIE] [CODE] Retreat

From: Beau Perrizo (Perrizo@aol.com)
Date: 02/11/99


For the people wanted the retreat code, here it is.

ACMD(do_retreat)
{
 int door;
 struct char_data *was_fighting;
 int percent, prob;

 one_argument(argument, arg);

if (!GET_SKILL(ch, SKILL_RETREAT)) {
    send_to_char("You do not posess the necessary skills to retreat.\r\n",
ch);
    return;
   }
if (GET_POS(ch) < POS_FIGHTING) {
    send_to_char("You are wounded too badly to move!\r\n", ch);
    return;
  }
if ((door = search_block(arg, dirs, FALSE)) == -1) {
    send_to_char("That's not a direction.\r\n", ch);
    return;
}
if (!CAN_GO(ch, door)) {
        send_to_char("You must have an exit to retreat to.\r\n", ch);
        return;
}

  percent = number(1, 101);     /* 101% is a complete failure */
  prob = GET_SKILL(ch, SKILL_RETREAT);

if (percent > prob) {
        act("$n tries to retreat but gets cut off!!", TRUE, ch, 0, 0, TO_ROOM);
        send_to_char("You've been cut off!!\r\n", ch);
} else {
        send_to_char("You successfully retreat from combat.\r\n", ch);
        act("$n retreats from combat!", TRUE, ch, 0, 0, TO_ROOM);
        was_fighting = FIGHTING(ch);
        do_simple_move(ch, door, TRUE);
}
        }

Feel free to use it if you like, you don't need to credit me with it or
anything, however, if you upgrade, enhance, or other wise improve the code I'd
like to know what you've done to it so I can add it to my own.

Turgantarganath


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



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