Skip to content

Commit f6839bb

Browse files
committed
Azacru: Add missing validation step when reorienting
1 parent 9fe9c6d commit f6839bb

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

locales/en/apgames.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3429,6 +3429,7 @@
34293429
"NO_MOVES": "The piece at {{where}} cannot move."
34303430
},
34313431
"azacru": {
3432+
"BAD_MOVE": "Pieces may only move straight ahead or at a 45 degree angle.",
34323433
"BAD_ORIENTATION": "The only valid orientation notations are \">\", \"<\", and \".\".",
34333434
"BAD_PASS": "You may not pass if legal moves are available.",
34343435
"ENEMY_TILE": "You can't land on opposing tiles.",

src/games/azacru.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,14 @@ export class AzacruGame extends GameBase {
495495

496496
// check for reorientation trigger
497497
if (m.endsWith("*")) {
498+
// make sure base move is legal
499+
const base = m.substring(0, m.length - 1);
500+
if (! this.baseMoves().includes(base)) {
501+
result.valid = false;
502+
result.message = i18next.t("apgames:validation.azacru.BAD_MOVE")
503+
return result;
504+
}
505+
// if it is, then proceed
498506
result.valid = true;
499507
result.complete = -1;
500508
result.canrender = true;

0 commit comments

Comments
 (0)