diff --git a/src/main/java/de/hsfulda/onses/controllers/GameController.java b/src/main/java/de/hsfulda/onses/controllers/GameController.java index 70cc61b..0abedb7 100644 --- a/src/main/java/de/hsfulda/onses/controllers/GameController.java +++ b/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); + } + } });