Пример #1
0
/*
 * Hack -- quick debugging hook
 */
static void do_cmd_wiz_hack_ben(void)
{
	int py = p_ptr->py;
	int px = p_ptr->px;

	int i, y, x;


	for (i = 0; i < MONSTER_FLOW_DEPTH; ++i)
	{
		/* Update map */
		for (y = Term->offset_y; y < Term->offset_y + SCREEN_HGT; y++)
		{
			for (x = Term->offset_x; x < Term->offset_x + SCREEN_WID; x++)
			{
				byte a = TERM_RED;

				if (!in_bounds_fully(y, x)) continue;

				/* Display proper cost */
				if (cave_cost[y][x] != i) continue;

				/* Reliability in yellow */
				if (cave_when[y][x] == cave_when[py][px])
				{
					a = TERM_YELLOW;
				}

				/* Display player/floors/walls */
				if ((y == py) && (x == px))
				{
					print_rel('@', a, y, x);
				}
				else if (cave_floor_bold(y, x))
				{
					print_rel('*', a, y, x);
				}
				else
				{
					print_rel('#', a, y, x);
				}
			}
		}

		/* Prompt */
		prt(format("Depth %d: ", i), 0, 0);

		/* Get key */
		if (inkey() == ESCAPE) break;

		/* Redraw map */
		prt_map();
	}

	/* Done */
	prt("", 0, 0);

	/* Redraw map */
	prt_map();
}
Пример #2
0
void display_light_map(void)
{	
	int y, x;
	
	/* Redraw map */
	prt_map();

	/* Update map */
	for (y = p_ptr->wy; y < p_ptr->wy + SCREEN_HGT; y++)
	{
		for (x = p_ptr->wx; x < p_ptr->wx + SCREEN_WID; x++)
		{
			byte a;
			
			int light = cave_light[y][x];
			
			/* Pretty colors by level */
			if (light < 0) a = TERM_L_DARK;
			else if (light == 0) a = TERM_SLATE;
			else a = TERM_WHITE;
			
			/* Display light */
			if (light >= 0)
			{
				print_rel('0' + (light % 10), a, y, x);
			}
			else
			{
				print_rel('0' + (-light % 10), a, y, x);
			}
		}
	}
}			
Пример #3
0
void display_scent_map(void)
{
	int y, x;
	byte a;
	int age;

	/* Redraw map */
	prt_map();

	/* Update map */
	for (y = p_ptr->wy; y < p_ptr->wy + SCREEN_HGT; y++)
	{
		for (x = p_ptr->wx; x < p_ptr->wx + SCREEN_WID; x++)
		{
			age = get_scent(y, x);
			
			/* Must have scent */
			if (age == -1) continue;
			
			/* Pretty colors by age */
			if (age < 10) a = TERM_RED;
			else if (age < 20) a = TERM_L_RED;
			else if (age < 30) a = TERM_ORANGE;
			else if (age < 40) a = TERM_YELLOW;
			else if (age < 50) a = TERM_L_GREEN;
			else if (age < 60) a = TERM_GREEN;
			else if (age < 70) a = TERM_L_BLUE;
			else a = TERM_BLUE;
			
			/* Display player/floors/walls */
			if ((y == p_ptr->py) && (x == p_ptr->px))
			{
				// do nothing
			}
			// ignore closed doors
			else if (cave_any_closed_door_bold(y,x))
			{
				// do nothing
			}
			// ignore visible monsters
			else if ((cave_m_idx[y][x] > 0) && (&mon_list[cave_m_idx[y][x]])->ml)
			{
				// do nothing
			}
			else
			{
				print_rel('0' + (age % 10), a, y, x);
			}
		}
	}
}
Пример #4
0
/*
 * Query the dungeon
 */
