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;
);
});
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;
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)
);
}
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)
);
}
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)
);
}
notation += "=" + move.appear[0].p.toUpperCase();
return notation;
}
+
};