Add Diamond Chess
[vchess.git] / client / src / variants / Alice.js
index 3fd02a3..15e629a 100644 (file)
@@ -173,18 +173,9 @@ export class AliceRules extends ChessRules {
         m.vanish.length == 2 &&
         this.board[m.end.x][m.end.y] == V.EMPTY
       ) {
-        m.vanish[1].c = V.GetOppCol(this.getColor(x, y));
-        // In the special case of en-passant, if
-        //  - board1 takes board2 : vanish[1] --> Alice
-        //  - board2 takes board1 : vanish[1] --> normal
-        let van = m.vanish[1];
-        if (mirrorSide == 1 && codes.includes(this.getPiece(van.x, van.y)))
-          van.p = V.ALICE_CODES[van.p];
-        else if (
-          mirrorSide == 2 &&
-          pieces.includes(this.getPiece(van.x, van.y))
-        )
-          van.p = V.ALICE_PIECES[van.p];
+        m.vanish[1].c = V.GetOppCol(this.turn);
+        const [epX, epY] = [m.vanish[1].x, m.vanish[1].y];
+        m.vanish[1].p = this.getPiece(epX, epY);
       }
       return true;
     });