X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FRococo.js;h=0cfb5dc7aa7d53915a520e1918a7e5965538eedf;hp=8489ae903248e725bf7ede90bc5bd517860b26b2;hb=e90bafa8fb5fb7641728231bf2398590d96c672a;hpb=2f8dce6a81063289d9d4cbca7971f80b1b194b84 diff --git a/client/src/variants/Rococo.js b/client/src/variants/Rococo.js index 8489ae90..0cfb5dc7 100644 --- a/client/src/variants/Rococo.js +++ b/client/src/variants/Rococo.js @@ -131,8 +131,9 @@ export class RococoRules extends ChessRules { getPotentialMovesFrom([x, y]) { // Pre-check: is thing on this square immobilized? const imSq = this.isImmobilized([x, y]); - if (!!imSq) { - // Only option is suicide: + const piece = this.getPiece(x, y); + if (!!imSq && piece != V.KING) { + // Only option is suicide, if I'm not a king: return [ new Move({ start: { x: x, y: y }, @@ -150,7 +151,7 @@ export class RococoRules extends ChessRules { ]; } let moves = []; - switch (this.getPiece(x, y)) { + switch (piece) { case V.IMMOBILIZER: moves = this.getPotentialImmobilizerMoves([x, y]); break;