From: Benjamin Auder <benjamin.auder@somewhere>
Date: Thu, 11 Jun 2020 08:35:16 +0000 (+0200)
Subject: Fix Absorption and Chakart variants
X-Git-Url: https://git.auder.net/%7B%7B%20asset%28%27mixstore/css/user/doc/pieces/cb.svg?a=commitdiff_plain;h=f4221ff17c58c277660865a11bf6358268fbda10;p=vchess.git

Fix Absorption and Chakart variants
---

diff --git a/client/src/variants/Absorption.js b/client/src/variants/Absorption.js
index b10f1653..64c03e68 100644
--- a/client/src/variants/Absorption.js
+++ b/client/src/variants/Absorption.js
@@ -49,8 +49,8 @@ export class AbsorptionRules extends ChessRules {
       // p1 or p2 already have knight + other piece
       return (p1 == V.KNIGHT ? p2 : p1);
     }
+    if ([p1, p2].includes(V.QN)) return V.QN;
     for (let p of [p1, p2]) {
-      if (p == V.QN) return V.QN;
       if ([V.BN, V.RN].includes(p))
         return V.MergeComposed[[p1, p2].sort().join("")];
     }
diff --git a/client/src/variants/Chakart.js b/client/src/variants/Chakart.js
index 1d12e42e..669ade11 100644
--- a/client/src/variants/Chakart.js
+++ b/client/src/variants/Chakart.js
@@ -394,7 +394,7 @@ export class ChakartRules extends ChessRules {
       return (
         V.OnBoard(x + forward, y) &&
         (
-          this.board[x + forward][y] != oppCol ||
+          this.board[x + forward][y] == V.EMPTY ||
           (
             V.OnBoard(x + forward, y + 1) &&
             this.board[x + forward][y + 1] != V.EMPTY &&
diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue
index fa7ab3b2..776b9eaf 100644
--- a/client/src/views/Game.vue
+++ b/client/src/views/Game.vue
@@ -1524,7 +1524,6 @@ console.log(data.data);
       };
       if (
         this.game.type == "corr" &&
-        V.CorrConfirm &&
         moveCol == this.game.mycolor &&
         !data.receiveMyMove
       ) {
@@ -1540,6 +1539,10 @@ console.log(data.data);
             if (data.score == "*") this.re_setClocks();
           }
         };
+        if (!V.CorrConfirm) {
+          afterSetScore();
+          return;
+        }
         let el = document.querySelector("#buttonsConfirm > .acceptBtn");
         // We may play several moves in a row: in case of, remove listener:
         let elClone = el.cloneNode(true);