Difference for common/treasure.c from version 1.30 to 1.31


version 1.30 version 1.31
Line 1
 
Line 1
   
 /*  /*
  * static char *rcs_treasure_c =   * static char *rcs_treasure_c =
  *   "$Id: treasure.c,v 1.30 2002/12/27 08:37:41 mwedel Exp $";   *   "$Id: treasure.c,v 1.31 2003/01/20 23:58:35 garbled Exp $";
  */   */
   
 /*  /*
Line 463
 
Line 463
   {  0, 0, 0, 0,100}, /*31*/    {  0, 0, 0, 0,100}, /*31*/
 };  };
   
   /* calculate the appropriate level for wands staves and scrolls.  If
      retmult is 1, return the multiplier, not the level, for computing value */
   
   int level_for_item(object *op, int difficulty, int retmult)
   {
       int level, mult, olevel;
   
       mult = 0;
       level = spells[op->stats.sp].level;
       if (SP_PARAMETERS[op->stats.sp].ldam != 0)
    mult = SP_PARAMETERS[op->stats.sp].ldam;
       if (SP_PARAMETERS[op->stats.sp].ldur > SP_PARAMETERS[op->stats.sp].ldam &&
    SP_PARAMETERS[op->stats.sp].ldur != 0)
    mult = SP_PARAMETERS[op->stats.sp].ldur;
       if (mult == 0)
    mult = 5;
   
       if (retmult)
    return mult;
   
       if (difficulty * mult > 100)
    difficulty = 100/mult;
       olevel = mult * rndm(1, difficulty);
   
       if (olevel > level)
    return olevel;
       return level;
   }
   
 /*  /*
  * Based upon the specified difficulty and upon the difftomagic_list array,   * Based upon the specified difficulty and upon the difftomagic_list array,
  * a random magical bonus is returned.  This is used when determine   * a random magical bonus is returned.  This is used when determine
Line 702
 
Line 731
 void fix_generated_item (object *op, object *creator, int difficulty,  void fix_generated_item (object *op, object *creator, int difficulty,
                          int max_magic, int flags)                           int max_magic, int flags)
 {  {
     int was_magic = op->magic, num_enchantments=0, save_item_power;      int was_magic = op->magic, num_enchantments=0, save_item_power, mult;
   
     if(!creator||creator->type==op->type) creator=op; /*safety & to prevent polymorphed       if(!creator||creator->type==op->type) creator=op; /*safety & to prevent polymorphed
  * objects giving attributes */    * objects giving attributes */
Line 876
 
Line 905
   
      case WAND:       case WAND:
  do    do
      op->stats.sp=RANDOM()%NROFREALSPELLS;       op->stats.sp=rndm(0, NROFREALSPELLS-1);
  while (!spells[op->stats.sp].charges|| spells[op->stats.sp].level>DICESPELL);   while (!spells[op->stats.sp].charges|| spells[op->stats.sp].level>DICESPELL);
   
  if (spells[op->stats.sp].cleric) {   if (spells[op->stats.sp].cleric) {
Line 887
 
Line 916
      copy_object(&staff_arch->clone, op);       copy_object(&staff_arch->clone, op);
      op->stats.sp = i;       op->stats.sp = i;
  }   }
  op->stats.food=RANDOM()%spells[op->stats.sp].charges+1;   op->stats.food=rndm(1, spells[op->stats.sp].charges);
  op->level = spells[op->stats.sp].level/2+ RANDOM()%difficulty + RANDOM()%difficulty;   op->level = level_for_item(op, difficulty, 0);
  if (op->level<1) op->level=1;   mult = level_for_item(op, difficulty, 1);
  op->value=(op->value*spells[op->stats.sp].level)/ (spells[op->stats.sp].level+4);   op->value += ((op->level - spells[op->stats.sp].level)/mult) *
        (op->value/(20/mult));
  break;   break;
   
      case ROD:       case ROD:
  if (op->stats.maxhp)   if (op->stats.maxhp)
      op->stats.maxhp += RANDOM()%op->stats.maxhp;       op->stats.maxhp += rndm(0, op->stats.maxhp-1);
  op->stats.hp = op->stats.maxhp;   op->stats.hp = op->stats.maxhp;
  do   do
      op->stats.sp = RANDOM()%NROFREALSPELLS;       op->stats.sp = rndm(0, NROFREALSPELLS-1);
  while (!spells[op->stats.sp].charges||   while (!spells[op->stats.sp].charges||
         spells[op->stats.sp].sp > op->stats.maxhp ||          spells[op->stats.sp].sp > op->stats.maxhp ||
         spells[op->stats.sp].level>DICESPELL);          spells[op->stats.sp].level>DICESPELL);
    mult = level_for_item(op, difficulty, 1);
  op->level = spells[op->stats.sp].level/2+ RANDOM()%difficulty + RANDOM()%difficulty;   op->level = level_for_item(op, difficulty, 0);
  op->value=(op->value*op->stats.hp*spells[op->stats.sp].level)/   op->value += ((op->level - spells[op->stats.sp].level)/mult *
      (spells[op->stats.sp].level+4);         op->stats.hp) * (op->value/(20/mult));
  break;   break;
   
      case SCROLL:       case SCROLL:
  do   do
      op->stats.sp=RANDOM()%NROFREALSPELLS;       op->stats.sp=rndm(0, NROFREALSPELLS-1);
  while (!spells[op->stats.sp].scrolls || spells[op->stats.sp].scroll_chance<=RANDOM()%10);   while (!spells[op->stats.sp].scrolls || spells[op->stats.sp].scroll_chance<=RANDOM()%10);
   
  op->nrof=RANDOM()%spells[op->stats.sp].scrolls+1;   op->nrof=rndm(1, spells[op->stats.sp].scrolls);
  op->level = spells[op->stats.sp].level/2+ RANDOM()%difficulty + RANDOM()%difficulty;   mult = level_for_item(op, difficulty, 1);
  if (op->level<1) op->level=1;   op->level = level_for_item(op, difficulty, 0);
  op->value=(op->value*spells[op->stats.sp].level)/ (spells[op->stats.sp].level+4);   op->value += ((op->level - spells[op->stats.sp].level)/mult) *
        (op->value/(20/mult));
   
  /* add exp so reading them properly gives xp */    /* add exp so reading them properly gives xp */
  op->stats.exp = op->value/5;   op->stats.exp = op->value/5;


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

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