Draft code reorganisation (+ fix Alice rules + stateless VariantRules object)
[vchess.git] / public / javascripts / variants / Crazyhouse.js
index f36bfcc..3d9c743 100644 (file)
@@ -29,8 +29,8 @@ class CrazyhouseRules extends ChessRules
                return Object.assign(
                        ChessRules.ParseFen(fen),
                        {
-                               reserve: fenParts[4],
-                               promoted: fenParts[5],
+                               reserve: fenParts[5],
+                               promoted: fenParts[6],
                        }
                );
        }
@@ -212,7 +212,7 @@ class CrazyhouseRules extends ChessRules
                super.updateVariables(move);
                if (move.vanish.length == 2 && move.appear.length == 2)
                        return; //skip castle
-               const color = this.turn;
+               const color = move.appear[0].c;
                if (move.vanish.length == 0)
                {
                        this.reserve[color][move.appear[0].p]--;