From 61d1baa94e02c346b7f33fc48621c77e510183c7 Mon Sep 17 00:00:00 2001 From: Benjamin Auder <benjamin.auder@somewhere> Date: Thu, 19 Mar 2020 20:49:45 +0100 Subject: [PATCH] Fix Perfect chess isAttackedBy(...) --- client/src/variants/Perfect.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/client/src/variants/Perfect.js b/client/src/variants/Perfect.js index a0c75c57..4f65a0ed 100644 --- a/client/src/variants/Perfect.js +++ b/client/src/variants/Perfect.js @@ -84,11 +84,12 @@ export class PerfectRules extends ChessRules { isAttackedByAmazon(sq, color) { return ( - super.isAttackedByQueen(sq, color) || + this.isAttackedBySlideNJump(sq, color, V.AMAZON, V.steps[V.BISHOP]) || + this.isAttackedBySlideNJump(sq, color, V.AMAZON, V.steps[V.ROOK]) || this.isAttackedBySlideNJump( sq, color, - V.MARSHALL, + V.AMAZON, V.steps[V.KNIGHT], "oneStep" ) @@ -97,11 +98,11 @@ export class PerfectRules extends ChessRules { isAttackedByEmpress(sq, color) { return ( - this.isAttackedBySlideNJump(sq, color, V.MARSHALL, V.steps[V.ROOK]) || + this.isAttackedBySlideNJump(sq, color, V.EMPRESS, V.steps[V.ROOK]) || this.isAttackedBySlideNJump( sq, color, - V.MARSHALL, + V.EMPRESS, V.steps[V.KNIGHT], "oneStep" ) @@ -110,11 +111,11 @@ export class PerfectRules extends ChessRules { isAttackedByPrincess(sq, color) { return ( - this.isAttackedBySlideNJump(sq, color, V.CARDINAL, V.steps[V.BISHOP]) || + this.isAttackedBySlideNJump(sq, color, V.PRINCESS, V.steps[V.BISHOP]) || this.isAttackedBySlideNJump( sq, color, - V.CARDINAL, + V.PRINCESS, V.steps[V.KNIGHT], "oneStep" ) -- 2.44.0