X-Git-Url: https://git.auder.net/?p=xogo.git;a=blobdiff_plain;f=variants%2FMadrasi%2Fclass.js;h=ac5ccffc2e987ce6c1b8bb8ac8ed9b14047b36f3;hp=bbec80a9b26b09d5a6a9e6e7222dbd658b855c1b;hb=f3e90e30b6e7ff416afe288bc9dd865e5daf9860;hpb=a548cb4e3ad8099e977da9bb4a4184973beb56e3 diff --git a/variants/Madrasi/class.js b/variants/Madrasi/class.js index bbec80a..ac5ccff 100644 --- a/variants/Madrasi/class.js +++ b/variants/Madrasi/class.js @@ -22,18 +22,16 @@ export default class MadrasiRules extends ChessRules { super(o); } - underCheck([x, y], color) { - if (this.options["rexincl"]) { - // If Rex Inclusive, kings do not check each other: - // we just replace it very temporarily. - const [ox, oy] = this.searchKingPos(color); - const saveOppKing = this.board[ox][oy]; - this.board[ox][oy] = C.GetOppCol(color) + "q"; //arbitrary - const res = super.underCheck([x, y], color); - this.board[ox][oy] = saveOppKing; - return res; - } - return super.underCheck([x, y], color); + canTake([x1, y1], [x2, y2]) { + return ( + ( + !this.options["rexincl"] || + this.getPiece(x1, y1) != 'k' || + this.getPiece(x2, y2) != 'k' + ) + && + super.canTake([x1, y1], [x2, y2]) + ); } };