Fix antikings attacking rule
authorBenjamin Auder <benjamin.auder@somewhere>
Thu, 6 Dec 2018 19:25:04 +0000 (20:25 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Thu, 6 Dec 2018 19:25:04 +0000 (20:25 +0100)
public/javascripts/variants/Antiking.js
views/rules/Antiking.pug

index f908495..71e01ff 100644 (file)
@@ -81,8 +81,8 @@ class AntikingRules extends ChessRules
        isAttackedByAntiking([x,y], colors)
        {
                const V = VariantRules;
-               if (this.getPiece(x,y) == V.KING)
-                       return false; //king is not attacked by antiking
+               if ([V.KING,V.ANTIKING].includes(this.getPiece(x,y)))
+                       return false; //(anti)king is not attacked by antiking
                return this.isAttackedBySlideNJump([x,y], colors, V.ANTIKING,
                        V.steps[V.ROOK].concat(V.steps[V.BISHOP]), "oneStep");
        }
index eda7db4..28e264b 100644 (file)
@@ -36,6 +36,8 @@ p Note 1: athough antiking captures his color, it doesn't check his king.
 
 p Note 2: since it would allow a basic tactic (keep antiking touching opponent's king), kings do not attack antikings.
 
+p Note 3: an antiking does not check opponent's antiking.
+
 h3 Credits
 
 p