Browse Source

refactoring: fix play card

main^2
fdai7736 11 months ago
parent
commit
1f3eab3dde
  1. 9
      src/main/java/de/hsfulda/onses/controllers/GameController.java

9
src/main/java/de/hsfulda/onses/controllers/GameController.java

@ -41,7 +41,14 @@ public class GameController implements Controller {
});
playButton.setOnAction(e -> {
gameService.playCard(new Card().setColor(Card.Color.GREEN).setValue(Card.Value.ONE));
Card cardToPlay = game.getPlayerService().getPlayerList().getFirst().getCurrentCard();
if(gameService.legalMove(cardToPlay)) {
System.out.println(cardToPlay.getPlayer());
if(cardToPlay.getPlayer() != null) {
cardToPlay.getPlayer().removeCardFromPlayerDeck(cardToPlay);
gameService.playCard(cardToPlay);
}
}
});

Loading…
Cancel
Save