Fix PocketKnight + add Screen variant
[vchess.git] / client / src / variants / Pocketknight.js
index 8756ab9..f40265e 100644 (file)
@@ -45,6 +45,12 @@ export class PocketknightRules extends ChessRules {
     );
   }
 
+  canIplay(side, [x, y]) {
+    if (this.subTurn == 1) return super.canIplay(side, [x, y]);
+    // subturn == 2, drop the knight:
+    return side == this.turn && this.board[x][y] == V.EMPTY;
+  }
+
   getPotentialMovesFrom([x, y]) {
     if (this.subTurn == 1) {
       let moves = super.getPotentialMovesFrom([x, y]);