X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FSwitching.js;h=b940d0a624dc9e061e8e08e1f525e82ffec748b8;hp=229c7b35b30512b564104215d43bcb87bf6e38e6;hb=0b8bd1214d662f6b1964f0807eda114ed1cac3c4;hpb=ff8100f795dc70eeb67120fd34573d9e62dc9d8f diff --git a/client/src/variants/Switching.js b/client/src/variants/Switching.js index 229c7b35..b940d0a6 100644 --- a/client/src/variants/Switching.js +++ b/client/src/variants/Switching.js @@ -76,6 +76,7 @@ export class SwitchingRules extends ChessRules { this.castleFlags[a.c] = [V.size.y, V.size.y]; } }); + const firstRank = (move.vanish[0].c == 'w' ? 7 : 0); for (let coords of [move.start, move.end]) { if ( Object.keys(firstRank).includes(coords.x) && @@ -106,7 +107,7 @@ export class SwitchingRules extends ChessRules { return super.getAllPotentialMoves().filter(m => { return ( m.appear.length == 1 || - (move.appear[0].p == V.KING && move.appear[1].p == V.ROOK) || + (m.appear[0].p == V.KING && m.appear[1].p == V.ROOK) || (m.appear[1].x <= m.vanish[1].x && m.appear[1].y <= m.vanish[1].y) ); });