Several small improvements + integrate options + first working draft of Cwda
[vchess.git] / client / src / variants / Newzealand.js
index eb7d625..3d78cba 100644 (file)
@@ -3,6 +3,7 @@ import { ChessRules } from "@/base_rules";
 // NOTE: a lot copy-pasted from Hoppelpoppel
 export class NewzealandRules extends ChessRules {
 
+  // TODO: merge with base_rules.js
   getSlideNJumpMoves_([x, y], steps, oneStep, options) {
     options = options || {};
     let moves = [];
@@ -11,7 +12,7 @@ export class NewzealandRules 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];
       }
@@ -45,21 +46,12 @@ export class NewzealandRules extends ChessRules {
 
   isAttackedByKnight([x, y], color) {
     return super.isAttackedBySlideNJump(
-      [x, y],
-      color,
-      V.KNIGHT,
-      V.steps[V.ROOK]
-    );
+      [x, y], color, V.KNIGHT, V.steps[V.ROOK]);
   }
 
   isAttackedByRook([x, y], color) {
     return super.isAttackedBySlideNJump(
-      [x, y],
-      color,
-      V.ROOK,
-      V.steps[V.KNIGHT],
-      "oneStep"
-    );
+      [x, y], color, V.ROOK, V.steps[V.KNIGHT], 1);
   }
 
 };