X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FAvalanche.js;h=db024597fb8e9122dc85ced5a6753336d54bdacf;hb=HEAD;hp=edeb5648d8279d6c6017eb489a9199b027e5220b;hpb=4258b58c6aff86ce69ebfbcd40d704836df27ac9;p=vchess.git diff --git a/client/src/variants/Avalanche.js b/client/src/variants/Avalanche.js index edeb5648..db024597 100644 --- a/client/src/variants/Avalanche.js +++ b/client/src/variants/Avalanche.js @@ -25,6 +25,7 @@ export class AvalancheRules extends ChessRules { } canIplay(side, [x, y]) { + if (side != this.turn) return false; if (this.subTurn == 0) return (x >= V.size.x); const c = this.getColor(x, y); return ( @@ -103,7 +104,7 @@ export class AvalancheRules extends ChessRules { vanish: [ new PiPo({ x: rank, y: file, c: color, p: V.PAWN }) ], - start: { x: 8, y: y }, + start: { x: 8 + (color == 'b' ? 1 : 0), y: y }, end: { x: rank, y: file } }); } @@ -339,6 +340,7 @@ export class AvalancheRules extends ChessRules { this.play(moves[3]); //HACK... 3 = queen index const res = this.getComputerMove(); this.undo(moves[3]); + if (Array.isArray(res)) return [moves[3]].concat(res); return [moves[3], res]; } // subTurn == 1 (necessarily)