Skip to content

Commit cf73410

Browse files
committed
Merge branch 'develop'
2 parents fe16eec + d646701 commit cf73410

3 files changed

Lines changed: 37 additions & 4 deletions

File tree

locales/en/apgames.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3117,6 +3117,12 @@
31173117
"name": "Hide 9x9 piece highlight"
31183118
}
31193119
},
3120+
"go": {
3121+
"show-controlled-areas": {
3122+
"description": "Highlight the areas currently controlled by each player.",
3123+
"name": "Show controlled areas"
3124+
}
3125+
},
31203126
"gyve": {
31213127
"vertex-style": {
31223128
"name": "Vertex style",
@@ -3519,6 +3525,9 @@
35193525
"ROUND": "Round",
35203526
"SCORES": "Scores",
35213527
"STACKSIZES": "Stack heights",
3528+
"stiletto" : {
3529+
"DAGGER": "Dagger:"
3530+
},
35223531
"tumbleweed": "Score (pieces + influence)",
35233532
"ESTIMATEDSCORES": "Estimated scores",
35243533
"TOPLACE": "Piece to place",

src/games/go.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { GameBase, IAPGameState, IClickResult, ICustomButton, IIndividualState, IScores, IValidationResult } from "./_base";
1+
import { GameBase, IAPGameState, IClickResult, ICustomButton, IIndividualState, IScores, IRenderOpts, IValidationResult } from "./_base";
22
import { APGamesInformation } from "../schemas/gameinfo";
33
import { APRenderRep, BoardBasic, MarkerDots, RowCol } from "@abstractplay/renderer/src/schemas/schema";
44
import { APMoveResult } from "../schemas/moveresults";
@@ -72,6 +72,7 @@ export class GoGame extends GameBase {
7272
],
7373
categories: ["goal>area", "mechanic>place", "mechanic>capture", "mechanic>enclose", "board>shape>rect", "components>simple>1per"],
7474
flags: ["scores", "custom-buttons", "custom-colours"],
75+
displays: [{uid: "show-controlled-areas"}],
7576
};
7677

7778
public coords2algebraic(x: number, y: number): string {
@@ -644,7 +645,18 @@ export class GoGame extends GameBase {
644645
return (player == 1 && !this.swapped) || (player == 2 && this.swapped) ? 1 : 2;
645646
}
646647

647-
public render(): APRenderRep {
648+
public render(opts?: IRenderOpts): APRenderRep {
649+
let altDisplay: string | undefined;
650+
if (opts !== undefined) {
651+
altDisplay = opts.altDisplay;
652+
}
653+
let highlightAreas = false;
654+
if (altDisplay !== undefined) {
655+
if (altDisplay === "show-controlled-areas") {
656+
highlightAreas = true;
657+
}
658+
}
659+
648660
// Build piece string
649661
let pstr = "";
650662
for (let row = 0; row < this.boardSize; row++) {
@@ -696,7 +708,7 @@ export class GoGame extends GameBase {
696708
}
697709
}
698710

699-
if (this.gameover) {
711+
if (highlightAreas || this.gameover) {
700712
const territories = this.getTerritories();
701713
const markers: Array<MarkerDots> = []
702714
for (const t of territories) {

src/games/stiletto.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { GameBase, IAPGameState, IClickResult, IIndividualState, IValidationResult } from "./_base";
1+
import { GameBase, IAPGameState, IClickResult, IIndividualState, IStatus, IValidationResult } from "./_base";
22
import { APGamesInformation } from "../schemas/gameinfo";
33
import { APMoveResult } from "../schemas/moveresults";
44
import { reviver, UserFacingError } from "../common";
@@ -596,11 +596,23 @@ export class StilettoGame extends InARowBase {
596596
};
597597
}
598598

599+
public statuses(): IStatus[] {
600+
const daggerPlayer = this.hasDagger() ? this.currplayer : this.currplayer % 2 + 1;
601+
const status = `Player ${daggerPlayer}\n`
602+
603+
return [{ key: i18next.t("apgames:status.stiletto.DAGGER"),
604+
value: [status] } as IStatus];
605+
}
606+
599607
public status(): string {
600608
let status = super.status();
601609
if (this.variants !== undefined) {
602610
status += "**Variants**: " + this.variants.join(", ") + "\n\n";
603611
}
612+
613+
const daggerPlayer = this.hasDagger() ? this.currplayer : this.currplayer % 2 + 1;
614+
status += `Player ${daggerPlayer} has dagger.\n`
615+
604616
return status;
605617
}
606618

0 commit comments

Comments
 (0)