X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FBerolina.js;h=ae1509575faf50d429a6ce50b6bb5fdd640c7a85;hp=4cdbb88b97bcc1e8f21e69a00da95ab45caaad98;hb=68e19a449db7a12e0a168e99cd750d985c983ba1;hpb=11589e7c4bb1b69473588d133db8b6d1d37b8fee diff --git a/client/src/variants/Berolina.js b/client/src/variants/Berolina.js index 4cdbb88b..ae150957 100644 --- a/client/src/variants/Berolina.js +++ b/client/src/variants/Berolina.js @@ -120,16 +120,14 @@ export const VariantRules = class BerolinaRules extends ChessRules { return moves; } - isAttackedByPawn([x, y], colors) { - for (let c of colors) { - let pawnShift = c == "w" ? 1 : -1; - if (x + pawnShift >= 0 && x + pawnShift < V.size.x) { - if ( - this.getPiece(x + pawnShift, y) == V.PAWN && - this.getColor(x + pawnShift, y) == c - ) { - return true; - } + isAttackedByPawn([x, y], color) { + let pawnShift = (color == "w" ? 1 : -1); + if (x + pawnShift >= 0 && x + pawnShift < V.size.x) { + if ( + this.getPiece(x + pawnShift, y) == V.PAWN && + this.getColor(x + pawnShift, y) == color + ) { + return true; } } return false;