Difference for server/alchemy.c from version 1.29 to 1.30


version 1.29 version 1.30
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_alchemy_c =   * static char *rcsid_alchemy_c =
  *   "$Id: alchemy.c,v 1.29 2006/09/03 13:01:02 ryo_saeba Exp $";   *   "$Id: alchemy.c,v 1.30 2006/09/16 06:18:50 qal21 Exp $";
  */   */
   
 /*  /*
Line 70
 
Line 70
 static int content_recipe_value (object *op);  static int content_recipe_value (object *op);
 static int numb_ob_inside (object *op);  static int numb_ob_inside (object *op);
 static void alchemy_failure_effect(object *op,object *cauldron,recipe *rp,int danger);  static void alchemy_failure_effect(object *op,object *cauldron,recipe *rp,int danger);
 static object * attempt_recipe(object *caster, object *cauldron, int ability, recipe *rp, int nbatches);  static object * attempt_recipe(object *caster, object *cauldron, int ability, recipe *rp, int nbatches, int ignore_cauldron);
 static int calc_alch_danger(object *caster,object *cauldron, recipe *rp);  static int calc_alch_danger(object *caster,object *cauldron, recipe *rp);
 static object * make_item_from_recipe(object *cauldron, recipe *rp);  static object * make_item_from_recipe(object *cauldron, recipe *rp);
 static void remove_contents (object *first_ob, object *save_item);  static void remove_contents (object *first_ob, object *save_item);
Line 137
 
Line 137
      LOG(llevDebug, "WIZ got formula: %s (nbatches:%d)\n",       LOG(llevDebug, "WIZ got formula: %s (nbatches:%d)\n",
  rp->arch_name[0], formula/rp->index);   rp->arch_name[0], formula/rp->index);
 #endif  #endif
  attempt_recipe(caster, cauldron, ability, rp, formula/rp->index);   attempt_recipe(caster, cauldron, ability, rp, formula/rp->index,
                       !is_defined_recipe(rp, cauldron, caster));
      } else LOG(llevDebug, "WIZ couldn't find formula for ingredients.\n");        } else LOG(llevDebug, "WIZ couldn't find formula for ingredients.\n");
      return;       return;
  } /* End of WIZ alchemy */   } /* End of WIZ alchemy */
Line 177
 
Line 178
      attempt_shadow_alchemy = !is_defined_recipe(rp, cauldron, caster);       attempt_shadow_alchemy = !is_defined_recipe(rp, cauldron, caster);
   
      /* create the object **FIRST**, then decide whether to keep it. */       /* create the object **FIRST**, then decide whether to keep it. */
      if ((item=attempt_recipe(caster, cauldron, ability, rp, formula/rp->index)) != NULL) {       if ((item=attempt_recipe(caster, cauldron, ability, rp, formula/rp->index, attempt_shadow_alchemy)) != NULL) {
  /*  compute base chance of recipe success */   /*  compute base chance of recipe success */
  success_chance = ((float)ability /   success_chance = ((float)ability /
    (float)(rp->diff * (item->level+2)));     (float)(rp->diff * (item->level+2)));
Line 268
 
Line 269
  * gain some exp from (successfull) fabrication of the product.    * gain some exp from (successfull) fabrication of the product.
  * If nbatches==-1, don't give exp for this creation (random generation/   * If nbatches==-1, don't give exp for this creation (random generation/
  * failed recipe)   * failed recipe)
    * If ignore_cauldron, don't check if we are using the matching cauldron
    * type (shadow alchemy)
  */    */
    
 static object * attempt_recipe(object *caster, object *cauldron, int ability, recipe *rp, int nbatches) {   static object * attempt_recipe(object *caster, object *cauldron, int ability, recipe *rp, int nbatches, int ignore_cauldron) {
   
     object *item=NULL, *skop;      object *item=NULL, *skop;
     /* this should be passed to this fctn, not effiecent cpu use this way */      /* this should be passed to this fctn, not effiecent cpu use this way */
     int batches=abs(nbatches);      int batches=abs(nbatches);
   
     /* is the cauldron the right type? */      /* is the cauldron the right type? */
     if (strcmp(rp->cauldron, cauldron->arch->name) != 0) {      if (!ignore_cauldron && (strcmp(rp->cauldron, cauldron->arch->name) != 0)) {
  new_draw_info(NDI_UNIQUE, 0, caster, "You are not using the proper"   new_draw_info(NDI_UNIQUE, 0, caster, "You are not using the proper"
      " facilities for this formula.");       " facilities for this formula.");
  return 0;   return 0;
Line 497
 
Line 500
     if((rp=get_random_recipe((recipelist *) NULL))==NULL)       if((rp=get_random_recipe((recipelist *) NULL))==NULL)
         return;          return;
   
  if((tmp=attempt_recipe(op,cauldron,1,rp,-1))) {    if((tmp=attempt_recipe(op,cauldron,1,rp,-1,0))) {
      if(!QUERY_FLAG(tmp,FLAG_CURSED)) /* curse it */       if(!QUERY_FLAG(tmp,FLAG_CURSED)) /* curse it */
      SET_FLAG(tmp,FLAG_CURSED);       SET_FLAG(tmp,FLAG_CURSED);
   
Line 522
 
Line 525
  fl=get_formulalist(numb-1); /* take a lower recipe list */    fl=get_formulalist(numb-1); /* take a lower recipe list */
  if(fl &&(rp=get_random_recipe(fl)))   if(fl &&(rp=get_random_recipe(fl)))
      /* even though random, don't grant user any EXP for it */       /* even though random, don't grant user any EXP for it */
      (void) attempt_recipe(op,cauldron,1,rp,-1);       (void) attempt_recipe(op,cauldron,1,rp,-1,0);
  else    else
      alchemy_failure_effect(op,cauldron,rp,level-1);       alchemy_failure_effect(op,cauldron,rp,level-1);
  return;   return;


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

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