Difference for server/skills.c from version 1.31 to 1.32


version 1.31 version 1.32
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_skills_c =   * static char *rcsid_skills_c =
  *   "$Id: skills.c,v 1.31 2002/11/26 08:48:20 garbled Exp $";   *   "$Id: skills.c,v 1.32 2002/12/03 07:40:18 mwedel Exp $";
  */   */
 /*  /*
     CrossFire, A Multiplayer game for X-windows      CrossFire, A Multiplayer game for X-windows
Line 1331
 
Line 1331
    return success;     return success;
 }  }
   
 int skill_throw (object *op, int dir, char *params) {  int skill_throw (object *op, object *part, int dir, char *params) {
   int success = 0;  
    
   if(op->type==PLAYER) do_throw(op,find_throw_ob(op,params),dir);      object *throw_ob;
   else do_throw(op,find_mon_throw_ob(op->head?op->head:op),dir);  
    
   return success;      if(op->type==PLAYER)
    throw_ob =  find_throw_ob(op,params);
       else
    throw_ob = find_mon_throw_ob(op);
   
       return do_throw(op,part, throw_ob,dir);
 }  }
   
 /* find_throw_ob() - if we request an object, then  /* find_throw_ob() - if we request an object, then
Line 1426
 
Line 1429
   
   
 /* do_throw() - op throws any object toss_item. This code  /* do_throw() - op throws any object toss_item. This code
  * was borrowed from fire_bow (see above), so probably these   * was borrowed from fire_bow (see above).
  * two functions should be merged together since they are   * Returns 1 if skill was successfully used, 0 if not
  * almost the same. I left them apart for now for debugging  
  * purposes, and also, so as to not screw up fire_bow()!  
  * This function is useable by monsters.  -b.t.  
  */   */
   
 void do_throw(object *op, object *toss_item, int dir) {  int do_throw(object *op, object *part, object *toss_item, int dir) {
     object *throw_ob=toss_item, *left=NULL;      object *throw_ob=toss_item, *left=NULL;
     tag_t left_tag;      tag_t left_tag;
     int eff_str = 0,maxc,str=op->stats.Str,dam=0;      int eff_str = 0,maxc,str=op->stats.Str,dam=0;
Line 1444
 
Line 1444
  if(op->type==PLAYER) {   if(op->type==PLAYER) {
      new_draw_info(NDI_UNIQUE, 0,op,"You have nothing to throw.");       new_draw_info(NDI_UNIQUE, 0,op,"You have nothing to throw.");
  }   }
  return;   return 0;
     }      }
     if (QUERY_FLAG(throw_ob, FLAG_STARTEQUIP)) {      if (QUERY_FLAG(throw_ob, FLAG_STARTEQUIP)) {
  if (op->type==PLAYER) {   if (op->type==PLAYER) {
      new_draw_info(NDI_UNIQUE, 0, op, "The gods won't let you throw that.");       new_draw_info(NDI_UNIQUE, 0, op, "The gods won't let you throw that.");
  }   }
  return;   return 0;
     }      }
    
   
Line 1475
 
Line 1475
     else { /* 0 or negative weight?!? Odd object, can't throw it */      else { /* 0 or negative weight?!? Odd object, can't throw it */
  new_draw_info_format(NDI_UNIQUE, 0,op,"You can't throw %s.\n",   new_draw_info_format(NDI_UNIQUE, 0,op,"You can't throw %s.\n",
       query_name(throw_ob));         query_name(throw_ob));
  return;   return 0;
     }      }
         
     eff_str = str * (load_factor<1.0?load_factor:1.0);      eff_str = str * (load_factor<1.0?load_factor:1.0);
Line 1497
 
