X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=variants%2FAlapo%2Fclass.js;h=483641334b0208537cd75c5968db5b9759ae1ece;hb=f3e90e30b6e7ff416afe288bc9dd865e5daf9860;hp=eb0e73f6bd3146778a26cf53ba64ce58db6c09ae;hpb=f55a0a6753a62257c7caa62ae49c8a5673769065;p=xogo.git diff --git a/variants/Alapo/class.js b/variants/Alapo/class.js index eb0e73f..4836413 100644 --- a/variants/Alapo/class.js +++ b/variants/Alapo/class.js @@ -1,9 +1,16 @@ import ChessRules from "/base_rules.js"; -import { ArrayFun } from "/utils/array.js"; -import { Random } from "/utils/alea.js"; +import {ArrayFun} from "/utils/array.js"; +import {Random} from "/utils/alea.js"; export default class AlapoRules extends ChessRules { + static get Options() { + return { + select: C.Options.select, + styles: C.Options.styles.filter(s => s != "teleport") + }; + } + get hasFlags() { return false; } @@ -81,15 +88,14 @@ export default class AlapoRules extends ChessRules { ); } + // Triangles are rotated from opponent viewpoint (=> suffix "_inv") pieces(color, x, y) { + const allSpecs = super.pieces(color, x, y); return { - 'r': super.pieces(color, x, y)['r'], - 'q': super.pieces(color, x, y)['q'], - 'b': { - // Triangle is rotated from opponent viewpoint - "class": "bishop" + (this.playerColor != color ? "_inv" : ""), - moves: [ { steps: [[1, 1], [1, -1], [-1, 1], [-1, -1]] } ] - }, + 'r': allSpecs['r'], + 'q': allSpecs['q'], + 'b': Object.assign({}, allSpecs['b'], + {"class": "bishop" + (this.playerColor != color ? "_inv" : "")}), 's': { //"square" "class": "babyrook", moves: [ @@ -143,8 +149,14 @@ export default class AlapoRules extends ChessRules { won[c] = this.board[goal].some((b,j) => { return ( this.getColor(goal, j) == c && - this.findCapturesOn( - [goal, j], {one: true, oppCol: oppCol}).length == 0 + !this.findCapturesOn( + [goal, j], + { + one: true, + oppCol: oppCol, + segments: this.options["cylinder"] + } + ) ); }); }