From: Benjamin Auder Date: Mon, 4 May 2020 10:26:00 +0000 (+0200) Subject: Improve Chakart rules (captures after banana/bomb redirection) X-Git-Url: https://git.auder.net/images/doc/html/current/pieces/rpsls.js?a=commitdiff_plain;h=7c8d0174f68dfcda183848d85588e58f5d347cda;p=vchess.git Improve Chakart rules (captures after banana/bomb redirection) --- diff --git a/client/src/translations/rules/Chakart/en.pug b/client/src/translations/rules/Chakart/en.pug index 78704579..a89d4ae9 100644 --- a/client/src/translations/rules/Chakart/en.pug +++ b/client/src/translations/rules/Chakart/en.pug @@ -55,6 +55,7 @@ ul li. A piece arriving on a banana (resp. bomb) is redirected at random by one square in an orthogonal (resp. diagonal) direction, if possible. + An enemy piece could be captured in this way. p. The effects can cumulate, as illustrated on the diagram: the bishop "captures" the banana on e4, and is then redirected twoard e5: diff --git a/client/src/translations/rules/Chakart/es.pug b/client/src/translations/rules/Chakart/es.pug index b8b4781d..378edce7 100644 --- a/client/src/translations/rules/Chakart/es.pug +++ b/client/src/translations/rules/Chakart/es.pug @@ -59,7 +59,7 @@ ul li. Una pieza que llega en un plátano (resp. bomba) se redirige aleatoriamente de una casilla en una dirección ortogonal (resp. diagonal), - si es posible. + si es posible. Une pieza enemiga podría ser capturada de esta manera. p. Los efectos pueden sumar, como se muestra en el diagrama: el alfil "captura" el plátano en e4, luego es redirigido a e5: hongo, diff --git a/client/src/translations/rules/Chakart/fr.pug b/client/src/translations/rules/Chakart/fr.pug index 8bd6e7ed..ee04216a 100644 --- a/client/src/translations/rules/Chakart/fr.pug +++ b/client/src/translations/rules/Chakart/fr.pug @@ -58,7 +58,7 @@ ul li. Une pièce arrivant sur une banane (resp. bombe) est redirigée aléatoirement d'une case dans une direction orthogonale (resp. diagonale), - si possible. + si possible. Une pièce adverse pourrait être capturée de cette façon. p. Les effets peuvent se cumuler, comme illustré sur le diagramme : le fou "capture" la banane en e4, puis est redirigé vers e5 : champignon, diff --git a/client/src/variants/Chakart.js b/client/src/variants/Chakart.js index bfbca52e..73d7cfc9 100644 --- a/client/src/variants/Chakart.js +++ b/client/src/variants/Chakart.js @@ -320,7 +320,6 @@ export class ChakartRules extends ChessRules { const L = this.firstMove.length; const fm = this.firstMove[L-1]; switch (fm.end.effect) { - // case 0: a click is required (banana or bomb) case "kingboo": // Exchange position with any piece, // except pawns if arriving on last rank. @@ -370,11 +369,12 @@ export class ChakartRules extends ChessRules { // Helper for getBasicMove() getRandomSquare([x, y], steps) { + const color = this.turn; const validSteps = steps.filter(s => { const [i, j] = [x + s[0], y + s[1]]; return ( V.OnBoard(i, j) && - (this.board[i][j] == V.EMPTY || this.getColor(i, j) == 'a') + (this.board[i][j] == V.EMPTY || this.getColor(i, j) != color) ); }); if (validSteps.length == 0)