From 96f8422ec4d5e3cee43e25e749e3cdc4547e0ed2 Mon Sep 17 00:00:00 2001 From: Benjamin Auder <benjamin.auder@somewhere> Date: Wed, 12 Dec 2018 18:29:31 +0100 Subject: [PATCH] Fix king pos update in Ultima. TODO: explain rules --- public/javascripts/variants/Ultima.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/javascripts/variants/Ultima.js b/public/javascripts/variants/Ultima.js index 588968da..1db36919 100644 --- a/public/javascripts/variants/Ultima.js +++ b/public/javascripts/variants/Ultima.js @@ -404,9 +404,9 @@ class UltimaRules extends ChessRules } // Does this move takes opponent's king? const oppCol = this.getOppCol(c); - for (let psq of move.vanish) + for (let i=1; i<move.vanish.length; i++) { - if (psq.p == VariantRules.KING) + if (move.vanish[i].p == VariantRules.KING) { this.kingPos[oppCol] = [-1,-1]; break; @@ -422,8 +422,9 @@ class UltimaRules extends ChessRules if (this.kingPos[oppCol][0] < 0) { // Last move took opponent's king - for (let psq of move.vanish) + for (let i=1; i<move.vanish.length; i++) { + const psq = move.vanish[i]; if (psq.p == 'k') { this.kingPos[oppCol] = [psq.x, psq.y]; -- 2.44.0