X-Git-Url: https://git.auder.net/?p=xogo.git;a=blobdiff_plain;f=base_rules.js;h=88197ea0bed834c970659b95068aa5bec6f0b1aa;hp=11b8b30fbaffc43958bcab57d2bfd8fa23123e28;hb=182ba661e9c6e30fc641f4e71f29ae76961f4510;hpb=b9877ed29697640d72b8f3d89848863fc87bd7e8 diff --git a/base_rules.js b/base_rules.js index 11b8b30..88197ea 100644 --- a/base_rules.js +++ b/base_rules.js @@ -779,8 +779,8 @@ export default class ChessRules { piece = "k"; //capturing cannibal king: back to king form const oldCount = this.reserve[color][piece]; this.reserve[color][piece] = count; - // Redrawing is much easier if count==0 - if ([oldCount, count].includes(0)) + // Redrawing is much easier if count==0 (or undefined) + if ([oldCount, count].some(item => !item)) this.re_drawReserve([color]); else { const numId = this.getReserveNumId(color, piece); @@ -2357,6 +2357,10 @@ export default class ChessRules { this.subTurnTeleport = 1; this.captured = null; } + this.tryChangeTurn(move); + } + + tryChangeTurn(move) { if (this.isLastMove(move)) { this.turn = C.GetOppCol(color); this.movesCount++;