X-Git-Url: https://git.auder.net/pieces/Checkered/cn.svg?a=blobdiff_plain;f=variants%2F_SpecialCaptures%2Fclass.js;h=0c2a30043c9fdd9747aad7aecb0991b2ebf2347d;hb=bc97fdd1302473b774cfb19e65dc3ed3ed388901;hp=9b482669af50939ff86486cacdde8ed0361e3549;hpb=a89fb4e9c92632a2e8295048a86d7a0ae0a7ec46;p=xogo.git diff --git a/variants/_SpecialCaptures/class.js b/variants/_SpecialCaptures/class.js index 9b48266..0c2a300 100644 --- a/variants/_SpecialCaptures/class.js +++ b/variants/_SpecialCaptures/class.js @@ -23,7 +23,7 @@ export default class AbstractSpecialCaptureRules extends ChessRules { addPincerCaptures(moves, byChameleon) { const steps = this.pieces()['p'].moves[0].steps; const color = this.turn; - const oppCol = C.GetOppCol(color); + const oppCol = C.GetOppTurn(color); moves.forEach(m => { if (byChameleon && m.start.x != m.end.x && m.start.y != m.end.y) // Chameleon not moving as pawn @@ -61,7 +61,7 @@ export default class AbstractSpecialCaptureRules extends ChessRules { addCoordinatorCaptures(moves, byChameleon) { const color = this.turn; - const oppCol = V.GetOppCol(color); + const oppCol = V.GetOppTurn(color); const kp = this.searchKingPos(color)[0]; moves.forEach(m => { // Check piece-king rectangle (if any) corners for enemy pieces @@ -91,7 +91,7 @@ export default class AbstractSpecialCaptureRules extends ChessRules { // Look in every direction for captures const steps = this.pieces()['r'].moves[0].steps; const color = this.turn; - const oppCol = C.GetOppCol(color); + const oppCol = C.GetOppTurn(color); let moves = []; outerLoop: for (let step of steps) { let [i, j] = [x + step[0], this.getY(y + step[1])]; @@ -112,7 +112,7 @@ export default class AbstractSpecialCaptureRules extends ChessRules { [i, j] = [i + step[0], this.getY(j + step[1])]; while (this.onBoard(i, j) && this.board[i][j] == "") { let mv = this.getBasicMove([x, y], [i, j]); - Array.prorotype.push.apply(mv.vanish, vanished); + Array.prototype.push.apply(mv.vanish, vanished); moves.push(mv); [i, j] = [i + step[0], this.getY(j + step[1])]; } @@ -133,7 +133,7 @@ export default class AbstractSpecialCaptureRules extends ChessRules { getChameleonCaptures(moves, pushPullType, onlyOneJump) { const [x, y] = [moves[0].start.x, moves[0].start.y]; moves = moves.concat( - this.getKnightCaptures([x, y], "asChameleon", onlyOneJump)); + this.getLeaperCaptures([x, y], "asChameleon", onlyOneJump)); // No "king capture" because king cannot remain under check this.addPincerCaptures(moves, "asChameleon"); this.addCoordinatorCaptures(moves, "asChameleon"); @@ -160,7 +160,7 @@ export default class AbstractSpecialCaptureRules extends ChessRules { const adjacentSteps = this.pieces()['r'].moves[0].steps; let capturingPullDir = {}; const color = this.turn; - const oppCol = C.GetOppCol(color); + const oppCol = C.GetOppTurn(color); if (type != "push") { adjacentSteps.forEach(step => { const [bi, bj] = [sx - step[0], this.getY(sy - step[1])]; @@ -177,8 +177,8 @@ export default class AbstractSpecialCaptureRules extends ChessRules { moves.forEach(m => { const [ex, ey] = [m.end.x, m.end.y]; const step = [ - ex != x ? (ex - x) / Math.abs(ex - x) : 0, - ey != y ? (ey - y) / Math.abs(ey - y) : 0 + ex != sx ? (ex - sx) / Math.abs(ex - sx) : 0, + ey != sy ? (ey - sy) / Math.abs(ey - sy) : 0 ]; let vanishPull, vanishPush; if (type != "pull") { @@ -194,7 +194,7 @@ export default class AbstractSpecialCaptureRules extends ChessRules { } } if (capturingPullDir[step[0] + "." + step[1]]) { - const [bi, bj] = [x - step[0], this.getY(y - step[1])]; + const [bi, bj] = [sx - step[0], this.getY(sy - step[1])]; vanishPull = new PiPo({x: bi, y: bj, p: this.getPiece(bi, bj), c: oppCol}); }