diff --git a/src/main/java/de/hsfulda/onses/services/PlayerService.java b/src/main/java/de/hsfulda/onses/services/PlayerService.java index 3cde989..fff2fb6 100644 --- a/src/main/java/de/hsfulda/onses/services/PlayerService.java +++ b/src/main/java/de/hsfulda/onses/services/PlayerService.java @@ -6,6 +6,8 @@ import java.util.ArrayList; public class PlayerService { + private int currentTurn = 0; // 0-3 + private int totalTurns = 0; // 1-4 private final ArrayList playerList = new ArrayList<>(); public ArrayList getPlayerList() { @@ -13,9 +15,9 @@ public class PlayerService { } public void addPlayerToList(Player player) { playerList.add(player); + totalTurns++; } - // button on gui activates it public void addOpponents(int amount) { for (int i=0; i 0 = main Player (skip -> 2x nextTurn()) + // possible: at start of game random int generator from 0-max to decide who starts first + // currentTurn = 2 --> player.getPlayerList(currentTurn) --> Bot 2 (Player 3) + public void nextTurn() + { + if (currentTurn != totalTurns-1) currentTurn++; + else currentTurn = 0; + } + + + + public int getCurrentTurn() { + return currentTurn; + } + + public PlayerService setCurrentTurn(int currentTurn) { + this.currentTurn = currentTurn; + return this; + } + + public int getTotalTurns() { + return totalTurns; + } + + public PlayerService setTotalTurns(int totalTurns) { + this.totalTurns = totalTurns; + return this; + } }