Pandemonium: promotion on last 2 ranks
[vchess.git] / client / src / base_rules.js
index aff4710..f7a2fee 100644 (file)
@@ -135,6 +135,14 @@ export const ChessRules = class ChessRules {
   static get LoseOnRepetition() {
     return false;
   }
+  // And in some others (Iceage), repetitions should be ignored:
+  static get IgnoreRepetition() {
+    return false;
+  }
+  loseOnRepetition() {
+    // In some variants, result depends on the position:
+    return V.LoseOnRepetition;
+  }
 
   // At some stages, some games could wait clicks only:
   onlyClick() {
@@ -761,9 +769,8 @@ export const ChessRules = class ChessRules {
       if (!!promotions) finalPieces = promotions;
       else if (!!V.PawnSpecs.promotions) finalPieces = V.PawnSpecs.promotions;
     }
-    let tr = null;
     for (let piece of finalPieces) {
-      tr = (piece != V.PAWN ? { c: color, p: piece } : null);
+      const tr = (piece != V.PAWN ? { c: color, p: piece } : null);
       moves.push(this.getBasicMove([x1, y1], [x2, y2], tr));
     }
   }