merge development into test #26
@@ -58,6 +58,12 @@ public void setPieceOnBoard(int index, Piece piece) {
|
|||||||
infield[index].setOccupant(piece);
|
infield[index].setOccupant(piece);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method returns the index of a specific piece on the board
|
||||||
|
*
|
||||||
|
* @param piece the piece to be searched for
|
||||||
|
* @return the index of the piece
|
||||||
|
*/
|
||||||
public int getInfieldIndexOfPiece(Piece piece) {
|
public int getInfieldIndexOfPiece(Piece piece) {
|
||||||
for (int i = 0; i < infield.length; i++) {
|
for (int i = 0; i < infield.length; i++) {
|
||||||
if (infield[i].getOccupant() == piece) {
|
if (infield[i].getOccupant() == piece) {
|
||||||
|
|||||||
@@ -1,8 +1,23 @@
|
|||||||
package pp.mdga.game;
|
package pp.mdga.game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enum representing the different types of bonus cards.
|
||||||
|
*/
|
||||||
public enum BonusCard {
|
public enum BonusCard {
|
||||||
|
/**
|
||||||
|
* The hidden bonus card.
|
||||||
|
*/
|
||||||
HIDDEN,
|
HIDDEN,
|
||||||
|
/**
|
||||||
|
* The shield bonus card.
|
||||||
|
*/
|
||||||
SHIELD,
|
SHIELD,
|
||||||
|
/**
|
||||||
|
* The turbo bonus card.
|
||||||
|
*/
|
||||||
TURBO,
|
TURBO,
|
||||||
|
/**
|
||||||
|
* The swap bonus card.
|
||||||
|
*/
|
||||||
SWAP
|
SWAP
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,7 @@
|
|||||||
package pp.mdga.game;
|
package pp.mdga.game;
|
||||||
|
|
||||||
public class BonusNode extends Node {
|
/**
|
||||||
|
* This class represents a BonusNode
|
||||||
public BonusNode() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is used to set a new Occupant
|
|
||||||
*
|
|
||||||
* @param occupant the new occupant of the node
|
|
||||||
*/
|
*/
|
||||||
@Override
|
public class BonusNode extends Node {
|
||||||
public void setOccupant(Piece occupant) {
|
|
||||||
if (occupant.isSuppressed()){
|
|
||||||
occupant.setShield(ShieldState.NONE);
|
|
||||||
}
|
|
||||||
//Draw Card Event
|
|
||||||
this.occupant = occupant;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package pp.mdga.game;
|
package pp.mdga.game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a home node.
|
||||||
|
*/
|
||||||
public class HomeNode extends Node {
|
public class HomeNode extends Node {
|
||||||
|
|
||||||
public HomeNode() {}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
public class Node {
|
public class Node {
|
||||||
protected Piece occupant;
|
protected Piece occupant;
|
||||||
|
|
||||||
public Node() {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is used to get an occupant of the Node.
|
* This method is used to get an occupant of the Node.
|
||||||
*
|
*
|
||||||
@@ -23,7 +21,7 @@ public Piece getOccupant() {
|
|||||||
* @param occupant the new occupant of the node
|
* @param occupant the new occupant of the node
|
||||||
*/
|
*/
|
||||||
public void setOccupant(Piece occupant) {
|
public void setOccupant(Piece occupant) {
|
||||||
if (occupant.isSuppressed()){
|
if (occupant.isSuppressed()) {
|
||||||
occupant.setShield(ShieldState.NONE);
|
occupant.setShield(ShieldState.NONE);
|
||||||
}
|
}
|
||||||
this.occupant = occupant;
|
this.occupant = occupant;
|
||||||
|
|||||||
@@ -6,9 +6,24 @@
|
|||||||
* This class will be used to hold all Piece relevant data.
|
* This class will be used to hold all Piece relevant data.
|
||||||
*/
|
*/
|
||||||
public class Piece {
|
public class Piece {
|
||||||
|
/**
|
||||||
|
* The shield state of the piece.
|
||||||
|
*/
|
||||||
private ShieldState shield;
|
private ShieldState shield;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current state of the piece.
|
||||||
|
*/
|
||||||
private PieceState state;
|
private PieceState state;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The color of the piece.
|
||||||
|
*/
|
||||||
private final Color color;
|
private final Color color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The unique identifier of the piece.
|
||||||
|
*/
|
||||||
private final UUID uuid = UUID.randomUUID();
|
private final UUID uuid = UUID.randomUUID();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,8 +1,23 @@
|
|||||||
package pp.mdga.game;
|
package pp.mdga.game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the state of a piece.
|
||||||
|
*/
|
||||||
public enum PieceState {
|
public enum PieceState {
|
||||||
|
/**
|
||||||
|
* The piece is active.
|
||||||
|
*/
|
||||||
ACTIVE,
|
ACTIVE,
|
||||||
|
/**
|
||||||
|
* The piece is waiting.
|
||||||
|
*/
|
||||||
WAITING,
|
WAITING,
|
||||||
|
/**
|
||||||
|
* The piece is in the home.
|
||||||
|
*/
|
||||||
HOME,
|
HOME,
|
||||||
|
/**
|
||||||
|
* The piece is finished.
|
||||||
|
*/
|
||||||
HOMEFINISHED
|
HOMEFINISHED
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,34 @@
|
|||||||
* This class will be used to handle general PlayerData
|
* This class will be used to handle general PlayerData
|
||||||
*/
|
*/
|
||||||
public class Player {
|
public class Player {
|
||||||
|
/**
|
||||||
|
* The name of the player.
|
||||||
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The statistics of the player.
|
||||||
|
*/
|
||||||
private Statistic playerStatistic;
|
private Statistic playerStatistic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The hand cards of the player.
|
||||||
|
*/
|
||||||
private ArrayList<BonusCard> handCards;
|
private ArrayList<BonusCard> handCards;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The color of the player.
|
||||||
|
*/
|
||||||
private Color color = Color.NONE;
|
private Color color = Color.NONE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the player is ready.
|
||||||
|
*/
|
||||||
private boolean isReady;
|
private boolean isReady;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the player is active.
|
||||||
|
*/
|
||||||
private boolean active = true;
|
private boolean active = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,7 +95,7 @@ public ArrayList<BonusCard> getHandCards() {
|
|||||||
*
|
*
|
||||||
* @param card the card to be added to the players hand
|
* @param card the card to be added to the players hand
|
||||||
*/
|
*/
|
||||||
public void addHandCards(BonusCard card) {
|
public void addHandCard(BonusCard card) {
|
||||||
handCards.add(card);
|
handCards.add(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,24 @@
|
|||||||
* This class is used to represent PlayerData related to the board
|
* This class is used to represent PlayerData related to the board
|
||||||
*/
|
*/
|
||||||
public class PlayerData {
|
public class PlayerData {
|
||||||
|
/**
|
||||||
|
* An array of HomeNode objects representing the home nodes of the player.
|
||||||
|
*/
|
||||||
private HomeNode[] homeNodes;
|
private HomeNode[] homeNodes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The index of the start node for the player.
|
||||||
|
*/
|
||||||
private int startNodeIndex;
|
private int startNodeIndex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of Piece objects representing the waiting area of the player.
|
||||||
|
*/
|
||||||
private Piece[] waitingArea;
|
private Piece[] waitingArea;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of Piece objects representing all the pieces of the player.
|
||||||
|
*/
|
||||||
private Piece[] pieces;
|
private Piece[] pieces;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,19 @@
|
|||||||
package pp.mdga.game;
|
package pp.mdga.game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the state of a piece's shield.
|
||||||
|
*/
|
||||||
public enum ShieldState {
|
public enum ShieldState {
|
||||||
|
/**
|
||||||
|
* The shield is not active.
|
||||||
|
*/
|
||||||
NONE,
|
NONE,
|
||||||
|
/**
|
||||||
|
* The shield is active.
|
||||||
|
*/
|
||||||
ACTIVE,
|
ACTIVE,
|
||||||
|
/**
|
||||||
|
* The shield is suppressed, when the piece is on a start node.
|
||||||
|
*/
|
||||||
SUPPRESSED
|
SUPPRESSED
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,21 @@
|
|||||||
package pp.mdga.game;
|
package pp.mdga.game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a start node.
|
||||||
|
*/
|
||||||
public class StartNode extends Node {
|
public class StartNode extends Node {
|
||||||
|
/**
|
||||||
public StartNode(Color color) {
|
* The color of the node.
|
||||||
this.color = color;
|
*/
|
||||||
}
|
|
||||||
|
|
||||||
private Color color;
|
private Color color;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is used to set a new Occupant
|
* Creates a new start node with the given color.
|
||||||
*
|
*
|
||||||
* @param occupant the new occupant of the node
|
* @param color the color of the node
|
||||||
*/
|
*/
|
||||||
@Override
|
public StartNode(Color color) {
|
||||||
public void setOccupant(Piece occupant) {
|
this.color = color;
|
||||||
if (occupant.isShielded()){
|
|
||||||
occupant.setShield(ShieldState.SUPPRESSED);
|
|
||||||
}
|
|
||||||
this.occupant = occupant;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,13 +4,39 @@
|
|||||||
* This class will be used to store Statistics during the Game;
|
* This class will be used to store Statistics during the Game;
|
||||||
*/
|
*/
|
||||||
public class Statistic {
|
public class Statistic {
|
||||||
|
/**
|
||||||
|
* The number of cards played.
|
||||||
|
*/
|
||||||
private int cardsPlayed;
|
private int cardsPlayed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of pieces thrown. (enemy)
|
||||||
|
*/
|
||||||
private int piecesThrown;
|
private int piecesThrown;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of pieces being thrown. (own pieces)
|
||||||
|
*/
|
||||||
private int piecesBeingThrown;
|
private int piecesBeingThrown;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of times a 6 was diced.
|
||||||
|
*/
|
||||||
private int diced6;
|
private int diced6;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of nodes traveled.
|
||||||
|
*/
|
||||||
private int traveledNodes;
|
private int traveledNodes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of bonus nodes activated.
|
||||||
|
*/
|
||||||
private int activatedBonusNodes;
|
private int activatedBonusNodes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new Statistic object with all values initialized to 0.
|
||||||
|
*/
|
||||||
public Statistic() {
|
public Statistic() {
|
||||||
cardsPlayed = 0;
|
cardsPlayed = 0;
|
||||||
piecesThrown = 0;
|
piecesThrown = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user