projects
/
xogo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Start thinking about Coregal
[xogo.git]
/
base_rules.js
diff --git
a/base_rules.js
b/base_rules.js
index
47f70c2
..
0b71cf4
100644
(file)
--- a/
base_rules.js
+++ b/
base_rules.js
@@
-97,6
+97,14
@@
export default class ChessRules {
return true;
}
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"] ||
get hasReserve() {
return (
!!this.options["crazyhouse"] ||
@@
-225,7
+233,7
@@
export default class ChessRules {
['r', 'n', 'b', 'q', 'k', 'b', 'n', 'r'],
{
randomness: this.options["randomness"],
['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']
}
diffCol: ['b'],
flags: ['r']
}
@@
-408,14
+416,14
@@
export default class ChessRules {
}
// Some additional variables from FEN (variant dependant)
}
// Some additional variables from FEN (variant dependant)
- setOtherVariables(fenParsed) {
+ setOtherVariables(fenParsed
, pieceArray
) {
// Set flags and enpassant:
if (this.hasFlags)
this.setFlags(fenParsed.flags);
if (this.hasEnpassant)
this.epSquare = this.getEpSquare(fenParsed.enpassant);
if (this.hasReserve && !this.isDiagram)
// Set flags and enpassant:
if (this.hasFlags)
this.setFlags(fenParsed.flags);
if (this.hasEnpassant)
this.epSquare = this.getEpSquare(fenParsed.enpassant);
if (this.hasReserve && !this.isDiagram)
- this.initReserves(fenParsed.reserve);
+ this.initReserves(fenParsed.reserve
, pieceArray
);
if (this.options["crazyhouse"])
this.initIspawn(fenParsed.ispawn);
if (this.options["teleport"]) {
if (this.options["crazyhouse"])
this.initIspawn(fenParsed.ispawn);
if (this.options["teleport"]) {
@@
-1188,7
+1196,7
@@
export default class ChessRules {
}
pieces(color, x, y) {
}
pieces(color, x, y) {
- const pawnShift = this.getPawnShift(color);
+ const pawnShift = this.getPawnShift(color
|| 'w'
);
return {
'p': {
"class": "pawn",
return {
'p': {
"class": "pawn",
@@
-1720,10
+1728,7
@@
export default class ChessRules {
});
Array.prototype.push.apply(squares, zenCaptures);
}
});
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],
{
const selfCaptures = this.findDestSquares(
[x, y],
{