Almost added TitanChess + EvolutionChess
[vchess.git] / client / src / variants / Perfect.js
index a0c75c5..4bd2ac9 100644 (file)
@@ -3,6 +3,7 @@ import { ArrayFun } from "@/utils/array";
 import { randInt } from "@/utils/alea";
 
 export class PerfectRules extends ChessRules {
+
   static get PawnSpecs() {
     return Object.assign(
       {},
@@ -84,11 +85,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 +99,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 +112,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"
       )
@@ -199,4 +201,5 @@ export class PerfectRules extends ChessRules {
       " w 0 " + flags + " -"
     );
   }
+
 };