Example #1
0
void sword_in_stone()
{
  if (psel("THERE IS A SWORD SET IN STONE HERE\n"
	   "\n"
	   "<- DRAW IT#LEAVE IT ->") == 0)
  {
    if (player->strength < SWORD_IN_STONE_STR)
    {
      draw_board();
      pwait("ALAS, YOU ARE NOT STRONG ENOUGH");
    }
    else
    {
      give_weapon(WPN_RUNESWORD);

      stile(player->y, player->x, TL_VOID);
      stile(player->y - 1, player->x, TL_VOID);
      stile(player->y - 2, player->x, TL_VOID);

      draw_board();
	 
      pwait("YOU DRAW THE SWORD FROM THE STONE\n"
	    "\n"
	    "THIS IS THE FABLED *RUNESWORD* !!!");
    }
  }

  return;
}
void CreatureType::make_creature(Creature& cr) const
{
    cr.type_idname=idname_;
    cr.align=get_alignment();
    cr.age=age_.roll();
    cr.juice=juice_.roll();
    cr.gender_liberal=cr.gender_conservative=roll_gender();
    cr.infiltration=roll_infiltration();
    cr.money=money_.roll();
    strcpy(cr.name,get_encounter_name());
    for(int i=0; i<SKILLNUM; i++) cr.set_skill(i,skills_[i].roll());
    give_armor(cr);
    give_weapon(cr);
}
Example #3
0
/**
   Give the player a random item suitable for the current floor or
   @gold if nothing useful was available.
*/
void give_item(char * msg, int gold, int type)
{
  char line[DEFLEN];

  if (game->weapon == WPN_UNARMED && rand() % 3 == 0)
  {
    give_weapon(WPN_BONECLUB);
    snprintf(line, DEFLEN, "%sYOU FIND A BONE CLUB", msg);
    goto print_msg;
  }

  switch (rand() % 20)
  {
  case 0:
    if (!has_eq(EQ_TORCH))
    {
      give_eq(EQ_TORCH);
      draw_stats();
      snprintf(line, DEFLEN, "%sYOU FIND A TORCH", msg);
      goto print_msg;
    }
    break;

  case 1:
    if (!has_eq(EQ_SHADES))
    {
      give_eq(EQ_SHADES);
      draw_stats();
      snprintf(line, DEFLEN, "%sYOU FIND SOME SHADES\n\nYOU LOOK REALLY COOL NOW", msg);
      goto print_msg;
    }
    break;

  default:
    break;
  }

  game->player_gold += gold;
  game->total_gold_earned += gold;
  draw_stats();
  snprintf(line, DEFLEN, "%sYOU FIND %d GOLD", msg, gold);

print_msg:
  pwait(line);

  return;
}
Example #4
0
int shoot_missile(mob_t * attacker, int dir)
{
  char line[DEFLEN];
  mob_t * target;
  int m_y; int m_x;
  int sc_y; int sc_x;
  int count;
  int m_type;
  int adjust_y;
  int passes;
  int pass;
  int xbow;
  chtype color;
  chtype missile;

//   attacker = &game->mob[mi];

  xbow = false;
  passes = 1;

  adjust_y = water_offset(attacker);
  m_y = attacker->y;
  sc_y = m_y - view_y - 1;

  m_x = attacker->x +
    (attacker->flip ? -attacker->pack_w + 2 : attacker->pack_w - 2) +
    dir * 2;

  if (attacker->type == MOB_EYE)
  {
    m_type = MIS_DISINT;
    sc_y -= 1;
    m_x = attacker->x;
  }
  else if (attacker->type == MOB_LICH)
  {
    m_type = MIS_FIREBALL;
    sc_y -= 1;
  }
  else if (attacker == player)
  {
    if (game->weapon == WPN_BOW)
      m_type = MIS_ARROW;
    else if (game->weapon == WPN_3XBOW)
    {
      xbow = true;
      m_type = MIS_ARROW;

      if (water_offset(attacker))
	passes = 2;
      else
	passes = 3;
    }
    else if (game->weapon == WPN_BLASTER)
    {
      m_type = MIS_BLASTER;
      adjust_y -= 1;
    }
  }
  else
  {
    m_type = MIS_ARROW;
  }

  draw_board();
  
  for (pass = 0; pass < passes; pass++)
  {
    count = 0;
    
    if (xbow)
    {
      m_x = attacker->x +
	(attacker->flip ? -attacker->pack_w + 2 : attacker->pack_w - 2) +
	dir * 2;
      
      if (pass == 0)
	adjust_y = water_offset(attacker) - 1;
      else if (pass == 1)
	adjust_y = water_offset(attacker);
      else if (pass == 2)
	adjust_y = water_offset(attacker) + 1;
    }

    while (1)
    {
      m_x += dir;
      sc_x = m_x - view_x;
      count++;

      if (sc_x < 0 || sc_x >= BOARD_W)
	goto end_pass;//break;//return 0;
      
      target = find_enemy(attacker, m_y, m_x + dir);
      
      if (target == NULL)
      {
	if (game->blinded)
	  continue;
	
	if (m_type != MIS_BLASTER && count % 2 == 1)
	  continue;
	
	// Skip the length of the barrel
	if (m_type == MIS_BLASTER && count < 4)
	  continue;
	
	missile = '?';
	color = COLOR_PAIR(PAIR_GREEN);
	
	if (m_type == MIS_ARROW)
	{
	  missile = '-';
	  color = COLOR_PAIR(PAIR_MAGENTA);
	}
	if (m_type == MIS_BLASTER)
	{
	  missile = '=';
	  color = COLOR_PAIR(PAIR_MAGENTA);
	}
	else if (m_type == MIS_FIREBALL)
	{
	  missile = '*';
	  color = COLOR_PAIR(PAIR_RED);
	}
	else if (m_type == MIS_DISINT)
	{
	  missile = (dir > 0 ? '>' : '<');
	  color = COLOR_PAIR(PAIR_RED);
	}
	
	if (water_join(gtile(m_y - 1, m_x)))
	{
	  color = COLOR_PAIR(PAIR_BLACK_ON_CYAN);
	}
	
	if (m_type == MIS_BLASTER)
	{
	  mvwaddch(board, sc_y + adjust_y, sc_x, '_' | color);
/*	if (count % 2)
	mvwaddch(board, sc_y, sc_x, (dir > 0 ? ')' : '(') | color);
	else
	mvwaddch(board, sc_y - 1, sc_x, (dir > 0 ? ')' : '(') | color);*/
	}
	else
	  mvwaddch(board, sc_y + adjust_y, sc_x, missile | color);
	
	
	wrefresh(board);
	spause();
	
	continue;
      }
      
      if (target->shd_up &&
	  ((!target->flip && dir < 0) ||
	   (target->flip && dir > 0)) )
      {
	if (target == player &&
	    m_type == MIS_DISINT &&
	    target->shd_type != SHD_NONE &&
	    target->shd_type != SHD_MAGIC)
	{
	  flush_input();
	  snprintf(line, DEFLEN,
		   "DISINTEGRATION BEAM!!\n\nYOUR %s\nCRUMBLES TO DUST!",
		   armor_name[target->shd_type]);
	  pwait(line);
	  target->shd_type = SHD_NONE;
	  target->shd_up = false;
	  goto end_pass;//return true;
	}
	
	if (m_type != MIS_BLASTER && shield_block(target))
	{
	  mob_text(target, "BLOCK");
	  damage_shield(target);
	  goto end_pass; //return true;
	}
      }
      
      if (target == player && m_type == MIS_DISINT)
      {
	if (target->armor_type != ARMOR_NONE &&
	    target->armor_type != ARMOR_MAGIC)
	{
	  flush_input();
	  snprintf(line, DEFLEN,
		   "DISINTEGRATION BEAM!!\n\nYOUR %s\nCRUMBLES TO DUST!",
		   armor_name[target->armor_type]);
	  pwait(line);
	  target->armor_type = ARMOR_NONE;
	  goto end_pass;// return true;
	}
	
	if (game->weapon != WPN_UNARMED)
	{
	  flush_input();
	  snprintf(line, DEFLEN,
		   "DISINTEGRATION BEAM!!\n\nYOUR %s\nCRUMBLES TO DUST!",
		   weapon_name[game->weapon]);
	  pwait(line);
	  give_weapon(WPN_UNARMED);
	  goto end_pass; //return true;
	}
      }
      
      damage(attacker, target);
      
      if (m_type == MIS_ARROW)
      {
	target->flags = GFX_HURT;
	draw_board(); lpause();
	target->flags = 0;
      }
      else if (m_type == MIS_BLASTER)
      {
	target->flags = GFX_HURT;
	draw_board(); lpause();
	target->flags = 0;
      }
      else if (m_type == MIS_FIREBALL)
      {
	explosion(sc_y, sc_x + dir);
      }
      
      if (target == player)
      {
	draw_bars();
      }
      
      if (target->hp <= 0)
      {
	if (target == player)
	{
	  snprintf(line, DEFLEN,
		   "YOU WERE %s\n"
		   "BY %s%s",
		   (m_type == MIS_FIREBALL ? "FRIED" :
		    (m_type == MIS_DISINT ? "DISINTEGRATED" : "SHOT")),
		   article[attacker->article],
		   mob_name[attacker->type]);
	  draw_board();
	  game_over(line, false);
	}
	else
	{
	  if (!xbow || pass == passes - 1)
	    kill_enemy(target);

	  goto end_pass;
	}
      }
      else if (target != player)
      {
	enemy_bar = target->index;
	enemy_bar_time = BAR_TIMEOUT;
	draw_bars();
	
	// update the number of eyes it has
	if (target->type == MOB_BIGSPIDER)
	  draw_board();//	  draw_board();
      }

      damage_armor(target);
      goto end_pass;
    }

  end_pass:
    continue;
  }
  
//      return 1;
//    }
    
  return 1;
}