PROBABLY WON'T FIX:
 Embedded rules language not updated when language is set (in Analyse, Game and Problems)
-If new live game starts in background, "new game" notify OK but not first move (not too serious however)
+If new live game starts in background, "new game" notify OK but not first move.
 
 NEW VARIANTS:
+https://www.chessvariants.com/incinf.dir/bario.html
+https://www.chessvariants.com/mvopponent.dir/avalanche.html
 https://www.pychess.org/variant/manchu
 https://www.pychess.org/variant/dobutsu
 https://musketeerchess.net/games/musketeer/index.php Attention règle de promotion + SVG / PNG
 https://www.reddit.com/r/TotemChess/comments/imi3v7/totem_rules/
 https://www.chessvariants.com/other.dir/fugue.html
 https://www.chessvariants.com/rules/spartan-chess
-https://www.chessvariants.com/mvopponent.dir/avalanche.html
 https://www.chessvariants.com/mvopponent.dir/hypnotic-chess.html
 https://www.chessvariants.com/mvopponent.dir/mesmer-chess.html
 https://brainking.com/en/GameRules?tp=47&fwa=ArchivedGame!g=8204276$i=1
 https://boardgamegeek.com/boardgame/18661/alapo
 Alapo is a strategy game. Each player owns twelve abstract pieces, two each of six different kinds. Round pieces move in any of the eight directions on the 6 by 6 board; square pieces move only orthogonally and triangular pieces only diagonally. Large pieces move any distance, small pieces only one field per turn.
 Opponent pieces can be eliminated by moving onto their position. The goal is to reach the opponent's base line with one of your pieces without the opponent being able to eliminate your piece in his/her next move.
-https://www.chessvariants.com/incinf.dir/bario.html
 https://discord.com/channels/686736099959504907/687076968046395410/735678637432635473 + Amazon Chess
 Maybe:
 https://www.chessvariants.com/diffmove.dir/asymmetric.html
 
     castlingCheck: for (let castleSide = 0; castleSide < 2; castleSide++) {
       if (this.castleFlags[c][castleSide] >= 8) continue;
       const rookPos = this.castleFlags[c][castleSide];
+      const castlingColor = this.board[x][rookPos].charAt(0);
+      const castlingPiece = this.board[x][rookPos].charAt(1);
 
       // Nothing on the path of the king ?
       const finDist = finalSquares[castleSide][0] - y;
             new PiPo({
               x: x,
               y: finalSquares[castleSide][1],
-              p: V.ROOK,
-              c: c
+              p: castlingPiece,
+              c: castlingColor
             })
           ],
           vanish: [
             // King might be initially disguised (Titan...)
             new PiPo({ x: x, y: y, p: V.KING, c: c }),
-            new PiPo({ x: x, y: rookPos, p: V.ROOK, c: c })
+            new PiPo({ x: x, y: rookPos, p: castlingPiece, c: castlingColor })
           ],
           end:
             Math.abs(y - rookPos) <= 2
     return moves;
   }
 
+  getEnpassantCaptures(sq, shiftX) {
+    // HACK: when artificially change turn, do not consider en-passant
+    const mcMod2 = this.movesCount % 2;
+    const c = this.turn;
+    if ((c == 'w' && mcMod2 == 1) || (c == 'b' && mcMod2 == 0)) return [];
+    return super.getEnpassantCaptures(sq, shiftX);
+  }
+
   isAttacked_aux(files, color, positions, fromSquare, released) {
     // "positions" = array of FENs to detect infinite loops. Example:
     // r1q1k2r/p1Pb1ppp/5n2/1f1p4/AV5P/P1eDP3/3B1PP1/R3K1NR,
     this.postPlay(move);
   }
 
+  updateCastleFlags(move, piece) {
+    const c = V.GetOppCol(this.turn);
+    const firstRank = (c == "w" ? 7 : 0);
+    const oppCol = this.turn;
+    const oppFirstRank = 7 - firstRank;
+    if (piece == V.KING && move.appear.length > 0)
+      this.castleFlags[c] = [V.size.y, V.size.y];
+    else if (
+      move.start.x == firstRank &&
+      this.castleFlags[c].includes(move.start.y)
+    ) {
+      const flagIdx = (move.start.y == this.castleFlags[c][0] ? 0 : 1);
+      this.castleFlags[c][flagIdx] = V.size.y;
+    }
+    // No more checking: a rook in union can take part in castling.
+  }
+
   postPlay(move) {
     if (move.vanish.length == 0)
       // A released piece just moved. Cannot be the king.