Re: [BPL14] Retreat [code]

From: Scorn (scorn@RMI.NET)
Date: 09/17/98


ok i found the problems you were right it set dir = 0  and also in the
do_simple_ move(ch, dir, TRUE)  dir should be retreat_type also noticed a
few bugs in then stop_fighting parts that caused the mud to crash so i
updated those.  If anyone wants this code i have included it sorry for the
spam.  Also someone may want to update the snippets page.  Scorn

ACMD(do_retreat)
  {
   int prob, percent, dir;
   int retreat_type;

   one_argument(argument, arg);

   if (!FIGHTING(ch))
     {
     send_to_char("You are not fighting!", ch);
     return;
     }
   if (!*arg)
     {
     send_to_char("Retreat where?!?", ch);
     return;
     }

   retreat_type = search_block(argument + 1, dirs, FALSE);

   if (retreat_type < 0 || !EXIT(ch, retreat_type) ||
     EXIT(ch, retreat_type)->to_room == NOWHERE)
     {
     send_to_char("Retreat where?\r\n", ch);
     return;
     }

   percent = GET_SKILL(ch, SKILL_RETREAT);
   prob = number(0, 101);

   if (prob <= percent){
      if (CAN_GO(ch, dir) && !IS_SET(ROOM_FLAGS(EXIT(ch,dir)->to_room),
ROOM_DEATH))
    {
    act("$n skillfully retreats from combat.", TRUE, ch, 0, 0, TO_ROOM);
    send_to_char("You skillfully retreat from combat.\r\n", ch);
    WAIT_STATE(ch, PULSE_VIOLENCE);
    do_simple_move(ch, retreat_type, TRUE);
   if (FIGHTING(ch))
    stop_fighting(ch);
    } else {
    act("$n tries to retreat from combat but has no where to go!", TRUE,
ch, 0, 0, TO_ROOM);
    send_to_char("You cannot retreat in that direction!", ch);
         return;
    }
   } else {
      send_to_char("You fail your attempt to retreat!\r\n", ch);
      WAIT_STATE(ch, PULSE_VIOLENCE);
      return;
    }
  }


     +------------------------------------------------------------+
     | 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/15/00 PST