X-Git-Url: https://git.auder.net/img/rock_paper_scissors_lizard_spock.gif?a=blobdiff_plain;f=base_rules.js;h=6078da86ccfa5e84730fe851c3ad947c0a665c4a;hb=8b629a6b470e02c96954054e55e31dffc407f4bd;hp=aea3f57bbf641d743e32e818f6cc8aadbdbde1ff;hpb=b8950be593d0663202c886f4252513bf1a499ee1;p=xogo.git diff --git a/base_rules.js b/base_rules.js index aea3f57..6078da8 100644 --- a/base_rules.js +++ b/base_rules.js @@ -97,6 +97,14 @@ export default class ChessRules { return true; } + // Allow to take (moving: not disappearing) own pieces? + get hasSelfCaptures() { + return ( + this.options["recycle"] || + (this.options["teleport"] && this.subTurnTeleport == 1) + ); + } + get hasReserve() { return ( !!this.options["crazyhouse"] || @@ -225,9 +233,9 @@ export default class ChessRules { ['r', 'n', 'b', 'q', 'k', 'b', 'n', 'r'], { randomness: this.options["randomness"], - between: {p1: 'k', p2: 'r'}, + between: [{p1: 'k', p2: 'r'}], diffCol: ['b'], - flags: ['r'] + flags: ['r', 'k'] } ); return { @@ -1720,10 +1728,7 @@ export default class ChessRules { }); Array.prototype.push.apply(squares, zenCaptures); } - if ( - this.options["recycle"] || - (this.options["teleport"] && this.subTurnTeleport == 1) - ) { + if (this.hasSelfCaptures) { const selfCaptures = this.findDestSquares( [x, y], {