merge the new developmentbranch into the test branch #39

Closed
j23f0712 wants to merge 431 commits from development2 into dev/test
134 changed files with 2324 additions and 1541 deletions
Showing only changes of commit 154efccf31 - Show all commits

View File

@@ -3,7 +3,7 @@
import java.util.*;
/**
* The Game class represents the game state of the Ludo game.
* The Game class represents the game state of the game.
* It contains all the information needed to play the game.
* The game state is updated by the game logic.
*/
@@ -14,38 +14,53 @@ public class Game {
public static final int AMOUNT_OF_TURBO_CARDS = 16;
/**
* The number of shield and swap cards available in the game.
* The number of shield cards available in the game.
*/
public static final int AMOUNT_OF_SHIELD_AND_SWAP_CARDS = 12;
public static final int AMOUNT_OF_SHIELD_CARDS = 12;
// The modifier applied to the dice roll.
private int diceModifier = 1;
/**
* The number of swap cards available in the game.
*/
public static final int AMOUNT_OF_SWAP_CARDS = 12;
// The number of eyes shown on the dice.
private int diceEyes;
// A map of player IDs to Player objects.
/**
* A map of player IDs to Player objects.
*/
private Map<Integer, Player> players = new HashMap<>();
// The statistics of the game.
/**
* The statistics of the game.
*/
private Statistic gameStatistics;
// The pile of bonus cards available for drawing.
private List<BonusCard> drawPile;
/**
* The pile of bonus cards available for drawing.
*/
private List<BonusCard> drawPile = new ArrayList<>();
// The pile of bonus cards that have been discarded.
/**
* The pile of bonus cards that have been discarded.
*/
private List<BonusCard> discardPile = new ArrayList<>();
// The game board.
/**
* The game board.
*/
private Board board;
// The die used in the game.
/**
* The die used in the game.
*/
private Die die;
// The host of this game
/**
* The host of this game
*/
private int host = -1;
// The color of the active player.
/**
* The color of the active player.
*/
private Color activeColor;
/**
@@ -53,18 +68,30 @@ public class Game {
*/
public Game() {
gameStatistics = new Statistic();
drawPile = new ArrayList<>();
for (int i = 0; i < AMOUNT_OF_TURBO_CARDS; i++) {
drawPile.add(BonusCard.TURBO);
}
for (int i = 0; i < AMOUNT_OF_SHIELD_AND_SWAP_CARDS; i++) {
drawPile.add(BonusCard.SWAP);
drawPile.add(BonusCard.SHIELD);
}
initializeDrawPile();
board = new Board();
die = new Die();
}
/**
* This method initializes the draw pile with the predefined number of bonus cards.
*/
private void initializeDrawPile() {
addBonusCards(BonusCard.TURBO, AMOUNT_OF_TURBO_CARDS);
addBonusCards(BonusCard.SWAP, AMOUNT_OF_SWAP_CARDS);
addBonusCards(BonusCard.SHIELD, AMOUNT_OF_SHIELD_CARDS);
}
/**
* This method adds a number of bonus cards to the draw pile.
*
* @param card the card to add
* @param count the number of cards to add
*/
private void addBonusCards(BonusCard card, int count) {
drawPile.addAll(Collections.nCopies(count, card));
}
/**
* This method adds a player to the game.
*
@@ -244,24 +271,6 @@ public boolean isHost() {
return this.host != -1;
}
/**
* This method returns the dice modifier.
*
* @return the dice modifier
*/
public int getDiceModifier() {
return diceModifier;
}
/**
* This method returns the dice eyes.
*
* @return the dice eyes
*/
public int getDiceEyes() {
return diceEyes;
}
/**
* This method returns the players.
*
@@ -334,24 +343,6 @@ public int getHost() {
return this.host;
}
/**
* This method sets the dice modifier.
*
* @param diceModifier the new dice modifier
*/
public void setDiceModifier(int diceModifier) {
this.diceModifier = diceModifier;
}
/**
* This method sets the dice eyes.
*
* @param diceEyes the new dice eyes
*/
public void setDiceEyes(int diceEyes) {
this.diceEyes = diceEyes;
}
/**
* This method sets the players.
*