Add Makpong, Hoppelpoppel, and Jangqi (rules unwritten yet)
[vchess.git] / client / src / variants / Makpong.js
diff --git a/client/src/variants/Makpong.js b/client/src/variants/Makpong.js
new file mode 100644 (file)
index 0000000..0576665
--- /dev/null
@@ -0,0 +1,14 @@
+import { MakrukRules } from "@/variants/Makruk";
+
+export class MakpongRules extends MakrukRules {
+
+  filterValid(moves) {
+    const color = this.turn;
+    if (this.underCheck(color)) {
+      // Filter out all moves involving king
+      return super.filterValid(moves.filter(m => m.vanish[0].p != V.KING));
+    }
+    return super.filterValid(moves);
+  }
+
+};