X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FPacosako.js;h=b88f2e3b4a7d89c8cd4452109ff1ad8d69b79942;hb=231bba397e6ed8aa2c06ba0568f47419b5d16a10;hp=2048d2c052db73819d9b1c4875e0ff0380dfb1fc;hpb=affde3c70a1cd0770688c95ceb4f00c1bd5ac149;p=vchess.git 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;