Add Giveaway. Preparing for Chakart a little more
[xogo.git] / variants / Atomic / class.js
index 7cac4e5..5c73de2 100644 (file)
@@ -7,45 +7,26 @@ export default class AtomicRules extends ChessRules {
   static get Options() {
     return {
       select: C.Options.select,
-      check: [
+      input: [
         {
           label: "Balanced",
-          defaut: false,
-          variable: "rempawn"
-        },
-        {
-          label: "Falling pawn",
-          defaut: false,
-          variable: "pawnfall"
+          variable: "rempawn",
+          type: "checkbox",
+          defaut: false
         }
-      ],
+      ].concat(C.Options.input.filter(i => i.variable == "pawnfall")),
       styles: C.Options.styles.filter(s => s != "atomic")
     };
   }
 
   constructor(o) {
+    o.options["atomic"] = true;
     super(o);
-    this.options.atomic = true;
-  }
-
-  genRandInitFen(seed) {
-    return super.genRandInitFen(seed).slice(0, -1) + ',"rempawn":' + (this.options.rempawn ? "1" : "0") + "}";
-  }
-
-  // TODO: capture king option doesn't make sense
-
-  setOtherVariables(fenParsed) {
-    super.setOtherVariables(fenParsed);
-    this.options["rempawn"] = (fenParsed.rempawn == 1);
-  }
-
-  getFen() {
-    return super.getFen().slice(0, -1) + ',"rempawn":' + (this.options["rempawn"] ? "1" : "0") + "}";
   }
 
   canIplay(x, y) {
     if (this.options["rempawn"] && this.movesCount == 0)
-      return (this.turn == side && this.getPiece(x, y) == "p");
+      return (this.playerColor == this.turn && this.getPiece(x, y) == "p");
     return super.canIplay(x, y);
   }