Esempio n. 1
0
File: blow.c Progetto: lollek/imoria
void b__chime_and_horn_effects(integer effect, boolean *idented)
{
  /*{ Chimes...				      }*/
  
  boolean          ident;
  integer          y,x;
  integer          i3;

  ident = *idented;

  switch (effect) {
    
  case 1  :  /*{ Chime of Light }*/
    ident = light_area(char_row,char_col);
    break;
    
  case 2  :  /*{ Chime of Detect Doors/Stairs }*/
    ident = detect_sdoor();
    break;
    
  case 3  :  /*{ Chime of Detect Traps }*/
    ident = detect_trap();
    break;
    
  case 4  :  /*{ Chime of Teleportation }*/
    teleport(100);
    ident = true;
    break;
    
  case 5  :  /*{ Chime of Thunderblasts }*/
    ident = earthquake();
    break;
    
  case 6  :  /*{ Chime of Summon Monster }*/
    for (i3 = 1; i3 <= randint(4); i3++) {
      y = char_row;
      x = char_col;
      if (is_in(cave[y][x].fval, water_set)) {
	summon_water_monster(&y,&x,false);
      } else {
	summon_land_monster(&y,&x,false);
      }
    }
    ident = true;
    break;
    
  case 7 :  /*{ Chime of Disarming }*/
    ident = true;
    for (i3 = 1; i3 <= 9; i3++) {
      if (i3 != 5) {
	disarm_all(i3,char_row,char_col);
      }
    }
    break;
    
  case 8 :  /*{ Chime of Aggravation }*/
    ident = aggravate_monster(20);
    break;
    
  case 9 :  /*{ Chime of Slow Monster }*/
    ident = zap_area(0,-1,c_speed);
    break;
    
  case 10 :  /*{ Chime of Sooth Monster }*/
    ident = zap_area(0,0,c_sleep);
    break;
    
  case 11 :  /*{ Chime of Cure Light Wounds }*/
    ident = hp_player(randint(8),"a chime.");
    break;
    
  case 12 :  /*{ Chime of Changing }*/
    ident = mass_poly();
    break;
    
  case 13 :  /*{ Chime of Remove Curse }*/
    if (remove_curse()) {
      msg_print("Your equipment glows blue for a moment...");
      ident = true;
    }
    break;
    
  case 14 :  /*{ Chime of Curing }*/
    //with py.flags do;
    ident  = cure_me(&PF.blind);
    ident |= cure_me(&PF.poisoned);
    ident |= cure_me(&PF.confused);
    break;
    
  case 15 :  /*{ Chime of Dispell Evil }*/
    ident = zap_area(0x0004,60,c_hp);
    break;
    
  case 16 :  /*{ Chime of Darkness }*/
    ident = unlight_area(char_row,char_col);
    break;
    
    /*{ Horns...						      }*/
    
  case 17 :  /*{ Horn of Bubbles }*/
    msg_print("Bubbles stream forth and surround you!");
    py.flags.blind += (randint(20) +5);
    ident = unlight_area(char_row,char_col);
    break;
    
  case 18 :  /*{ Horn of Calling }*/
    for (i3 = 1; i3 <= randint(4); i3++) {
      y = char_row;
      x = char_col;
      if (is_in(cave[y][x].fval, water_set)) {
	summon_water_monster(&y,&x,false);
      } else {
	summon_land_monster(&y,&x,false);
      }
    }
    ident = true;
    break;
    
  case 19 :  /*{ Horn of Soft Sounds }*/
    ident = sleep_monsters1(char_row,char_col);
    break;
    
  case 20 :  /*{ Horn of *Blasting* }*/
    ident = destroy_area(char_row,char_col);
    break;
    
  case 21 :  /*{ Horn of Cold }*/
    msg_print("A wave of cold pours forth...");
    ident = zap_area(0x0010,60,c_hp);
    break;
    
  case 22 :  /*{ Horn of Heat }*/
    msg_print("A blast of warm air pours forth...");
    ident = zap_area(0x0020,60,c_hp);
    break;
    
  case 23 :  /*{ Horn of Gas }*/
    msg_print("Gas streams out ...!");
    ident = zap_area(0x0040,60,c_hp);
    py.flags.poisoned += randint(10);
    break;
    
  case 24 :  /*{ Horn of Recall }*/
    py.flags.word_recall = (randint(20) + 20);
    ident = true;
    break;
    
  case 25 :  /*{ Horn of *Chaos* }*/
    ident = earthquake();
    ident = unlight_area(char_row,char_col);
    for (i3 = 1; i3 <= randint(4); i3++) {
      y = char_row;
      x = char_col;
      if (is_in(cave[y][x].fval, water_set)) {
	summon_water_monster(&y,&x,false);
      } else {
	summon_land_monster(&y,&x,false);
      }
    }
    break;
    
  case 26 :  /*{ Horn of Glue }*/
    msg_print("glue pours out of the horn!");
    msg_print("all of your equipment is stuck!");
    for (i3 = Equipment_primary; i3 <= Equipment_cloak; i3++) {
      //with equipment[i3] do;
      equipment[i3].flags |= 0x80000000;
    }
    //with equipment[Equipment_secondary]. do;
    equipment[Equipment_secondary].flags |= 0x80000000;
    ident = true;
    break;
    
  case 27 :  /*{ Horn of Valhalla }*/
    msg_print("The Voice of Odin (oh brother...) smites evil!");
    ident = zap_area(0x0004,70,c_hp);
    light_area(char_row,char_col);
    hp_player(randint(20)+20,"a horn.");
    break;
    
  case 28 :  /*{ Horn of Tritons }*/
    //with py.flags do;
    ident = true;
    msg_print("All of the seas of the world still (yeah, right)!");
    msg_print("The gods of the ocean hear you..."	 );
    PF.blessed += randint(20);
    cure_me(&PF.blind);
    cure_me(&PF.poisoned);
    break;
    
  case 29 :  /*{ Horn of Fog }*/
    msg_print("Thick fog billows out...");
    ident = unlight_area(char_row,char_col);
    msg_print("The nearby creatures are confused");
    ident = zap_area(0,0,c_confuse);
    break;
    
  default:
    break;
  }

  *idented = ident;
  
};
Esempio n. 2
0
/* Use a staff.					-RAK-	*/
void use()
{
  int32u i;
  int j, k, item_val, chance, y, x;
  register int ident;
  register struct misc *m_ptr;
  register inven_type *i_ptr;

  free_turn_flag = TRUE;
  if (inven_ctr == 0)
    msg_print("But you are not carrying anything.");
  else if (!find_range(TV_STAFF, TV_NEVER, &j, &k))
    msg_print("You are not carrying any staffs.");
  else if (get_item(&item_val, "Use which staff?", j, k, CNIL, CNIL))
    {
      i_ptr = &inventory[item_val];
      free_turn_flag = FALSE;
      m_ptr = &py.misc;
      chance = m_ptr->save + stat_adj(A_INT) - (int)i_ptr->level - 5
	+ (class_level_adj[m_ptr->pclass][CLA_DEVICE] * m_ptr->lev / 3);
      if (py.flags.confused > 0)
	chance = chance / 2;
      if ((chance < USE_DEVICE) && (randint(USE_DEVICE - chance + 1) == 1))
	chance = USE_DEVICE; /* Give everyone a slight chance */
      if (chance <= 0)	chance = 1;
      if (randint(chance) < USE_DEVICE)
	msg_print("You failed to use the staff properly.");
      else if (i_ptr->p1 > 0)
	{
	  i = i_ptr->flags;
	  ident = FALSE;
	  (i_ptr->p1)--;
	  while (i != 0)
	    {
	      j = bit_pos(&i) + 1;
	      /* Staffs.				*/
	      switch(j)
		{
		case 1:
		  ident = light_area(char_row, char_col);
		  break;
		case 2:
		  ident = detect_sdoor();
		  break;
		case 3:
		  ident = detect_trap();
		  break;
		case 4:
		  ident = detect_treasure();
		  break;
		case 5:
		  ident = detect_object();
		  break;
		case 6:
		  teleport(100);
		  ident = TRUE;
		  break;
		case 7:
		  ident = TRUE;
		  earthquake();
		  break;
		case 8:
		  ident = FALSE;
		  for (k = 0; k < randint(4); k++)
		    {
		      y = char_row;
		      x = char_col;
		      ident |= summon_monster(&y, &x, FALSE);
		    }
		  break;
		case 10:
		  ident = TRUE;
		  destroy_area(char_row, char_col);
		  break;
		case 11:
		  ident = TRUE;
		  starlite(char_row, char_col);
		  break;
		case 12:
		  ident = speed_monsters(1);
		  break;
		case 13:
		  ident = speed_monsters(-1);
		  break;
		case 14:
		  ident = sleep_monsters2();
		  break;
		case 15:
		  ident = hp_player(randint(8));
		  break;
		case 16:
		  ident = detect_invisible();
		  break;
		case 17:
		  if (py.flags.fast == 0)
		    ident = TRUE;
		  py.flags.fast += randint(30) + 15;
		  break;
		case 18:
		  if (py.flags.slow == 0)
		    ident = TRUE;
		  py.flags.slow += randint(30) + 15;
		  break;
		case 19:
		  ident = mass_poly();
		  break;
		case 20:
		  if (remove_curse())
		    {
		      if (py.flags.blind < 1)
			msg_print("The staff glows blue for a moment..");
		      ident = TRUE;
		    }
		  break;
		case 21:
		  ident = detect_evil();
		  break;
		case 22:
		  if ((cure_blindness()) || (cure_poison()) ||
		      (cure_confusion()))
		    ident = TRUE;
		  break;
		case 23:
		  ident = dispel_creature(CD_EVIL, 60);
		  break;
		case 25:
		  ident = unlight_area(char_row, char_col);
		  break;
		case 32:
		  /* store bought flag */
		  break;
		default:
		  msg_print("Internal error in staffs()");
		  break;
		}
	      /* End of staff actions.		*/
	    }
	  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];
		}
	    }