projects
/
xogo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
639afc9
)
Current state - TODO: pawnfall fix, better pre/postPlay()
author
Benjamin Auder
<benjamin.auder@somewhere>
Mon, 23 May 2022 08:01:43 +0000
(10:01 +0200)
committer
Benjamin Auder
<benjamin.auder@somewhere>
Mon, 23 May 2022 08:01:43 +0000
(10:01 +0200)
base_rules.js
patch
|
blob
|
blame
|
history
diff --git
a/base_rules.js
b/base_rules.js
index
a2cb951
..
8ad54a4
100644
(file)
--- a/
base_rules.js
+++ b/
base_rules.js
@@
-1363,7
+1363,12
@@
export default class ChessRules {
);
if (!promotionOk)
return; //nothing to do
);
if (!promotionOk)
return; //nothing to do
- if (!this.options["pawnfall"]) {
+ if (this.options["pawnfall"]) {
+ m.appear.shift();
+ m.pawnfall = true; //required in prePlay() /// ????????????
+ return;
+ }
+ //if (!this.options["pawnfall"]) { --> OK
if (
this.options["cannibal"] &&
this.board[x2][y2] != "" &&
if (
this.options["cannibal"] &&
this.board[x2][y2] != "" &&
@@
-1373,7
+1378,7
@@
export default class ChessRules {
}
else
finalPieces = this.pawnPromotions;
}
else
finalPieces = this.pawnPromotions;
- }
+
//
}
m.appear[0].p = finalPieces[0];
if (initPiece == "!") //cannibal king-pawn
m.appear[0].p = C.CannibalKingCode[finalPieces[0]];
m.appear[0].p = finalPieces[0];
if (initPiece == "!") //cannibal king-pawn
m.appear[0].p = C.CannibalKingCode[finalPieces[0]];
@@
-1388,8
+1393,6
@@
export default class ChessRules {
}
let newMove = this.getBasicMove([x1, y1], [x2, y2], tr);
if (this.options["pawnfall"]) {
}
let newMove = this.getBasicMove([x1, y1], [x2, y2], tr);
if (this.options["pawnfall"]) {
- newMove.appear.shift();
- newMove.pawnfall = true; //required in prePlay()
}
moreMoves.push(newMove);
}
}
moreMoves.push(newMove);
}
@@
-1948,6
+1951,11
@@
export default class ChessRules {
});
}
});
}
+
+// TODO: englober + de cas ici...
+ // + generique start/end board or reserve
+ // + bien séparer les options... ?
+
prePlay(move) {
if (
typeof move.start.x == "number" &&
prePlay(move) {
if (
typeof move.start.x == "number" &&