Difference for server/attack.c from version 1.28 to 1.29


version 1.28 version 1.29
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_attack_c =   * static char *rcsid_attack_c =
  *   "$Id: attack.c,v 1.28 2001/01/08 20:39:59 avogl Exp $";   *   "$Id: attack.c,v 1.29 2001/01/15 23:49:21 cvs Exp $";
  */   */
 /*  /*
     CrossFire, A Multiplayer game for X-windows      CrossFire, A Multiplayer game for X-windows
Line 1443
 
Line 1443
 {  {
     object *tmp,*owner;      object *tmp,*owner;
   
       /* This shouldn't happen, but will prevent divide by zero errors below if it does. */
       if (op->resist[ATNR_BLIND]==100) return;
   
     tmp = present_in_ob(BLINDNESS,op);      tmp = present_in_ob(BLINDNESS,op);
     if(!tmp) {       if(!tmp) {
       tmp = get_archetype("blindness");        tmp = get_archetype("blindness");
       SET_FLAG(tmp, FLAG_BLIND);        SET_FLAG(tmp, FLAG_BLIND);
       SET_FLAG(tmp, FLAG_APPLIED);        SET_FLAG(tmp, FLAG_APPLIED);
         /* use floats so we don't lose too much precision due to rounding errors.
          * speed is a float anyways.
          */
         tmp->speed = 100.0 * tmp->speed / (100.0 - (float)op->resist[ATNR_BLIND]);
   
       tmp = insert_ob_in_ob(tmp,op);        tmp = insert_ob_in_ob(tmp,op);
       change_abil(op,tmp);   /* Mostly to display any messages */        change_abil(op,tmp);   /* Mostly to display any messages */
       fix_player(op);        /* This takes care of some other stuff */        fix_player(op);        /* This takes care of some other stuff */
Line 1463
 
Line 1471
 }  }
   
 void paralyze_player(object *op, object *hitter, int dam)   void paralyze_player(object *op, object *hitter, int dam)
 {    object *tmp;  {
       float effect,max;
       object *tmp;
   
       /* Same note as blindness above */
       if (op->resist[ATNR_PARALYZE]==100) return;
   
     if((tmp=present(PARAIMAGE,op->map,op->x,op->y))==NULL) {      if((tmp=present(PARAIMAGE,op->map,op->x,op->y))==NULL) {
       tmp=clone_arch(PARAIMAGE);        tmp=clone_arch(PARAIMAGE);
       tmp->x=op->x,tmp->y=op->y;        tmp->x=op->x,tmp->y=op->y;
Line 1473
 
Line 1487
        */         */
       insert_ob_in_map_simple(tmp,op->map);        insert_ob_in_map_simple(tmp,op->map);
     }      }
     op->speed_left-=(float)FABS(op->speed)*(dam*3);      /* Do this as a float - otherwise, rounding might very well reduce this to 0 */
     tmp->stats.food+=(signed short) (dam*3)/op->speed;      effect = (float)dam * 3.0 / (100.0 - (float) op->resist[ATNR_PARALYZE]);
     if(op->speed_left< -(FABS(op->speed)*40)) {  
       op->speed_left  = (float) -(FABS(op->speed)*40);      op->speed_left-=FABS(op->speed)*effect;
       tmp->stats.food = (signed short) (40/FABS(op->speed));      tmp->stats.food+=(signed short) effect/op->speed;
   
       /* max number of ticks to be affected for. */
       max = (100 - op->resist[ATNR_PARALYZE])/ 2;
   
       if (op->speed_left< -(FABS(op->speed)*max)) {
         op->speed_left  = (float) -(FABS(op->speed)*max);
         tmp->stats.food = (signed short) (max/FABS(op->speed));
     }      }
 }  }
   


Legend:
line(s) removed in v.1.28 
line(s) changed
 line(s) added in v.1.29

File made using version 1.98 of cvs2html by leaf at 2011-07-21 17:25