projects
/
xogo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix Convert, start Chaining
[xogo.git]
/
variants
/
Chakart
/
class.js
diff --git
a/variants/Chakart/class.js
b/variants/Chakart/class.js
index
aefbcd0
..
2b502b6
100644
(file)
--- a/
variants/Chakart/class.js
+++ b/
variants/Chakart/class.js
@@
-132,7
+132,12
@@
export default class ChakartRules extends ChessRules {
genRandInitBaseFen() {
const s = FenUtil.setupPieces(
genRandInitBaseFen() {
const s = FenUtil.setupPieces(
- ['r', 'n', 'b', 'q', 'k', 'b', 'n', 'r'], {diffCol: ['b']});
+ ['r', 'n', 'b', 'q', 'k', 'b', 'n', 'r'],
+ {
+ randomness: this.options["randomness"],
+ diffCol: ['b']
+ }
+ );
return {
fen: s.b.join("") + "/pppppppp/8/8/8/8/PPPPPPPP/" +
s.w.join("").toUpperCase(),
return {
fen: s.b.join("") + "/pppppppp/8/8/8/8/PPPPPPPP/" +
s.w.join("").toUpperCase(),
@@
-215,7
+220,7
@@
export default class ChakartRules extends ChessRules {
moves = this.getDropMovesFrom([x, y]);
else if (this.egg == "kingboo") {
const color = this.turn;
moves = this.getDropMovesFrom([x, y]);
else if (this.egg == "kingboo") {
const color = this.turn;
- const oppCol = C.GetOpp
Col
(color);
+ const oppCol = C.GetOpp
Turn
(color);
// Only allow to swap (non-immobilized!) pieces
for (let i=0; i<this.size.x; i++) {
for (let j=0; j<this.size.y; j++) {
// Only allow to swap (non-immobilized!) pieces
for (let i=0; i<this.size.x; i++) {
for (let j=0; j<this.size.y; j++) {
@@
-277,7
+282,7
@@
export default class ChakartRules extends ChessRules {
getPawnMovesFrom([x, y]) {
const color = this.turn;
getPawnMovesFrom([x, y]) {
const color = this.turn;
- const oppCol = C.GetOpp
Col
(color);
+ const oppCol = C.GetOpp
Turn
(color);
const shiftX = (color == 'w' ? -1 : 1);
const firstRank = (color == "w" ? this.size.x - 1 : 0);
let moves = [];
const shiftX = (color == 'w' ? -1 : 1);
const firstRank = (color == "w" ? this.size.x - 1 : 0);
let moves = [];
@@
-387,7
+392,7
@@
export default class ChakartRules extends ChessRules {
play(move) {
const color = this.turn;
play(move) {
const color = this.turn;
- const oppCol = C.GetOpp
Col
(color);
+ const oppCol = C.GetOpp
Turn
(color);
this.egg = move.egg;
if (move.egg == "toadette") {
this.reserve = { w: {}, b: {} };
this.egg = move.egg;
if (move.egg == "toadette") {
this.reserve = { w: {}, b: {} };
@@
-473,7
+478,7
@@
export default class ChakartRules extends ChessRules {
)
) {
// "Forgotten" promotion, which occurred after some effect
)
) {
// "Forgotten" promotion, which occurred after some effect
- let moves = super.pawnPostProcess([move], color, C.GetOpp
Col
(color));
+ let moves = super.pawnPostProcess([move], color, C.GetOpp
Turn
(color));
super.showChoices(moves, r);
}
else
super.showChoices(moves, r);
}
else
@@
-584,11
+589,15
@@
export default class ChakartRules extends ChessRules {
case "luigi":
case "waluigi":
// Change color of friendly or enemy piece, king excepted
case "luigi":
case "waluigi":
// Change color of friendly or enemy piece, king excepted
- const oldColor = (move.egg == "waluigi" ? color : C.GetOpp
Col
(color));
- const newColor = C.GetOpp
Col
(oldColor);
+ const oldColor = (move.egg == "waluigi" ? color : C.GetOpp
Turn
(color));
+ const newColor = C.GetOpp
Turn
(oldColor);
const coords = getRandomPiece(oldColor);
if (coords) {
const piece = this.getPiece(coords[0], coords[1]);
const coords = getRandomPiece(oldColor);
if (coords) {
const piece = this.getPiece(coords[0], coords[1]);
+ if (coords[0] == move.start.x && coords[1] == move.start.y) {
+ // Moving piece change color: fix coords
+ coords = [move.end.x, move.end.y];
+ }
em = new Move({
appear: [
new PiPo({x: coords[0], y: coords[1], c: newColor, p: piece})
em = new Move({
appear: [
new PiPo({x: coords[0], y: coords[1], c: newColor, p: piece})