X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FAbsorption.js;h=64c03e6815a1759723d8be0bf3f18b478cd3ede1;hb=306dab5f2087a35669a114587c0415b31145665b;hp=7a9ff3c53688ff9dd4be7e970de388a775227ffb;hpb=8948a2876de183467f610a703d8c7f6d7c2df570;p=vchess.git diff --git a/client/src/variants/Absorption.js b/client/src/variants/Absorption.js index 7a9ff3c5..64c03e68 100644 --- a/client/src/variants/Absorption.js +++ b/client/src/variants/Absorption.js @@ -49,8 +49,8 @@ export class AbsorptionRules extends ChessRules { // p1 or p2 already have knight + other piece return (p1 == V.KNIGHT ? p2 : p1); } + if ([p1, p2].includes(V.QN)) return V.QN; for (let p of [p1, p2]) { - if (p == V.QN) return V.QN; if ([V.BN, V.RN].includes(p)) return V.MergeComposed[[p1, p2].sort().join("")]; } @@ -80,6 +80,15 @@ export class AbsorptionRules extends ChessRules { default: moves = super.getPotentialMovesFrom(sq); } + // Filter out capturing promotions (except one), + // because they are all the same. + moves = moves.filter(m => { + return ( + m.vanish.length == 1 || + m.vanish[0].p != V.PAWN || + [V.PAWN, V.QUEEN].includes(m.appear[0].p) + ); + }); moves.forEach(m => { if (m.vanish.length == 2) { // Augment pieces abilities in case of captures