Difference for server/alchemy.c from version 1.4 to 1.5


version 1.4 version 1.5
Line 85
 
Line 85
    change_skill(caster,SK_ALCHEMY);     change_skill(caster,SK_ALCHEMY);
           ability+=SK_level(caster)*((4.0 + cauldron->magic)/4.0);            ability+=SK_level(caster)*((4.0 + cauldron->magic)/4.0);
         }          }
    /* Add caster's luck to alcheky skill */
    /* cauldron->magic multiplies luck only half as much as *
    * it does Alchemy skill.  -- DAMN */
    ability += caster->stats.luck*((8.0 + cauldron->magic)/8.0);
   
 #ifdef ALCHEMY_DEBUG  #ifdef ALCHEMY_DEBUG
  LOG(llevDebug,"Got alchemy ability lvl = %d\n",ability);   LOG(llevDebug,"Got alchemy ability lvl = %d\n",ability);
Line 113
 
Line 117
      return;       return;
  } /* End of WIZ alchemy */   } /* End of WIZ alchemy */
   
  /*  compute base chance of recipe success */  
  success_chance = 15.0 * ability / ( numb * numb * numb + 30 + 15.0*ability);  
 #ifdef ALCHEMY_DEBUG  #ifdef ALCHEMY_DEBUG
  LOG(llevDebug,"base success chance =  %f\n",success_chance);   LOG(llevDebug,"base success chance =  %f\n",success_chance);
 #endif  #endif
Line 125
 
Line 127
  if(rp)  /* if we found a recipe */   if(rp)  /* if we found a recipe */
  {   {
    float ave_chance = fl->total_chance/(float)fl->number;     float ave_chance = fl->total_chance/(float)fl->number;
      object *item;
   
      /* create the object **FIRST**, then decide whether to keep it. */
      if((item=attempt_recipe(caster,cauldron,ability,rp,formula/rp->index)) != NULL) {
        /*  compute base chance of recipe success */
        success_chance = ((float)(15*ability) /
          (float)(15*ability + numb*item->level * (numb+item->level+formula/rp->index)));
    if(ave_chance == 0) ave_chance = 1;     if(ave_chance == 0) ave_chance = 1;
    /* adjust the success chance by the chance from the recipe list */     /* adjust the success chance by the chance from the recipe list */
    if(ave_chance > rp->chance)     if(ave_chance > rp->chance)
Line 137
 
Line 146
 #endif  #endif
   
    /* roll the dice */     /* roll the dice */
    if(RANDOM()%100 <= 100 * success_chance) {       if((float)(RANDOM()%100) <= 100.0 * success_chance) {
      if(attempt_recipe(caster,cauldron,ability,rp,formula/rp->index)) return;         /* we learn from our experience IF we know something of the alchemical arts */
          if(caster->chosen_skill&&caster->chosen_skill->stats.sp==SK_ALCHEMY) {
    /* more exp is given for higher ingred number recipes */
    int amount = numb*numb*calc_skill_exp(caster,item);
    add_exp(caster,amount);
    item->stats.exp=0; /* so when skill id this item, less xp is awarded */
   #ifdef EXTREME_ALCHEMY_DEBUG
    LOG(llevDebug,"%s gains %d experience points.\n",caster->name,amount);
   #endif
          }
          return;
        }
    }     }
  }   }
      }       }
Line 202
 
Line 222
 object * attempt_recipe(object *caster, object *cauldron,int ability, recipe *rp, int nbatches) {   object * attempt_recipe(object *caster, object *cauldron,int ability, recipe *rp, int nbatches) {
   object *item=NULL;      object *item=NULL; 
   /* this should be passed to this fctn, not too effiecent cpu use this way */    /* this should be passed to this fctn, not too effiecent cpu use this way */
   int numb=numb_ob_inside(cauldron), batches=abs(nbatches);    int /*numb=numb_ob_inside(cauldron),unused?*/ batches=abs(nbatches);
   
   if(rp->keycode)  /* code required for this recipe, search the caster */    if(rp->keycode)  /* code required for this recipe, search the caster */
  { object *tmp;   { object *tmp;
Line 230
 
Line 250
             "Your spell causes the %s to explode!",cauldron->name); */              "Your spell causes the %s to explode!",cauldron->name); */
       /* kaboom_cauldron(); */         /* kaboom_cauldron(); */
     } else {      } else {
       /* we learn from our experience IF we know something of the alchemical arts */  
       if(nbatches>=0 && caster->chosen_skill&&caster->chosen_skill->stats.sp==SK_ALCHEMY) {   
         /* more exp is given for higher ingred number recipes */   
         int amount = numb*numb*calc_skill_exp(caster,item);  
  add_exp(caster,amount);  
  item->stats.exp=0; /* so when skill id this item, less xp is awarded */  
 #ifdef EXTREME_ALCHEMY_DEBUG   
         LOG(llevDebug,"%s gains %d experience points.\n",caster->name,amount);   
 #endif  
       }  
       new_draw_info_format(NDI_UNIQUE, 0,caster,         new_draw_info_format(NDI_UNIQUE, 0,caster,
                "The %s %s.",cauldron->name,cauldron_sound());                 "The %s %s.",cauldron->name,cauldron_sound());
     }         }   
Line 269
 
Line 279
    item->stats.exp += lvl*lvl*nrof;     item->stats.exp += lvl*lvl*nrof;
   
    /* item->level = (lvl+item->level)/2; avg between default and caster levels */     /* item->level = (lvl+item->level)/2; avg between default and caster levels */
      
 }  }
   
   


Legend:
line(s) removed in v.1.4 
line(s) changed
 line(s) added in v.1.5

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