promote not that uggly

This commit is contained in:
2025-04-02 17:19:26 +02:00
parent 97cafb903a
commit 9179b3cda9
7 changed files with 142 additions and 27 deletions

View File

@@ -17,6 +17,8 @@ import chess.io.OutputSystem;
import chess.io.commands.GetAllowedMovesCommand;
import chess.io.commands.GetPieceAtCommand;
import chess.io.commands.MoveCommand;
import chess.io.commands.PromoteCommand;
import chess.io.commands.PromoteCommand.PromoteType;
import chess.model.Coordinate;
import chess.model.Move;
import chess.model.Piece;
@@ -96,9 +98,9 @@ public class Window extends JFrame implements OutputSystem {
private boolean previewMoves(int x, int y) {
GetAllowedMovesCommand movesCommand = new GetAllowedMovesCommand(new Coordinate(x, y));
if(sendCommand(movesCommand) == CommandResult.NotAllowed)
if (sendCommand(movesCommand) == CommandResult.NotAllowed)
return false;
List<Coordinate> allowedMoves = movesCommand.getDestinations();
if (allowedMoves.isEmpty())
return false;
@@ -180,4 +182,10 @@ public class Window extends JFrame implements OutputSystem {
buildBoard();
}
@Override
public void promotePawn(Coordinate pieceCoords) {
System.out.println("PROMOTE");
sendCommand(new PromoteCommand(PromoteType.Queen, pieceCoords));
}
}