Fix Makruk/Makpong
[vchess.git] / client / src / variants / Makruk.js
index 5561702..75fb1da 100644 (file)
@@ -109,6 +109,12 @@ export class MakrukRules extends ChessRules {
     );
   }
 
+  isAttacked(sq, color) {
+    return (
+      super.isAttacked(sq, color) || this.isAttackedByPromoted(sq, color)
+    );
+  }
+
   isAttackedByBishop(sq, color) {
     const forward = (color == 'w' ? 1 : -1);
     return this.isAttackedBySlideNJump(
@@ -130,6 +136,16 @@ export class MakrukRules extends ChessRules {
     );
   }
 
+  isAttackedByPromoted(sq, color) {
+    return super.isAttackedBySlideNJump(
+      sq,
+      color,
+      V.PROMOTED,
+      V.steps[V.BISHOP],
+      "oneStep"
+    );
+  }
+
   static get VALUES() {
     return {
       p: 1,