Browse Source

unable to draw from empty DrawCardDeck

main
fdai7920 11 months ago
parent
commit
ddfb8e271b
  1. 2
      src/main/java/de/hsfulda/onses/services/GameService.java

2
src/main/java/de/hsfulda/onses/services/GameService.java

@ -32,6 +32,7 @@ public class GameService {
public void drawCard(int amount) { public void drawCard(int amount) {
Player player = null; Player player = null;
if (!game.getDrawCardDeck().isEmpty()) {
if (game.getPlayerService().getCurrentTurn()) { if (game.getPlayerService().getCurrentTurn()) {
player = game.getPlayerService().getPlayerList().getFirst(); player = game.getPlayerService().getPlayerList().getFirst();
} else { } else {
@ -41,6 +42,7 @@ public class GameService {
player.getPlayerDeck().add(game.getDrawCardDeck().getFirst()); player.getPlayerDeck().add(game.getDrawCardDeck().getFirst());
game.getDrawCardDeck().removeFirst(); game.getDrawCardDeck().removeFirst();
} }
}
if (amount != 1) { if (amount != 1) {
nextPlayer(); nextPlayer();
} }

Loading…
Cancel
Save