This commit is contained in:
Benjamin Feyer
2024-12-12 01:03:04 +01:00

View File

@@ -24,6 +24,10 @@ public NoPieceState(ChoosePieceState choosePieceAutomaton, ServerGameLogic logic
super(choosePieceAutomaton, logic);
}
/**
* Initializes the state based on the current game logic and active player.
* Determines the next state of the automaton based on the game conditions.
*/
private void initialize() {
Player activePlayer = logic.getGame().getPlayerByColor(logic.getGame().getActiveColor());
if (logic.getGame().getDiceModifier() == 0) {
@@ -53,6 +57,12 @@ private void initialize() {
}
}
/**
* Checks and selects the pieces that can be moved by the active player.
* Updates the state of the automaton based on the movable pieces.
*
* @param activePlayer the player whose pieces are being checked
*/
private void checkSelectPiece(Player activePlayer) {
ArrayList<Piece> moveablePieces = new ArrayList<>();
for (Piece piece : activePlayer.getPieces()) {