projects
/
vchess.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
03beb21
)
Better Ball rules (I think...)
author
Benjamin Auder
<benjamin.auder@somewhere>
Fri, 3 Apr 2020 21:55:01 +0000
(23:55 +0200)
committer
Benjamin Auder
<benjamin.auder@somewhere>
Fri, 3 Apr 2020 21:55:01 +0000
(23:55 +0200)
client/src/translations/rules/Ball/en.pug
patch
|
blob
|
blame
|
history
client/src/translations/rules/Ball/es.pug
patch
|
blob
|
blame
|
history
client/src/translations/rules/Ball/fr.pug
patch
|
blob
|
blame
|
history
client/src/variants/Ball.js
patch
|
blob
|
blame
|
history
diff --git
a/client/src/translations/rules/Ball/en.pug
b/client/src/translations/rules/Ball/en.pug
index
c70fb46
..
e87db51
100644
(file)
--- a/
client/src/translations/rules/Ball/en.pug
+++ b/
client/src/translations/rules/Ball/en.pug
@@
-10,12
+10,18
@@
ul
li.
Capturing an enemy unit holding the ball both make the piece
disappear and grab the ball.
li.
Capturing an enemy unit holding the ball both make the piece
disappear and grab the ball.
- li "Capturing" a friendly unit pass the ball to it.
+ li.
+ "Capturing" a friendly unit pass the ball to it, or take the ball
+ from it. In both cases the pieces don't move.
p.
All pieces represent players on a field of some ball game,
so they can move up to three squares only for a better realism.
p.
All pieces represent players on a field of some ball game,
so they can move up to three squares only for a better realism.
+p.
+ To balance the advantage of ball possession, the piece holding the ball
+ cannot capture enemy pieces.
+
figure.diagram-container
.diagram.diag12
| fen:1bnrqrnhb/ppppppppp/2h6/9/4a4/5P3/9/PPPPP1PPP/HBNRQRNHB:
figure.diagram-container
.diagram.diag12
| fen:1bnrqrnhb/ppppppppp/2h6/9/4a4/5P3/9/PPPPP1PPP/HBNRQRNHB:
diff --git
a/client/src/translations/rules/Ball/es.pug
b/client/src/translations/rules/Ball/es.pug
index
916ef80
..
ce371e9
100644
(file)
--- a/
client/src/translations/rules/Ball/es.pug
+++ b/
client/src/translations/rules/Ball/es.pug
@@
-10,12
+10,18
@@
ul
li.
Capturar una pieza enemiga con el globo lo roba
mientras lo hace desaparecer.
li.
Capturar una pieza enemiga con el globo lo roba
mientras lo hace desaparecer.
- li "Capturar" una pieza amiga le pasa la pelota.
+ li.
+ "Capturar" una pieza amistosa pasa o toma la pelota. En ambos casos,
+ las piezas no se mueven.
p.
Todas las piezas representan jugadores en un área de juego de pelota,
entonces solo se mueven tres casillas como máximo para un mejor realismo.
p.
Todas las piezas representan jugadores en un área de juego de pelota,
entonces solo se mueven tres casillas como máximo para un mejor realismo.
+p.
+ Para compensar la ventaja de la posesión, una pieza que tiene la
+ la pelota no puede capturar piezas opuestas.
+
figure.diagram-container
.diagram.diag12
| fen:1bnrqrnhb/ppppppppp/2h6/9/4a4/5P3/9/PPPPP1PPP/HBNRQRNHB:
figure.diagram-container
.diagram.diag12
| fen:1bnrqrnhb/ppppppppp/2h6/9/4a4/5P3/9/PPPPP1PPP/HBNRQRNHB:
diff --git
a/client/src/translations/rules/Ball/fr.pug
b/client/src/translations/rules/Ball/fr.pug
index
f38bfbd
..
19c9284
100644
(file)
--- a/
client/src/translations/rules/Ball/fr.pug
+++ b/
client/src/translations/rules/Ball/fr.pug
@@
-10,13
+10,19
@@
ul
li.
Capturer une pièce ennemie possédant le ballon lui vole
tout en la faisant disparaître.
li.
Capturer une pièce ennemie possédant le ballon lui vole
tout en la faisant disparaître.
- li "Capturer" une pièce amie lui passe le ballon.
+ li.
+ "Capturer" une pièce amie lui passe le ballon, ou lui prend.
+ Dans les deux cas, les pièces ne bougent pas.
p.
Toutes les pièces représentent des joueurs sur un terrain d'un certain
jeu de ballon, donc elles ne se déplacent que de trois cases au maximum
pour un meilleur réalisme.
p.
Toutes les pièces représentent des joueurs sur un terrain d'un certain
jeu de ballon, donc elles ne se déplacent que de trois cases au maximum
pour un meilleur réalisme.
+p.
+ Pour compenser l'avantage de possession du ballon, une pièce ayant la
+ balle ne peut pas capturer les pièces adverses.
+
figure.diagram-container
.diagram.diag12
| fen:1bnrqrnhb/ppppppppp/2h6/9/4a4/5P3/9/PPPPP1PPP/HBNRQRNHB:
figure.diagram-container
.diagram.diag12
| fen:1bnrqrnhb/ppppppppp/2h6/9/4a4/5P3/9/PPPPP1PPP/HBNRQRNHB:
diff --git
a/client/src/variants/Ball.js
b/client/src/variants/Ball.js
index
3903e2b
..
e3c8e5e
100644
(file)
--- a/
client/src/variants/Ball.js
+++ b/
client/src/variants/Ball.js
@@
-112,10
+112,17
@@
export class BallRules extends ChessRules {
}
canTake([x1, y1], [x2, y2]) {
}
canTake([x1, y1], [x2, y2]) {
- // Capture enemy or pass ball to friendly pieces
+ if (this.getColor(x1, y1) !== this.getColor(x2, y2)) {
+ // The piece holding the ball cannot capture:
+ return (
+ !(Object.keys(V.HAS_BALL_DECODE)
+ .includes(this.board[x1][y1].charAt(1)))
+ );
+ }
+ // Pass: possible only if one of the friendly pieces has the ball
return (
return (
-
this.getColor(x1, y1) !== this.getColor(x2, y2
) ||
- Object.keys(V.HAS_BALL_DECODE).includes(this.board[x
1][y1
].charAt(1))
+
Object.keys(V.HAS_BALL_DECODE).includes(this.board[x1][y1].charAt(1)
) ||
+ Object.keys(V.HAS_BALL_DECODE).includes(this.board[x
2][y2
].charAt(1))
);
}
);
}
@@
-238,15
+245,29
@@
export class BallRules extends ChessRules {
);
}
);
}
- // Post-processing: maybe the ball was taken, or a piece + ball
+ // Post-processing: maybe the ball was taken, or a piece + ball,
+ // or maybe a pass (ball <--> piece)
if (mv.vanish.length == 2) {
if (
// Take the ball?
mv.vanish[1].c == 'a' ||
if (mv.vanish.length == 2) {
if (
// Take the ball?
mv.vanish[1].c == 'a' ||
- // Capture a ball-holding piece?
+ // Capture a ball-holding piece?
If friendly one, then adjust
Object.keys(V.HAS_BALL_DECODE).includes(mv.vanish[1].p)
) {
mv.appear[0].p = V.HAS_BALL_CODE[mv.appear[0].p];
Object.keys(V.HAS_BALL_DECODE).includes(mv.vanish[1].p)
) {
mv.appear[0].p = V.HAS_BALL_CODE[mv.appear[0].p];
+ if (mv.vanish[1].c == mv.vanish[0].c) {
+ // "Capturing" self => pass
+ mv.appear[0].x = mv.start.x;
+ mv.appear[0].y = mv.start.y;
+ mv.appear.push(
+ new PiPo({
+ x: mv.end.x,
+ y: mv.end.y,
+ p: V.HAS_BALL_DECODE[mv.vanish[1].p],
+ c: mv.vanish[0].c
+ })
+ );
+ }
} else if (mv.vanish[1].c == mv.vanish[0].c) {
// Pass the ball: the passing unit does not disappear
mv.appear.push(JSON.parse(JSON.stringify(mv.vanish[0])));
} else if (mv.vanish[1].c == mv.vanish[0].c) {
// Pass the ball: the passing unit does not disappear
mv.appear.push(JSON.parse(JSON.stringify(mv.vanish[0])));