static void do_cmd_wiz_query(void)
{
	int py = p_ptr->py;
	int px = p_ptr->px;

	int y, x;

	struct keypress cmd;

	u16b mask = 0x00;


	/* Get a "debug command" */
	if (!get_com("Debug Command Query: ", &cmd)) return;

	/* Extract a flag */
	switch (cmd.code)
	{
		case '0': mask = (1 << 0); break;
		case '1': mask = (1 << 1); break;
		case '2': mask = (1 << 2); break;
		case '3': mask = (1 << 3); break;
		case '4': mask = (1 << 4); break;
		case '5': mask = (1 << 5); break;
		case '6': mask = (1 << 6); break;
		case '7': mask = (1 << 7); break;

		case 'm': mask |= (CAVE_MARK); break;
		case 'g': mask |= (CAVE_GLOW); break;
		case 'r': mask |= (CAVE_ROOM); break;
		case 'i': mask |= (CAVE_ICKY); break;
		case 's': mask |= (CAVE_SEEN); break;
		case 'v': mask |= (CAVE_VIEW); break;
		case 't': mask |= (CAVE_TEMP); break;
		case 'w': mask |= (CAVE_WALL); break;
	}

	/* Scan map */
	for (y = Term->offset_y; y < Term->offset_y + SCREEN_HGT; y++)
	{
		for (x = Term->offset_x; x < Term->offset_x + SCREEN_WID; x++)
		{
			byte a = TERM_RED;

			if (!in_bounds_fully(y, x)) continue;

			/* Given mask, show only those grids */
			if (mask && !(cave->info[y][x] & mask)) continue;

			/* Given no mask, show unknown grids */
			if (!mask && (cave->info[y][x] & (CAVE_MARK))) continue;

			/* Color */
			if (cave_floor_bold(y, x)) a = TERM_YELLOW;

			/* Display player/floors/walls */
			if ((y == py) && (x == px))
				print_rel(L'@', a, y, x);
			else if (cave_floor_bold(y, x))
				print_rel(L'*', a, y, x);
			else
				print_rel(L'#', a, y, x);
		}
	}

	/* Get keypress */
	msg("Press any key.");
	message_flush();

	/* Redraw map */
	prt_map();
}
Пример #5
0
void display_noise_map(void)
{
	int y, x;
	byte a = TERM_DARK; // default to soothe compilation warnings
	int dist;
    int d;
    
	/* Redraw map */
	prt_map();
		
	/* Update map */
	for (y = p_ptr->wy; y < p_ptr->wy + SCREEN_HGT; y++)
	{
		for (x = p_ptr->wx; x < p_ptr->wx + SCREEN_WID; x++)
		{
            if (!in_bounds(y,x)) continue;
            
            // default to player noise (i.e. the distance from the player in terms of how much sound decays)
			dist = flow_dist(FLOW_PLAYER_NOISE, y, x);
            
            // if a monster is targetted, then use a monster relevant flow
            if (p_ptr->health_who > 0)
            {
                monster_type *m_ptr = &mon_list[p_ptr->health_who];
                
                // if it is unwary, use its distance in turns to its wandering monster destination
                if (m_ptr->alertness < ALERTNESS_ALERT)     dist = flow_dist(m_ptr->wandering_idx, y, x);
                
                // otherwise, use its distance in turns to the player
                else                                        dist = flow_dist(p_ptr->health_who, y, x);
            }

            if (dist <= 0) continue;
            
            d = (dist % 100) / 10;
            
            switch (d)
            {
                case 0: a = TERM_RED;                   break;
                case 1: a = TERM_RED + TERM_SHADE;      break;
                case 2: a = TERM_ORANGE;                break;
                case 3: a = TERM_YELLOW;                break;
                case 4: a = TERM_L_GREEN;               break;
                case 5: a = TERM_GREEN;                 break;
                case 6: a = TERM_L_BLUE;                break;
                case 7: a = TERM_BLUE + TERM_SHADE;     break;
                case 8: a = TERM_BLUE;                  break;
                case 9: a = TERM_VIOLET + TERM_SHADE;   break;
            }
			
			if (dist < FLOW_MAX_DIST)
			{
				/* Display player/floors/walls */
				if ((y == p_ptr->py) && (x == p_ptr->px))
				{
					// do nothing
				}
				// ignore closed doors
				else if (cave_any_closed_door_bold(y,x))
				{
					// do nothing
				}
				// ignore visible monsters
				else if ((cave_m_idx[y][x] > 0) && (&mon_list[cave_m_idx[y][x]])->ml)
				{
					// do nothing
				}
				else
				{
					print_rel('0' + (dist % 10), a, y, x);
				}
			}
		}
	}
}
Пример #6
0
/**
 * Debug scent trails and noise bursts.
 */
