A few bug fixes
[vchess.git] / client / src / variants / Stealthbomb2.js
1 import { Move, PiPo } from "@/base_rules";
2 import { Stealthbomb1Rules } from "@/variants/Stealthbomb1";
3
4 export class Stealthbomb2Rules extends Stealthbomb1Rules {
5
6 // Initiate the game by choosing a pawn holding the bomb:
7 doClick(square) {
8 const c = this.turn;
9 if (
10 this.movesCount >= 2 ||
11 (
12 (c == 'w' && square[0] != 6) ||
13 (c == 'b' && square[0] != 1)
14 )
15 ) {
16 return null;
17 }
18 const [x, y] = square;
19 return new Move({
20 appear: [ new PiPo({ x: x, y: y, c: c, p: 's' }) ],
21 vanish: [ new PiPo({ x: x, y: y, c: c, p: 'p' }) ],
22 start: { x: -1, y: -1 },
23 end: { x: x, y: y, noHighlight: true }
24 });
25 }
26
27 };