remove "instanceof Pawn"
This commit is contained in:
@@ -12,6 +12,7 @@ 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 {
|
||||
|
||||
@@ -39,7 +40,7 @@ public class PromoteCommand extends PlayerCommand {
|
||||
return CommandResult.NotAllowed;
|
||||
|
||||
Piece pawn = board.pieceAt(this.pieceCoords);
|
||||
if (pawn == null || !(pawn instanceof Pawn))
|
||||
if (!new PawnIdentifier(game.getPlayerTurn()).isPawn(pawn))
|
||||
return CommandResult.NotAllowed;
|
||||
|
||||
int destY = this.pieceCoords.getY();
|
||||
|
||||
Reference in New Issue
Block a user