X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FCheckered.js;h=ecf25817e7251b44c628f44729af17d2f1cb3081;hb=e78633dbd29be1920e0c02509b6ce62b87b61d77;hp=bca365d097a11a374d499244cbe5aefe0a1c3539;hpb=57d9b2c4f08948bd5a5fc4a01a0b62d4c80523e2;p=vchess.git diff --git a/client/src/variants/Checkered.js b/client/src/variants/Checkered.js index bca365d0..ecf25817 100644 --- a/client/src/variants/Checkered.js +++ b/client/src/variants/Checkered.js @@ -177,7 +177,7 @@ export class CheckeredRules extends ChessRules { // Does m2 un-do m1 ? (to disallow undoing checkered moves) oppositeMoves(m1, m2) { return ( - m1 && + !!m1 && m2.appear[0].c == "c" && m2.appear.length == 1 && m2.vanish.length == 1 && @@ -303,7 +303,8 @@ export class CheckeredRules extends ChessRules { } isAttackedByBishop(sq, colors) { - return this.isAttackedBySlideNJump(sq, colors, V.BISHOP, V.steps[V.BISHOP]); + return this.isAttackedBySlideNJump( + sq, colors, V.BISHOP, V.steps[V.BISHOP]); } isAttackedByQueen(sq, colors) { @@ -337,7 +338,7 @@ export class CheckeredRules extends ChessRules { "c" ]); let res = kingAttacked - ? [JSON.parse(JSON.stringify(this.kingPos[color]))] //need to duplicate! + ? [JSON.parse(JSON.stringify(this.kingPos[color]))] : []; this.turn = color; return res;