X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=base_rules.js;fp=base_rules.js;h=c0d9b60622b163464e3d2a6442b0b700c12d97c4;hb=b98feb3f6bb7e03319474f7a032e296750eb179f;hp=aea3f57bbf641d743e32e818f6cc8aadbdbde1ff;hpb=b8950be593d0663202c886f4252513bf1a499ee1;p=xogo.git diff --git a/base_rules.js b/base_rules.js index aea3f57..c0d9b60 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"] || @@ -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], {