X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FCrazyhouse.js;h=a133b275703773f5e772b00b2c7797eca4b604fe;hb=fef153df51fe60a5af4c5b2a05e0b1177187bf62;hp=321bf4cf6d465dc1f1c9c792f5fb3361b83ec044;hpb=32f6285ee325a14286562a53baefc647201df2af;p=vchess.git diff --git a/client/src/variants/Crazyhouse.js b/client/src/variants/Crazyhouse.js index 321bf4cf..a133b275 100644 --- a/client/src/variants/Crazyhouse.js +++ b/client/src/variants/Crazyhouse.js @@ -22,17 +22,13 @@ export class CrazyhouseRules extends ChessRules { static ParseFen(fen) { const fenParts = fen.split(" "); - return Object.assign(ChessRules.ParseFen(fen), { - reserve: fenParts[5], - promoted: fenParts[6] - }); - } - - getEpSquare(moveOrSquare) { - if (typeof moveOrSquare !== "object" || moveOrSquare.vanish.length > 0) - return super.getEpSquare(moveOrSquare); - // Landing move: no en-passant - return undefined; + return Object.assign( + ChessRules.ParseFen(fen), + { + reserve: fenParts[5], + promoted: fenParts[6] + } + ); } static GenRandInitFen(randomness) { @@ -202,7 +198,8 @@ export class CrazyhouseRules extends ChessRules { postPlay(move) { super.postPlay(move); - if (move.vanish.length == 2 && move.appear.length == 2) return; //skip castle + // Skip castle: + if (move.vanish.length == 2 && move.appear.length == 2) return; const color = move.appear[0].c; if (move.vanish.length == 0) { this.reserve[color][move.appear[0].p]--;