Re: previous postings of do_flee

From: Gary (gwalicze@students.uiuc.edu)
Date: 09/24/95


On Sun, 24 Sep 1995, Michael K. Lee wrote:

> 
> >From old postings, we know that patch 8 doesn't subtract
> exp from fleeing.  So, I took out the if(FIGHTING(ch))
> since the player is not in that state after do_simple_move,
> if I am not mistaken.  Does anyone have a suggestion for
> the loss equations?  

	An easy way to do this would be to declair a char_data * variable and
before calling do_simple_move assign FIGHTING(ch) to that variable. Then 
go through and replace FIGHTING(ch) with that variable after the 
do_simple move call.

>			The loss equations are based on 
> FIGHTING state, and if the player is not in the FIGHTING state
> after do_simple_move,it is not calculating the loss exp.
> 
> 
> thanks for your help
> 
> 
> and here it is...
> 
> ACMD(do_flee)
> {
>   int i, attempt, loss;
    struct char_data *enemy = FIGHTING(ch);
>   if (!enemy) {
>         act("$n panics but nobody knows why!", TRUE, ch, 0,0, TO_ROOM);
>         send_to_char("Easy! Easy! Don't panic, nobody is fighting you.\r\n",
>                 ch);
>         return;
>         }
> 
>   for (i = 0; i < 6; i++) {
>     attempt = number(0, NUM_OF_DIRS - 1);       /* Select a random 
> direction */
>     if (CAN_GO(ch, attempt) &&
>         !IS_SET(ROOM_FLAGS(EXIT(ch, attempt)->to_room), ROOM_DEATH)) {
>       act("$n panics, and attempts to flee!", TRUE, ch, 0, 0, TO_ROOM);
>       if (do_simple_move(ch, attempt, TRUE)) {
>         send_to_char("You flee head over heels.\r\n", ch);
>       if (enemy) { 
> 
>           if (!IS_NPC(ch)) {
> 
> 
>             loss = GET_MAX_HIT(enemy) - GET_HIT(enemy);
>             loss *= GET_LEVEL(enemy);
>             gain_exp(ch, -loss);
>             sprintf(buf, "You just lost %d points from fleeing.\r\n", loss);
>             send_to_char(buf, ch);
>           }
>           if (FIGHTING(enemy) == ch)
>             stop_fighting(enemy);
>           stop_fighting(ch);
>         } 
>       } else {
>         act("$n tries to flee, but can't!", TRUE, ch, 0, 0, TO_ROOM);
>       }
>       return;
>     }
>   }
>   send_to_char("PANIC!  You couldn't escape!\r\n", ch);
> }
> 



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