Fix games ordering in MyGames, fix en-passant mistake in Rifle variant
[vchess.git] / client / src / variants / Crazyhouse.js
index d677823..ff705c7 100644 (file)
@@ -28,6 +28,13 @@ export const VariantRules = class CrazyhouseRules extends ChessRules {
     });
   }
 
+  getEpSquare(moveOrSquare) {
+    if (typeof moveOrSquare !== "object" || move.vanish.length > 0)
+      return super.getEpSquare(moveOrSquare);
+    // Landing move: no en-passant
+    return undefined;
+  }
+
   static GenRandInitFen(randomness) {
     return ChessRules.GenRandInitFen(randomness) + " 0000000000 -";
   }
@@ -118,6 +125,14 @@ export const VariantRules = class CrazyhouseRules extends ChessRules {
   getReservePpath(index, color) {
     return color + V.RESERVE_PIECES[index];
   }
+//  // Version if some day I have pieces with numbers printed on it:
+//  getReservePpath(index, color) {
+//    return (
+//      "Crazyhouse/" +
+//      color + V.RESERVE_PIECES[index] +
+//      "_" + this.vr.reserve[playingColor][V.RESERVE_PIECES[i]]
+//    );
+//  }
 
   // Ordering on reserve pieces
   static get RESERVE_PIECES() {