remove PawnIdentifier

This commit is contained in:
2025-05-10 18:08:55 +02:00
parent 810a0f2159
commit c1bf9bcaf9
4 changed files with 6 additions and 58 deletions

View File

@@ -9,9 +9,9 @@ import chess.model.Game;
import chess.model.Piece;
import chess.model.pieces.Bishop;
import chess.model.pieces.Knight;
import chess.model.pieces.Pawn;
import chess.model.pieces.Queen;
import chess.model.pieces.Rook;
import chess.model.visitor.PawnIdentifier;
public class PromoteCommand extends PlayerCommand {
@@ -43,7 +43,7 @@ public class PromoteCommand extends PlayerCommand {
return CommandResult.NotAllowed;
Piece pawn = board.pieceAt(this.pieceCoords);
if (!new PawnIdentifier(game.getPlayerTurn()).isPawn(pawn))
if (!(pawn instanceof Pawn))
return CommandResult.NotAllowed;
int destY = this.pieceCoords.getY();