X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FVchess.js;h=c11cce4e65fc168b86b509f9a4e800597ec2a013;hp=4e84eb0e9115d3e80757029488fc13b6d1e1621c;hb=1d67d9611c52fbe667cea39f68098f4e52464223;hpb=c01212801607b7f6336d6378ad64872a19bb4f15 diff --git a/client/src/variants/Vchess.js b/client/src/variants/Vchess.js index 4e84eb0e..c11cce4e 100644 --- a/client/src/variants/Vchess.js +++ b/client/src/variants/Vchess.js @@ -9,9 +9,28 @@ export class VchessRules extends ChessRules { ); } + isAttackedByPawn(sq, color) { + return this.isAttackedBySlideNJump( + sq, + color, + V.PAWN, + V.steps[V.BISHOP], + "oneStep" + ); + } + getNotation(move) { let notation = super.getNotation(move); - // TODO: if capture backwards, add an indication 'b' + // If pawn captures backward, add an indication 'b' + if ( + move.appear[0].p == V.PAWN && + ( + (move.appear[0].c == 'w' && (move.end.x - move.start.x > 0)) || + (move.appear[0].c == 'b' && (move.end.x - move.start.x < 0)) + ) + ) { + notation += 'b'; + } return notation; } };