X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FHoppelpoppel.js;h=59574f871f2b66f20ab1f4dbdbb8a4318e890f08;hp=59c20bb81a00c7de1dbb774e14cc256d56ad4de9;hb=4313762da3237b04f204e121a20cab3ba7bb5dd2;hpb=cee75a57d2f4f89c89d64cefbab55d839a238ed9 diff --git a/client/src/variants/Hoppelpoppel.js b/client/src/variants/Hoppelpoppel.js index 59c20bb8..59574f87 100644 --- a/client/src/variants/Hoppelpoppel.js +++ b/client/src/variants/Hoppelpoppel.js @@ -2,6 +2,7 @@ import { ChessRules } from "@/base_rules"; export class HoppelpoppelRules extends ChessRules { + // TODO: merge with base_rules.js (see also Orda, Empire) getSlideNJumpMoves_([x, y], steps, oneStep, options) { options = options || {}; let moves = []; @@ -10,7 +11,7 @@ export class HoppelpoppelRules extends ChessRules { let j = y + step[1]; while (V.OnBoard(i, j) && this.board[i][j] == V.EMPTY) { if (!options.onlyTake) moves.push(this.getBasicMove([x, y], [i, j])); - if (!!oneStep) continue outerLoop; + if (oneStep) continue outerLoop; i += step[0]; j += step[1]; } @@ -44,21 +45,12 @@ export class HoppelpoppelRules extends ChessRules { isAttackedByKnight([x, y], color) { return super.isAttackedBySlideNJump( - [x, y], - color, - V.KNIGHT, - V.steps[V.BISHOP] - ); + [x, y], color, V.KNIGHT, V.steps[V.BISHOP]); } isAttackedByBishop([x, y], color) { return super.isAttackedBySlideNJump( - [x, y], - color, - V.BISHOP, - V.steps[V.KNIGHT], - "oneStep" - ); + [x, y], color, V.BISHOP, V.steps[V.KNIGHT], 1); } };