diff --git a/src/main/java/de/hsfulda/onses/services/GameService.java b/src/main/java/de/hsfulda/onses/services/GameService.java index 129790f..29c01d5 100644 --- a/src/main/java/de/hsfulda/onses/services/GameService.java +++ b/src/main/java/de/hsfulda/onses/services/GameService.java @@ -4,6 +4,7 @@ import de.hsfulda.onses.models.Card; import de.hsfulda.onses.models.Game; import de.hsfulda.onses.models.Player; +import java.util.ArrayList; import java.util.Collections; import java.util.Random; @@ -107,6 +108,21 @@ public class GameService { } } + public void playSeven() { + ArrayList übergangBot = new ArrayList<>(game.getPlayerService().getPlayerList().getLast().getPlayerDeck()); + ArrayList übergangSpieler = new ArrayList<>(game.getPlayerService().getPlayerList().getFirst().getPlayerDeck()); + + game.getPlayerService().getPlayerList().getFirst().getPlayerDeck().clear(); + for (int i = 0; i < übergangBot.size(); i++) { + game.getPlayerService().getPlayerList().getFirst().getPlayerDeck().add(übergangBot.get(i)); + } + + game.getPlayerService().getPlayerList().getLast().getPlayerDeck().clear(); + for (int i = 0; i < übergangSpieler.size(); i++) { + game.getPlayerService().getPlayerList().getLast().getPlayerDeck().add(übergangSpieler.get(i)); + } + } + public void checkForWin() { if (this.game.getPlayerService().getPlayerList().getFirst().getPlayerDeck().isEmpty() || this.game.getPlayerService().getPlayerList().getLast().getPlayerDeck().isEmpty()) { this.game.setGameOver(true);