Line 1497
      * have no effective throwing strength, or you threw at a wall       * have no effective throwing strength, or you threw at a wall
      */        */
     if(!dir || (eff_str <= 1) ||      if(!dir || (eff_str <= 1) ||
        wall(op->map,op->x+freearr_x[dir],op->y+freearr_y[dir])) {         wall(part->map,part->x+freearr_x[dir],part->y+freearr_y[dir])) {
   
  /* bounces off 'wall', and drops to feet */   /* bounces off 'wall', and drops to feet */
  remove_ob(throw_ob);   remove_ob(throw_ob);
  throw_ob->x = op->x; throw_ob->y = op->y;   throw_ob->x = part->x; throw_ob->y = part->y;
  insert_ob_in_map(throw_ob,op->map,op,0);   insert_ob_in_map(throw_ob,part->map,op,0);
  if(op->type==PLAYER) {   if(op->type==PLAYER) {
      if(eff_str<=1) {       if(eff_str<=1) {
  new_draw_info_format(NDI_UNIQUE, 0,op,   new_draw_info_format(NDI_UNIQUE, 0,op,
Line 1516
 
Line 1516
      else       else
  new_draw_info(NDI_UNIQUE, 0,op,"Something is in the way.");   new_draw_info(NDI_UNIQUE, 0,op,"Something is in the way.");
  }   }
  return;   return 0;
     } /* if object can't be thrown */      } /* if object can't be thrown */
    
     left = throw_ob; /* these are throwing objects left to the player */      left = throw_ob; /* these are throwing objects left to the player */
Line 1545
 
Line 1545
     /* special case: throwing powdery substances like dust, dirt */      /* special case: throwing powdery substances like dust, dirt */
     if(QUERY_FLAG(throw_ob,FLAG_DUST)) {       if(QUERY_FLAG(throw_ob,FLAG_DUST)) {
  cast_dust(op,throw_ob,dir);    cast_dust(op,throw_ob,dir);
  return;   return 1;
     }      }
   
     /* Make a thrown object -- insert real object in a 'carrier' object.      /* Make a thrown object -- insert real object in a 'carrier' object.
Line 1556
 
Line 1556
  throw_ob = toss_item;   throw_ob = toss_item;
     else {      else {
  insert_ob_in_ob(throw_ob,op);   insert_ob_in_ob(throw_ob,op);
  return;   return 0;
     }      }
   
     set_owner(throw_ob,op);      set_owner(throw_ob,op);
Line 1564
 
Line 1564
      * becomes the hitter.  As such, we need to make sure that has a proper       * becomes the hitter.  As such, we need to make sure that has a proper
      * owner value so exp goes to the right place.       * owner value so exp goes to the right place.
      */       */
     /*    set_owner(throw_ob,op->inv);  
    Set thrown object's owner to first object in player's inventory???  
    Don't you mean to set player as owner of object in throw_ob's inv?  */  
     set_owner(throw_ob->inv,op);      set_owner(throw_ob->inv,op);
     throw_ob->direction=dir;      throw_ob->direction=dir;
     throw_ob->x = op->x;      throw_ob->x = part->x;
     throw_ob->y = op->y;      throw_ob->y = part->y;
   
     /* the damage bonus from the force of the throw */      /* the damage bonus from the force of the throw */
     dam = str_factor * dam_bonus[eff_str];      dam = str_factor * dam_bonus[eff_str];
Line 1638
 
Line 1635
     if(throw_ob->stats.food>100) throw_ob->stats.food=100;      if(throw_ob->stats.food>100) throw_ob->stats.food=100;
     if(throw_ob->stats.wc>30) throw_ob->stats.wc=30;      if(throw_ob->stats.wc>30) throw_ob->stats.wc=30;
   
     /* We shouldn't need a call to fix player just for throwing an  
      * object.  
      */  
 /*    fix_player(op);*/  
   
     /* how long to pause the thrower. Higher values mean less pause */      /* how long to pause the thrower. Higher values mean less pause */
     pause_f = ((2*eff_str)/3)+20+SK_level(op);      pause_f = ((2*eff_str)/3)+20+SK_level(op);
   
Line 1654
 
Line 1646
      * In short summary, a throw can take anywhere between speed 5 and       * In short summary, a throw can take anywhere between speed 5 and
      * speed 0.5       * speed 0.5
      */       */
   
     op->speed_left -=  50 / pause_f;      op->speed_left -=  50 / pause_f;
   
     update_ob_speed(throw_ob);      update_ob_speed(throw_ob);
     throw_ob->speed_left = 0;      throw_ob->speed_left = 0;
     throw_ob->map = op->map;      throw_ob->map = part->map;
   
     SET_FLAG(throw_ob, FLAG_FLYING);      SET_FLAG(throw_ob, FLAG_FLYING);
     SET_FLAG(throw_ob, FLAG_FLY_ON);      SET_FLAG(throw_ob, FLAG_FLY_ON);
Line 1697
 
Line 1688
         throw_ob->last_sp,throw_ob->speed,throw_ob->stats.food);          throw_ob->last_sp,throw_ob->speed,throw_ob->stats.food);
     LOG(llevDebug,"inserting tossitem (%d) into map\n",throw_ob->count);      LOG(llevDebug,"inserting tossitem (%d) into map\n",throw_ob->count);
 #endif  #endif
     insert_ob_in_map(throw_ob,op->map,op,0);      insert_ob_in_map(throw_ob,part->map,op,0);
     move_arrow(throw_ob);      move_arrow(throw_ob);
       return 1;
 }  }
   


Legend:
line(s) removed in v.1.31 
line(s) changed
 line(s) added in v.1.32

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