merge dev into test #33

Merged
j23f0712 merged 36 commits from development into dev/test 2024-12-02 17:37:00 +01:00
49 changed files with 1202 additions and 375 deletions
Showing only changes of commit 6c136b78b8 - Show all commits

View File

@@ -12,17 +12,17 @@ public class Piece {
/** /**
* The shield state of the piece. * The shield state of the piece.
*/ */
private int shield; private ShieldState shield;
/** /**
* The current state of the piece. * The current state of the piece.
*/ */
private int state; private PieceState state;
/** /**
* The color of the piece. * The color of the piece.
*/ */
private final int color; private final Color color;
/** /**
* The unique identifier of the piece. * The unique identifier of the piece.
@@ -36,15 +36,15 @@ public class Piece {
* @param state the state of the piece * @param state the state of the piece
*/ */
public Piece(Color color, PieceState state, int id) { public Piece(Color color, PieceState state, int id) {
this.color = color.ordinal(); this.color = color;
this.state = state.ordinal(); this.state = state;
shield = ShieldState.NONE.ordinal(); shield = ShieldState.NONE;
} }
private Piece() { private Piece() {
color = Color.NONE.ordinal(); color = Color.NONE;
state = PieceState.WAITING.ordinal(); state = PieceState.WAITING;
shield = ShieldState.NONE.ordinal(); shield = ShieldState.NONE;
} }
/** /**
@@ -53,7 +53,7 @@ private Piece() {
* @return the color of the piece * @return the color of the piece
*/ */
public void setShield(ShieldState shield) { public void setShield(ShieldState shield) {
this.shield = shield.ordinal(); this.shield = shield;
} }
/** /**
@@ -62,7 +62,7 @@ public void setShield(ShieldState shield) {
* @return the color of the piece * @return the color of the piece
*/ */
public ShieldState getShield() { public ShieldState getShield() {
return ShieldState.values()[shield]; return shield;
} }
/** /**
@@ -71,7 +71,7 @@ public ShieldState getShield() {
* @param state the state of the piece * @param state the state of the piece
*/ */
public void setState(PieceState state) { public void setState(PieceState state) {
this.state = state.ordinal(); this.state = state;
} }
/** /**
@@ -80,7 +80,7 @@ public void setState(PieceState state) {
* @return the color of the piece * @return the color of the piece
*/ */
public PieceState getState() { public PieceState getState() {
return PieceState.values()[state]; return state;
} }
/** /**
@@ -89,7 +89,7 @@ public PieceState getState() {
* @return the color of the piece * @return the color of the piece
*/ */
public boolean isShielded() { public boolean isShielded() {
return shield == ShieldState.ACTIVE.ordinal(); return shield == ShieldState.ACTIVE;
} }
/** /**
@@ -98,7 +98,7 @@ public boolean isShielded() {
* @return the color of the piece * @return the color of the piece
*/ */
public boolean isSuppressed() { public boolean isSuppressed() {
return shield == ShieldState.SUPPRESSED.ordinal(); return shield == ShieldState.SUPPRESSED;
} }
/** /**
@@ -107,7 +107,7 @@ public boolean isSuppressed() {
* @return the color of the piece * @return the color of the piece
*/ */
public Color getColor() { public Color getColor() {
return Color.values()[color]; return color;
} }
/** /**