Pandemonium 1 & 2, Stealthbomb 1 & 2
[vchess.git] / client / src / variants / Stealthbomb2.js
diff --git a/client/src/variants/Stealthbomb2.js b/client/src/variants/Stealthbomb2.js
new file mode 100644 (file)
index 0000000..613a5c2
--- /dev/null
@@ -0,0 +1,27 @@
+import { Move, PiPo } from "@/base_rules";
+import { Stealthbomb1Rules } from "@/variants/Stealthbomb1";
+
+export class Stealthbomb2Rules extends Stealthbomb1Rules {
+
+  // Initiate the game by choosing a square for the bomb:
+  doClick(square) {
+    const c = this.turn;
+    if (
+      this.movesCount >= 2 ||
+      (
+        (c == 'w' && square[0] != 6) ||
+        (c == 'b' && square[0] != 1)
+      )
+    ) {
+      return null;
+    }
+    const [x, y] = square;
+    return new Move({
+      appear: [ new PiPo({ x: x, y: y, c: c, p: 's' }) ],
+      vanish: [ new PiPo({ x: x, y: y, c: c, p: 'p' }) ],
+      start: { x: -1, y: -1 },
+      end: { x: x, y: y, noHighlight: true }
+    });
+  }
+
+};