X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FDynamo.js;h=5955f64135187b52d81d368d9ce5884edbc2a323;hb=6e0c0bcba5c9e76a50a2676aa3e63bc317123bcb;hp=c299f84a87183c7da7f880e7be4d91a0d348b9ff;hpb=81e74ee5b8c584cd29d79762a8e726a04aa7cd8f;p=vchess.git diff --git a/client/src/variants/Dynamo.js b/client/src/variants/Dynamo.js index c299f84a..5955f641 100644 --- a/client/src/variants/Dynamo.js +++ b/client/src/variants/Dynamo.js @@ -158,7 +158,6 @@ export class DynamoRules extends ChessRules { } // There was something on x2,y2, maybe our color, pushed/pulled. - // Also, the pushed/pulled piece must exit the board. isAprioriValidExit([x1, y1], [x2, y2], color2) { const color1 = this.getColor(x1, y1); const pawnShift = (color1 == 'w' ? -1 : 1); @@ -338,6 +337,8 @@ export class DynamoRules extends ChessRules { // Piece at subTurn 1 just exited the board. // Can I be a piece which caused the exit? if ( + // Only "turn" color can do actions + sqCol == color && this.isAprioriValidExit( [x, y], [fm.start.x, fm.start.y], @@ -347,7 +348,9 @@ export class DynamoRules extends ChessRules { // Seems so: const dir = this.getNormalizedDirection( [fm.start.x - x, fm.start.y - y]); - return this.getMovesInDirection([x, y], dir); + const nbSteps = + ([V.PAWN,V.KING,V.KNIGHT].includes(this.getPiece(x, y)) ? 1 : null); + return this.getMovesInDirection([x, y], dir, nbSteps); } } else {