X-Git-Url: https://git.auder.net/?p=xogo.git;a=blobdiff_plain;f=base_rules.js;h=4808d0c22eed87c4a4870119bfa9d0949f21b514;hp=715f4e053a03b9b092618b4e6cdbf0e33b30bdf4;hb=f46a68b8ed74b54b6a26645b88d2a4ae48c1227a;hpb=55a15dcb7df5091f46f7dd9c170b2aae5846c6c0 diff --git a/base_rules.js b/base_rules.js index 715f4e0..4808d0c 100644 --- a/base_rules.js +++ b/base_rules.js @@ -1543,11 +1543,19 @@ export default class ChessRules { addPawnMoves([x1, y1], [x2, y2], moves, promotions) { let finalPieces = ["p"]; const color = this.getColor(x1, y1); + const oppCol = C.GetOppCol(color); const lastRank = (color == "w" ? 0 : this.size.x - 1); if (x2 == lastRank && (!this.options["rifle"] || this.board[x2][y2] == "")) { // promotions arg: special override for Hiddenqueen variant - if (promotions) finalPieces = promotions; + if ( + this.options["cannibal"] && + this.board[x2][y2] != "" && + this.getColor(x2, y2) == oppCol + ) { + finalPieces = [this.getPieceType(x2, y2)]; + } + else if (promotions) finalPieces = promotions; else if (this.pawnSpecs.promotions) finalPieces = this.pawnSpecs.promotions; }