X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FAbsorption.js;h=33c8351789925a1e71a906a41c8d49168e8ccdd4;hb=e023d74715d327ebd7623079cb778b0def0a1464;hp=64c03e6815a1759723d8be0bf3f18b478cd3ede1;hpb=f4221ff17c58c277660865a11bf6358268fbda10;p=vchess.git diff --git a/client/src/variants/Absorption.js b/client/src/variants/Absorption.js index 64c03e68..33c83517 100644 --- a/client/src/variants/Absorption.js +++ b/client/src/variants/Absorption.js @@ -1,6 +1,7 @@ import { ChessRules } from "@/base_rules"; export class AbsorptionRules extends ChessRules { + getPpath(b) { if ([V.BN, V.RN, V.QN].includes(b[1])) return "Absorption/" + b; return b; @@ -90,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; @@ -147,4 +151,5 @@ export class AbsorptionRules extends ChessRules { notation += "=" + move.appear[0].p.toUpperCase(); return notation; } + };