From bf2dd254701cfbaf3f966a1abc29830c50104cf2 Mon Sep 17 00:00:00 2001 From: fdai7793 Date: Sun, 4 Feb 2024 20:12:00 +0100 Subject: [PATCH] botCanDrawCards --- src/main/java/de/hsfulda/onses/services/PlayerService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/de/hsfulda/onses/services/PlayerService.java b/src/main/java/de/hsfulda/onses/services/PlayerService.java index 09b9f91..14382d3 100644 --- a/src/main/java/de/hsfulda/onses/services/PlayerService.java +++ b/src/main/java/de/hsfulda/onses/services/PlayerService.java @@ -61,6 +61,7 @@ public class PlayerService { } public void botMove() { + Card lastPlayedCard = game.getLastPlayedCard(); for (int i = 0; i < this.playerList.getLast().getPlayerDeck().size(); i++) { if (getGame().getGameService().legalMove(this.playerList.getLast().getPlayerDeck().get(i))) { Card playCard = this.playerList.getLast().getPlayerDeck().get(i); @@ -69,5 +70,8 @@ public class PlayerService { break; } } + if (lastPlayedCard == game.getLastPlayedCard()) { + game.getGameService().drawCard(1); + } } }