X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=public%2Fjavascripts%2Fvariants%2FCheckered.js;h=019e1e2c5c11aeafdc277e2b8d04ed7e93a42e52;hp=b702018a416112d194e88bf0037a73486de3ebd1;hb=9234226104764b91df9d677fb360ad538b98510c;hpb=68f5ccc8cc5e6b034b4fee199f6d353fe448a1dc diff --git a/public/javascripts/variants/Checkered.js b/public/javascripts/variants/Checkered.js index b702018a..019e1e2c 100644 --- a/public/javascripts/variants/Checkered.js +++ b/public/javascripts/variants/Checkered.js @@ -103,7 +103,8 @@ class CheckeredRules extends ChessRules canIplay(side, [x,y]) { - return ((side=='w' && this.moves.length%2==0) || (side=='b' && this.moves.length%2==1)) + return ((side=='w' && this.moves.length%2==0) + || (side=='b' && this.moves.length%2==1)) && [side,'c'].includes(this.getColor(x,y)); } @@ -166,7 +167,8 @@ class CheckeredRules extends ChessRules this.play(move); const color = this.turn; this.moves.push(move); //artifically change turn, for checkered pawns (TODO) - const kingAttacked = this.isAttacked(this.kingPos[color], [this.getOppCol(color),'c']); + const kingAttacked = this.isAttacked( + this.kingPos[color], [this.getOppCol(color),'c']); let res = kingAttacked ? [ JSON.parse(JSON.stringify(this.kingPos[color])) ] //need to duplicate! : [ ]; @@ -259,12 +261,15 @@ class CheckeredRules extends ChessRules { // Capture let startColumn = String.fromCharCode(97 + move.start.y); - notation = startColumn + "x" + finalSquare + "=" + move.appear[0].p.toUpperCase(); + notation = startColumn + "x" + finalSquare + + "=" + move.appear[0].p.toUpperCase(); } else //no capture + { notation = finalSquare; - if (move.appear.length > 0 && piece != move.appear[0].p) //promotion - notation += "=" + move.appear[0].p.toUpperCase(); + if (move.appear.length > 0 && piece != move.appear[0].p) //promotion + notation += "=" + move.appear[0].p.toUpperCase(); + } return notation; }