This commit is contained in:
Romain MURPHY 2025-05-07 20:50:00 +02:00
commit 0b6afd2ef2
2 changed files with 5 additions and 1 deletions

View File

@ -209,6 +209,9 @@ public class Board {
if (movedPiece != null) {
movedPiece.setMoved(true);
}
if (kingCheck.isKingInCheck(board,turnColor) || kingCheck.isKingInCheck(board,!turnColor)) {
soundEffect.checkSound();
}
}
}
@ -252,6 +255,7 @@ public class Board {
if (board.get(y).get(x).getType() == PieceType.King && board.get(y).get(x).isWhite == turnColor){
if (kingCheck.isKingInCheck(board,turnColor)) {
out = true;
}
}
}

View File

@ -1,8 +1,8 @@
package backend;
import java.util.ArrayList;
public class KingCheck {
private SoundEffect soundEffect = new SoundEffect ();
public ArrayList<ArrayList<Boolean>> getLegalMoves(Piece piece, ArrayList<ArrayList<Piece>> board, Move lastMove) {
ArrayList<ArrayList<Boolean>> rawMoves = piece.getPossibleMoves(board,lastMove);