X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FCwda.js;h=a07672a1eedecaea5ed755bf5383e7b0107a4cc9;hp=9142d4684b80ec02cea950a150034f45bc8e0383;hb=902378e6276422d38b45f7d79282c2462f1124b1;hpb=02c6ba4f6e6608ba120b121da516a195be3a1042 diff --git a/client/src/variants/Cwda.js b/client/src/variants/Cwda.js index 9142d468..a07672a1 100644 --- a/client/src/variants/Cwda.js +++ b/client/src/variants/Cwda.js @@ -304,13 +304,9 @@ export class CwdaRules extends ChessRules { } getPotentialN_knightMoves(sq) { - const backward = (this.turn == 'w' ? 1 : -1); - const kingSteps = [ - [0, -1], [0, 1], [backward, -1], [backward, 0], [backward, 1] - ]; return ( this.getSlideNJumpMoves(sq, V.steps.$n, 1).concat( - this.getSlideNJumpMoves(sq, kingSteps, 1)) + this.getSlideNJumpMoves(sq, V.steps.f, 1)) ); } @@ -445,13 +441,9 @@ export class CwdaRules extends ChessRules { } isAttackedByN_knight(sq, color) { - const backward = (color == 'w' ? -1 : 1); - const kingSteps = [ - [0, -1], [0, 1], [backward, -1], [backward, 0], [backward, 1] - ]; return ( - this.isAttackedBySlideNJump(sq, color, V.N_KNIGHT, V.steps.$n) || - this.isAttackedBySlideNJump(sq, color, V.N_KNIGHT, kingSteps, 1) + this.isAttackedBySlideNJump(sq, color, V.N_KNIGHT, V.steps.$n, 1) || + this.isAttackedBySlideNJump(sq, color, V.N_KNIGHT, V.steps.f, 1) ); }