From: Benjamin Auder Date: Thu, 6 Dec 2018 19:25:04 +0000 (+0100) Subject: Fix antikings attacking rule X-Git-Url: https://git.auder.net/game/scripts/js/%7B%7B%20path%28%27fos_user_profile_show%27%29%20%7D%7D?a=commitdiff_plain;h=a734a1a07f5309300a95ae2bd113c72be15bab22;p=vchess.git Fix antikings attacking rule --- diff --git a/public/javascripts/variants/Antiking.js b/public/javascripts/variants/Antiking.js index f9084951..71e01ff1 100644 --- a/public/javascripts/variants/Antiking.js +++ b/public/javascripts/variants/Antiking.js @@ -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"); } diff --git a/views/rules/Antiking.pug b/views/rules/Antiking.pug index eda7db44..28e264b7 100644 --- a/views/rules/Antiking.pug +++ b/views/rules/Antiking.pug @@ -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