X-Git-Url: https://git.auder.net/?p=xogo.git;a=blobdiff_plain;f=variants%2FChakart%2Fclass.js;h=916156ed7f35c2535dabb1856841b96f847011db;hp=815be74b8d1d24f1e2ed711ec01099c754995292;hb=9ac672172c605f9f5ea4355b8f743bcf189601fe;hpb=f31de5e46015a93dca20765da61670035ce8f491 diff --git a/variants/Chakart/class.js b/variants/Chakart/class.js index 815be74..916156e 100644 --- a/variants/Chakart/class.js +++ b/variants/Chakart/class.js @@ -387,25 +387,6 @@ export default class ChakartRules extends ChessRules { play(move) { const color = this.turn; const oppCol = C.GetOppCol(color); - if ( - move.appear.length > 0 && - move.appear[0].p == 'p' && - ( - (color == 'w' && move.end.x == 0) || - (color == 'b' && move.end.x == this.size.x - 1) - ) - ) { - // "Forgotten" promotion, which occurred after some effect - let moves = [move]; - super.pawnPostProcess(moves, color, oppCol); - super.showChoices(moves); - return false; - } - this.postPlay(move, color, oppCol); - return true; - } - - postPlay(move, color, oppCol) { this.egg = move.egg; if (move.egg == "toadette") { this.reserve = { w: {}, b: {} }; @@ -480,6 +461,25 @@ export default class ChakartRules extends ChessRules { this.displayBonus(move); } + buildMoveStack(move, r) { + const color = this.turn; + if ( + move.appear.length > 0 && + move.appear[0].p == 'p' && + ( + (color == 'w' && move.end.x == 0) || + (color == 'b' && move.end.x == this.size.x - 1) + ) + ) { + // "Forgotten" promotion, which occurred after some effect + let moves = [move]; + super.pawnPostProcess(moves, color, C.GetOppCol(color)); + super.showChoices(moves, r); + } + else + super.buildMoveStack(move, r); + } + computeNextMove(move) { // Set potential random effects, so that play() is deterministic // from opponent viewpoint: @@ -559,8 +559,17 @@ export default class ChakartRules extends ChessRules { let bagOfPieces = []; for (let i=0; i 0) + ) + ) { bagOfPieces.push([i, j]); + } } } if (bagOfPieces.length >= 1)