X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FSchess.js;h=ebc2c7c26f2d289053d6404bab805ebf23c42e33;hb=40ac07d9dfc8a58911550aa9c87a0f0736723f1f;hp=7cbb47a10e542b84f5ee4d88c72930b7950d9b28;hpb=55cbcd88f278d4861f3f1beb8f9725d572f548f0;p=vchess.git diff --git a/client/src/variants/Schess.js b/client/src/variants/Schess.js index 7cbb47a1..ebc2c7c2 100644 --- a/client/src/variants/Schess.js +++ b/client/src/variants/Schess.js @@ -199,16 +199,14 @@ export class SchessRules extends ChessRules { } getPotentialHawkMoves(sq) { - return this.getSlideNJumpMoves( - sq, - V.steps[V.BISHOP].concat(V.steps[V.KNIGHT]) + return this.getSlideNJumpMoves(sq, V.steps[V.BISHOP]).concat( + this.getSlideNJumpMoves(sq, V.steps[V.KNIGHT], "oneStep") ); } getPotentialElephantMoves(sq) { - return this.getSlideNJumpMoves( - sq, - V.steps[V.ROOK].concat(V.steps[V.KNIGHT]) + return this.getSlideNJumpMoves(sq, V.steps[V.ROOK]).concat( + this.getSlideNJumpMoves(sq, V.steps[V.KNIGHT], "oneStep") ); } @@ -221,20 +219,28 @@ export class SchessRules extends ChessRules { } isAttackedByHawk(sq, color) { - return this.isAttackedBySlideNJump( - sq, - color, - V.HAWK, - V.steps[V.BISHOP].concat(V.steps[V.KNIGHT]) + return ( + this.isAttackedBySlideNJump(sq, color, V.HAWK, V.steps[V.BISHOP]) || + this.isAttackedBySlideNJump( + sq, + color, + V.HAWK, + V.steps[V.KNIGHT], + "oneStep" + ) ); } isAttackedByElephant(sq, color) { - return this.isAttackedBySlideNJump( - sq, - color, - V.ELEPHANT, - V.steps[V.ROOK].concat(V.steps[V.KNIGHT]) + return ( + this.isAttackedBySlideNJump(sq, color, V.ELEPHANT, V.steps[V.ROOK]) || + this.isAttackedBySlideNJump( + sq, + color, + V.ELEPHANT, + V.steps[V.KNIGHT], + "oneStep" + ) ); }