diff --git a/locales/en/apresults.json b/locales/en/apresults.json index 2295ff80..06d7715e 100644 --- a/locales/en/apresults.json +++ b/locales/en/apresults.json @@ -23,7 +23,7 @@ "biscuit": "The following cards were in opposing hands: {{cards}}.", "deckfish": "{{player}} was unable to move and must pass from now on.", "quincunx": "Player {{playerNum}} had the following cards left in their hand: {{cards}}.", - "stawvs": "{{player}} was unable to move and must pass from now on." + "stawvs": "{{player}} was unable to move and must pass from now on. Their pieces remain on the following pyramids: {{pyramids}}." }, "BEAROFF": { "complete_one": "{{player}} bore off one piece from {{from}}.", @@ -100,6 +100,7 @@ "spook_lateral_opponent_other": "{{player}} has {{count}} of their opponent's balls captured by Spooky on the same level at {{where}}.", "spook_lateral_self_one": "{{player}} has 1 of their own ball captured by Spooky on the same level at {{where}}.", "spook_lateral_self_other": "{{player}} has {{count}} of their own balls captured by Spooky on the same level at {{where}}.", + "stawvs": "{{player}} captured the {{what}} at {{where}}.", "tafl": "{{player}} captured a piece at {{where}}.", "terrace_other": "{{player}} captured a size {{what}} piece at {{where}}.", "terrace_self": "{{player}} cannibalized their own size {{what}} piece at {{where}}.", @@ -316,7 +317,7 @@ "saltire": "{{player}} swapped the pieces at {{from}} and {{to}}.", "slyde": "{{player}} slid a piece from {{from}} to {{to}}.", "spook": "{{player}} moved Spooky from {{from}} to {{to}}.", - "stawvs": "{{player}} moved a piece from {{from}} to {{to}} and captured the {{what}} at {{how}}.", + "stawvs": "{{player}} moved a piece from {{from}} to {{to}} and captured {{what}} at {{how}}.", "susan": "{{player}} slid a piece from {{from}} to {{to}}.", "tafl": "{{player}} moved a piece from {{from}} to {{to}}.", "tafl_jump": "{{player}} jumped a piece from {{from}} to {{to}}.", diff --git a/src/games/stawvs.ts b/src/games/stawvs.ts index 9b384336..d257279e 100644 --- a/src/games/stawvs.ts +++ b/src/games/stawvs.ts @@ -300,6 +300,31 @@ export class StawvsGame extends GameBase { return mycells; } + public getPyramidsByPlayer(player: playerid): Pyramid[] { + //Used for final collections. + const tempcaps: Pyramid[] = []; + for (let row = 0; row < boardDim; row++) { + for (let col = 0; col < boardDim; col++) { + const cell = StawvsGame.coords2algebraic(col, row); + if (this.board.has(cell)) { + const contents = this.board.get(cell); + if (contents!.length > 1) { + const cellplayer = contents![1]; + if (cellplayer === player) + tempcaps.push(contents![0]); + } + } + } + } + return tempcaps; + } + + public getPyramidsByName(): string[] { + //Used for final collection logging. + const mymids = this.getPyramidsByPlayer(this.currplayer); + return mymids.map(mid => this.namePyramid(mid)); + } + public getOwner(cell: string): playerid | undefined { if (! this.board.has(cell)) { return undefined; @@ -367,7 +392,7 @@ export class StawvsGame extends GameBase { //Name the captured pyramid for the chat log. const colors = ["pink","blue","green","orange"]; const sizes = ["small","medium","large"]; - let name = ""; + let name = "a "; name += sizes[pyramid[1] as number - 1] + " "; name += colors[allColours.indexOf(pyramid[0])] + " pyramid"; return name; @@ -612,10 +637,8 @@ export class StawvsGame extends GameBase { //passing is forevah if (this.eliminated.indexOf(this.currplayer) < 0) { this.eliminated.push(this.currplayer); - if (this.eliminated.length < this.numplayers) - this.results = [{type: "eliminated", who: this.currplayer.toString()}]; - else - this.results = [{type: "pass"}]; + const finalMids = this.getPyramidsByName(); + this.results = [{type: "announce", payload: finalMids}]; } else { this.results = [{type: "pass"}]; } @@ -1067,6 +1090,10 @@ export class StawvsGame extends GameBase { node.push(i18next.t("apresults:MOVE.stawvs", {player, what: r.what, from: r.from, to: r.to, how: r.how})); resolved = true; break; + case "capture": + node.push(i18next.t("apresults:CAPTURE.stawvs", {what: r.what, where: r.where})); + resolved = true; + break; case "pass": node.push(i18next.t("apresults:PASS.simple", {player})); resolved = true; @@ -1075,6 +1102,10 @@ export class StawvsGame extends GameBase { node.push(i18next.t("apresults:ELIMINATED", {player})); resolved = true; break; + case "announce": + node.push(i18next.t("apresults:ANNOUNCE.stawvs", {player, pyramids: (r.payload as string[]).join(", ")})); + resolved = true; + break; case "eog": node.push(i18next.t("apresults:EOG.stawvs", {player})); resolved = true;