From 78a75d54a18dec6dcedeeba98e5f67645d2edd51 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Thu, 21 May 2020 11:06:17 +0200
Subject: [PATCH] Fix Koopa promotions after stunning pieces

---
 client/src/variants/Koopa.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/client/src/variants/Koopa.js b/client/src/variants/Koopa.js
index 3f2e855a..c7b0859f 100644
--- a/client/src/variants/Koopa.js
+++ b/client/src/variants/Koopa.js
@@ -184,7 +184,10 @@ export class KoopaRules extends ChessRules {
             m.appear[0].x = i;
             m.appear[0].y = j;
             // Is it a pawn on last rank?
-            if ((color == 'w' && i == 0) || (color == 'b' && i == 7)) {
+            if (
+              m.appear[0].p == V.PAWN &&
+              ((color == 'w' && i == 0) || (color == 'b' && i == 7))
+            ) {
               m.appear[0].p = V.ROOK;
               for (let ppiece of [V.KNIGHT, V.BISHOP, V.QUEEN]) {
                 let mp = JSON.parse(JSON.stringify(m));
-- 
2.44.0