Skip to content

Commit e2df2e9

Browse files
committed
Terrace: Fix diagonal captures and differentiate self capture from other capture
1 parent f749bc4 commit e2df2e9

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

locales/en/apresults.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@
8282
"spook_lateral_self_one": "{{player}} has 1 of their own ball captured by Spooky on the same level at {{where}}.",
8383
"spook_lateral_self_other": "{{player}} has {{count}} of their own balls captured by Spooky on the same level at {{where}}.",
8484
"tafl": "{{player}} captured a piece at {{where}}.",
85-
"terrace": "{{player}} captured a size {{what}} piece at {{where}}.",
85+
"terrace_other": "{{player}} captured a size {{what}} piece at {{where}}.",
86+
"terrace_self": "{{player}} cannibalized their own size {{what}} piece at {{where}}.",
8687
"tumbleweed": "{{player}} captured a stack of size {{count}} at {{where}}.",
8788
"tumbleweed_self": "{{player}} reinforces a stack of size {{count}} at {{where}}.",
8889
"witch": {

src/games/terrace.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ export class TerraceGame extends GameBase {
4242
dateAdded: "2023-06-18",
4343
// i18next.t("apgames:descriptions.terrace")
4444
description: "apgames:descriptions.terrace",
45+
// i18next.t("apgames:notes.terrace")
46+
notes: "apgames:notes.terrace",
4547
urls: [
4648
"https://boardgamegeek.com/boardgame/2872/terrace",
4749
"https://boardgamegeek.com/boardgame/15676/terrace-6x6",
@@ -355,8 +357,8 @@ export class TerraceGame extends GameBase {
355357
else {
356358
// up straight, I must be larger
357359
const capUp = gOrth.neighbours(piece.location).filter(cell => this.board.has(cell) && gOrth.elevation(cell) === thisElev + 1 && this.board.get(cell)!.size < piece.size);
358-
// same level, I must be at least same size
359-
const capSame = g.neighbours(piece.location).filter(cell => this.board.has(cell) && gOrth.elevation(cell) === thisElev && this.board.get(cell)!.size <= piece.size);
360+
// same level, I must be at least same size and orthogonally adjacent
361+
const capSame = gOrth.neighbours(piece.location).filter(cell => this.board.has(cell) && gOrth.elevation(cell) === thisElev && this.board.get(cell)!.size <= piece.size);
360362
// down diagonal, I must be at least 1 size smaller
361363
const capDown = gDiag.neighbours(piece.location).filter(cell => this.board.has(cell) && gDiag.elevation(cell) === thisElev - 1 && this.board.get(cell)!.size > piece.size);
362364
// up straight, my king attacking a largest piece
@@ -574,7 +576,7 @@ export class TerraceGame extends GameBase {
574576
this.board.set(to, pcFrom);
575577
this.results.push({type: "move", from: fCell, to, what: pcFrom.size.toString()});
576578
if (m.includes("x") || m.includes("*")) {
577-
this.results.push({type: "capture", where: to, what: pcTo!.size.toString(), whose: pcTo!.owner});
579+
this.results.push({type: "capture", where: to, what: `${m.includes("x") ? "x" : "*"}${pcTo!.size}`, whose: pcTo!.owner});
578580
}
579581

580582
// update currplayer
@@ -935,7 +937,7 @@ export class TerraceGame extends GameBase {
935937
let resolved = false;
936938
switch (r.type) {
937939
case "capture":
938-
node.push(i18next.t("apresults:CAPTURE.terrace", {player, where: r.where, what: r.what}));
940+
node.push(i18next.t("apresults:CAPTURE.terrace", {context: r.what?.startsWith("*") ? "self" : "other", player, where: r.where, what: r.what?.substring(1)}));
939941
resolved = true;
940942
break;
941943
case "move":

0 commit comments

Comments
 (0)