X-Git-Url: https://git.auder.net/pieces/Cwda/n_black_rook.svg?a=blobdiff_plain;f=variants%2FSuction%2Fclass.js;h=dbaefa0a72b81888b8fd1ed9c9a9e0228069eb4e;hb=5f08c59b29c2173cc8b2df1a3799ee971a14e691;hp=f9cf26dc33ad67f822936101490d2c8cfe2442a4;hpb=f54357573d4fdf87a05b19f78506c11f16bb3a26;p=xogo.git diff --git a/variants/Suction/class.js b/variants/Suction/class.js index f9cf26d..dbaefa0 100644 --- a/variants/Suction/class.js +++ b/variants/Suction/class.js @@ -42,8 +42,8 @@ export default class SuctionRules extends ChessRules { } genRandInitFen(seed) { - const gr = new GiveawayRules( - {mode: "suicide", options: this.options, genFenOnly: true}); + const options = Object.assign({mode: "suicide"}, this.options); + const gr = new GiveawayRules({options: options, genFenOnly: true}); // Add empty cmove: return ( gr.genRandInitFen(seed).slice(0, -17) + '{"enpassant":"-","cmove":"-"}'); @@ -110,4 +110,13 @@ export default class SuctionRules extends ChessRules { return "*"; } + // Better animation for swaps + customAnimate(move, segments, cb) { + if (move.vanish.length < 2) + return 0; + super.animateMoving(move.end, move.start, null, + segments.reverse().map(s => s.reverse()), cb); + return 1; + } + };