From 9715a7aa1decd42366e80b646d6fd3760fff03ea Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Mon, 8 Jun 2020 01:14:17 +0200
Subject: [PATCH] Fix capturing promotions in Absorption variant

---
 client/src/variants/Absorption.js | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/client/src/variants/Absorption.js b/client/src/variants/Absorption.js
index 7a9ff3c5..b10f1653 100644
--- a/client/src/variants/Absorption.js
+++ b/client/src/variants/Absorption.js
@@ -80,6 +80,15 @@ export class AbsorptionRules extends ChessRules {
       default:
         moves = super.getPotentialMovesFrom(sq);
     }
+    // Filter out capturing promotions (except one),
+    // because they are all the same.
+    moves = moves.filter(m => {
+      return (
+        m.vanish.length == 1 ||
+        m.vanish[0].p != V.PAWN ||
+        [V.PAWN, V.QUEEN].includes(m.appear[0].p)
+      );
+    });
     moves.forEach(m => {
       if (m.vanish.length == 2) {
         // Augment pieces abilities in case of captures
-- 
2.48.1