static void do_cmd_wiz_hack_ben(void)
{
	struct keypress cmd;

	int py = p_ptr->py;
	int px = p_ptr->px;

	int i, y, x, y2, x2;

	/* Get a "debug command" */
	if (!get_com("Press 'S' for scent, 'N' for noise info: ", &cmd))
		return;


	/* Analyze the command */
	switch (cmd.code) {
	case 'S':
	case 's':
		{
			/* Update map */
			for (y = Term->offset_y; y <= Term->offset_y + SCREEN_HGT; y++) {
				for (x = Term->offset_x; x <= Term->offset_x + SCREEN_WID;
					 x++) {
					byte a;

					int age = get_scent(y, x);

					/* Must have scent */
					if (age == -1)
						continue;

					/* Pretty colors by age */
					if (age > SMELL_STRENGTH)
						a = TERM_L_DARK;

					else if (age < 10)
						a = TERM_BLUE;
					else if (age < 20)
						a = TERM_L_BLUE;
					else if (age < 30)
						a = TERM_GREEN;
					else if (age < 40)
						a = TERM_L_GREEN;
					else if (age < 50)
						a = TERM_YELLOW;
					else if (age < 60)
						a = TERM_ORANGE;
					else if (age < 70)
						a = TERM_L_RED;
					else
						a = TERM_RED;


					/* Display player/floors/walls */
					if ((y == py) && (x == px)) {
						print_rel('@', a, y, x);
					} else {
						print_rel('0' + (age % 10), a, y, x);
					}
				}
			}

			/* Prompt */
			prt("Scent ages", 0, 0);

			/* Wait for a keypress */
			(void) inkey();

			/* Redraw map */
			prt_map();

			break;

		}

	case 'N':
	case 'n':
		{

			/* Get a "debug command" */
			if (!get_com
				("Press 'D' for direction of flow, 'C' for actual cost values: ",
				 &cmd))
				return;

			if ((cmd.code == 'D') || (cmd.code == 'd')) {
				/* Update map */
				for (y = Term->offset_y; y <= Term->offset_y + SCREEN_HGT;
					 y++) {
					for (x = Term->offset_x;
						 x <= Term->offset_x + SCREEN_WID; x++) {
						int lowest_cost = cave_cost[y][x];
						int dir = -1;
						int cost;

						if (lowest_cost == 0)
							continue;

						for (i = 0; i < 8; i++) {
							/* Get the location */
							y2 = y + ddy_ddd[i];
							x2 = x + ddx_ddd[i];

							cost = cave_cost[y2][x2];
							if (!cost)
								continue;

							/* If this grid's scent is younger, save it */
							if (lowest_cost > cost)
								lowest_cost = cost;

							/* If it isn't, look elsewhere */
							else
								continue;

							/* Save this direction */
							dir = i;
						}

						/* If we didn't find any younger scent, print a '5' */
						if (dir == -1)
							print_rel('5', TERM_YELLOW, y, x);

						/* Otherwise, convert to true direction and print */
						else {
							i = ddd[dir];
							print_rel('0' + i, TERM_L_BLUE, y, x);
						}
					}
				}

				/* Prompt */
				prt("Directions given to advancing monsters using noise info", 0, 0);

				/* Wait for a keypress */
				(void) inkey();

				/* Redraw map */
				prt_map();
			}

			/* Actual cost values */
			else {
				int j;
				struct keypress key;

				for (i = cost_at_center - 2; i <= 100 + NOISE_STRENGTH;
					 ++i) {
					/* First show grids with no scent */
					if (i == cost_at_center - 2)
						j = 0;

					/* Then show specially marked grids (bug-checking) */
					else if (i == cost_at_center - 1)
						j = 255;

					/* Then show standard grids */
					else
						j = i;

					/* Update map */
					for (y = Term->offset_y;
						 y <= Term->offset_y + SCREEN_HGT; y++) {
						for (x = Term->offset_x;
							 x <= Term->offset_x + SCREEN_WID; x++) {
							byte a = TERM_YELLOW;
							feature_type *f_ptr = &f_info[cave_feat[y][x]];

							/* Display proper cost */
							if (cave_cost[y][x] != j)
								continue;

							/* Display player/floors/walls */
							if ((y == py) && (x == px)) {
								print_rel('@', a, y, x);
							} else if (!tf_has(f_ptr->flags, TF_NO_SCENT)) {
								print_rel('*', a, y, x);
							} else {
								print_rel('#', a, y, x);
							}
						}
					}

					/* Prompt */
					if (j == 0) {
						prt("Grids with no scent", 0, 0);
					} else if (j == 255) {
						prt("Specially marked grids", 0, 0);
					} else {
						prt(format("Depth %d: ", j), 0, 0);
					}

					/* Get key */
					key = inkey();
					if (key.code == ESCAPE)
						break;

					/* Redraw map */
					prt_map();
				}
			}

			break;
		}

	default:
		{
			break;
		}
	}

	/* Done */
	prt("", 0, 0);

	/* Redraw map */
	prt_map();
}
Пример #7
0
/* Scrolls for the reading				-RAK-	*/
void read_scroll()
{
  int32u i;
  int j, k, item_val, y, x;
  int tmp[6], flag, used_up;
  bigvtype out_val, tmp_str;
  register int ident, l;
  register inven_type *i_ptr;
  register struct misc *m_ptr;

  free_turn_flag = TRUE;
  if (py.flags.blind > 0)
    msg_print("You can't see to read the scroll.");
  else if (no_light())
    msg_print("You have no light to read by.");
  else if (py.flags.confused > 0)
    msg_print("You are too confused to read a scroll.");
  else if (inven_ctr == 0)
    msg_print("You are not carrying anything!");
  else if (!find_range(TV_SCROLL1, TV_SCROLL2, &j, &k))
    msg_print ("You are not carrying any scrolls!");
  else if (get_item(&item_val, "Read which scroll?", j, k, 0))
    {
      i_ptr = &inventory[item_val];
      free_turn_flag = FALSE;
      used_up = TRUE;
      i = i_ptr->flags;
      ident = FALSE;

      while (i != 0)
	{
	  j = bit_pos(&i) + 1;
	  if (i_ptr->tval == TV_SCROLL2)
	    j += 32;

	  /* Scrolls.			*/
	  switch(j)
	    {
	    case 1:
	      i_ptr = &inventory[INVEN_WIELD];
	      if (i_ptr->tval != TV_NOTHING)
		{
		  objdes(tmp_str, i_ptr, FALSE);
		  (void) sprintf(out_val, "Your %s glows faintly!", tmp_str);
		  msg_print(out_val);
		  if (enchant(&i_ptr->tohit))
		    {
		      i_ptr->flags &= ~TR_CURSED;
		      calc_bonuses();
		    }
		  else
		    msg_print("The enchantment fails.");
		  ident = TRUE;
		}
	      break;
	    case 2:
	      i_ptr = &inventory[INVEN_WIELD];
	      if (i_ptr->tval != TV_NOTHING)
		{
		  objdes(tmp_str, i_ptr, FALSE);
		  (void) sprintf(out_val, "Your %s glows faintly!", tmp_str);
		  msg_print(out_val);
		  if (enchant(&i_ptr->todam))
		    {
		      i_ptr->flags &= ~TR_CURSED;
		      calc_bonuses ();
		    }
		  else
		    msg_print("The enchantment fails.");
		  ident = TRUE;
		}
	      break;
	    case 3:
	      k = 0;
	      l = 0;
	      if (inventory[INVEN_BODY].tval != TV_NOTHING)
		tmp[k++] = INVEN_BODY;
	      if (inventory[INVEN_ARM].tval != TV_NOTHING)
		tmp[k++] = INVEN_ARM;
	      if (inventory[INVEN_OUTER].tval != TV_NOTHING)
		tmp[k++] = INVEN_OUTER;
	      if (inventory[INVEN_HANDS].tval != TV_NOTHING)
		tmp[k++] = INVEN_HANDS;
	      if (inventory[INVEN_HEAD].tval != TV_NOTHING)
		tmp[k++] = INVEN_HEAD;
	      /* also enchant boots */
	      if (inventory[INVEN_FEET].tval != TV_NOTHING)
		tmp[k++] = INVEN_FEET;

	      if (k > 0)  l = tmp[randint(k)-1];
	      if (TR_CURSED & inventory[INVEN_BODY].flags)
		l = INVEN_BODY;
	      else if (TR_CURSED & inventory[INVEN_ARM].flags)
		l = INVEN_ARM;
	      else if (TR_CURSED & inventory[INVEN_OUTER].flags)
		l = INVEN_OUTER;
	      else if (TR_CURSED & inventory[INVEN_HEAD].flags)
		l = INVEN_HEAD;
	      else if (TR_CURSED & inventory[INVEN_HANDS].flags)
		l = INVEN_HANDS;
	      else if (TR_CURSED & inventory[INVEN_FEET].flags)
		l = INVEN_FEET;

	      if (l > 0)
		{
		  i_ptr = &inventory[l];
		  objdes(tmp_str, i_ptr, FALSE);
		  (void) sprintf(out_val, "Your %s glows faintly!", tmp_str);
		  msg_print(out_val);
		  if (enchant(&i_ptr->toac))
		    {
		      i_ptr->flags &= ~TR_CURSED;
		      calc_bonuses ();
		    }
		  else
		    msg_print("The enchantment fails.");
		  ident = TRUE;
		}
	      break;
	    case 4:
	      msg_print("This is an identify scroll.");
	      ident = TRUE;
	      used_up = ident_spell();

	      /* the identify may merge objects, causing the identify scroll
		 to move to a different place.	Check for that here. */
	      if (i_ptr->tval != TV_SCROLL1 || i_ptr->flags != 0x00000008)
		{
		  item_val--;
		  i_ptr = &inventory[item_val];
		  if (i_ptr->tval != TV_SCROLL1 || i_ptr->flags != 0x00000008)
		    {
		      msg_print("internal error with identify spell.");
		      msg_print("Please tell the wizard!");
		      return;
		    }
		}
	      break;
	    case 5:
	      if (remove_curse())
		{
		  msg_print("You feel as if someone is watching over you.");
		  ident = TRUE;
		}
	      break;
	    case 6:
	      ident = light_area(char_row, char_col);
	      break;
	    case 7:
	      for (k = 0; k < randint(3); k++)
		{
		  y = char_row;
		  x = char_col;
		  ident |= summon_monster(&y, &x, FALSE);
		}
	      break;
	    case 8:
	      teleport(10);
	      ident = TRUE;
	      break;
	    case 9:
	      teleport(100);
	      ident = TRUE;
	      break;
	    case 10:
	      (void) tele_level();
	      ident = TRUE;
	      break;
	    case 11:
	      if (py.flags.confuse_monster == 0)
		{
		  msg_print("Your hands begin to glow.");
		  py.flags.confuse_monster = TRUE;
		  ident = TRUE;
		}
	      break;
	    case 12:
	      ident = TRUE;
	      map_area();
	      break;
	    case 13:
	      ident = sleep_monsters1(char_row, char_col);
	      break;
	    case 14:
	      ident = TRUE;
	      warding_glyph();
	      break;
	    case 15:
	      ident = detect_treasure();
	      break;
	    case 16:
	      ident = detect_object();
	      break;
	    case 17:
	      ident = detect_trap();
	      break;
	    case 18:
	      ident = detect_sdoor();
	      break;
	    case 19:
	      msg_print("This is a mass genocide scroll.");
	      ident = mass_genocide(TRUE);
	      break;
	    case 20:
	      ident = detect_invisible();
	      break;
	    case 21:
	      ident = aggravate_monster(20);
	      if (ident)
		msg_print("There is a high pitched humming noise.");
	      break;
	    case 22:
	      ident = trap_creation();
	      break;
	    case 23:
	      ident = td_destroy();
	      break;
	    case 24:  /* Not Used , used to be door creation */
	      break;
	    case 25:
	      msg_print("This is a Recharge-Item scroll.");
	      ident = TRUE;
	      used_up = recharge(60);
	      break;
	    case 26:
	      msg_print("This is a genocide scroll.");
	      ident = genocide(TRUE);
	      break;
	    case 27:
	      ident = unlight_area(char_row, char_col);
	      break;
	    case 28:
	      ident = protect_evil();
	      break;
	    case 29:
	      ident = TRUE;
	      create_food();
	      break;
	    case 30:
	      ident = dispel_creature(UNDEAD, 60);
	      break;
	    case 31:
	      remove_all_curse();
	      ident = TRUE;
	      break;
	    case 33:
	      i_ptr = &inventory[INVEN_WIELD];
	      if (i_ptr->tval != TV_NOTHING)
		{
		  objdes(tmp_str, i_ptr, FALSE);
		  (void) sprintf(out_val, "Your %s glows brightly!", tmp_str);
		  msg_print(out_val);
		  flag = FALSE;
		  for (k = 0; k < randint(2); k++)
		    if (enchant(&i_ptr->tohit))
		      flag = TRUE;
		  for (k = 0; k < randint(2); k++)
		    if (enchant(&i_ptr->todam))
		      flag = TRUE;
		  if (flag)
		    {
		      i_ptr->flags &= ~TR_CURSED;
		      calc_bonuses ();
		    }
		  else
		    msg_print("The enchantment fails.");
		  ident = TRUE;
		}
	      break;
	    case 34:
	      i_ptr = &inventory[INVEN_WIELD];
	      if (i_ptr->tval != TV_NOTHING)
		{
		  objdes(tmp_str, i_ptr, FALSE);
		  (void)sprintf(out_val,"Your %s glows black, fades.",tmp_str);
		  msg_print(out_val);
		  unmagic_name(i_ptr);
		  i_ptr->tohit = -randint(5) - randint(5);
		  i_ptr->todam = -randint(5) - randint(5);
		  i_ptr->flags = TR_CURSED;
		  py_bonuses(i_ptr, -1);
		  calc_bonuses ();
		  ident = TRUE;
		}
	      break;
	    case 35:
	      k = 0;
	      l = 0;
	      if (inventory[INVEN_BODY].tval != TV_NOTHING)
		tmp[k++] = INVEN_BODY;
	      if (inventory[INVEN_ARM].tval != TV_NOTHING)
		tmp[k++] = INVEN_ARM;
	      if (inventory[INVEN_OUTER].tval != TV_NOTHING)
		tmp[k++] = INVEN_OUTER;
	      if (inventory[INVEN_HANDS].tval != TV_NOTHING)
		tmp[k++] = INVEN_HANDS;
	      if (inventory[INVEN_HEAD].tval != TV_NOTHING)
		tmp[k++] = INVEN_HEAD;
	      /* also enchant boots */
	      if (inventory[INVEN_FEET].tval != TV_NOTHING)
		tmp[k++] = INVEN_FEET;

	      if (k > 0)  l = tmp[randint(k)-1];
	      if (TR_CURSED & inventory[INVEN_BODY].flags)
		l = INVEN_BODY;
	      else if (TR_CURSED & inventory[INVEN_ARM].flags)
		l = INVEN_ARM;
	      else if (TR_CURSED & inventory[INVEN_OUTER].flags)
		l = INVEN_OUTER;
	      else if (TR_CURSED & inventory[INVEN_HEAD].flags)
		l = INVEN_HEAD;
	      else if (TR_CURSED & inventory[INVEN_HANDS].flags)
		l = INVEN_HANDS;
	      else if (TR_CURSED & inventory[INVEN_FEET].flags)
		l = INVEN_FEET;

	      if (l > 0)
		{
		  i_ptr = &inventory[l];
		  objdes(tmp_str, i_ptr, FALSE);
		  (void) sprintf(out_val,"Your %s glows brightly!", tmp_str);
		  msg_print(out_val);
		  flag = FALSE;
		  for (k = 0; k < randint(2) + 1; k++)
		    if (enchant(&i_ptr->toac))
		      flag = TRUE;
		  if (flag)
		    {
		      i_ptr->flags &= ~TR_CURSED;
		      calc_bonuses ();
		    }
		  else
		    msg_print("The enchantment fails.");
		  ident = TRUE;
		}
	      break;
	    case 36:
	      if ((inventory[INVEN_BODY].tval != TV_NOTHING)
		  && (randint(4) == 1))
		k = INVEN_BODY;
	      else if ((inventory[INVEN_ARM].tval != TV_NOTHING)
		       && (randint(3) ==1))
		k = INVEN_ARM;
	      else if ((inventory[INVEN_OUTER].tval != TV_NOTHING)
		       && (randint(3) ==1))
		k = INVEN_OUTER;
	      else if ((inventory[INVEN_HEAD].tval != TV_NOTHING)
		       && (randint(3) ==1))
		k = INVEN_HEAD;
	      else if ((inventory[INVEN_HANDS].tval != TV_NOTHING)
		       && (randint(3) ==1))
		k = INVEN_HANDS;
	      else if ((inventory[INVEN_FEET].tval != TV_NOTHING)
		       && (randint(3) ==1))
		k = INVEN_FEET;
	      else if (inventory[INVEN_BODY].tval != TV_NOTHING)
		k = INVEN_BODY;
	      else if (inventory[INVEN_ARM].tval != TV_NOTHING)
		k = INVEN_ARM;
	      else if (inventory[INVEN_OUTER].tval != TV_NOTHING)
		k = INVEN_OUTER;
	      else if (inventory[INVEN_HEAD].tval != TV_NOTHING)
		k = INVEN_HEAD;
	      else if (inventory[INVEN_HANDS].tval != TV_NOTHING)
		k = INVEN_HANDS;
	      else if (inventory[INVEN_FEET].tval != TV_NOTHING)
		k = INVEN_FEET;
	      else
		k = 0;

	      if (k > 0)
		{
		  i_ptr = &inventory[k];
		  objdes(tmp_str, i_ptr, FALSE);
		  (void)sprintf(out_val,"Your %s glows black, fades.",tmp_str);
		  msg_print(out_val);
		  unmagic_name(i_ptr);
		  i_ptr->flags = TR_CURSED;
		  i_ptr->toac = -randint(5) - randint(5);
		  calc_bonuses ();
		  ident = TRUE;
		}
	      break;
	    case 37:
	      ident = FALSE;
	      for (k = 0; k < randint(3); k++)
		{
		  y = char_row;
		  x = char_col;
		  ident |= summon_undead(&y, &x);
		}
	      break;
	    case 38:
	      ident = TRUE;
	      bless(randint(12)+6);
	      break;
	    case 39:
	      ident = TRUE;
	      bless(randint(24)+12);
	      break;
	    case 40:
	      ident = TRUE;
	      bless(randint(48)+24);
	      break;
	    case 41:
	      ident = TRUE;
	      if (py.flags.word_recall == 0)
		py.flags.word_recall = 25 + randint(30);
	      msg_print("The air about you becomes charged.");
	      break;
	    case 42:
	      destroy_area(char_row, char_col);
	      ident = TRUE;
	      break;
	    case 43:
	      place_special(char_row, char_col, SPECIAL);
	      prt_map();
	      break;
	    case 44:
	      special_random_object(char_row, char_col, 1);
	      prt_map();
	      break;
	    default:
	      msg_print("Internal error in scroll()");
	      break;
	    }
	  /* End of Scrolls.			       */
	}
      i_ptr = &inventory[item_val];
      if (ident)
	{
	  if (!known1_p(i_ptr))
	    {
	      m_ptr = &py.misc;
	      /* round half-way case up */
	      m_ptr->exp += (i_ptr->level +(m_ptr->lev >> 1)) / m_ptr->lev;
	      prt_experience();

	      identify(&item_val);
	      i_ptr = &inventory[item_val];
	    }
	}