Almost added TitanChess + EvolutionChess
[vchess.git] / client / src / variants / Gridolina.js
index fd43be3..6efff14 100644 (file)
@@ -2,6 +2,7 @@ import { ChessRules } from "@/base_rules";
 import { BerolinaRules } from "@/variants/Berolina";
 
 export class GridolinaRules extends BerolinaRules {
+
   static get Lines() {
     return [
       [[2, 0], [2, 8]],
@@ -34,4 +35,25 @@ export class GridolinaRules extends BerolinaRules {
       })
     );
   }
+
+  isAttackedBySlideNJump([x, y], color, piece, steps, oneStep) {
+    for (let step of steps) {
+      let rx = x + step[0],
+          ry = y + step[1];
+      while (V.OnBoard(rx, ry) && this.board[rx][ry] == V.EMPTY && !oneStep) {
+        rx += step[0];
+        ry += step[1];
+      }
+      if (
+        V.OnBoard(rx, ry) &&
+        this.getPiece(rx, ry) == piece &&
+        this.getColor(rx, ry) == color &&
+        V.OnDifferentGrids([x, y], [rx, ry])
+      ) {
+        return true;
+      }
+    }
+    return false;
+  }
+
 };