From: Benjamin Auder Date: Mon, 4 Jan 2021 17:43:18 +0000 (+0100) Subject: [Paco-Sako] At least forbid to castle when under direct check X-Git-Url: https://git.auder.net/doc/html/index.html?a=commitdiff_plain;h=231bba397e6ed8aa2c06ba0568f47419b5d16a10;p=vchess.git [Paco-Sako] At least forbid to castle when under direct check --- diff --git a/client/src/variants/Pacosako.js b/client/src/variants/Pacosako.js index 2048d2c0..b88f2e3b 100644 --- a/client/src/variants/Pacosako.js +++ b/client/src/variants/Pacosako.js @@ -405,6 +405,23 @@ export class PacosakoRules extends ChessRules { return moves; } + getPotentialKingMoves(sq) { + let moves = this.getSlideNJumpMoves( + sq, + V.steps[V.ROOK].concat(V.steps[V.BISHOP]), + "oneStep" + ); + const c = this.turn; + const oppCol = V.GetOppCol(c); + if ( + !this.isAttacked(this.kingPos[c], oppCol) && + this.castleFlags[c].some(v => v < V.size.y) + ) { + moves = moves.concat(super.getCastleMoves(sq, null, true)); + } + return moves; + } + getEpSquare(moveOrSquare) { if (typeof moveOrSquare === "string") { const square = moveOrSquare;