Show a turn summary before the step that ends the turn
When the next move would end the turn (the buy, or a placement or decision that passes the turn on), the viewer holds it back and shows this turn's moves in plain language from the log (placements and their effects, foundings, merger results and disposals, swaps), the pending move, the cash and shares it leaves, and why it is final: ending the turn draws new tiles, or the game ends and is scored. "End turn" sends it, "Back" returns to the choice, and Undo steps back through the private draft from the summary. Lines already saved before the last commit boundary are greyed. A placement that would make earlier undoable moves permanent (a two-tile turn whose second tile pays merger bonuses) gets the same review. A lone placement that ends the turn keeps only its own placement confirmation, and tutorials keep their single-step flow. Undo after the turn has committed is still impossible: the end-of-turn draw reveals the next tile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3db7dbe404
commit
2bdb95f23d
28 changed files with 541 additions and 51 deletions
|
|
@ -43,7 +43,9 @@ Use Node 24 and pnpm 11. Inspect the working tree before editing and preserve un
|
|||
`toSave: undefined`; only the acting player receives the stripped preview. Revisions must
|
||||
not append saved history or award time. Commit boundaries include another player's
|
||||
decision, hidden information being revealed, draws and game end. Keep atomic moves working
|
||||
for older viewers, tutorials and analysis.
|
||||
for older viewers, tutorials and analysis. The viewer predicts each boundary by running the
|
||||
engine's `draftCanContinue` on a throwaway copy of the player's own view (`moveOutcome`), so
|
||||
the turn-ending step shows a turn summary first and merger decisions warn when undo stops.
|
||||
- Preserve two-player bank mode, four hands, team play and dropped-player behavior when changing rules.
|
||||
- Put new UI/log/tutorial text in all 17 catalogs under `packages/viewer/src/lib/locales/`.
|
||||
Keep chain names and tile coordinates unchanged. CMS text and setup labels have separate
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@
|
|||
import ChainMark from "./ChainMark.svelte";
|
||||
import HoldingChange from "./HoldingChange.svelte";
|
||||
import StockSwap from "./StockSwap.svelte";
|
||||
import TurnSummary from "./TurnSummary.svelte";
|
||||
import UndoButton from "./UndoButton.svelte";
|
||||
import { mergerPreview } from "./mergerPreview";
|
||||
import {
|
||||
adjustShares,
|
||||
|
|
@ -129,21 +131,12 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
{#if moves.length > 0 && !store.sending}
|
||||
{#if store.reviewing}
|
||||
<TurnSummary {store} />
|
||||
{:else if moves.length > 0 && !store.sending}
|
||||
<section class="panel" class:disposal={game.phase === "dispose"} aria-label={t("panel.label")}>
|
||||
{#if store.canUndo}
|
||||
<button type="button" class="actionable undo" onclick={() => store.undo()}>
|
||||
<svg
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
aria-hidden="true"><path d="M9 4 3 10l6 6M3 10h11a7 7 0 0 1 0 14" transform="translate(0 -2)" /></svg
|
||||
>
|
||||
{t("turn.undo")}
|
||||
</button>
|
||||
<UndoButton {store} />
|
||||
{/if}
|
||||
{#if legal("announce")}
|
||||
<div class="announce">
|
||||
|
|
@ -491,12 +484,6 @@
|
|||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.panel .undo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-inline-start: auto;
|
||||
}
|
||||
.panel {
|
||||
background: var(--panel);
|
||||
padding: 10px 12px 12px;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
<script lang="ts">
|
||||
import type { GameState } from "acquire-engine";
|
||||
import { describeEntryParts, type LogPart } from "./format";
|
||||
import { CHAIN_STYLES, themeInk } from "./palette";
|
||||
import { playerColor } from "./playerAppearance";
|
||||
import LogParts from "./LogParts.svelte";
|
||||
import { useStore } from "./store.svelte";
|
||||
|
||||
let { state: game }: { state: GameState } = $props();
|
||||
|
|
@ -41,21 +40,7 @@
|
|||
<ol class="log">
|
||||
{#each showAll ? lines : lines.slice(0, RECENT) as line (line.index)}
|
||||
<li class:turn={line.turn} class:hidden={line.hidden}>
|
||||
{#each line.parts as part}
|
||||
{#if part.kind === "player" || part.kind === "chain"}
|
||||
{@const color =
|
||||
part.kind === "player"
|
||||
? playerColor(game.seatOwner[part.seat] ?? part.seat, store.appearance?.playerColors)
|
||||
: CHAIN_STYLES[part.chain].fill}
|
||||
<span
|
||||
class="name"
|
||||
class:player-name={part.kind === "player"}
|
||||
class:chain-name={part.kind === "chain"}
|
||||
style:--name-ink-light={themeInk(color, "light")}
|
||||
style:--name-ink-dark={themeInk(color, "dark")}>{part.text}</span
|
||||
>
|
||||
{:else if part.kind === "money"}<span class="money">{part.text}</span>{:else}{part.text}{/if}
|
||||
{/each}
|
||||
<LogParts {game} parts={line.parts} />
|
||||
</li>
|
||||
{/each}
|
||||
</ol>
|
||||
|
|
@ -86,14 +71,6 @@
|
|||
color: var(--ink-muted);
|
||||
font-style: italic;
|
||||
}
|
||||
.name,
|
||||
.money {
|
||||
font-weight: 600;
|
||||
}
|
||||
.money {
|
||||
white-space: nowrap;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.more {
|
||||
margin: 8px 0 0;
|
||||
padding: 6px 12px;
|
||||
|
|
|
|||
37
packages/viewer/src/lib/LogParts.svelte
Normal file
37
packages/viewer/src/lib/LogParts.svelte
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<script lang="ts">
|
||||
import type { GameState } from "acquire-engine";
|
||||
import type { LogPart } from "./format";
|
||||
import { CHAIN_STYLES, themeInk } from "./palette";
|
||||
import { playerColor } from "./playerAppearance";
|
||||
import { useStore } from "./store.svelte";
|
||||
|
||||
let { game, parts }: { game: GameState; parts: LogPart[] } = $props();
|
||||
const store = useStore();
|
||||
</script>
|
||||
|
||||
{#each parts as part}
|
||||
{#if part.kind === "player" || part.kind === "chain"}
|
||||
{@const color =
|
||||
part.kind === "player"
|
||||
? playerColor(game.seatOwner[part.seat] ?? part.seat, store.appearance?.playerColors)
|
||||
: CHAIN_STYLES[part.chain].fill}
|
||||
<span
|
||||
class="name"
|
||||
class:player-name={part.kind === "player"}
|
||||
class:chain-name={part.kind === "chain"}
|
||||
style:--name-ink-light={themeInk(color, "light")}
|
||||
style:--name-ink-dark={themeInk(color, "dark")}>{part.text}</span
|
||||
>
|
||||
{:else if part.kind === "money"}<span class="money">{part.text}</span>{:else}{part.text}{/if}
|
||||
{/each}
|
||||
|
||||
<style>
|
||||
.name,
|
||||
.money {
|
||||
font-weight: 600;
|
||||
}
|
||||
.money {
|
||||
white-space: nowrap;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
</style>
|
||||
111
packages/viewer/src/lib/TurnSummary.svelte
Normal file
111
packages/viewer/src/lib/TurnSummary.svelte
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
<script lang="ts">
|
||||
import HoldingChange from "./HoldingChange.svelte";
|
||||
import LogParts from "./LogParts.svelte";
|
||||
import UndoButton from "./UndoButton.svelte";
|
||||
import type { ViewerStore } from "./store.svelte";
|
||||
import { holdingsAfter, moveEffect, turnSummary } from "./turn-summary";
|
||||
|
||||
let { store }: { store: ViewerStore } = $props();
|
||||
|
||||
const review = $derived(store.review!);
|
||||
const game = $derived(store.state!);
|
||||
const t = $derived(store.lang.t);
|
||||
// Without private drafts every sent move is already final, so nothing is greyed out.
|
||||
const lines = $derived(turnSummary(game, review.move, store.lang, store.drafting ? store.undoFrom : 0));
|
||||
const effect = $derived(moveEffect(game, review.move));
|
||||
const holdings = $derived(effect && holdingsAfter(game, effect));
|
||||
const mixed = $derived(store.canUndo && lines.some((line) => line.final));
|
||||
const note = $derived(
|
||||
review.outcome.endsGame ? t("turn.gameEnds") : review.kind === "end" ? t("turn.endNote") : t("turn.finalStep")
|
||||
);
|
||||
</script>
|
||||
|
||||
<section class="panel turn-summary" aria-label={t("turn.summary")}>
|
||||
<div class="head">
|
||||
<h3>{t("turn.summary")}</h3>
|
||||
{#if store.canUndo}<UndoButton {store} />{/if}
|
||||
</div>
|
||||
<ol class="lines">
|
||||
{#each lines as line (line.key)}
|
||||
<li class:final={line.final} class:pending={line.pending}><LogParts {game} parts={line.parts} /></li>
|
||||
{/each}
|
||||
</ol>
|
||||
{#if mixed}<p class="note">{t("turn.finalLines")}</p>{/if}
|
||||
{#if holdings}
|
||||
<HoldingChange label={t("turn.after")} cash={holdings.cash} shares={holdings.shares} />
|
||||
{/if}
|
||||
<p class="note warning">{note}</p>
|
||||
<div class="actions">
|
||||
<button type="button" class="actionable primary" onclick={() => store.send(review.move, true)}
|
||||
>{review.kind === "commit" && review.move.type === "place"
|
||||
? t("place.button", { tile: review.move.tile })
|
||||
: t("turn.end")}</button
|
||||
>
|
||||
<button type="button" class="actionable" onclick={() => (store.review = undefined)}>{t("turn.back")}</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<style>
|
||||
.turn-summary {
|
||||
background: var(--panel);
|
||||
padding: 10px 12px 12px;
|
||||
margin: 0 0 12px;
|
||||
}
|
||||
.head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 15px;
|
||||
}
|
||||
.lines {
|
||||
list-style: none;
|
||||
margin: 6px 0 8px;
|
||||
padding: 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
.lines li {
|
||||
padding: 3px 0 3px 10px;
|
||||
border-inline-start: 3px solid var(--panel-alt);
|
||||
}
|
||||
.lines li.final {
|
||||
color: var(--ink-muted);
|
||||
}
|
||||
.lines li.pending {
|
||||
border-inline-start-color: var(--accent);
|
||||
font-weight: 600;
|
||||
}
|
||||
.note {
|
||||
margin: 0 0 8px;
|
||||
font-size: 13px;
|
||||
color: var(--ink-muted);
|
||||
}
|
||||
.note.warning {
|
||||
color: var(--ink);
|
||||
}
|
||||
.actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
.actions button {
|
||||
padding: 6px 16px;
|
||||
min-height: 40px;
|
||||
background: var(--page);
|
||||
color: var(--ink);
|
||||
font: inherit;
|
||||
border: none;
|
||||
}
|
||||
.actions button.primary {
|
||||
background: var(--accent);
|
||||
color: var(--on-accent);
|
||||
font-weight: 600;
|
||||
}
|
||||
@media (pointer: coarse) {
|
||||
.actions button {
|
||||
min-height: 44px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
33
packages/viewer/src/lib/UndoButton.svelte
Normal file
33
packages/viewer/src/lib/UndoButton.svelte
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<script lang="ts">
|
||||
import type { ViewerStore } from "./store.svelte";
|
||||
|
||||
let { store }: { store: ViewerStore } = $props();
|
||||
</script>
|
||||
|
||||
<button type="button" class="actionable undo" onclick={() => store.undo()}>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"
|
||||
><path d="M9 4 3 10l6 6M3 10h11a7 7 0 0 1 0 14" transform="translate(0 -2)" /></svg
|
||||
>
|
||||
{store.lang.t("turn.undo")}
|
||||
</button>
|
||||
|
||||
<style>
|
||||
.undo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-block: 4px;
|
||||
margin-inline: auto 0;
|
||||
padding: 6px 12px;
|
||||
min-height: 36px;
|
||||
background: var(--page);
|
||||
color: var(--ink);
|
||||
font: inherit;
|
||||
border: none;
|
||||
}
|
||||
@media (pointer: coarse) {
|
||||
.undo {
|
||||
min-height: 44px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -31,7 +31,14 @@ export const da: Catalog = {
|
|||
"panel.label": "Din beslutning",
|
||||
"panel.sending": "Sender…",
|
||||
"turn.undo": "Fortryd",
|
||||
"turn.summary": "Gennemse din tur",
|
||||
"turn.end": "Afslut tur",
|
||||
"turn.back": "Tilbage",
|
||||
"turn.after": "Efter denne tur",
|
||||
"turn.endNote": "Når turen afsluttes, trækkes nye brikker, så den kan ikke fortrydes.",
|
||||
"turn.gameEnds": "Dette afslutter spillet: Slutbonusser udbetales, og alle aktier sælges.",
|
||||
"turn.finalStep": "Fortryd er ikke muligt efter dette trin.",
|
||||
"turn.finalLines": "Grå linjer er endelige; Fortryd går tilbage gennem resten én ad gangen.",
|
||||
"announce.ask": "Afslut spillet efter denne tur?",
|
||||
"announce.confirm": "Meld afslutning",
|
||||
"announce.cancel": "Spil videre",
|
||||
|
|
|
|||
|
|
@ -31,7 +31,14 @@ export const de: Catalog = {
|
|||
"panel.label": "Deine Entscheidung",
|
||||
"panel.sending": "Wird gesendet…",
|
||||
"turn.undo": "Rückgängig",
|
||||
"turn.summary": "Zug überprüfen",
|
||||
"turn.end": "Zug beenden",
|
||||
"turn.back": "Zurück",
|
||||
"turn.after": "Nach diesem Zug",
|
||||
"turn.endNote": "Beim Beenden des Zugs werden neue Plättchen gezogen; das lässt sich nicht rückgängig machen.",
|
||||
"turn.gameEnds": "Damit endet das Spiel: Schlussprämien werden gezahlt und alle Aktien verkauft.",
|
||||
"turn.finalStep": "Nach diesem Schritt ist Rückgängig nicht mehr möglich.",
|
||||
"turn.finalLines": "Graue Zeilen sind endgültig; Rückgängig nimmt die übrigen Schritt für Schritt zurück.",
|
||||
"announce.ask": "Das Spiel nach diesem Zug beenden?",
|
||||
"announce.confirm": "Spielende ankündigen",
|
||||
"announce.cancel": "Weiterspielen",
|
||||
|
|
|
|||
|
|
@ -31,7 +31,14 @@ export const el: Catalog = {
|
|||
"panel.label": "Η απόφασή σου",
|
||||
"panel.sending": "Αποστολή…",
|
||||
"turn.undo": "Αναίρεση",
|
||||
"turn.summary": "Έλεγχος γύρου",
|
||||
"turn.end": "Τέλος γύρου",
|
||||
"turn.back": "Πίσω",
|
||||
"turn.after": "Μετά από αυτόν τον γύρο",
|
||||
"turn.endNote": "Με το τέλος του γύρου τραβιούνται νέα πλακίδια, οπότε δεν αναιρείται.",
|
||||
"turn.gameEnds": "Έτσι τελειώνει το παιχνίδι: πληρώνονται τα τελικά μπόνους και πωλούνται όλες οι μετοχές.",
|
||||
"turn.finalStep": "Μετά από αυτό το βήμα δεν υπάρχει αναίρεση.",
|
||||
"turn.finalLines": "Οι γκρίζες γραμμές είναι οριστικές· η Αναίρεση γυρίζει πίσω τις υπόλοιπες μία μία.",
|
||||
"announce.ask": "Να τελειώσει το παιχνίδι μετά από αυτόν τον γύρο;",
|
||||
"announce.confirm": "Ανακοίνωση τέλους",
|
||||
"announce.cancel": "Συνέχεια παιχνιδιού",
|
||||
|
|
|
|||
|
|
@ -36,7 +36,14 @@ export const en = {
|
|||
"panel.label": "Your decision",
|
||||
"panel.sending": "Sending…",
|
||||
"turn.undo": "Undo",
|
||||
"turn.summary": "Review your turn",
|
||||
"turn.end": "End turn",
|
||||
"turn.back": "Back",
|
||||
"turn.after": "After this turn",
|
||||
"turn.endNote": "Ending your turn draws new tiles, so it can’t be undone.",
|
||||
"turn.gameEnds": "This ends the game: final bonuses are paid and all shares are sold.",
|
||||
"turn.finalStep": "Undo isn’t available after this step.",
|
||||
"turn.finalLines": "Greyed lines are final; Undo steps back through the rest.",
|
||||
"announce.ask": "End the game after this turn?",
|
||||
"announce.confirm": "Announce the end",
|
||||
"announce.cancel": "Keep playing",
|
||||
|
|
|
|||
|
|
@ -31,7 +31,14 @@ export const fa: Catalog = {
|
|||
"panel.label": "تصمیم شما",
|
||||
"panel.sending": "در حال ارسال…",
|
||||
"turn.undo": "واگرد",
|
||||
"turn.summary": "مرور نوبت",
|
||||
"turn.end": "پایان نوبت",
|
||||
"turn.back": "بازگشت",
|
||||
"turn.after": "پس از این نوبت",
|
||||
"turn.endNote": "با پایان نوبت کاشیهای تازه کشیده میشوند، پس قابل واگرد نیست.",
|
||||
"turn.gameEnds": "بازی تمام میشود: پاداشهای پایانی پرداخت و همهی سهام فروخته میشود.",
|
||||
"turn.finalStep": "پس از این مرحله واگرد ممکن نیست.",
|
||||
"turn.finalLines": "خطهای خاکستری قطعیاند؛ واگرد بقیه را یکییکی برمیگرداند.",
|
||||
"announce.ask": "بازی بعد از این نوبت تمام شود؟",
|
||||
"announce.confirm": "اعلام پایان",
|
||||
"announce.cancel": "ادامهی بازی",
|
||||
|
|
|
|||
|
|
@ -32,7 +32,14 @@ export const fr: Catalog = {
|
|||
"panel.label": "Votre décision",
|
||||
"panel.sending": "Envoi…",
|
||||
"turn.undo": "Annuler",
|
||||
"turn.summary": "Vérifier votre tour",
|
||||
"turn.end": "Finir le tour",
|
||||
"turn.back": "Retour",
|
||||
"turn.after": "Après ce tour",
|
||||
"turn.endNote": "Finir le tour pioche de nouvelles tuiles : impossible de l’annuler ensuite.",
|
||||
"turn.gameEnds": "Cela termine la partie : les primes finales sont versées et toutes les actions vendues.",
|
||||
"turn.finalStep": "Annuler ne sera plus possible après cette étape.",
|
||||
"turn.finalLines": "Les lignes grisées sont définitives ; Annuler revient sur les autres une à une.",
|
||||
"announce.ask": "Terminer la partie après ce tour ?",
|
||||
"announce.confirm": "Annoncer la fin",
|
||||
"announce.cancel": "Continuer à jouer",
|
||||
|
|
|
|||
|
|
@ -31,7 +31,14 @@ export const hi: Catalog = {
|
|||
"panel.label": "आपका निर्णय",
|
||||
"panel.sending": "भेजा जा रहा है…",
|
||||
"turn.undo": "पूर्ववत करें",
|
||||
"turn.summary": "अपनी बारी जाँचें",
|
||||
"turn.end": "बारी समाप्त करें",
|
||||
"turn.back": "वापस",
|
||||
"turn.after": "इस बारी के बाद",
|
||||
"turn.endNote": "बारी समाप्त करने पर नई टाइलें ली जाती हैं, इसलिए इसे पूर्ववत नहीं किया जा सकता।",
|
||||
"turn.gameEnds": "इससे खेल समाप्त होगा: अंतिम बोनस दिए जाएँगे और सभी शेयर बेचे जाएँगे।",
|
||||
"turn.finalStep": "इस चरण के बाद पूर्ववत उपलब्ध नहीं होगा।",
|
||||
"turn.finalLines": "धूसर पंक्तियाँ अंतिम हैं; पूर्ववत बाकी को एक-एक करके वापस लेता है।",
|
||||
"announce.ask": "इस बारी के बाद खेल समाप्त करें?",
|
||||
"announce.confirm": "अंत की घोषणा करें",
|
||||
"announce.cancel": "खेलना जारी रखें",
|
||||
|
|
|
|||
|
|
@ -31,7 +31,14 @@ export const it: Catalog = {
|
|||
"panel.label": "La tua decisione",
|
||||
"panel.sending": "Invio…",
|
||||
"turn.undo": "Annulla",
|
||||
"turn.summary": "Rivedi il turno",
|
||||
"turn.end": "Termina il turno",
|
||||
"turn.back": "Indietro",
|
||||
"turn.after": "Dopo questo turno",
|
||||
"turn.endNote": "Terminando il turno si pescano nuove tessere, quindi non si può annullare.",
|
||||
"turn.gameEnds": "Questo termina la partita: si pagano i premi finali e si vendono tutte le azioni.",
|
||||
"turn.finalStep": "Dopo questo passo non potrai annullare.",
|
||||
"turn.finalLines": "Le righe grigie sono definitive; Annulla torna indietro sulle altre una alla volta.",
|
||||
"announce.ask": "Terminare la partita dopo questo turno?",
|
||||
"announce.confirm": "Annuncia la fine",
|
||||
"announce.cancel": "Continua a giocare",
|
||||
|
|
|
|||
|
|
@ -31,7 +31,14 @@ export const ko: Catalog = {
|
|||
"panel.label": "내 결정",
|
||||
"panel.sending": "보내는 중…",
|
||||
"turn.undo": "되돌리기",
|
||||
"turn.summary": "턴 확인",
|
||||
"turn.end": "턴 끝내기",
|
||||
"turn.back": "뒤로",
|
||||
"turn.after": "이번 턴 후",
|
||||
"turn.endNote": "턴을 끝내면 새 타일을 뽑으므로 되돌릴 수 없습니다.",
|
||||
"turn.gameEnds": "게임이 끝납니다. 최종 보너스가 지급되고 모든 주식이 매도됩니다.",
|
||||
"turn.finalStep": "이 단계 이후에는 되돌릴 수 없습니다.",
|
||||
"turn.finalLines": "회색 줄은 확정되었습니다. 되돌리기는 나머지를 하나씩 취소합니다.",
|
||||
"announce.ask": "이번 턴이 끝나면 게임을 끝낼까요?",
|
||||
"announce.confirm": "종료 선언",
|
||||
"announce.cancel": "계속 플레이",
|
||||
|
|
|
|||
|
|
@ -31,7 +31,14 @@ export const nl: Catalog = {
|
|||
"panel.label": "Jouw beslissing",
|
||||
"panel.sending": "Versturen…",
|
||||
"turn.undo": "Ongedaan maken",
|
||||
"turn.summary": "Controleer je beurt",
|
||||
"turn.end": "Beurt beëindigen",
|
||||
"turn.back": "Terug",
|
||||
"turn.after": "Na deze beurt",
|
||||
"turn.endNote": "Bij het beëindigen van je beurt trek je nieuwe tegels, dus dit kan niet ongedaan worden gemaakt.",
|
||||
"turn.gameEnds": "Dit beëindigt het spel: eindbonussen worden uitbetaald en alle aandelen verkocht.",
|
||||
"turn.finalStep": "Na deze stap is ongedaan maken niet meer mogelijk.",
|
||||
"turn.finalLines": "Grijze regels zijn definitief; Ongedaan maken loopt de rest stap voor stap terug.",
|
||||
"announce.ask": "Het spel na deze beurt beëindigen?",
|
||||
"announce.confirm": "Einde aankondigen",
|
||||
"announce.cancel": "Verder spelen",
|
||||
|
|
|
|||
|
|
@ -31,7 +31,14 @@ export const pl: Catalog = {
|
|||
"panel.label": "Twoja decyzja",
|
||||
"panel.sending": "Wysyłanie…",
|
||||
"turn.undo": "Cofnij",
|
||||
"turn.summary": "Sprawdź swoją turę",
|
||||
"turn.end": "Zakończ turę",
|
||||
"turn.back": "Wstecz",
|
||||
"turn.after": "Po tej turze",
|
||||
"turn.endNote": "Zakończenie tury dobiera nowe płytki, więc nie da się jej cofnąć.",
|
||||
"turn.gameEnds": "To kończy grę: zostaną wypłacone premie końcowe i sprzedane wszystkie akcje.",
|
||||
"turn.finalStep": "Po tym kroku cofnięcie nie będzie możliwe.",
|
||||
"turn.finalLines": "Szare wiersze są ostateczne; Cofnij wycofuje pozostałe po kolei.",
|
||||
"announce.ask": "Zakończyć grę po tej turze?",
|
||||
"announce.confirm": "Ogłoś koniec gry",
|
||||
"announce.cancel": "Graj dalej",
|
||||
|
|
|
|||
|
|
@ -31,7 +31,14 @@ export const ptBR: Catalog = {
|
|||
"panel.label": "Sua decisão",
|
||||
"panel.sending": "Enviando…",
|
||||
"turn.undo": "Desfazer",
|
||||
"turn.summary": "Revise seu turno",
|
||||
"turn.end": "Encerrar turno",
|
||||
"turn.back": "Voltar",
|
||||
"turn.after": "Depois deste turno",
|
||||
"turn.endNote": "Encerrar o turno compra novas peças, então não dá para desfazer.",
|
||||
"turn.gameEnds": "Isto encerra o jogo: os bônus finais são pagos e todas as ações são vendidas.",
|
||||
"turn.finalStep": "Desfazer não estará disponível depois desta etapa.",
|
||||
"turn.finalLines": "Linhas em cinza são definitivas; Desfazer volta pelas outras uma a uma.",
|
||||
"announce.ask": "Encerrar o jogo depois deste turno?",
|
||||
"announce.confirm": "Anunciar o fim",
|
||||
"announce.cancel": "Continuar jogando",
|
||||
|
|
|
|||
|
|
@ -32,7 +32,14 @@ export const ro: Catalog = {
|
|||
"panel.label": "Decizia ta",
|
||||
"panel.sending": "Se trimite…",
|
||||
"turn.undo": "Anulează",
|
||||
"turn.summary": "Verifică tura",
|
||||
"turn.end": "Încheie tura",
|
||||
"turn.back": "Înapoi",
|
||||
"turn.after": "După această tură",
|
||||
"turn.endNote": "Încheierea turei trage piese noi, deci nu mai poate fi anulată.",
|
||||
"turn.gameEnds": "Aceasta încheie jocul: se plătesc bonusurile finale și se vând toate acțiunile.",
|
||||
"turn.finalStep": "După acest pas nu mai poți anula.",
|
||||
"turn.finalLines": "Liniile gri sunt definitive; Anulează revine pas cu pas asupra celorlalte.",
|
||||
"announce.ask": "Încheiem jocul după această tură?",
|
||||
"announce.confirm": "Anunță sfârșitul",
|
||||
"announce.cancel": "Continuă jocul",
|
||||
|
|
|
|||
|
|
@ -31,7 +31,14 @@ export const ru: Catalog = {
|
|||
"panel.label": "Ваше решение",
|
||||
"panel.sending": "Отправка…",
|
||||
"turn.undo": "Отменить",
|
||||
"turn.summary": "Проверьте ход",
|
||||
"turn.end": "Закончить ход",
|
||||
"turn.back": "Назад",
|
||||
"turn.after": "После этого хода",
|
||||
"turn.endNote": "В конце хода берутся новые фишки, поэтому его нельзя отменить.",
|
||||
"turn.gameEnds": "Это завершит игру: будут выплачены итоговые премии и проданы все акции.",
|
||||
"turn.finalStep": "После этого шага отмена будет недоступна.",
|
||||
"turn.finalLines": "Серые строки окончательны; «Отменить» по одной откатывает остальные.",
|
||||
"announce.ask": "Закончить игру после этого хода?",
|
||||
"announce.confirm": "Объявить конец игры",
|
||||
"announce.cancel": "Продолжить игру",
|
||||
|
|
|
|||
|
|
@ -31,7 +31,14 @@ export const vi: Catalog = {
|
|||
"panel.label": "Quyết định của bạn",
|
||||
"panel.sending": "Đang gửi…",
|
||||
"turn.undo": "Hoàn tác",
|
||||
"turn.summary": "Xem lại lượt",
|
||||
"turn.end": "Kết thúc lượt",
|
||||
"turn.back": "Quay lại",
|
||||
"turn.after": "Sau lượt này",
|
||||
"turn.endNote": "Kết thúc lượt sẽ bốc ô mới nên không thể hoàn tác.",
|
||||
"turn.gameEnds": "Ván đấu sẽ kết thúc: trả thưởng cuối và bán toàn bộ cổ phiếu.",
|
||||
"turn.finalStep": "Sau bước này sẽ không thể hoàn tác.",
|
||||
"turn.finalLines": "Dòng màu xám đã cố định; Hoàn tác lùi lại từng bước cho phần còn lại.",
|
||||
"announce.ask": "Kết thúc ván chơi sau lượt này?",
|
||||
"announce.confirm": "Tuyên bố kết thúc",
|
||||
"announce.cancel": "Tiếp tục chơi",
|
||||
|
|
|
|||
|
|
@ -31,7 +31,14 @@ export const zhCN: Catalog = {
|
|||
"panel.label": "你的决定",
|
||||
"panel.sending": "正在发送…",
|
||||
"turn.undo": "撤销",
|
||||
"turn.summary": "查看本回合",
|
||||
"turn.end": "结束回合",
|
||||
"turn.back": "返回",
|
||||
"turn.after": "本回合后",
|
||||
"turn.endNote": "结束回合会抽取新板块,因此无法撤销。",
|
||||
"turn.gameEnds": "游戏将结束:支付最终奖金并出售所有股票。",
|
||||
"turn.finalStep": "此步骤之后将无法撤销。",
|
||||
"turn.finalLines": "灰色项目已确定;撤销会逐步撤回其余项目。",
|
||||
"announce.ask": "在本回合结束后结束游戏?",
|
||||
"announce.confirm": "宣布结束",
|
||||
"announce.cancel": "继续游戏",
|
||||
|
|
|
|||
|
|
@ -31,7 +31,14 @@ export const zhTW: Catalog = {
|
|||
"panel.label": "你的決定",
|
||||
"panel.sending": "正在傳送…",
|
||||
"turn.undo": "復原",
|
||||
"turn.summary": "檢視本回合",
|
||||
"turn.end": "結束回合",
|
||||
"turn.back": "返回",
|
||||
"turn.after": "本回合後",
|
||||
"turn.endNote": "結束回合會抽取新圖塊,因此無法復原。",
|
||||
"turn.gameEnds": "遊戲將結束:支付最終獎金並出售所有股票。",
|
||||
"turn.finalStep": "此步驟之後將無法復原。",
|
||||
"turn.finalLines": "灰色項目已確定;復原會逐步撤回其餘項目。",
|
||||
"announce.ask": "在本回合結束後結束遊戲?",
|
||||
"announce.confirm": "宣布結束",
|
||||
"announce.cancel": "繼續遊戲",
|
||||
|
|
|
|||
|
|
@ -6,7 +6,14 @@ import { movesFor } from "./decisions";
|
|||
import { langFor } from "./format";
|
||||
import { isRightToLeft, type Locale } from "./i18n";
|
||||
import { replayStart, replayView } from "./replay";
|
||||
import { moveOutcome, TurnDraft, type MoveOutcome } from "./turn-draft";
|
||||
import { moveOutcome, reviewFor, TurnDraft, type MoveOutcome } from "./turn-draft";
|
||||
|
||||
/** A move held back for confirmation: the end of the turn, or a step that ends undo. */
|
||||
export interface PendingReview {
|
||||
move: Move;
|
||||
kind: "end" | "commit";
|
||||
outcome: MoveOutcome;
|
||||
}
|
||||
|
||||
/** Context key: the store is given to every component at mount, for viewer-wide settings. */
|
||||
export const STORE = Symbol("viewer-store");
|
||||
|
|
@ -53,13 +60,23 @@ export class ViewerStore {
|
|||
|
||||
private readonly draft = new TurnDraft();
|
||||
undoCount = $state(0);
|
||||
/** The first log entry that Undo can still take back (earlier entries are final). */
|
||||
undoFrom = $state(0);
|
||||
/** The move awaiting confirmation in the turn summary, if any. */
|
||||
review = $state<PendingReview | undefined>();
|
||||
reviewing = $derived(this.review !== undefined && this.moves.length > 0 && !this.sending);
|
||||
canUndo = $derived(
|
||||
this.undoCount > 0 && !this.sending && !this.readOnly && !this.analysis && this.replayAt === undefined
|
||||
);
|
||||
|
||||
constructor(
|
||||
private readonly sendMove: (move: Move | TurnRequest) => boolean,
|
||||
private readonly options: { turnDrafts?: boolean; onState?: (state: GameState) => void } = {}
|
||||
private readonly options: {
|
||||
turnDrafts?: boolean;
|
||||
/** Confirm the end of each turn with a summary (off in tutorials, whose steps name each button). */
|
||||
reviewTurns?: boolean;
|
||||
onState?: (state: GameState) => void;
|
||||
} = {}
|
||||
) {}
|
||||
|
||||
private display(state: GameState): void {
|
||||
|
|
@ -69,7 +86,9 @@ export class ViewerStore {
|
|||
}
|
||||
this.selected = undefined;
|
||||
this.sending = false;
|
||||
this.review = undefined;
|
||||
this.undoCount = this.draft.count;
|
||||
this.undoFrom = this.draft.base?.log.length ?? state.log.length;
|
||||
this.options.onState?.(state);
|
||||
}
|
||||
|
||||
|
|
@ -104,6 +123,7 @@ export class ViewerStore {
|
|||
if (!this.canUndo) {
|
||||
return;
|
||||
}
|
||||
this.review = undefined;
|
||||
const previous = this.draft.undo();
|
||||
if (previous) {
|
||||
this.display(previous);
|
||||
|
|
@ -129,11 +149,22 @@ export class ViewerStore {
|
|||
return this.state ? moveOutcome($state.snapshot(this.state), move, this.player) : undefined;
|
||||
}
|
||||
|
||||
send(move: Move): void {
|
||||
/** Sends a move, first holding back the end of the turn for its summary unless `confirmed`. */
|
||||
send(move: Move, confirmed = false): void {
|
||||
if (this.sending || this.readOnly || this.replayAt !== undefined) {
|
||||
return;
|
||||
}
|
||||
const action = $state.snapshot(move);
|
||||
if (!confirmed && this.options.reviewTurns && this.state) {
|
||||
const view = $state.snapshot(this.state);
|
||||
const outcome = moveOutcome(view, action, this.player);
|
||||
const kind = reviewFor(view, action, outcome, this.drafting ? this.undoCount : 0);
|
||||
if (kind) {
|
||||
this.review = { move: action, kind, outcome };
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.review = undefined;
|
||||
const request =
|
||||
this.options.turnDrafts && this.state?.supportsTurnDrafts && !this.analysis ? this.draft.begin(action) : action;
|
||||
this.sending = true;
|
||||
|
|
|
|||
76
packages/viewer/src/lib/turn-summary.spec.ts
Normal file
76
packages/viewer/src/lib/turn-summary.spec.ts
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
import { applyMove, type Move } from "acquire-engine";
|
||||
import * as engine from "acquire-engine/wrapper";
|
||||
import { preparedPosition } from "../tutorial/lessons.ts";
|
||||
import { langFor } from "./format.ts";
|
||||
import { holdingsAfter, moveEffect, turnSummary } from "./turn-summary.ts";
|
||||
|
||||
const lang = langFor("en");
|
||||
const text = (lines: ReturnType<typeof turnSummary>) =>
|
||||
lines.map((line) => line.parts.map((part) => part.text).join(""));
|
||||
|
||||
test("the turn summary lists this turn's moves, then the pending move and the cash it leaves", () => {
|
||||
const full = preparedPosition("founding");
|
||||
const start = full.log.length;
|
||||
applyMove(full, { type: "place", tile: "2A" }, 0);
|
||||
const afterPlace = full.log.length;
|
||||
applyMove(full, { type: "found", chain: "tower" }, 0);
|
||||
const view = engine.stripSecret(full, 0);
|
||||
const buy: Move = { type: "buy", shares: { tower: 2 } };
|
||||
|
||||
const lines = turnSummary(view, buy, lang, afterPlace);
|
||||
assert.deepEqual(text(lines), [
|
||||
"Alex placed 2A",
|
||||
"Alex founded Tower (2 tiles) and received a free share",
|
||||
"Alex bought 2 Tower for $400",
|
||||
]);
|
||||
assert.deepEqual(
|
||||
lines.map((line) => [line.final, line.pending]),
|
||||
[
|
||||
[true, false],
|
||||
[false, false],
|
||||
[false, true],
|
||||
]
|
||||
);
|
||||
assert.ok(turnSummary(view, buy, lang, start).every((line) => !line.final));
|
||||
|
||||
const effect = moveEffect(view, buy)!;
|
||||
assert.deepEqual(effect, { cash: -400, shares: { tower: 2 } });
|
||||
assert.deepEqual(holdingsAfter(view, effect), {
|
||||
cash: { before: 6000, after: 5600 },
|
||||
shares: [{ chain: "tower", before: 1, after: 3 }],
|
||||
});
|
||||
});
|
||||
|
||||
test("disposal and swap effects use the defunct sale price, the 2:1 trade and current prices", () => {
|
||||
const full = preparedPosition("mergers");
|
||||
applyMove(full, { type: "place", tile: "4A" }, 0);
|
||||
const view = engine.stripSecret(full, 0);
|
||||
assert.equal(view.phase, "dispose");
|
||||
const dispose: Move = { type: "dispose", sell: 1, trade: 2 };
|
||||
assert.deepEqual(moveEffect(view, dispose), { cash: 200, shares: { luxor: -3, tower: 1 } });
|
||||
const after = holdingsAfter(view, moveEffect(view, dispose)!);
|
||||
assert.equal(after.cash.after - after.cash.before, 200);
|
||||
assert.deepEqual(
|
||||
after.shares.map(({ chain, before, after }) => [chain, before, after]),
|
||||
[
|
||||
["tower", 0, 1],
|
||||
["luxor", 3, 0],
|
||||
["festival", 1, 1],
|
||||
]
|
||||
);
|
||||
assert.equal(
|
||||
text(turnSummary(view, dispose, lang, 0)).at(-1),
|
||||
"Alex sold 1 Luxor share for $200 and traded 2 Luxor shares for 1 of the survivor"
|
||||
);
|
||||
|
||||
// Merger moves pay bonuses that may depend on hidden holdings: no forecast.
|
||||
const before = preparedPosition("mergers");
|
||||
assert.equal(moveEffect(engine.stripSecret(before, 0), { type: "place", tile: "4A" }), undefined);
|
||||
assert.deepEqual(moveEffect(engine.stripSecret(before, 0), { type: "place", tile: "12I" }), { cash: 0, shares: {} });
|
||||
assert.deepEqual(moveEffect(view, { type: "swap", from: "tower", to: "luxor", count: 1 })?.shares, {
|
||||
tower: -1,
|
||||
luxor: 1,
|
||||
});
|
||||
});
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
// The acting seat's cash and shares after a move, for previews before it is sent. Only the
|
||||
// acting seat's own numbers are used; nothing is inferred about hidden holdings.
|
||||
// The turn summary shown before a move that ends the turn: this turn's log lines, the move
|
||||
// about to be sent, and the acting seat's cash and shares afterwards. Only the acting seat's own
|
||||
// numbers are used; nothing is inferred about hidden holdings.
|
||||
import {
|
||||
CHAIN_IDS,
|
||||
chainSize,
|
||||
connectedLoose,
|
||||
currentSeat,
|
||||
placementEffect,
|
||||
sharePrice,
|
||||
|
|
@ -10,9 +12,13 @@ import {
|
|||
parseTile,
|
||||
type ChainId,
|
||||
type GameState,
|
||||
type LogEntry,
|
||||
type Move,
|
||||
type Shares,
|
||||
} from "acquire-engine";
|
||||
import { describePlacement } from "./decisions.ts";
|
||||
import { describeEntryParts, type Lang, type LogPart } from "./format.ts";
|
||||
import { currentTurnEntries } from "./turn-draft.ts";
|
||||
|
||||
export interface Effect {
|
||||
cash: number;
|
||||
|
|
@ -76,3 +82,88 @@ export function holdingsAfter(state: GameState, effect: Effect) {
|
|||
});
|
||||
return { cash: { before: seat.cash, after: seat.cash + effect.cash }, shares };
|
||||
}
|
||||
|
||||
export interface SummaryLine {
|
||||
key: string;
|
||||
parts: LogPart[];
|
||||
/** Already saved: Undo cannot take it back. */
|
||||
final: boolean;
|
||||
/** The move that confirming will send. */
|
||||
pending: boolean;
|
||||
}
|
||||
|
||||
/** How the pending move will be logged, built from the same log entries and translations. */
|
||||
function pendingEntry(state: GameState, move: Move, seat: number): LogEntry | undefined {
|
||||
switch (move.type) {
|
||||
case "buy": {
|
||||
const cost = -(moveEffect(state, move)?.cash ?? 0);
|
||||
return { type: "bought", seat, shares: move.shares, cost };
|
||||
}
|
||||
case "swap":
|
||||
return {
|
||||
type: "swapped",
|
||||
seat,
|
||||
from: move.from,
|
||||
to: move.to,
|
||||
count: move.count,
|
||||
cost: stockSwapCost(state, move.from, move.to, move.count),
|
||||
};
|
||||
case "dispose": {
|
||||
const merger = state.merger!;
|
||||
const chain = merger.current!;
|
||||
return {
|
||||
type: "disposed",
|
||||
seat,
|
||||
chain,
|
||||
sold: move.sell,
|
||||
traded: move.trade,
|
||||
held: state.seats[seat]!.shares[chain] - move.sell - move.trade,
|
||||
proceeds: move.sell * sharePrice(chain, merger.sizes[chain]!),
|
||||
};
|
||||
}
|
||||
case "pass":
|
||||
return { type: "skipPlace", seat };
|
||||
case "announce":
|
||||
return { type: "announced", seat };
|
||||
case "found":
|
||||
return {
|
||||
type: "founded",
|
||||
seat,
|
||||
chain: move.chain,
|
||||
size: connectedLoose(state.board, state.pendingTile!).length,
|
||||
bonus: state.bank[move.chain] > 0,
|
||||
};
|
||||
default:
|
||||
return { type: "move", seat, move };
|
||||
}
|
||||
}
|
||||
|
||||
/** This turn's lines, oldest first, ending with the move about to be sent. */
|
||||
export function turnSummary(state: GameState, move: Move, lang: Lang, undoFrom: number): SummaryLine[] {
|
||||
const seat = currentSeat(state)!;
|
||||
const start = state.log.length - currentTurnEntries(state).length;
|
||||
const lines: SummaryLine[] = [];
|
||||
state.log.slice(start).forEach((entry, offset) => {
|
||||
const index = start + offset;
|
||||
const parts = describeEntryParts(state, entry, lang);
|
||||
if (parts) {
|
||||
lines.push({ key: String(index), parts, final: index < undoFrom, pending: false });
|
||||
}
|
||||
});
|
||||
const parts =
|
||||
move.type === "place"
|
||||
? [
|
||||
{
|
||||
kind: "text" as const,
|
||||
text: lang.t("place.effect", {
|
||||
tile: move.tile,
|
||||
effect: describePlacement(state, parseTile(move.tile)!, lang),
|
||||
}),
|
||||
},
|
||||
]
|
||||
: describeEntryParts(state, pendingEntry(state, move, seat)!, lang);
|
||||
if (parts) {
|
||||
lines.push({ key: "pending", parts, final: false, pending: true });
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,11 @@ export const viewer = registerViewer<GameState, Move | TurnRequest>(
|
|||
style.textContent = themeCss();
|
||||
document.head.append(style);
|
||||
const sounds = createActionSounds(target);
|
||||
const store = new ViewerStore(move, { turnDrafts: true, onState: (state) => sounds.onState(state) });
|
||||
const store = new ViewerStore(move, {
|
||||
turnDrafts: true,
|
||||
reviewTurns: true,
|
||||
onState: (state) => sounds.onState(state),
|
||||
});
|
||||
store.theme = initialTheme();
|
||||
const app = mount(App, { target, props: { store }, context: new Map([[STORE, store]]) });
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -149,6 +149,10 @@ try {
|
|||
.screenshot({ path: fileURLToPath(new URL(`purchase-limit-${limit}-${theme}.png`, output)) });
|
||||
}
|
||||
await page.locator(".panel .primary").click();
|
||||
// The final step waits for the turn summary.
|
||||
assert.match(await page.locator(".turn-summary").innerText(), /bought/);
|
||||
assert.equal(await page.evaluate(() => window.acquireDev.state.turn), 1);
|
||||
await page.locator(".turn-summary").getByRole("button", { name: "End turn", exact: true }).click();
|
||||
await page.waitForFunction(() => window.acquireDev.state.turn === 2);
|
||||
assert.deepEqual(
|
||||
await page.evaluate(() => ({
|
||||
|
|
@ -208,6 +212,8 @@ try {
|
|||
await page.locator(".board").getByRole("button", { name: "Place 3A", exact: true }).click();
|
||||
await page.waitForSelector("table.buy");
|
||||
await page.locator(".panel .primary").click();
|
||||
assert.match(await page.locator(".turn-summary").innerText(), /placed 2A[\s\S]*placed 3A/);
|
||||
await page.locator(".turn-summary").getByRole("button", { name: "End turn", exact: true }).click();
|
||||
await page.waitForFunction(() => window.acquireDev.state.turn === 2);
|
||||
assert.deepEqual(
|
||||
await page.evaluate(() => ({
|
||||
|
|
@ -360,6 +366,11 @@ try {
|
|||
await page.getByRole("button", { name: "Buy one more Tower", exact: true }).click();
|
||||
}
|
||||
await page.getByRole("button", { name: "Buy for $900 and end turn", exact: true }).click();
|
||||
assert.match(
|
||||
await page.locator(".turn-summary").innerText(),
|
||||
/swapped[\s\S]*swapped[\s\S]*bought 3 Tower for \$900/
|
||||
);
|
||||
await page.locator(".turn-summary").getByRole("button", { name: "End turn", exact: true }).click();
|
||||
await page.waitForFunction(() => window.acquireDev.state.turn === 2);
|
||||
assert.deepEqual(
|
||||
await page.evaluate(() => ({
|
||||
|
|
@ -564,6 +575,7 @@ try {
|
|||
await page.waitForSelector("table.buy");
|
||||
// Disposal remains an undoable private draft until this player finishes buying.
|
||||
await page.getByRole("button", { name: "Buy nothing and end turn", exact: true }).click();
|
||||
await page.locator(".turn-summary").getByRole("button", { name: "End turn", exact: true }).click();
|
||||
await page.waitForFunction(() => window.acquireDev.state.turn === 2);
|
||||
const result = await page.evaluate(() => window.acquireDev.state.seats[0]);
|
||||
assert.equal(result.shares.tower, expectedTrade / 2);
|
||||
|
|
@ -1012,6 +1024,16 @@ try {
|
|||
await page.waitForSelector("table.buy");
|
||||
await page.screenshot({ path: fileURLToPath(new URL(`undo-${width}.png`, output)), fullPage: true });
|
||||
await page.locator(".panel .primary").click();
|
||||
await page.locator(".turn-summary").getByRole("button", { name: "Back", exact: true }).click();
|
||||
await page.waitForSelector("table.buy");
|
||||
await page.locator(".panel .primary").click();
|
||||
await page.screenshot({ path: fileURLToPath(new URL(`turn-summary-${width}.png`, output)), fullPage: true });
|
||||
await page.locator(".turn-summary").getByRole("button", { name: "Undo", exact: true }).click();
|
||||
await page.waitForSelector(".choices");
|
||||
await page.locator(".choices button").filter({ hasText: "Luxor" }).click();
|
||||
await page.waitForSelector("table.buy");
|
||||
await page.locator(".panel .primary").click();
|
||||
await page.locator(".turn-summary").getByRole("button", { name: "End turn", exact: true }).click();
|
||||
await page.waitForFunction(() => window.acquireDev.state.turn === 2);
|
||||
await settle();
|
||||
assert.equal(await undo.count(), 0, "no undo after drawing and handing over");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue