Difference for server/spell_effect.c from version 1.62 to 1.63


version 1.62 version 1.63
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_spell_effect_c =   * static char *rcsid_spell_effect_c =
  *   "$Id: spell_effect.c,v 1.62 2001/09/26 21:34:08 garbled Exp $";   *   "$Id: spell_effect.c,v 1.63 2001/10/15 21:12:08 garbled Exp $";
  */   */
   
   
Line 188
 
Line 188
   new_draw_info_format(NDI_UNIQUE, 0, op,    new_draw_info_format(NDI_UNIQUE, 0, op,
  "The %s glows with power.",query_name(wand));   "The %s glows with power.",query_name(wand));
   
   wand->stats.food += RANDOM()%spells[wand->stats.sp].charges + 1;    wand->stats.food += rndm(1, spells[wand->stats.sp].charges);
   if(wand->arch&&QUERY_FLAG(&wand->arch->clone, FLAG_ANIMATE))    if(wand->arch&&QUERY_FLAG(&wand->arch->clone, FLAG_ANIMATE))
   {    {
     SET_FLAG(wand, FLAG_ANIMATE);      SET_FLAG(wand, FLAG_ANIMATE);
Line 244
 
Line 244
     if (!numat) return; /* no valid matches? if so, return */      if (!numat) return; /* no valid matches? if so, return */
   
     /* Next make a choice, and loop through until we get to it */      /* Next make a choice, and loop through until we get to it */
     choice = RANDOM()%numat;      choice = rndm(0, numat-1);
     for(at = first_archetype ; at != NULL; at = at->next)      for(at = first_archetype ; at != NULL; at = at->next)
  if(QUERY_FLAG((&at->clone),FLAG_MONSTER) == QUERY_FLAG(op, FLAG_MONSTER) &&   if(QUERY_FLAG((&at->clone),FLAG_MONSTER) == QUERY_FLAG(op, FLAG_MONSTER) &&
     at->more == NULL && EDITABLE((&at->clone)))      at->more == NULL && EDITABLE((&at->clone)))
Line 353
 
Line 353
     if (difficulty<0) difficulty=0;      if (difficulty<0) difficulty=0;
     new_ob = get_object();      new_ob = get_object();
     do {      do {
  choice = RANDOM()%numat;   choice = rndm(0, numat-1);
  for(at = first_archetype ; at != NULL; at = at->next) {   for(at = first_archetype ; at != NULL; at = at->next) {
      if(at->clone.type == op->type && !at->clone.invisible &&        if(at->clone.type == op->type && !at->clone.invisible &&
         at->clone.value > 0 && at->clone.value < max_value &&           at->clone.value > 0 && at->clone.value < max_value &&
Line 382
 
Line 382
     if(op->nrof && new_ob->nrof) {      if(op->nrof && new_ob->nrof) {
  new_ob->nrof = op->nrof;   new_ob->nrof = op->nrof;
  /* decrease the number of items */   /* decrease the number of items */
  if (new_ob->nrof>2) new_ob->nrof -= RANDOM() % (op->nrof/2);   if (new_ob->nrof>2) new_ob->nrof -= rndm(0, op->nrof/2-1);
     }      }
   
     /* We don't want rings to keep sustenance/hungry status. There are propably      /* We don't want rings to keep sustenance/hungry status. There are propably
Line 434
 
Line 434
        || QUERY_FLAG(op, FLAG_NO_PASS) || op->type == TREASURE)         || QUERY_FLAG(op, FLAG_NO_PASS) || op->type == TREASURE)
  return;   return;
   
     tmp = RANDOM() % 8;      tmp = rndm(0, 7);
     if (tmp) polymorph_item(who, op);      if (tmp) polymorph_item(who, op);
     else polymorph_melt(who, op);      else polymorph_melt(who, op);
 }  }
Line 695
 
Line 695
   
 int cast_wow(object *op, int dir, int ability, SpellTypeFrom item) {  int cast_wow(object *op, int dir, int ability, SpellTypeFrom item) {
   int sp;    int sp;
   if(!(RANDOM()%4))    if(!rndm(0, 3))
     return cast_cone(op,op,0,10,SP_WOW,spellarch[SP_WOW],0);      return cast_cone(op,op,0,10,SP_WOW,spellarch[SP_WOW],0);
   do    do
     sp=RANDOM()%NROFREALSPELLS;      sp=rndm(0, NROFREALSPELLS-1);
   while (!spells[sp].books);    while (!spells[sp].books);
   return cast_spell(op,op,dir,sp,ability,item,NULL);    return cast_spell(op,op,dir,sp,ability,item,NULL);
 }  }
Line 1234
 
Line 1234
  * a no magic spot.   * a no magic spot.
  */   */
  if(blocked(op->map,op->x+freearr_x[dir]*dist, op->y+freearr_y[dir]*dist)){   if(blocked(op->map,op->x+freearr_x[dir]*dist, op->y+freearr_y[dir]*dist)){
      int x=RANDOM()%MAP_WIDTH(op->map),y=RANDOM()%MAP_HEIGHT(op->map);       int x=rndm(0, MAP_WIDTH(op->map)-1),y=rndm(0, MAP_HEIGHT(op->map)-1);
   
      if(blocked(op->map,x,y) || blocks_magic(op->map,x,y)) {       if(blocked(op->map,x,y) || blocks_magic(op->map,x,y)) {
  new_draw_info(NDI_UNIQUE, 0,op,"You cast your spell, but nothing happens.\n");   new_draw_info(NDI_UNIQUE, 0,op,"You cast your spell, but nothing happens.\n");
Line 1754
 
Line 1754
   level = ((op->head?op->head->level:SK_level(op)) / 4);    level = ((op->head?op->head->level:SK_level(op)) / 4);
   if (level >= MAX_PET_MONSTERS)    if (level >= MAX_PET_MONSTERS)
     level = MAX_PET_MONSTERS - 1;      level = MAX_PET_MONSTERS - 1;
   switch(RANDOM()%3) {    switch(rndm(0, 2)) {
   case 0:    case 0:
     number = priest_num_called[level];      number = priest_num_called[level];
     monster = priest_pet_monsters[level];      monster = priest_pet_monsters[level];
Line 1955
 
Line 1955
  cancellation(tmp);   cancellation(tmp);
   }    }
   else /* Nullify this object. */    else /* Nullify this object. */
     if(FABS(op->magic)<=(RANDOM()%6)) {      if(FABS(op->magic)<=(rndm(0, 5))) {
       op->magic=0;        op->magic=0;
       CLEAR_FLAG(op, FLAG_DAMNED);        CLEAR_FLAG(op, FLAG_DAMNED);
       CLEAR_FLAG(op, FLAG_CURSED);        CLEAR_FLAG(op, FLAG_CURSED);
Line 2087
 
Line 2087
     else      else
  value *= 0.9;   value *= 0.9;
   
     if ((obj->value>0) && RANDOM()%30) {      if ((obj->value>0) && rndm(0, 29)) {
 #ifdef LOSSY_ALCHEMY  #ifdef LOSSY_ALCHEMY
  int tmp = (value % large->value) / small->value;   int tmp = (value % large->value) / small->value;
   
  *large_nuggets += value/ large->value;   *large_nuggets += value/ large->value;
  if (tmp)   if (tmp)
      *small_nuggets += RANDOM() % (tmp + 1);       *small_nuggets += rndm(1, tmp);
 #else  #else
  static int value_store;   static int value_store;
  int count;   int count;
Line 2815
 
Line 2815
  break;   break;
      }       }
      case 2: {       case 2: {
  if(RANDOM()%150 == 0) {   if(rndm(0, 149) == 0) {
      tmp->stats.hp--;  /* weaken the rune */       tmp->stats.hp--;  /* weaken the rune */
      if(!tmp->stats.hp) {       if(!tmp->stats.hp) {
  remove_ob(tmp);   remove_ob(tmp);
Line 2949
 
Line 2949
    
     /* next, randomly select a race from the aligned_races string */      /* next, randomly select a race from the aligned_races string */
     if(racenr>1) {       if(racenr>1) {
  racenr = RANDOM()%racenr;   racenr = rndm(0, racenr-1);
  strcpy(buf,god->race);   strcpy(buf,god->race);
         race = strtok(buf,",");          race = strtok(buf,",");
         for(i=0;i<racenr;i++)           for(i=0;i<racenr;i++)
Line 2985
 
Line 2985
      * a valid entry, assuming nothing is available and quit.       * a valid entry, assuming nothing is available and quit.
      */       */
     if (!mon_nr) return NULL;      if (!mon_nr) return NULL;
     mon_nr = RANDOM() % mon_nr;      mon_nr = rndm(0, mon_nr-1);
     for(tobl=list->member;tobl;tobl=tobl->next) {      for(tobl=list->member;tobl;tobl=tobl->next) {
  otmp=tobl->ob;   otmp=tobl->ob;
  if(!otmp||!QUERY_FLAG(otmp,FLAG_MONSTER)) continue;   if(!otmp||!QUERY_FLAG(otmp,FLAG_MONSTER)) continue;
Line 3078
 
Line 3078
      int ii;       int ii;
   
      for(ii=summon_level-(head->level)-5;ii>0;ii--) {       for(ii=summon_level-(head->level)-5;ii>0;ii--) {
  switch(RANDOM()%3+1) {   switch(rndm(1, 3)) {
      case 1:       case 1:
  head->stats.wc--;   head->stats.wc--;
  break;   break;
Line 3924
 
Line 3924
     if(victim->stats.exp == 0) continue;      if(victim->stats.exp == 0) continue;
     def_lev = MAX(1,victim->level);      def_lev = MAX(1,victim->level);
     atk_lev = MAX(1,op->level);      atk_lev = MAX(1,op->level);
     if(RANDOM() % atk_lev > def_lev) {      if(rndm(0, atk_lev-1) > def_lev) {
   
       /* make this sucker peaceful. */        /* make this sucker peaceful. */
       victim->stats.dam = 0;        victim->stats.dam = 0;


Legend:
line(s) removed in v.1.62 
line(s) changed
 line(s) added in v.1.63

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