public static void main(String args[]) {
    byte coins = 0;
    byte rep = 0;
    boolean win = true;
    boolean tie = true;
    byte play = 1;
    byte xp = -128;
    byte lvl = 1;
    short nXp = 0;
    byte showXp = 0; // TODO: use this to show more beautyfull xp
    byte rankXp = 0; // TODO: use this to show more beautyfull xp
    boolean showDialog = true;

    while (play != 0) {
      if (xp > -110 && showDialog) {
        System.out.println(
            "Congratulations, you lvl'ed up! You are lvl 1 now. \n You can now buy from the store!");
        showDialog = false;
        lvl++;
        xp = -128;
      }
      if (lvl > 1)
        System.out.println(
            "Do you want to play	R.P.S.? - Don't press 0. \n Do you want to use the store? - Press 2");
      else System.out.println("Do you want to play	R.P.S.? - Don't press 0.");
      if (play == 2)
        System.out.println(
            "Buy: Pattern giver(4GP) - Type -15 "
                + "\n Buy: Encrypted Win(24GP) - Type -25 \n Buy: 2 hour challenge(100GP) - Type -35 \n");
      Scanner sc = new Scanner(System.in);
      System.out.println(
          "-------------------- \n \n You have " + coins + " coins. \n Your xp: " + xp);
      play = sc.nextByte();
      if (
      /*win*/ play == 11) {
        System.out.println("You win! +3xp");
        coins += 5;
        xp += 3;
      } else if (
      /*tie*/ play == 22) {
        System.out.println("You tied..Respect.. +1xp");
        coins += 1;
        rep += 10;
        xp += 1;
      } else {
        System.out.println("You lost man...another time, another time..");
        if (coins != -128) coins--;
      }
    }
  }
Esempio n. 2
0
 /**
  * Reads the next token from standard input, parses it as a byte, and returns the byte.
  *
  * @return the next byte on standard input
  * @throws InputMismatchException if the next token cannot be parsed as a <tt>byte</tt>
  */
 public static byte readByte() {
   return scanner.nextByte();
 }