X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FBishopawns.js;h=feecd45856f21703f78ab3986c5ba5d2fcdfa1dd;hb=7e8a7ea1cb66adb4a987badfb0a3c2f99a21bd0a;hp=1ee9b97a4072b0e632159546a74363b955bef0c3;hpb=737a5dafb39740ebe304b8d0a82df85070def571;p=vchess.git diff --git a/client/src/variants/Bishopawns.js b/client/src/variants/Bishopawns.js index 1ee9b97a..feecd458 100644 --- a/client/src/variants/Bishopawns.js +++ b/client/src/variants/Bishopawns.js @@ -1,6 +1,7 @@ import { ChessRules } from "@/base_rules"; export class BishopawnsRules extends ChessRules { + static get PawnSpecs() { return Object.assign( {}, @@ -36,8 +37,12 @@ export class BishopawnsRules extends ChessRules { } // Did a black pawn promote? Can the bishop take it? const qIdx = this.board[7].findIndex(cell => cell[1] == V.QUEEN); - if (qIdx >= 0 && !super.isAttackedByBishop([7, qIdx], 'w')) + if ( + qIdx >= 0 && + (this.turn == 'b' || !super.isAttackedByBishop([7, qIdx], 'w')) + ) { return "0-1"; + } if (!this.atLeastOneMove()) return "1/2"; return "*"; } @@ -48,4 +53,5 @@ export class BishopawnsRules extends ChessRules { static get SEARCH_DEPTH() { return 4; } + };