X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FVchess.js;h=fc4337294b1f1581ca5a594119897742d6f8dce8;hb=4313762da3237b04f204e121a20cab3ba7bb5dd2;hp=4e84eb0e9115d3e80757029488fc13b6d1e1621c;hpb=c01212801607b7f6336d6378ad64872a19bb4f15;p=vchess.git diff --git a/client/src/variants/Vchess.js b/client/src/variants/Vchess.js index 4e84eb0e..fc433729 100644 --- a/client/src/variants/Vchess.js +++ b/client/src/variants/Vchess.js @@ -1,6 +1,7 @@ import { ChessRules } from "@/base_rules"; export class VchessRules extends ChessRules { + static get PawnSpecs() { return Object.assign( {}, @@ -9,9 +10,24 @@ export class VchessRules extends ChessRules { ); } + isAttackedByPawn(sq, color) { + return this.isAttackedBySlideNJump( + sq, color, V.PAWN, V.steps[V.BISHOP], 1); + } + 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; } + };