X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=variants%2F_Antiking%2Fclass.js;h=941bd821c064cd6f797a2a3275d0a51d61e7f4d6;hb=f31de5e46015a93dca20765da61670035ce8f491;hp=e92edab21f1c67d1b016bd520af8731ee99a7fb6;hpb=f3e90e30b6e7ff416afe288bc9dd865e5daf9860;p=xogo.git diff --git a/variants/_Antiking/class.js b/variants/_Antiking/class.js index e92edab..941bd82 100644 --- a/variants/_Antiking/class.js +++ b/variants/_Antiking/class.js @@ -26,17 +26,9 @@ export default class AbstractAntikingRules extends ChessRules { } pieces(color, x, y) { - return Object.assign( - { - 'a': { - // Move like a king, no attacks - "class": "antiking", - moves: super.pieces(color, x, y)['k'].moves, - attack: [] - } - }, - super.pieces(color, x, y) - ); + let antikingSpec = super.pieces(color, x, y)['k']; + antikingSpec["class"] = "antiking"; + return Object.assign({'a': antikingSpec}, super.pieces(color, x, y)); } isKing(x, y, p) { @@ -63,9 +55,11 @@ export default class AbstractAntikingRules extends ChessRules { m.vanish.length == 1 || m.vanish[1].p != 'a'); } - underCheck(squares, color) { + underCheck(square_s, color) { let res = false; - squares.forEach(sq => { + if (!Array.isArray(square_s[0])) + square_s = [square_s]; + square_s.forEach(sq => { switch (this.getPiece(sq[0], sq[1])) { case 'k': res ||= super.underAttack(sq, color);