Fix bug that would not allow a piece move if you tried to take an opponents piece.

This commit is contained in:
Marco 2024-01-09 12:48:25 +01:00
parent 5bb658ca0f
commit ff34e052dc

View File

@ -27,12 +27,12 @@ class TapBloc extends Bloc<TapEvent, TapState> {
ChessPiece? piece; ChessPiece? piece;
if (ChessBloc.myColor != ChessBloc.turnColor) return; if (ChessBloc.myColor != ChessBloc.turnColor) return;
if (event.pieceOnSquare != null &&
ChessBloc.myColor != event.pieceOnSquare!.color) return;
if (state.firstSquareTapped == null) { if (state.firstSquareTapped == null) {
//first tap //first tap
if (event.pieceOnSquare == null) return; if (event.pieceOnSquare == null) return;
if (event.pieceOnSquare != null &&
ChessBloc.myColor != event.pieceOnSquare!.color) return;
firstTappedSquare = event.tapped; firstTappedSquare = event.tapped;
piece = event.pieceOnSquare; piece = event.pieceOnSquare;
} else { } else {