X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FJoker.js;h=fd302bbb7a35f9bbd891e6949ef4a6f6ca89e5a0;hp=137249c4f83d5d0836bbbf064c46fd012f027ff5;hb=cee75a57d2f4f89c89d64cefbab55d839a238ed9;hpb=3aa0c7783242b063c9a2890bdd4cf2767859dfca diff --git a/client/src/variants/Joker.js b/client/src/variants/Joker.js index 137249c4..fd302bbb 100644 --- a/client/src/variants/Joker.js +++ b/client/src/variants/Joker.js @@ -76,6 +76,19 @@ export class JokerRules extends ChessRules { return moving.concat(swapping); } + postPlay(move) { + super.postPlay(move); + // Was my king swapped? + if (move.vanish.length == 2 && move.vanish[1].p == V.KING) + this.kingPos[move.appear[1].c] = [move.appear[1].x, move.appear[1].y]; + } + + postUndo(move) { + super.postUndo(move); + if (move.vanish.length == 2 && move.vanish[1].p == V.KING) + this.kingPos[move.vanish[1].c] = [move.vanish[1].x, move.vanish[1].y]; + } + static get VALUES() { return Object.assign({ j: 2 }, ChessRules.VALUES); }