X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FCopycat.js;h=c7d12a52fb8c474de74bb0e443a595bd3dcfa34b;hp=78299c69eb2bc61d1a6cef1073f1d8788d855ffd;hb=4313762da3237b04f204e121a20cab3ba7bb5dd2;hpb=cee75a57d2f4f89c89d64cefbab55d839a238ed9 diff --git a/client/src/variants/Copycat.js b/client/src/variants/Copycat.js index 78299c69..c7d12a52 100644 --- a/client/src/variants/Copycat.js +++ b/client/src/variants/Copycat.js @@ -8,7 +8,6 @@ export class CopycatRules extends ChessRules { const piece = this.getPiece(x,y); if ([V.PAWN, V.KING].includes(piece)) return moves; const color = this.turn; - const oneStep = (piece == V.PAWN); let movements = {}, steps = []; if (piece == V.QUEEN) steps = V.steps[V.ROOK].concat(V.steps[V.BISHOP]); @@ -39,8 +38,9 @@ export class CopycatRules extends ChessRules { (piece != V.QUEEN && type != piece) || (piece == V.QUEEN && type == V.KNIGHT) ) { + const nbSteps = (type == V.KNIGHT ? 1 : undefined); Array.prototype.push.apply(moves, - this.getSlideNJumpMoves([x, y], V.steps[type], type == V.KNIGHT)); + super.getSlideNJumpMoves([x, y], V.steps[type], nbSteps)); } }); return moves;