X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FKnightrelay1.js;h=0afa9aa21793342f2d23aeb93cafa2e065471d99;hb=9a7a1ccca45d083f50d92bc15cd389c14149b50a;hp=aba952905069a08367310accc078c9a4da5139f9;hpb=157a72c805261f68aa1adcd4776debf965d7e6cd;p=vchess.git diff --git a/client/src/variants/Knightrelay1.js b/client/src/variants/Knightrelay1.js index aba95290..0afa9aa2 100644 --- a/client/src/variants/Knightrelay1.js +++ b/client/src/variants/Knightrelay1.js @@ -73,7 +73,7 @@ export class Knightrelay1Rules extends ChessRules { // Check if a (non-knight) piece at knight distance // is guarded by a knight (and thus attacking) - // --> Except for pawns targetting last rank. + // --> Except for kings, and pawns targetting last rank. const x = sq[0], y = sq[1]; // Last rank for me, that is to say oppCol of color: @@ -84,7 +84,10 @@ export class Knightrelay1Rules extends ChessRules { this.getColor(x+step[0],y+step[1]) == color ) { const piece = this.getPiece(x+step[0],y+step[1]); - if (piece != V.KNIGHT && (piece != V.PAWN || x != lastRank)) { + if ( + ![V.KNIGHT, V.KING].includes(piece) && + (piece != V.PAWN || x != lastRank) + ) { for (const step2 of V.steps[V.KNIGHT]) { const xx = x+step[0]+step2[0], yy = y+step[1]+step2[1];