Merge remote-tracking branch 'origin/development' into development
This commit is contained in:
@@ -48,9 +48,6 @@ public class Game {
|
||||
// The color of the active player.
|
||||
private Color activeColor;
|
||||
|
||||
// A flag indicating whether all players are ready.
|
||||
private boolean allReady = false;
|
||||
|
||||
/**
|
||||
* This constructor creates a new Game object.
|
||||
*/
|
||||
@@ -65,6 +62,7 @@ public Game() {
|
||||
drawPile.add(BonusCard.SHIELD);
|
||||
}
|
||||
board = new Board();
|
||||
die = new Die();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,6 +111,21 @@ public boolean isColorTaken(Color color) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be used to return the first unused color if possible.
|
||||
*
|
||||
* @return color as a Color enumeration.
|
||||
*/
|
||||
public Color getFirstUnusedColor() {
|
||||
for (Color color : Color.values()) {
|
||||
if (!isColorTaken(color)) {
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be used to return the player which has the given id parameter.
|
||||
*
|
||||
@@ -155,6 +168,22 @@ public int getNumberOfActivePlayers() {
|
||||
return activePlayers;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be used to check if all players are ready.
|
||||
* If yes it will return true, otherwise false.
|
||||
*
|
||||
* @return true or false.
|
||||
*/
|
||||
public boolean areAllReady() {
|
||||
for (Map.Entry<Integer, Player> entry : this.players.entrySet()) {
|
||||
if (!entry.getValue().isReady()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be used to return a piece based on the UUID.
|
||||
*
|
||||
@@ -350,22 +379,4 @@ public void setDie(Die die) {
|
||||
public void setHost(int host) {
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the all ready state.
|
||||
*
|
||||
* @return the already state
|
||||
*/
|
||||
public Boolean allReady() {
|
||||
return allReady;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method sets the all ready state.
|
||||
*
|
||||
* @param allReady the new all-ready state
|
||||
*/
|
||||
public void setAllReady(Boolean allReady) {
|
||||
this.allReady = allReady;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user