Browse Source

add special Rule playSeven

main
fdai7906 11 months ago
parent
commit
bcaf4c8aac
  1. 16
      src/main/java/de/hsfulda/onses/services/GameService.java

16
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.Game;
import de.hsfulda.onses.models.Player; import de.hsfulda.onses.models.Player;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Random; import java.util.Random;
@ -107,6 +108,21 @@ public class GameService {
} }
} }
public void playSeven() {
ArrayList<Card> übergangBot = new ArrayList<>(game.getPlayerService().getPlayerList().getLast().getPlayerDeck());
ArrayList<Card> ü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() { public void checkForWin() {
if (this.game.getPlayerService().getPlayerList().getFirst().getPlayerDeck().isEmpty() || this.game.getPlayerService().getPlayerList().getLast().getPlayerDeck().isEmpty()) { if (this.game.getPlayerService().getPlayerList().getFirst().getPlayerDeck().isEmpty() || this.game.getPlayerService().getPlayerList().getLast().getPlayerDeck().isEmpty()) {
this.game.setGameOver(true); this.game.setGameOver(true);

Loading…
Cancel
Save