Example #1
0
void show_screen() {
  graphmode();
  show_map();
  show_sm_map();
  show_side();
  show_player();
  show_messages();
  }
	void shooting(square& another)
	{
		if ((sf::Keyboard::isKeyPressed(sf::Keyboard::R) && (show_wing() == wing::left)) ||
			(sf::Keyboard::isKeyPressed(sf::Keyboard::P) && (show_wing() == wing::right)))
		{
			if (!dressing)
			{
				sf::Vector2f shot_speed{m_shot_speed};
				
				if (another.m_posit.x < m_posit.x)
				{
					shot_speed = -m_shot_speed;
				}
				
				const shot fired{show_side(), show_posit(), shot_speed, show_color()};	
				m_shots.push_back(fired);
				dressing = true;
			}
		}
		else if (dressing)
		{
			dressing = false;
		}
	}
Example #3
0
void area25(int damage) {
  int  x,y;
  int  x1,y1;
  int  mon;
  int  i;
  x1 = player.x; y1 = player.y;
  if (x1<2) x1=2; else if (x1>98) x1 = 98;
  if (y1<2) y1=2; else if (y1>98) y1 = 98;
  for (x=x1-2; x<=x1+2; x++)
    for (y=y1-2; y<=y1+2; y++)
      if (player.map[x][y] < 0 || (player.map[x][y]>400 && player.map[x][y]<500)) {
        if (in_arena == 'Y') mon = player.map[x][y] - 400;
          else mon = player.map[x][y];
        i = 90;
        if (in_arena == 'Y' && player.monster[mon][a_mon].special == 1) i = 0;
        if (in_arena != 'Y' && player.monster[1][mon].special == 1) i = 0;
        if (u_random(100) < i) {
          clear_prompt();
          noise(1000,100);
          prompt("HIT !!!");
          if (in_arena != 'Y' && player.monster[1][mon].special > 9) {
            player.align -= 20;
            player.monster[1][mon].special -= 10;
            if (player.align < 0) player.align = 0;
            }
          if (in_arena == 'Y' && player.monster[mon][a_mon].special > 9) {
            player.align -= 20;
            player.monster[mon][a_mon].special -= 10;
            if (player.align < 0) player.align = 0;
            }
          if (in_sight(x,y) == '*') {
            show_sprite(x-player.map_x,y-player.map_y,80);
            delay(250);
            show_spot(x,y);
            }
          i = u_random(damage) + 1;
          if (in_arena == 'Y') player.monster[mon][a_mon].hp -= i;
            else player.monster[1][mon].hp -= i;
          if (in_arena == 'Y') i=player.monster[mon][a_mon].hp;
            else i=player.monster[1][mon].hp;
          if (i <= 0) {
            clear_prompt();
            if (in_arena != 'Y') {
              gain_exp(player.monster[1][mon].exp);
              player.map[x][y] = player.monster[1][mon].prev;
              }
            if (in_arena == 'Y') {
              gain_exp(player.monster[mon][a_mon].exp);
              player.map[x][y] = player.monster[mon][a_mon].prev;
              }
            show_spot(x,y);
            if (in_arena != 'Y' && player.monster[1][mon].special > 9) {
              player.align -= 20;
              if (player.align < 0) player.align = 0;
              }
            if (in_arena == 'Y' && player.monster[mon][a_mon].special > 9) {
              player.align -= 20;
              if (player.align < 0) player.align = 0;
              }
            show_side();
            }
    
          }
        else {
          clear_prompt();
          prompt("Fizzle. . .");
          }
        }
  }
Example #4
0
void drain(int damage) {
  char key;
  char buffer[32];
  int  x,y;
  int  xdir,ydir;
  int  mon;
  int  i;
  key = get_dir(&xdir,&ydir);
  x = player.x + xdir;
  y = player.y + ydir;
  if (player.map[x][y] < 0 || (player.map[x][y]>400 && player.map[x][y]<500)) {
    if (in_arena == 'Y') mon = player.map[x][y] - 400;
      else mon = player.map[x][y];
    i = 90;
    if (in_arena == 'Y' && player.monster[mon][a_mon].special == 1) i = 0;
    if (in_arena != 'Y' && player.monster[1][mon].special == 1) i = 0;
    if (u_random(100) < i) {
      clear_prompt();
      noise(1000,100);
      prompt("HIT !!!");
      if (in_arena != 'Y' && player.monster[1][mon].special > 9) {
        player.align -= 20;
        player.monster[1][mon].special -= 10;
        if (player.align < 0) player.align = 0;
        }
      if (in_arena == 'Y' && player.monster[mon][a_mon].special > 9) {
        player.align -= 20;
        player.monster[mon][a_mon].special -= 10;
        if (player.align < 0) player.align = 0;
        }
      if (in_sight(x,y) == '*') {
        show_sprite(x-player.map_x,y-player.map_y,80);
        delay(250);
        show_spot(x,y);
        }
      i = u_random(damage) + 1;
      player.chp += i;
      if (player.chp > player.mhp) player.chp = player.mhp;
      if (in_arena == 'Y') player.monster[mon][a_mon].hp -= i;
        else player.monster[1][mon].hp -= i;
      if (in_arena == 'Y') i=player.monster[mon][a_mon].hp;
        else i=player.monster[1][mon].hp;
      if (i <= 0) {
        clear_prompt();
        if (in_arena != 'Y') {
          sprintf(buffer,"Exp=%.0f",player.monster[1][mon].exp);
          prompt(buffer);
          player.exp += player.monster[1][mon].exp;
          player.map[x][y] = player.monster[1][mon].prev;
          }
        if (in_arena == 'Y') {
          sprintf(buffer,"Exp=%.0f",player.monster[mon][a_mon].exp);
          prompt(buffer);
          player.exp += player.monster[mon][a_mon].exp;
          player.map[x][y] = player.monster[mon][a_mon].prev;
          }
        show_spot(x,y);
        if (in_arena != 'Y' && player.monster[1][mon].special > 9) {
          player.align -= 20;
          if (player.align < 0) player.align = 0;
          }
        if (in_arena == 'Y' && player.monster[mon][a_mon].special > 9) {
          player.align -= 20;
          if (player.align < 0) player.align = 0;
          }
        show_side();
        }

      }
    else {
      clear_prompt();
      prompt("Fizzle. . .");
      }
    }
  }