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 2346 additions and 1542 deletions
Showing only changes of commit 6576250113 - Show all commits

View File

@@ -6,7 +6,7 @@
import java.util.ArrayList;
/**
* This class will be used to handle general PlayerData
* This class represents a player in the game.
*/
@Serializable
public class Player {
@@ -44,8 +44,20 @@ public class Player {
* Node and piece attributes
*/
private int startNodeIndex = -1;
/**
* The home nodes of the player.
*/
private HomeNode[] homeNodes = new HomeNode[Resources.MAX_PIECES];
/**
* The waiting area of the player.
*/
private Piece[] waitingArea = new Piece[Resources.MAX_PIECES];
/**
* The pieces of the player.
*/
private Piece[] pieces = new Piece[Resources.MAX_PIECES];
/**
@@ -88,7 +100,6 @@ public void addHandCard(BonusCard card) {
* This method will be used to remove the given card parameter from the handCards attribute of Player card.
*
* @param card as the card which should be removed from the handCards attribute as a PowerCard object.
* @return the removed card or null if there is none of that card type
*/
public void removeHandCard(BonusCard card) {
this.handCards.remove(card);
@@ -116,7 +127,12 @@ public void addWaitingPiece(Piece piece) {
* @return true or false.
*/
public boolean isFinished() {
return false;
for (int i = 0; i < Resources.MAX_PIECES; i++) {
if (this.pieces[i].getState() != PieceState.HOMEFINISHED) {
return false;
}
}
return true;
}
/**
@@ -255,8 +271,13 @@ public void setPieceInHome(int index, Piece piece) {
this.homeNodes[index].setOccupant(piece);
}
/**
* The string representation of the player
*
* @return the string representation of the player
*/
@Override
public String toString(){
public String toString() {
return "Player: " + name + " Color: " + color;
}
}