private void guessPressed() { GuessDialog gs = new GuessDialog(); assert goc.getPlayerPos().isRoom(); Card shownCard = goc.guess(gs.getGuess("Guess", goc.getPlayerPos().getRoom().getName())); if (shownCard != null) { System.out.println("show card"); List<Card> cardList = new ArrayList<Card>(); cardList.add(shownCard); new ShowCardsFrame( cardList, "You were shown the " + shownCard.getTitle() + " card!", "You were shown the " + shownCard.getTitle() + " card!\n" + "This card cannot be in the envelope!"); } endTurn(); }
private void accusePressed() { GuessDialog ac = new GuessDialog(); if (goc.accuse(ac.getGuess("Accuse"))) { System.out.println("You win"); goc.setWinner(goc.getCurrentPlayer()); // Correct set winner and end game endTurn(); } else { System.out.println("You lost"); String playerName = goc.getCurrentPlayer().getName(); goc.playerLost(goc.getCurrentPlayer()); // Wrong remove player from play endTurn(); if (goc != null && !goc.checkGameOver()) { can_board.setBoard(goc.getBoard()); JOptionPane.showMessageDialog(this, playerName + " has been eliminated"); } } }