From eecd2fc1306c5793d80cb31da4fbe4f547846f94 Mon Sep 17 00:00:00 2001 From: fdai7793 Date: Sat, 3 Feb 2024 15:14:12 +0100 Subject: [PATCH] setFirstCard --- src/main/java/de/hsfulda/onses/services/GameService.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/de/hsfulda/onses/services/GameService.java b/src/main/java/de/hsfulda/onses/services/GameService.java index 2e9424b..d316d7a 100644 --- a/src/main/java/de/hsfulda/onses/services/GameService.java +++ b/src/main/java/de/hsfulda/onses/services/GameService.java @@ -13,6 +13,14 @@ public class GameService { this.game.setGameService(this); fillDrawDeck(); shuffleDeck(); + + for (int i = 0; i < this.game.getDrawCardDeck().size(); i++) { + Card card = this.game.getDrawCardDeck().get(i); + if (card.getColor() != Card.Color.BLACK) { + this.game.setLastPlayedCard(card); + break; + } + } } public GameService() { this(new Game());