Example #1
0
  private int showTreasures(String message, ArrayList<Treasure> treasures, boolean menu) {
    int optionMenu = Command.GoBack.menu;

    System.out.println("\n------- ------- ------- ------- ------- ------- -------");
    System.out.println(message + "\n");
    if (menu) System.out.println("\n" + Command.GoBack.menu + " : " + Command.GoBack.text);

    for (Treasure t : treasures) {
      optionMenu++;
      System.out.println("\n" + (menu ? optionMenu + ":" : "") + t.toString());
    }
    return optionMenu;
  }
Example #2
0
  private Command processCommand(Command command, Player aPlayer) {
    Treasure aTreasure;

    switch (command) {
      case Exit:
        break;
      case Combat:
        break;
      case ShowMonster:
        System.out.println("\n------- ------- ------- ------- ------- ------- ------- ");
        System.out.println("El monstruo actual es:\n\n" + game.getCurrentMonster().toString());
        break;
      case ShowVisibleTreasure:
        showTreasures("Esta es tu lista de tesoros visibles", aPlayer.getVisibleTreasures(), false);
        break;
      case ShowHiddenTreasure:
        showTreasures("Esta es tu lista de tesoros ocultos", aPlayer.getHiddenTreasures(), false);
        break;
      case MakeTreasureVisible:
        manageMakeTreasureVisible(aPlayer);
        break;
      case DiscardVisibleTreasure:
        manageDiscardTreasures(true, aPlayer);
        break;
      case DiscardHiddenTreasure:
        manageDiscardTreasures(false, aPlayer);
        break;
      case DiscardAll:
        aPlayer.discardAllTreasures();
        break;
      case StealTreasure:
        aTreasure = aPlayer.stealTreasure();
        if (aTreasure == null) System.out.println("\n\n No has podido robar nada \n\n");
        else System.out.println("\n\n Has robado este tesoro: \n\n" + aTreasure.toString());
        break;
      case NextTurn:
        if (!game.nextTurn()) {
          System.out.println("\n\n ERROR \n");
          System.out.println("No cumples las condiciones para pasar de turno.");
          System.out.println("O bien tienes más de 4 tesoros ocultos");
          System.out.println("O bien te queda mal rollo por cumplir");
        } else {
          command = Command.NextTurnAllowed;
        }
        break;
    }
    return command;
  }