added java docs to NoPieceState

This commit is contained in:
Hanno Fleischer
2024-12-12 00:20:15 +01:00
parent 176affa9c5
commit 1f3b07709c

View File

@@ -24,6 +24,10 @@ public NoPieceState(ChoosePieceState choosePieceAutomaton, ServerGameLogic logic
super(choosePieceAutomaton, 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() { private void initialize() {
Player activePlayer = logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()); Player activePlayer = logic.getGame().getPlayerByColor(logic.getGame().getActiveColor());
if (logic.getGame().getDiceModifier() == 0) { 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) { private void checkSelectPiece(Player activePlayer) {
ArrayList<Piece> moveablePieces = new ArrayList<>(); ArrayList<Piece> moveablePieces = new ArrayList<>();
for (Piece piece : activePlayer.getPieces()) { for (Piece piece : activePlayer.getPieces()) {