From 16aff085c0fee024fd1579c25ade8c9cc2e0adab Mon Sep 17 00:00:00 2001 From: fdai7906 Date: Fri, 2 Feb 2024 17:36:54 +0100 Subject: [PATCH] add gameService drawCard --- .../java/de/hsfulda/onses/services/GameService.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/hsfulda/onses/services/GameService.java b/src/main/java/de/hsfulda/onses/services/GameService.java index 92293de..3f32a14 100644 --- a/src/main/java/de/hsfulda/onses/services/GameService.java +++ b/src/main/java/de/hsfulda/onses/services/GameService.java @@ -24,7 +24,16 @@ public class GameService { game.getPlayerService().nextTurn(); } public void drawCard(int amount) { - + Player player = null; + if (game.getPlayerService().getCurrentTurn()) { + player = game.getPlayerService().getPlayerList().getFirst(); + } else { + player = game.getPlayerService().getPlayerList().getLast(); + } + for (int i = 0; i < amount; i++) { + player.getPlayerDeck().add(game.getDrawCardDeck().getFirst()); + game.getDrawCardDeck().removeFirst(); + } } public void playCard(Player player, Card card) {