X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FAbsorption.js;h=293238dbd8790672f33a1790e73c92900236c494;hb=4313762da3237b04f204e121a20cab3ba7bb5dd2;hp=c6e1de7476af0c61f08a69d059f0907ee4016efa;hpb=7e8a7ea1cb66adb4a987badfb0a3c2f99a21bd0a;p=vchess.git diff --git a/client/src/variants/Absorption.js b/client/src/variants/Absorption.js index c6e1de74..293238db 100644 --- a/client/src/variants/Absorption.js +++ b/client/src/variants/Absorption.js @@ -91,10 +91,13 @@ export class AbsorptionRules extends ChessRules { ); }); moves.forEach(m => { - if (m.vanish.length == 2) { + if ( + m.vanish.length == 2 && + m.appear.length == 1 && + piece != m.vanish[1].p + ) { // Augment pieces abilities in case of captures - const piece2 = m.vanish[1].p; - if (piece != piece2) m.appear[0].p = V.Fusion(piece, piece2); + m.appear[0].p = V.Fusion(piece, m.vanish[1].p); } }); return moves; @@ -113,7 +116,7 @@ export class AbsorptionRules extends ChessRules { return ( this.isAttackedBySlideNJump(sq, color, V.BN, V.steps[V.BISHOP]) || this.isAttackedBySlideNJump( - sq, color, V.BN, V.steps[V.KNIGHT], "oneStep") + sq, color, V.BN, V.steps[V.KNIGHT], 1) ); } @@ -121,7 +124,7 @@ export class AbsorptionRules extends ChessRules { return ( this.isAttackedBySlideNJump(sq, color, V.RN, V.steps[V.ROOK]) || this.isAttackedBySlideNJump( - sq, color, V.RN, V.steps[V.KNIGHT], "oneStep") + sq, color, V.RN, V.steps[V.KNIGHT], 1) ); } @@ -130,7 +133,7 @@ export class AbsorptionRules extends ChessRules { this.isAttackedBySlideNJump( sq, color, V.QN, V.steps[V.BISHOP].concat(V.steps[V.ROOK])) || this.isAttackedBySlideNJump( - sq, color, V.QN, V.steps[V.KNIGHT], "oneStep") + sq, color, V.QN, V.steps[V.KNIGHT], 1) ); }