Fix Omega promotions
[vchess.git] / client / src / variants / Progressive2.js
1 import { Progressive1Rules } from "@/variants/Progressive1";
2 import { SuicideRules } from "@/variants/Suicide";
3 import { ChessRules } from "@/base_rules";
4 import { randInt } from "@/utils/alea";
5
6 export class Progressive2Rules extends Progressive1Rules {
7 static get PawnSpecs() {
8 return Object.assign(
9 {},
10 ChessRules.PawnSpecs,
11 { twoSquares: false }
12 );
13 }
14
15 static get HasFlags() {
16 return false;
17 }
18
19 postPlay(move) {
20 const c = move.turn[0];
21 const piece = move.vanish[0].p;
22 if (piece == V.KING && move.appear.length > 0) {
23 this.kingPos[c][0] = move.appear[0].x;
24 this.kingPos[c][1] = move.appear[0].y;
25 }
26 }
27
28 undo(move) {
29 V.UndoOnBoard(this.board, move);
30 if (this.turn != move.turn[0]) this.movesCount--;
31 this.turn = move.turn[0];
32 this.subTurn = move.turn[1];
33 super.postUndo(move);
34 }
35
36 static GenRandInitFen(randomness) {
37 return SuicideRules.GenRandInitFen(randomness);
38 }
39
40 static get VALUES() {
41 return {
42 p: 1,
43 r: 5,
44 n: 3,
45 b: 3,
46 q: 7, //slightly less than in orthodox game
47 k: 1000
48 };
49 }
50 };