Several small improvements + integrate options + first working draft of Cwda
[vchess.git] / client / src / variants / Rookpawns.js
index abbd785..3ffa6fc 100644 (file)
@@ -1,6 +1,11 @@
 import { ChessRules } from "@/base_rules";
 
 export class RookpawnsRules extends ChessRules {
+
+  static get Options() {
+    return null;
+  }
+
   static get PawnSpecs() {
     return Object.assign(
       {},
@@ -36,8 +41,12 @@ export class RookpawnsRules extends ChessRules {
     }
     // Did a black pawn promote? Can the rook take it?
     const qIdx = this.board[7].findIndex(cell => cell[1] == V.QUEEN);
-    if (qIdx >= 0 && !super.isAttackedByRook([7, qIdx], 'w'))
+    if (
+      qIdx >= 0 &&
+      (this.turn == 'b' || !super.isAttackedByRook([7, qIdx], 'w'))
+    ) {
       return "0-1";
+    }
     if (!this.atLeastOneMove()) return "1/2";
     return "*";
   }
@@ -48,4 +57,5 @@ export class RookpawnsRules extends ChessRules {
   static get SEARCH_DEPTH() {
     return 4;
   }
+
 };