X-Git-Url: https://git.auder.net/assets/icon_infos.svg?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FOtage.js;h=9eb900a4d86837ccc05321cbd65c17c322936f68;hb=259035ec507062fdfc7158ac62b68c722404bfdf;hp=742c6ee19e02c0cf6217be9fa9ac48e17da2bb55;hpb=d2af3400944331ffd0c770f83857257c2f48e487;p=vchess.git diff --git a/client/src/variants/Otage.js b/client/src/variants/Otage.js index 742c6ee1..9eb900a4 100644 --- a/client/src/variants/Otage.js +++ b/client/src/variants/Otage.js @@ -255,7 +255,14 @@ export class OtageRules extends ChessRules { // Transformation computed without taking union into account const up = this.getUnionPieces(initColor, initPiece); let args = [tr.p, up[oppCol]]; - if (['a', 'v'].includes(initColor)) args = args.reverse(); + if ( + ['a', 'v'].includes(initColor) || + // HACK: "ba" piece = two pawns, black controling. + // If promoting, must artificially imagine color was 'a': + (initPiece == 'a' && initColor == 'b') + ) { + args = args.reverse(); + } const capturer = (['a', 'b'].includes(initColor) ? 'b' : 'w'); const cp = this.getUnionCode(args[0], args[1], capturer); tr.c = cp.c; @@ -657,7 +664,7 @@ export class OtageRules extends ChessRules { r.piece == newState.piece && ( r.square.x == newState.square.x && - r.square.y == newState.square.y && + r.square.y == newState.square.y ) && r.position == newState.position );