From 6f74b81a893da23181f30e2ef1e68bde8a5476cd Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Thu, 21 Apr 2022 10:02:33 +0200
Subject: [PATCH] Doublemove ok. Still some random issues with animation

---
 base_rules.js                  |  8 +++++++-
 common.css                     |  5 +++++
 variants.js                    |  2 +-
 variants/Atomic/class.js       | 17 +----------------
 variants/Benedict/rules.html   |  6 +++++-
 variants/Chakart/rules.html    |  2 ++
 variants/Dark/rules.html       |  2 ++
 variants/Doublemove/rules.html |  4 ++--
 variants/Zen/rules.html        |  2 ++
 9 files changed, 27 insertions(+), 21 deletions(-)

diff --git a/base_rules.js b/base_rules.js
index 0dfe217..6efce02 100644
--- a/base_rules.js
+++ b/base_rules.js
@@ -2124,7 +2124,13 @@ export default class ChessRules {
         (this.options["progressive"] && this.subTurn <= this.movesCount)
       ) {
         const oppKingPos = this.searchKingPos(oppCol);
-        if (oppKingPos[0] >= 0 && !this.underCheck(oppKingPos, color)) {
+        if (
+          oppKingPos[0] >= 0 &&
+          (
+            this.options["taking"] ||
+            !this.underCheck(oppKingPos, color)
+          )
+        ) {
           this.subTurn++;
           return;
         }
diff --git a/common.css b/common.css
index 6450242..91fd2a6 100644
--- a/common.css
+++ b/common.css
@@ -52,6 +52,11 @@ main > div {
   }
 }
 
+.author {
+  color: darkblue;
+  font-style: italic;
+}
+
 #boardContainer {
   margin: 0;
   padding: 0;
diff --git a/variants.js b/variants.js
index 6daa94b..879b139 100644
--- a/variants.js
+++ b/variants.js
@@ -18,7 +18,7 @@ const variants = [
 //  { name: 'Bario', desc: 'A quantum story' },
   {name: "Balanced", desc: "balanced chess"},
 //  { name: 'Baroque', desc: 'Exotic captures' },*/
-//  { name: "Benedict", desc: "Change colors" },
+  { name: "Benedict", desc: "Change colors" },
 //  { name: 'Berolina', desc: 'Pawns move diagonally' },
 //  { name: 'Bicolour', desc: 'Harassed kings' },
 //  { name: 'Bishopawns', desc: 'Bishop versus pawns', disp: 'Bishop-Pawns' },
diff --git a/variants/Atomic/class.js b/variants/Atomic/class.js
index 7cac4e5..ad2e9a1 100644
--- a/variants/Atomic/class.js
+++ b/variants/Atomic/class.js
@@ -25,22 +25,7 @@ export default class AtomicRules extends ChessRules {
 
   constructor(o) {
     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") + "}";
+    this.options["atomic"] = true;
   }
 
   canIplay(x, y) {
diff --git a/variants/Benedict/rules.html b/variants/Benedict/rules.html
index 0211f6b..1a21c0c 100644
--- a/variants/Benedict/rules.html
+++ b/variants/Benedict/rules.html
@@ -1 +1,5 @@
-<a href="https://www.chessvariants.com/difftaking.dir/benedict.html">Benedict rules</a>.
+<p>After each move, all units attacked by the moving piece change color.</p>
+
+<p>Goal: change the enemy king's color.</p>
+
+<p class="author">William Daniel Troyka (2001).</p>
diff --git a/variants/Chakart/rules.html b/variants/Chakart/rules.html
index 7d3681f..c87be5c 100644
--- a/variants/Chakart/rules.html
+++ b/variants/Chakart/rules.html
@@ -6,3 +6,5 @@
   <li>Bombs redirect by one square diagonally.</li>
   <li>Eggs hide either a bonus or malus, as indicated...</li>
 </ul>
+
+<p class="author">Charlotte Blard &amp; Benjamin Auder (2020).</p>
diff --git a/variants/Dark/rules.html b/variants/Dark/rules.html
index 4fefa83..8716272 100644
--- a/variants/Dark/rules.html
+++ b/variants/Dark/rules.html
@@ -1,3 +1,5 @@
 <p>You only see what your pieces can reach and capture.</p>
 
 <p>Win by capturing the enemy king.</p>
+
+<p class="author">Jens Baek Nielsen (1997).</p>
diff --git a/variants/Doublemove/rules.html b/variants/Doublemove/rules.html
index 569f213..56054c8 100644
--- a/variants/Doublemove/rules.html
+++ b/variants/Doublemove/rules.html
@@ -1,3 +1,3 @@
-<p>Pieces capture enemy units which threaten them (normal captures are disabled).</p>
+<p>After the initial white move, each player moves twice on each turn.</p>
 
-<p>Exception: the king is attacked as usual.</p>
+<p class="author">Albert Fortis (1922).</p>
diff --git a/variants/Zen/rules.html b/variants/Zen/rules.html
index 569f213..1508496 100644
--- a/variants/Zen/rules.html
+++ b/variants/Zen/rules.html
@@ -1,3 +1,5 @@
 <p>Pieces capture enemy units which threaten them (normal captures are disabled).</p>
 
 <p>Exception: the king is attacked as usual.</p>
+
+<p class="author">Moe Moss (1970).</p>
-- 
2.44.0