Almost added TitanChess + EvolutionChess
[vchess.git] / client / src / variants / Orda.js
index 4d911f4..308ae2f 100644 (file)
@@ -3,6 +3,7 @@ import { ArrayFun } from "@/utils/array";
 import { randInt } from "@/utils/alea";
 
 export class OrdaRules extends ChessRules {
+
   static get PawnSpecs() {
     return Object.assign(
       {},
@@ -143,7 +144,7 @@ export class OrdaRules extends ChessRules {
       let j = y + step[1];
       while (V.OnBoard(i, j) && this.board[i][j] == V.EMPTY) {
         if (!options.onlyTake) moves.push(this.getBasicMove([x, y], [i, j]));
-        if (oneStep) continue outerLoop;
+        if (!!oneStep) continue outerLoop;
         i += step[0];
         j += step[1];
       }
@@ -212,8 +213,8 @@ export class OrdaRules extends ChessRules {
   getPotentialYurtMoves(sq) {
     return this.getSlideNJumpMoves(
       sq,
-      V.steps[V.BISHOP].concat([1, 0]),
-      "oneSTep"
+      V.steps[V.BISHOP].concat([ [1, 0] ]),
+      "oneStep"
     );
   }
 
@@ -234,13 +235,14 @@ export class OrdaRules extends ChessRules {
         this.isAttackedByKheshig(sq, color)
       );
     }
-    // Horde: only pawn and queen (if promotions) in common:
+    // Horde: only pawn, king and queen (if promotions) in common:
     return (
       super.isAttackedByPawn(sq, color) ||
       this.isAttackedByLancer(sq, color) ||
       this.isAttackedByKheshig(sq, color) ||
       this.isAttackedByArcher(sq, color) ||
       this.isAttackedByYurt(sq, color) ||
+      super.isAttackedByKing(sq, color) ||
       super.isAttackedByQueen(sq, color)
     );
   }
@@ -268,7 +270,7 @@ export class OrdaRules extends ChessRules {
       sq,
       color,
       V.YURT,
-      V.steps[V.BISHOP].concat([1, 0]),
+      V.steps[V.BISHOP].concat([ [1, 0] ]),
       "oneStep"
     );
   }
@@ -320,4 +322,5 @@ export class OrdaRules extends ChessRules {
       }
     );
   }
+
 };