X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fbase_rules.js;h=29b3af60525973b19661f03f9d4c1d1f61ece765;hp=fad1853a8ace34de286274ebb413220ebc6a5718;hb=c583ef1c1dfd19aee88b22c2175202fbdf4dc1c0;hpb=f1c9d7072d253ba55a941f97a99eee7e394577ed diff --git a/client/src/base_rules.js b/client/src/base_rules.js index fad1853a..29b3af60 100644 --- a/client/src/base_rules.js +++ b/client/src/base_rules.js @@ -750,12 +750,13 @@ export const ChessRules = class ChessRules { // What are the king moves from square x,y ? getPotentialKingMoves(sq) { // Initialize with normal moves - const moves = this.getSlideNJumpMoves( + let moves = this.getSlideNJumpMoves( sq, V.steps[V.ROOK].concat(V.steps[V.BISHOP]), "oneStep" ); - return moves.concat(this.getCastleMoves(sq)); + if (V.HasCastle) moves = moves.concat(this.getCastleMoves(sq)); + return moves; } getCastleMoves([x, y]) {