reformatted code

This commit is contained in:
Benjamin Feyer
2024-12-10 02:23:19 +01:00
parent 91d4718179
commit 38c865d135
5 changed files with 78 additions and 76 deletions

View File

@@ -68,8 +68,6 @@ public void received(MoveMessage msg) {
}
logic.getGame().getBoard().getInfield()[infieldIndex].clearOccupant();
logic.getGame().getPlayerByColor(piece.getColor()).setPieceInHome(msg.getTargetIndex(), piece);
}
else {
System.out.println("Client: SelectPieceState: receivedMoveMessage:reached else");
@@ -84,10 +82,9 @@ public void received(MoveMessage msg) {
}
logic.getGame().getActivePlayer().getHomeNodes()[pieceHomeIndex].clearOccupant();
logic.getGame().getPlayerByColor(piece.getColor()).setPieceInHome(msg.getTargetIndex(), piece);
}
} else {
}
else {
int oldIndex = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
Piece occ = logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].getOccupant();
@@ -109,7 +106,8 @@ public void received(MoveMessage msg) {
piece.setShield(ShieldState.SUPPRESSED);
logic.addNotification(new ShieldSuppressedNotification(piece.getUuid()));
}
} else if (piece.isSuppressed()){
}
else if (piece.isSuppressed()) {
piece.setShield(ShieldState.ACTIVE);
logic.addNotification(new ShieldActiveNotification(piece.getUuid()));
}

View File

@@ -38,7 +38,6 @@ protected boolean canMove(Piece piece) {
int normPieceIdx = (-startIdx + pieceIdx + 40) % 40;
int targetIdx = normPieceIdx + steps;
//checks if the piece can move in the home
if (piece.getState().equals(PieceState.HOME)) {
if (canPieceMoveInHome(piece, steps)) {

View File

@@ -36,19 +36,24 @@ private void initialize(){
}
}
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getNoTurnState());
} else if (activePlayer.hasPieceInWaitingArea()) {
}
else if (activePlayer.hasPieceInWaitingArea()) {
if (!logic.getGame().getBoard().getInfield()[activePlayer.getStartNodeIndex()].isOccupied(activePlayer.getColor())) {
if (logic.getGame().getDiceEyes() == 6) {
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getWaitingPieceState());
} else {
}
else {
checkSelectPiece(activePlayer);
}
} else if (canMove(logic.getGame().getBoard().getInfield()[activePlayer.getStartNodeIndex()].getOccupant())){
}
else if (canMove(logic.getGame().getBoard().getInfield()[activePlayer.getStartNodeIndex()].getOccupant())) {
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getStartPieceState());
} else {
}
else {
checkSelectPiece(activePlayer);
}
} else {
}
else {
checkSelectPiece(activePlayer);
}
}
@@ -63,7 +68,8 @@ private void checkSelectPiece(Player activePlayer){
moveablePieces.removeIf(piece -> !canMove(piece));
if (moveablePieces.isEmpty()) {
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getNoTurnState());
} else {
}
else {
this.choosePieceAutomaton.getSelectPieceState().setMoveablePieces(moveablePieces);
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getSelectPieceState());
}

View File

@@ -84,7 +84,6 @@ public void received(RequestMoveMessage msg, int from){
oldNode.clearOccupant();
targetNode.setOccupant(piece);
}
else {
int oldNoteIdx = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
@@ -103,7 +102,6 @@ public void received(RequestMoveMessage msg, int from){
oldNode.clearOccupant();
targetNode.setOccupant(piece);
}
LOGGER.log(System.Logger.Level.INFO, "Server : SelectPieceState: PieceState:" + piece.getState());
}
@@ -126,7 +124,6 @@ public void received(RequestMoveMessage msg, int from){
oldNode.clearOccupant();
targetNode.setOccupant(piece);
}
boolean homeMove = isHomeMove.get(indexOfPiece);
@@ -143,7 +140,8 @@ public void received(RequestMoveMessage msg, int from){
PowerCard cardToDraw = logic.getGame().draw();
p.addHandCard(cardToDraw);
logic.getServerSender().send(logic.getGame().getPlayerIdByColor(p.getColor()), new DrawCardMessage(cardToDraw));
} else {
}
else {
logic.getServerSender().send(logic.getGame().getPlayerIdByColor(p.getColor()), new DrawCardMessage(new HiddenCard()));
}
}

View File

@@ -67,7 +67,8 @@ public void received(RequestMoveMessage msg, int from){
PowerCard cardToDraw = logic.getGame().draw();
p.addHandCard(cardToDraw);
logic.getServerSender().send(logic.getGame().getPlayerIdByColor(p.getColor()), new DrawCardMessage(cardToDraw));
} else {
}
else {
logic.getServerSender().send(logic.getGame().getPlayerIdByColor(p.getColor()), new DrawCardMessage(new HiddenCard()));
}
}