feat: add undo
This commit is contained in:
@@ -75,7 +75,7 @@ public class PromoteCommand extends PlayerCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo(Game game, OutputSystem outputSystem) {
|
||||
public CommandResult undo(Game game, OutputSystem outputSystem) {
|
||||
final ChessBoard board = game.getBoard();
|
||||
|
||||
Piece promoted = board.pieceAt(this.pieceCoords);
|
||||
@@ -84,6 +84,8 @@ public class PromoteCommand extends PlayerCommand {
|
||||
|
||||
Color player = promoted.getColor();
|
||||
board.pieceComes(new Pawn(player), this.pieceCoords);
|
||||
|
||||
return CommandResult.ActionNeeded;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user