Merge branch 'main' of https://gitarero.ecam.fr/romain.murphy/OOP_2B1_Project.git into main
This commit is contained in:
commit
0b6afd2ef2
|
|
@ -209,6 +209,9 @@ public class Board {
|
||||||
if (movedPiece != null) {
|
if (movedPiece != null) {
|
||||||
movedPiece.setMoved(true);
|
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 (board.get(y).get(x).getType() == PieceType.King && board.get(y).get(x).isWhite == turnColor){
|
||||||
if (kingCheck.isKingInCheck(board,turnColor)) {
|
if (kingCheck.isKingInCheck(board,turnColor)) {
|
||||||
out = true;
|
out = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package backend;
|
package backend;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class KingCheck {
|
public class KingCheck {
|
||||||
|
private SoundEffect soundEffect = new SoundEffect ();
|
||||||
public ArrayList<ArrayList<Boolean>> getLegalMoves(Piece piece, ArrayList<ArrayList<Piece>> board, Move lastMove) {
|
public ArrayList<ArrayList<Boolean>> getLegalMoves(Piece piece, ArrayList<ArrayList<Piece>> board, Move lastMove) {
|
||||||
ArrayList<ArrayList<Boolean>> rawMoves = piece.getPossibleMoves(board,lastMove);
|
ArrayList<ArrayList<Boolean>> rawMoves = piece.getPossibleMoves(board,lastMove);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue