Kniffel/domain/Game.java

62 lines
1.2 KiB
Java
Raw Permalink Normal View History

package domain;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
public class Game {
private ArrayList<Player> currentPlayers;
private int turnPlayer;
private Dice dice;
private String gamemode;
public Game(){
currentPlayers = new ArrayList<Player>();
turnPlayer = 0;
}
public String setGamemode(String gamemode){
if (gamemode.equals("1")){
this.gamemode = "default";
dice = new Dice(6);
return "Default mode selected.";
} else {
this.gamemode = "starwars";
dice = new Dice(8);
return "Starwars mode selected.";
}
}
public String getGamemode(){
return this.gamemode;
}
public void nextTurn(){
Collections.rotate(currentPlayers, -1);
}
public Player getCurrentPlayer(){
return currentPlayers.getFirst();
}
public int rollDice(){
return dice.roll();
}
public void addPlayer(Player playerToAdd){
currentPlayers.add(playerToAdd);
}
public ArrayList<Player> getPlayers(){
return currentPlayers;
}
}