Пример #1
0
  public void saveFile() {
    try {
      cardFormatter = new Formatter(currentFile);
    } catch (Exception e) {
      System.out.print("That File doesn't exist");
    }
    cardFormatter.format("%s%n", currentPlayer.getName());
    cardFormatter.format("%d%n", currentPlayer.getTotalCardsOwned());
    cardFormatter.format("%d%n", currentPlayer.getNumberOfCardsInDeck());
    cardFormatter.format("%d%n", currentPlayer.getWins());
    cardFormatter.format("%d%n", currentPlayer.getLosses());
    cardFormatter.format("%d%n", currentPlayer.getMoney());

    Card[] deck = currentPlayer.getDeck();

    for (int count = 0; count < deck.length; count++) {
      cardFormatter.format("%d%n", deck[count].getCardIndex());
      cardFormatter.format("%b%n", deck[count].getInDeck());
    }
    cardFormatter.close();
  }
Пример #2
0
 public int getCustomLosses() {
   return currentPlayer.getLosses();
 }