diff --git a/README.md b/README.md index 3cb5c65..c5a024f 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,8 @@ original edition's physical decks differ in a few counts (e.g. only two "4" wate - Mega production cards (expert rule 12.1) are implemented: with 4+ operated water/titanium/ new-chemicals factories you may elect 1 Mega card per group of 4 (fixed printed value — Mega Water 30, Mega Titanium 44, Mega New Chemicals 88 — that counts as 4 cards toward - hand capacity). The election is **blind**, made before any of that round's production + hand capacity). Eligible players choose **simultaneously**, with choices sealed until everyone confirms. + Production and choices are revealed together. The election is **blind**, made before any of that round's production draws are revealed, and decided per group of 4; only operated factories count (never upgrade freebies or Kicker bonuses). Mega cards are a separate face-up pool; a spent or discarded mega returns to its pool. The pool is unlimited — like every component in the diff --git a/packages/engine/package.json b/packages/engine/package.json index 24ac17d..a62895b 100644 --- a/packages/engine/package.json +++ b/packages/engine/package.json @@ -1,6 +1,6 @@ { "name": "outpost-engine", - "version": "0.10.17", + "version": "0.10.18", "description": "Unofficial Outpost rules engine for boardgamers.space", "license": "AGPL-3.0", "files": [ diff --git a/packages/engine/src/describe.ts b/packages/engine/src/describe.ts index 8578d3b..d895220 100644 --- a/packages/engine/src/describe.ts +++ b/packages/engine/src/describe.ts @@ -68,6 +68,9 @@ export function describeLogEntry(state: GameState, entry: LogEntry): string { const info = entry.info; switch (move.action) { case "mega": { + if (info?.megaSealed) { + return `${name} locks in their production choice`; + } const count = info?.mega ?? 0; return count > 0 ? `${name} takes ${count} mega production card${count === 1 ? "" : "s"}` diff --git a/packages/engine/src/mega.spec.ts b/packages/engine/src/mega.spec.ts index 249d239..e78f111 100644 --- a/packages/engine/src/mega.spec.ts +++ b/packages/engine/src/mega.spec.ts @@ -1,10 +1,10 @@ import assert from "node:assert/strict"; import { test } from "node:test"; import { MEGA_CARDS } from "./data.js"; -import { applyMove, initGame } from "./moves.js"; +import { applyMove, dropPlayer, initGame } from "./moves.js"; import { replay } from "./replay.js"; -import { countingHandSize, handValue, megaEligible } from "./state.js"; -import { currentPlayer, stripSecret } from "../wrapper.js"; +import { availableMoves, countingHandSize, handValue, megaEligible } from "./state.js"; +import { currentPlayer, logSlice, stripSecret } from "../wrapper.js"; import type { GameState, PlayerState, ProductionCard } from "./types.js"; /** A game where seat 0 just produced 5 water draws (1 mega group + 1 single). */ @@ -214,3 +214,168 @@ test("mega: full flow replays identically, including from a stripped log", () => assert.equal(replayMega?.v, MEGA_CARDS.water?.value); assert.equal(handValue(strippedReplay.players[0] as PlayerState) >= 0, true); }); + +function simultaneousMegaGame(): GameState { + const state = megaGame(); + const first = state.players[0]!; + for (const [seat, player] of state.players.entries()) { + player.hand = []; + player.pendingMega = first.pendingMega!.map((c) => ({ ...c, v: c.v + seat })); + player.megaGroups = { water: 1 }; + player.factories = first.factories.map((f) => ({ ...f })); + } + const round = state.log.find((e) => e.type === "round"); + assert.ok(round?.type === "round"); + round.produced = state.players.map((p, player) => ({ player, cards: structuredClone(p.pendingMega!) })); + round.megaGroups = state.players.map((_, player) => ({ player, groups: { water: 1 } })); + return state; +} + +test("mega: submitted choices cannot be inferred from state, deck counts, or sliced logs", () => { + const mega = simultaneousMegaGame(); + const singles = structuredClone(mega); + const before = structuredClone(mega); + applyMove(mega, { action: "mega", take: { water: 1 } }, 2); + applyMove(singles, { action: "mega", take: {} }, 2); + assert.deepEqual(currentPlayer(mega), [0, 1]); + assert.deepEqual(availableMoves(mega, 2), []); + assert.deepEqual(mega.decks, before.decks); + assert.deepEqual( + mega.players.map((p) => p.hand), + before.players.map((p) => p.hand) + ); + for (const viewer of [undefined, -1, 0, 1]) { + assert.deepEqual(stripSecret(mega, viewer), stripSecret(singles, viewer)); + const hidden = stripSecret(mega, viewer); + assert.deepEqual(hidden.players[2]!.megaChoice, {}); + const entry = hidden.log.at(-1); + assert.ok(entry?.type === "move" && entry.move.action === "mega"); + assert.deepEqual(entry.move.take, {}); + assert.deepEqual(entry.info, { megaSealed: true }); + const slice = logSlice(mega, { player: viewer, start: mega.log.length - 1 }); + assert.deepEqual(slice, logSlice(singles, { player: viewer, start: singles.log.length - 1 })); + assert.match(slice.log[0]!.simple!, /locks in their production choice/); + } + const own = stripSecret(mega, 2); + assert.deepEqual(own.players[2]!.megaChoice, { water: 1 }); + assert.ok(own.players[2]!.pendingMega!.every((c) => c.v === -1)); +}); + +test("mega: all choices reveal together after JSON persistence, including earlier log slices", () => { + let state = simultaneousMegaGame(); + applyMove(state, { action: "mega", take: { water: 1 } }, 2); + const index = state.log.length - 1; + state = JSON.parse(JSON.stringify(state)) as GameState; + applyMove(state, { action: "mega", take: {} }, 0); + assert.equal(currentPlayer(state), 1); + assert.equal(state.phase, "mega"); + assert.ok(state.players.every((p) => p.hand.length === 0)); + applyMove(state, { action: "mega", take: { water: 1 } }, 1); + assert.notEqual(state.phase, "mega"); + assert.deepEqual( + state.players.map((p) => p.hand.filter((c) => c.m).length), + [0, 1, 1] + ); + assert.ok(state.players.every((p) => p.megaChoice === undefined && p.pendingMega?.length === 0)); + for (const viewer of [undefined, 0, 1, 2]) { + const entry = logSlice(state, { player: viewer, start: index, end: index + 1 }).log[0]; + assert.ok(entry?.type === "move" && entry.move.action === "mega"); + assert.deepEqual(entry.move.take, { water: 1 }); + assert.match(entry.simple!, /takes 1 mega production card/); + const hand = stripSecret(state, viewer).players[2]!.hand; + assert.equal(hand.find((c) => c.m)?.v, MEGA_CARDS.water!.value); + assert.ok(hand.filter((c) => !c.m).every((c) => (viewer === 2 ? c.v > 0 : c.v === -1))); + } +}); + +test("mega: duplicate and invalid commitments leave the whole state unchanged", () => { + const state = simultaneousMegaGame(); + const before = structuredClone(state); + assert.throws(() => applyMove(state, { action: "mega", take: { water: 2 } }, 0)); + assert.deepEqual(state, before); + applyMove(state, { action: "mega", take: {} }, 0); + const committed = structuredClone(state); + assert.throws(() => applyMove(state, { action: "mega", take: { water: 1 } }, 0)); + assert.deepEqual(state, committed); +}); + +test("mega: pending and resolved secret-stripped replays preserve hands and sealed choices", () => { + const state = simultaneousMegaGame(); + applyMove(state, { action: "mega", take: { water: 1 } }, 2); + for (const viewer of [undefined, 0, 1, 2]) { + const visible = stripSecret(state, viewer); + const rebuilt = replay(visible); + assert.equal(rebuilt.phase, "mega"); + if (viewer !== 2) { + const last = rebuilt.log.at(-1); + assert.ok(last?.type === "move" && last.info?.megaSealed); + } + assert.deepEqual(currentPlayer(rebuilt), currentPlayer(visible)); + for (let i = 0; i < 3; i++) { + assert.deepEqual(rebuilt.players[i]!.hand, visible.players[i]!.hand); + assert.deepEqual(rebuilt.players[i]!.pendingMega, visible.players[i]!.pendingMega); + assert.deepEqual(rebuilt.players[i]!.megaChoice, visible.players[i]!.megaChoice); + } + } + applyMove(state, { action: "mega", take: {} }, 0); + applyMove(state, { action: "mega", take: { water: 1 } }, 1); + for (const viewer of [undefined, 0, 1, 2]) { + const visible = stripSecret(state, viewer); + const rebuilt = replay(visible); + assert.equal(rebuilt.phase, visible.phase); + assert.deepEqual( + rebuilt.players.map((p) => p.hand), + visible.players.map((p) => p.hand) + ); + } +}); + +test("mega: response order cannot change resolved hands or returned deck order", () => { + const first = simultaneousMegaGame(); + const second = structuredClone(first); + for (const seat of [2, 0, 1]) { + applyMove(first, { action: "mega", take: { water: 1 } }, seat); + } + for (const seat of [0, 1, 2]) { + applyMove(second, { action: "mega", take: { water: 1 } }, seat); + } + assert.deepEqual(first.decks, second.decks); + assert.deepEqual(first.players, second.players); +}); + +test("mega: dropping the last waiting player reveals the remaining commitments", () => { + const state = simultaneousMegaGame(); + applyMove(state, { action: "mega", take: { water: 1 } }, 0); + applyMove(state, { action: "mega", take: {} }, 1); + dropPlayer(state, 2); + assert.notEqual(state.phase, "mega"); + assert.equal(state.players[0]!.hand.filter((c) => c.m).length, 1); + assert.equal(state.players[1]!.hand.length, 6); + assert.equal(state.players[2]!.hand.length, 0); + assert.ok(state.players.every((p) => p.megaChoice === undefined)); +}); + +test("mega: dropping a committed player cancels their choice without blocking others", () => { + const state = simultaneousMegaGame(); + applyMove(state, { action: "mega", take: { water: 1 } }, 0); + dropPlayer(state, 0); + assert.deepEqual(currentPlayer(state), [1, 2]); + applyMove(state, { action: "mega", take: {} }, 1); + applyMove(state, { action: "mega", take: {} }, 2); + assert.notEqual(state.phase, "mega"); + assert.equal(state.players[0]!.hand.length, 0); + assert.ok(state.players.every((p) => p.megaChoice === undefined)); +}); + +test("mega: old mid-production saves with already-collected hands still complete", () => { + const state = simultaneousMegaGame(); + state.players[0]!.hand = [{ t: "water", v: MEGA_CARDS.water!.value, m: true }]; + state.players[0]!.pendingMega = []; + state.players[0]!.megaGroups = {}; + const existingHand = structuredClone(state.players[0]!.hand); + assert.deepEqual(currentPlayer(state), [1, 2]); + applyMove(state, { action: "mega", take: {} }, 1); + applyMove(state, { action: "mega", take: { water: 1 } }, 2); + assert.notEqual(state.phase, "mega"); + assert.deepEqual(state.players[0]!.hand, existingHand); +}); diff --git a/packages/engine/src/moves.ts b/packages/engine/src/moves.ts index c79022c..782ce5e 100644 --- a/packages/engine/src/moves.ts +++ b/packages/engine/src/moves.ts @@ -11,6 +11,7 @@ import { hasExchange, maxBid, megaEligible, + needsMegaChoice, mustAutoPassBid, populationCost, populationMax, @@ -137,6 +138,7 @@ export function enterMegaPhase(state: GameState): void { for (const player of state.players) { player.done = false; player.mustDiscard = false; + delete player.megaChoice; if (player.dropped) { player.pendingMega = []; continue; @@ -333,7 +335,7 @@ export function applyMove(state: GameState, rawMove: Move | unknown, seat: numbe switch (move.action) { case "mega": - info = moveMega(state, move, seat, player); + info = moveMega(state, move, player); break; case "discard": info = moveDiscard(state, move, seat, player); @@ -371,7 +373,8 @@ export function applyMove(state: GameState, rawMove: Move | unknown, seat: numbe /** Phase transitions that must happen after the move is logged (may end the round/game). */ function postMove(state: GameState, move: Move): void { - if (state.phase === "mega" && !state.players.some((p) => (p.pendingMega?.length ?? 0) > 0)) { + if (state.phase === "mega" && !state.players.some(needsMegaChoice)) { + resolveMegaChoices(state); enterDiscardPhase(state); return; } @@ -384,13 +387,8 @@ function postMove(state: GameState, move: Move): void { } } -/** - * Confirm the mega-vs-singles choice for the staged production draws. Any full - * group of 4 pending draws of a mega resource may be exchanged for one fixed - * Mega card (while the pool lasts); the rest joins the hand as singles. - */ -function moveMega(state: GameState, move: Move & { action: "mega" }, seat: number, player: PlayerState): MoveInfo { - if (state.phase !== "mega" || (player.pendingMega?.length ?? 0) === 0) { +function moveMega(state: GameState, move: Move & { action: "mega" }, player: PlayerState): MoveInfo { + if (state.phase !== "mega" || !needsMegaChoice(player)) { err("no production pending for this player"); } // The election is blind (rule 12.1): the player commits to a number of Mega @@ -403,6 +401,23 @@ function moveMega(state: GameState, move: Move & { action: "mega" }, seat: numbe err(`cannot take ${count} mega ${resource} card(s)`); } } + player.megaChoice = { ...take }; + const count = Object.values(take).reduce((sum, value) => sum + (value ?? 0), 0); + return count > 0 ? { mega: count } : {}; +} + +function resolveMegaChoices(state: GameState): void { + // Resolve in purchase order so response timing cannot change the deck order. + for (const seat of state.purchaseOrder) { + const player = state.players[seat]; + if (player && !player.dropped && player.megaChoice !== undefined) { + collectProduction(state, player, player.megaChoice); + delete player.megaChoice; + } + } +} + +function collectProduction(state: GameState, player: PlayerState, take: Partial>): void { const pending = player.pendingMega ?? []; const megas: ProductionCard[] = []; const consumed = new Set(); @@ -434,7 +449,6 @@ function moveMega(state: GameState, move: Move & { action: "mega" }, seat: numbe player.hand.push(...keep, ...megas); player.pendingMega = []; player.megaGroups = {}; - return megas.length > 0 ? { mega: megas.length } : {}; } function moveDiscard( @@ -1025,6 +1039,7 @@ export function dropPlayer(state: GameState, seat: number): GameState { player.mustDiscard = false; player.done = true; player.pendingMega = []; + delete player.megaChoice; for (const factory of player.factories) { factory.manned = false; } @@ -1033,12 +1048,15 @@ export function dropPlayer(state: GameState, seat: number): GameState { if (state.ended) { return state; } + if (state.phase === "mega" && !state.players.some(needsMegaChoice)) { + resolveMegaChoices(state); + } if (activePlayers(state) <= 1) { finishGame(state); return state; } - if (state.phase === "mega" && !state.players.some((p) => (p.pendingMega?.length ?? 0) > 0)) { + if (state.phase === "mega" && !state.players.some(needsMegaChoice)) { enterDiscardPhase(state); return state; } diff --git a/packages/engine/src/replay.ts b/packages/engine/src/replay.ts index 9b97d94..1a50164 100644 --- a/packages/engine/src/replay.ts +++ b/packages/engine/src/replay.ts @@ -67,6 +67,12 @@ export function replay(state: GameState, options?: { to?: number; trackKnowledge } setReplayExchangeTake(entry.info?.exchangeTake ?? -1); applyMove(replayed, entry.move, entry.player); + if (entry.info?.megaSealed) { + const applied = replayed.log.at(-1); + if (applied?.type === "move") { + applied.info = { megaSealed: true }; + } + } } } } finally { diff --git a/packages/engine/src/state.ts b/packages/engine/src/state.ts index 678cc09..bc3740c 100644 --- a/packages/engine/src/state.ts +++ b/packages/engine/src/state.ts @@ -214,6 +214,10 @@ export function handValue(player: PlayerState): number { return player.hand.reduce((sum, c) => sum + c.v, 0) + (player.pendingMega ?? []).reduce((sum, c) => sum + c.v, 0); } +export function needsMegaChoice(player: PlayerState): boolean { + return !player.dropped && (player.pendingMega?.length ?? 0) > 0 && player.megaChoice === undefined; +} + /** * Mega production eligibility (rule 12.1): the Mega cards a player may elect to * take this round — full groups of 4 operated factories per mega resource. Only @@ -632,7 +636,7 @@ export function availableMoves(state: GameState, player?: number): string[] { } switch (state.phase) { case "mega": - return (p.pendingMega?.length ?? 0) > 0 ? ["mega"] : []; + return needsMegaChoice(p) ? ["mega"] : []; case "discard": return p.mustDiscard ? ["discard"] : []; case "exchange": diff --git a/packages/engine/src/types.ts b/packages/engine/src/types.ts index 8717457..3faf147 100644 --- a/packages/engine/src/types.ts +++ b/packages/engine/src/types.ts @@ -89,6 +89,8 @@ export interface PlayerState { * blind — made before the pendingMega values are revealed to the player. */ megaGroups?: Partial>; + /** Committed production choice, kept sealed until every eligible player has chosen. */ + megaChoice?: Partial>; dropped: boolean; /** Per-player gameplay settings (set via setPlayerSettings). */ settings: PlayerSettings; @@ -208,6 +210,7 @@ export interface MoveInfo { discarded?: number; /** Mega cards taken with this "mega" move (for the log description). */ mega?: number; + megaSealed?: true; /** * Seats auto-passed out of the auction by this move (public bound or the * autoPassBids setting). Replay applies these verbatim: the true-value check diff --git a/packages/engine/wrapper.ts b/packages/engine/wrapper.ts index 945c129..72820e7 100644 --- a/packages/engine/wrapper.ts +++ b/packages/engine/wrapper.ts @@ -1,7 +1,7 @@ import { PRODUCTION_DECKS, KICKER_SPECS, UPGRADE_SPECS } from "./src/data.js"; import { nextInt, shuffle } from "./src/prng.js"; import { RESOURCES } from "./src/types.js"; -import { maxBid } from "./src/state.js"; +import { maxBid, needsMegaChoice } from "./src/state.js"; import { moveAI as moveAICore } from "./src/ai.js"; import { describeLogEntry } from "./src/describe.js"; import { applyMove, dropPlayer as dropPlayerCore, initGame } from "./src/moves.js"; @@ -65,7 +65,7 @@ export function currentPlayer(data: GameState): number | number[] | undefined { } switch (data.phase) { case "mega": { - const waiting = data.players.flatMap((p, seat) => ((p.pendingMega?.length ?? 0) > 0 && !p.dropped ? [seat] : [])); + const waiting = data.players.flatMap((p, seat) => (needsMegaChoice(p) ? [seat] : [])); return waiting.length === 1 ? waiting[0] : waiting; } case "discard": { @@ -97,7 +97,7 @@ export function logLength(data: GameState): number { return data.log.length; } -/** Rule 12.1: the viewer's own production draws stay hidden while their mega election is pending. */ +/** Rule 12.1: production draws stay hidden until all mega elections are resolved. */ function hideOwnProduction(data: GameState, viewer: number | undefined): boolean { if (data.phase !== "mega" || viewer === undefined) { return false; @@ -267,7 +267,7 @@ export function stripSecret(data: GameState, player?: number): GameState { players: data.players.map((p, i) => { if (i === viewer) { // Rule 12.1: the mega election is blind — the player's own pending - // draw values stay hidden until they commit (mega phase only). + // draw values stay hidden until all choices resolve (mega phase only). if (data.phase === "mega" && (p.pendingMega?.length ?? 0) > 0) { return { ...p, pendingMega: p.pendingMega?.map((c): ProductionCard => ({ t: c.t, v: -1 })) }; } @@ -275,6 +275,7 @@ export function stripSecret(data: GameState, player?: number): GameState { } return { ...p, + ...(p.megaChoice !== undefined ? { megaChoice: {} } : {}), hand: p.hand.map((c): ProductionCard => ({ t: c.t, v: c.m ? c.v : -1, ...(c.m ? { m: true } : {}) })), pendingMega: p.pendingMega?.map( (c): ProductionCard => ({ @@ -306,19 +307,31 @@ function maskLog( // An exchange's received card is parked on the upgrade until the exchange // step (end of the discard phase) closes, i.e. while data.exchange is set. const exchangeOngoing = data.exchange != null && !data.ended; - return data.log - .slice(start, end) - .map((entry, i) => - hideProduced( - entry, - viewer, - data.options.fastBid === true, - hideOwn, - revealed.has(i + start), - data.ended, - exchangeOngoing - ) + let productionStart = data.log.length; + if (data.phase === "mega" && !data.ended) { + while (productionStart > 0 && data.log[productionStart - 1]?.type !== "round") { + productionStart--; + } + } + return data.log.slice(start, end).map((entry, i) => { + if ( + i + start >= productionStart && + entry.type === "move" && + entry.move.action === "mega" && + entry.player !== viewer + ) { + return { ...entry, move: { action: "mega" as const, take: {} }, info: { megaSealed: true as const } }; + } + return hideProduced( + entry, + viewer, + data.options.fastBid === true, + hideOwn, + revealed.has(i + start), + data.ended, + exchangeOngoing ); + }); } export interface LogSliceOptions { diff --git a/packages/viewer/package.json b/packages/viewer/package.json index e07e4b2..90b59cc 100644 --- a/packages/viewer/package.json +++ b/packages/viewer/package.json @@ -1,6 +1,6 @@ { "name": "outpost-viewer", - "version": "0.1.9", + "version": "0.1.10", "description": "Browser viewer for the Outpost game on boardgamers.space", "license": "AGPL-3.0", "files": [ diff --git a/packages/viewer/src/lib/ActionBar.svelte b/packages/viewer/src/lib/ActionBar.svelte index 242696a..560cfd2 100644 --- a/packages/viewer/src/lib/ActionBar.svelte +++ b/packages/viewer/src/lib/ActionBar.svelte @@ -7,6 +7,7 @@ MIN_CARD_VALUE, UPGRADE_SPECS, auctionCard, + needsMegaChoice, operators, } from "outpost-engine"; import ResourceIcon from "./ResourceIcon.svelte"; @@ -44,7 +45,7 @@ seat === undefined ? "…" : (s.players[seat]?.name ?? `Player ${seat + 1}`); switch (s.phase) { case "mega": { - const seats = s.players.flatMap((p, i) => ((p.pendingMega?.length ?? 0) > 0 ? [i] : [])); + const seats = s.players.flatMap((p, i) => (needsMegaChoice(p) ? [i] : [])); return `Waiting for ${seats.map(name).join(", ")} to take production…`; } case "discard": { @@ -106,6 +107,7 @@ Production: choose Mega cards before drawing. Each Mega replaces the production of 4 staffed factories; other factories produce single cards. + Choices stay hidden until everyone has confirmed. {#each Object.entries(store.megaEligible) as [resource, groups] (resource)} {@const mega = MEGA_CARDS[resource as keyof typeof MEGA_CARDS]} {@const taking = store.megaTake[resource] ?? 0} @@ -282,6 +284,10 @@ {/if} {:else}
+ {#if state?.phase === "mega" && me?.megaChoice !== undefined} + Production choice locked. + Choices stay hidden until everyone has confirmed. + {/if} {waitingOn}
{/if} diff --git a/packages/viewer/src/lib/PlayerPanel.svelte b/packages/viewer/src/lib/PlayerPanel.svelte index c18350c..44c5df2 100644 --- a/packages/viewer/src/lib/PlayerPanel.svelte +++ b/packages/viewer/src/lib/PlayerPanel.svelte @@ -10,6 +10,7 @@ UPGRADES, handValueExpected, handValueRange, + needsMegaChoice, productionRange, operators as availableOperators, type GameState, @@ -42,7 +43,8 @@ const orderPos = $derived(state.purchaseOrder.indexOf(index) + 1); const isActive = $derived( !state.ended && - ((state.phase === "actions" && state.activeSeat === index) || + ((state.phase === "mega" && needsMegaChoice(player)) || + (state.phase === "actions" && state.activeSeat === index) || (state.phase === "discard" && player.mustDiscard) || (state.phase === "auction" && (state.auction?.bids ? state.auction.bids[index] === undefined : state.auction?.activeBidder === index)) || @@ -264,14 +266,9 @@ {/if} {/if} - {#if isMe && store.myMega && (player.pendingMega?.length ?? 0) > 0} + {#if isMe && state.phase === "mega" && (player.pendingMega?.length ?? 0) > 0}
- - produced: - + produced: {#each player.pendingMega ?? [] as card, i (i)} {/each} diff --git a/packages/viewer/src/lib/SpaceScene.svelte b/packages/viewer/src/lib/SpaceScene.svelte index 9e0b3a7..e6812e4 100644 --- a/packages/viewer/src/lib/SpaceScene.svelte +++ b/packages/viewer/src/lib/SpaceScene.svelte @@ -302,9 +302,9 @@ > - - - + + + 0; + return !!s && !s.ended && s.phase === "mega" && !this.replay.active && !!this.me && needsMegaChoice(this.me); } /** Mega conversions available from my staged draws (resource -> groups of 4). */ @@ -574,7 +575,7 @@ export class ViewerStore { get myHandValue(): number { const me = this.me; - return me ? handValue(me) : 0; + return me ? me.hand.reduce((sum, card) => sum + card.v, 0) : 0; } vpOf(index: number): number { diff --git a/packages/viewer/src/localization/da.json b/packages/viewer/src/localization/da.json index 7089a27..7f9aa89 100644 --- a/packages/viewer/src/localization/da.json +++ b/packages/viewer/src/localization/da.json @@ -1179,5 +1179,8 @@ "Remaining upgrades": "Remaining upgrades", "Remaining Kicker cards": "Remaining Kicker cards", "Pass auctions I can't afford": "Pas på auktioner, jeg ikke har råd til", - "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Pas automatisk på en auktion, når dine kort og rabatter ikke kan dække det krævede bud. Det kan afsløre, at din hånd er for svag." + "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Pas automatisk på en auktion, når dine kort og rabatter ikke kan dække det krævede bud. Det kan afsløre, at din hånd er for svag.", + "Choices stay hidden until everyone has confirmed.": "Valgene forbliver skjulte, indtil alle har bekræftet.", + "Production choice locked.": "Produktionsvalg bekræftet.", + "{p0} locks in their production choice": "{p0} bekræfter sit produktionsvalg" } diff --git a/packages/viewer/src/localization/de.json b/packages/viewer/src/localization/de.json index a9f0616..772a3fb 100644 --- a/packages/viewer/src/localization/de.json +++ b/packages/viewer/src/localization/de.json @@ -1179,5 +1179,8 @@ "Remaining upgrades": "Remaining upgrades", "Remaining Kicker cards": "Remaining Kicker cards", "Pass auctions I can't afford": "Bei unbezahlbaren Auktionen passen", - "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Bei einer Auktion automatisch passen, wenn deine Karten und Rabatte das erforderliche Gebot nicht decken. Das kann verraten, dass deine Hand zu schwach ist." + "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Bei einer Auktion automatisch passen, wenn deine Karten und Rabatte das erforderliche Gebot nicht decken. Das kann verraten, dass deine Hand zu schwach ist.", + "Choices stay hidden until everyone has confirmed.": "Die Entscheidungen bleiben verborgen, bis alle bestätigt haben.", + "Production choice locked.": "Produktionsentscheidung bestätigt.", + "{p0} locks in their production choice": "{p0} bestätigt die Produktionsentscheidung" } diff --git a/packages/viewer/src/localization/el.json b/packages/viewer/src/localization/el.json index 521cc76..df7cba5 100644 --- a/packages/viewer/src/localization/el.json +++ b/packages/viewer/src/localization/el.json @@ -1179,5 +1179,8 @@ "Remaining upgrades": "Remaining upgrades", "Remaining Kicker cards": "Remaining Kicker cards", "Pass auctions I can't afford": "Πάσο σε δημοπρασίες που δεν μπορώ να πληρώσω", - "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Αυτόματο πάσο σε δημοπρασία όταν οι κάρτες και οι εκπτώσεις σου δεν καλύπτουν την απαιτούμενη προσφορά. Αυτό μπορεί να αποκαλύψει ότι το χέρι σου είναι πολύ αδύναμο." + "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Αυτόματο πάσο σε δημοπρασία όταν οι κάρτες και οι εκπτώσεις σου δεν καλύπτουν την απαιτούμενη προσφορά. Αυτό μπορεί να αποκαλύψει ότι το χέρι σου είναι πολύ αδύναμο.", + "Choices stay hidden until everyone has confirmed.": "Οι επιλογές παραμένουν κρυφές μέχρι να επιβεβαιώσουν όλοι.", + "Production choice locked.": "Η επιλογή παραγωγής κλειδώθηκε.", + "{p0} locks in their production choice": "{p0} κλειδώνει την επιλογή παραγωγής" } diff --git a/packages/viewer/src/localization/en.json b/packages/viewer/src/localization/en.json index bdeb533..cce5957 100644 --- a/packages/viewer/src/localization/en.json +++ b/packages/viewer/src/localization/en.json @@ -1179,5 +1179,8 @@ "Remaining upgrades": "Remaining upgrades", "Remaining Kicker cards": "Remaining Kicker cards", "Pass auctions I can't afford": "Pass auctions I can't afford", - "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak." + "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.", + "Choices stay hidden until everyone has confirmed.": "Choices stay hidden until everyone has confirmed.", + "Production choice locked.": "Production choice locked.", + "{p0} locks in their production choice": "{p0} locks in their production choice" } diff --git a/packages/viewer/src/localization/fa.json b/packages/viewer/src/localization/fa.json index f2efbc2..3c4ce50 100644 --- a/packages/viewer/src/localization/fa.json +++ b/packages/viewer/src/localization/fa.json @@ -1179,5 +1179,8 @@ "Remaining upgrades": "ارتقاهای باقی‌مانده", "Remaining Kicker cards": "کارت‌های کیکر باقی‌مانده", "Pass auctions I can't afford": "در مزایده‌هایی که توان پرداخت ندارم، انصراف بده", - "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "وقتی کارت‌ها و تخفیف‌هایتان مبلغ پیشنهاد لازم را پوشش نمی‌دهند، خودکار از حراج انصراف دهید. این کار ممکن است ضعیف بودن دستتان را آشکار کند." + "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "وقتی کارت‌ها و تخفیف‌هایتان مبلغ پیشنهاد لازم را پوشش نمی‌دهند، خودکار از حراج انصراف دهید. این کار ممکن است ضعیف بودن دستتان را آشکار کند.", + "Choices stay hidden until everyone has confirmed.": "انتخاب‌ها تا زمانی که همه تأیید کنند پنهان می‌مانند.", + "Production choice locked.": "انتخاب تولید ثبت شد.", + "{p0} locks in their production choice": "{p0} انتخاب تولید خود را ثبت می‌کند" } diff --git a/packages/viewer/src/localization/fr.json b/packages/viewer/src/localization/fr.json index b9ff277..495e9c1 100644 --- a/packages/viewer/src/localization/fr.json +++ b/packages/viewer/src/localization/fr.json @@ -1179,5 +1179,8 @@ "Remaining upgrades": "Remaining upgrades", "Remaining Kicker cards": "Remaining Kicker cards", "Pass auctions I can't afford": "Passer les enchères hors budget", - "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Passer automatiquement une enchère si vos cartes et réductions ne permettent pas de couvrir l’enchère requise. Cela peut révéler que votre main est trop faible." + "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Passer automatiquement une enchère si vos cartes et réductions ne permettent pas de couvrir l’enchère requise. Cela peut révéler que votre main est trop faible.", + "Choices stay hidden until everyone has confirmed.": "Les choix restent cachés jusqu’à ce que tout le monde ait confirmé.", + "Production choice locked.": "Choix de production confirmé.", + "{p0} locks in their production choice": "{p0} confirme son choix de production" } diff --git a/packages/viewer/src/localization/hi.json b/packages/viewer/src/localization/hi.json index 4a36398..49a33b0 100644 --- a/packages/viewer/src/localization/hi.json +++ b/packages/viewer/src/localization/hi.json @@ -1179,5 +1179,8 @@ "Remaining upgrades": "Remaining upgrades", "Remaining Kicker cards": "Remaining Kicker cards", "Pass auctions I can't afford": "जिन नीलामियों का भुगतान न कर सकूँ, उनमें पास करें", - "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "जब आपके कार्ड और छूट आवश्यक बोली के लिए पर्याप्त न हों, तो नीलामी में अपने-आप पास करें। इससे पता चल सकता है कि आपका हाथ कमज़ोर है।" + "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "जब आपके कार्ड और छूट आवश्यक बोली के लिए पर्याप्त न हों, तो नीलामी में अपने-आप पास करें। इससे पता चल सकता है कि आपका हाथ कमज़ोर है।", + "Choices stay hidden until everyone has confirmed.": "सभी की पुष्टि होने तक विकल्प छिपे रहेंगे।", + "Production choice locked.": "उत्पादन का विकल्प तय हो गया।", + "{p0} locks in their production choice": "{p0} अपना उत्पादन विकल्प तय करता है" } diff --git a/packages/viewer/src/localization/it.json b/packages/viewer/src/localization/it.json index 23370b3..ab94d03 100644 --- a/packages/viewer/src/localization/it.json +++ b/packages/viewer/src/localization/it.json @@ -1179,5 +1179,8 @@ "Remaining upgrades": "Remaining upgrades", "Remaining Kicker cards": "Remaining Kicker cards", "Pass auctions I can't afford": "Passa nelle aste che non posso permettermi", - "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Passa automaticamente in un’asta quando le tue carte e i tuoi sconti non coprono l’offerta richiesta. Questo può rivelare che la tua mano è troppo debole." + "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Passa automaticamente in un’asta quando le tue carte e i tuoi sconti non coprono l’offerta richiesta. Questo può rivelare che la tua mano è troppo debole.", + "Choices stay hidden until everyone has confirmed.": "Le scelte restano nascoste finché tutti non hanno confermato.", + "Production choice locked.": "Scelta di produzione confermata.", + "{p0} locks in their production choice": "{p0} conferma la propria scelta di produzione" } diff --git a/packages/viewer/src/localization/ko.json b/packages/viewer/src/localization/ko.json index c77861d..8aae295 100644 --- a/packages/viewer/src/localization/ko.json +++ b/packages/viewer/src/localization/ko.json @@ -1179,5 +1179,8 @@ "Remaining upgrades": "Remaining upgrades", "Remaining Kicker cards": "Remaining Kicker cards", "Pass auctions I can't afford": "감당할 수 없는 경매는 패스", - "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "카드와 할인으로 필요한 입찰 금액을 충당할 수 없으면 경매에서 자동으로 패스합니다. 이로 인해 패가 약하다는 사실이 드러날 수 있습니다." + "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "카드와 할인으로 필요한 입찰 금액을 충당할 수 없으면 경매에서 자동으로 패스합니다. 이로 인해 패가 약하다는 사실이 드러날 수 있습니다.", + "Choices stay hidden until everyone has confirmed.": "모두가 확정할 때까지 선택은 공개되지 않습니다.", + "Production choice locked.": "생산 선택이 확정되었습니다.", + "{p0} locks in their production choice": "{p0} 님이 생산 선택을 확정합니다" } diff --git a/packages/viewer/src/localization/nl.json b/packages/viewer/src/localization/nl.json index c736969..9a75fb5 100644 --- a/packages/viewer/src/localization/nl.json +++ b/packages/viewer/src/localization/nl.json @@ -1179,5 +1179,8 @@ "Remaining upgrades": "Remaining upgrades", "Remaining Kicker cards": "Remaining Kicker cards", "Pass auctions I can't afford": "Pas bij veilingen die ik niet kan betalen", - "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Pas automatisch bij een veiling als je kaarten en kortingen het vereiste bod niet dekken. Dit kan verraden dat je hand te zwak is." + "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Pas automatisch bij een veiling als je kaarten en kortingen het vereiste bod niet dekken. Dit kan verraden dat je hand te zwak is.", + "Choices stay hidden until everyone has confirmed.": "De keuzes blijven verborgen totdat iedereen heeft bevestigd.", + "Production choice locked.": "Productiekeuze bevestigd.", + "{p0} locks in their production choice": "{p0} bevestigt de productiekeuze" } diff --git a/packages/viewer/src/localization/pl.json b/packages/viewer/src/localization/pl.json index e6bedbf..e7a079c 100644 --- a/packages/viewer/src/localization/pl.json +++ b/packages/viewer/src/localization/pl.json @@ -1179,5 +1179,8 @@ "Remaining upgrades": "Remaining upgrades", "Remaining Kicker cards": "Remaining Kicker cards", "Pass auctions I can't afford": "Pasuj w aukcjach, na które mnie nie stać", - "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Automatycznie pasuj w licytacji, gdy twoje karty i zniżki nie wystarczają na wymaganą ofertę. Może to ujawnić, że twoja ręka jest zbyt słaba." + "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Automatycznie pasuj w licytacji, gdy twoje karty i zniżki nie wystarczają na wymaganą ofertę. Może to ujawnić, że twoja ręka jest zbyt słaba.", + "Choices stay hidden until everyone has confirmed.": "Wybory pozostają ukryte, dopóki wszyscy ich nie zatwierdzą.", + "Production choice locked.": "Wybór produkcji zatwierdzony.", + "{p0} locks in their production choice": "{p0} zatwierdza wybór produkcji" } diff --git a/packages/viewer/src/localization/pt-BR.json b/packages/viewer/src/localization/pt-BR.json index 4827464..bf7c47d 100644 --- a/packages/viewer/src/localization/pt-BR.json +++ b/packages/viewer/src/localization/pt-BR.json @@ -1179,5 +1179,8 @@ "Remaining upgrades": "Remaining upgrades", "Remaining Kicker cards": "Remaining Kicker cards", "Pass auctions I can't afford": "Passar em leilões que não posso pagar", - "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Passe automaticamente em um leilão quando suas cartas e descontos não cobrirem o lance necessário. Isso pode revelar que sua mão é fraca demais." + "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Passe automaticamente em um leilão quando suas cartas e descontos não cobrirem o lance necessário. Isso pode revelar que sua mão é fraca demais.", + "Choices stay hidden until everyone has confirmed.": "As escolhas ficam ocultas até que todos tenham confirmado.", + "Production choice locked.": "Escolha de produção confirmada.", + "{p0} locks in their production choice": "{p0} confirma sua escolha de produção" } diff --git a/packages/viewer/src/localization/ro.json b/packages/viewer/src/localization/ro.json index 0252d85..d7d56ff 100644 --- a/packages/viewer/src/localization/ro.json +++ b/packages/viewer/src/localization/ro.json @@ -1179,5 +1179,8 @@ "Remaining upgrades": "Remaining upgrades", "Remaining Kicker cards": "Remaining Kicker cards", "Pass auctions I can't afford": "Pas la licitațiile pe care nu mi le permit", - "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Pasează automat la o licitație când cărțile și reducerile tale nu acoperă oferta necesară. Asta poate dezvălui că mâna ta este prea slabă." + "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Pasează automat la o licitație când cărțile și reducerile tale nu acoperă oferta necesară. Asta poate dezvălui că mâna ta este prea slabă.", + "Choices stay hidden until everyone has confirmed.": "Alegerile rămân ascunse până când toți au confirmat.", + "Production choice locked.": "Alegerea producției a fost confirmată.", + "{p0} locks in their production choice": "{p0} confirmă alegerea producției" } diff --git a/packages/viewer/src/localization/ru.json b/packages/viewer/src/localization/ru.json index 810ef5e..72d03f2 100644 --- a/packages/viewer/src/localization/ru.json +++ b/packages/viewer/src/localization/ru.json @@ -1179,5 +1179,8 @@ "Remaining upgrades": "Remaining upgrades", "Remaining Kicker cards": "Remaining Kicker cards", "Pass auctions I can't afford": "Пасовать на аукционах, если не хватает средств", - "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Автоматически пасовать на аукционе, если ваших карт и скидок недостаточно для требуемой ставки. Это может выдать слабость вашей руки." + "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Автоматически пасовать на аукционе, если ваших карт и скидок недостаточно для требуемой ставки. Это может выдать слабость вашей руки.", + "Choices stay hidden until everyone has confirmed.": "Выбор остаётся скрытым, пока все его не подтвердят.", + "Production choice locked.": "Выбор производства подтверждён.", + "{p0} locks in their production choice": "{p0} подтверждает выбор производства" } diff --git a/packages/viewer/src/localization/vi.json b/packages/viewer/src/localization/vi.json index 624e854..1e5c34a 100644 --- a/packages/viewer/src/localization/vi.json +++ b/packages/viewer/src/localization/vi.json @@ -1179,5 +1179,8 @@ "Remaining upgrades": "Remaining upgrades", "Remaining Kicker cards": "Remaining Kicker cards", "Pass auctions I can't afford": "Bỏ qua đấu giá khi không đủ tiền", - "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Tự động bỏ lượt đấu giá khi bài và mức giảm giá của bạn không đủ cho giá thầu cần thiết. Điều này có thể tiết lộ rằng bài trên tay bạn quá yếu." + "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "Tự động bỏ lượt đấu giá khi bài và mức giảm giá của bạn không đủ cho giá thầu cần thiết. Điều này có thể tiết lộ rằng bài trên tay bạn quá yếu.", + "Choices stay hidden until everyone has confirmed.": "Các lựa chọn được giữ kín cho đến khi mọi người xác nhận.", + "Production choice locked.": "Đã chốt lựa chọn sản xuất.", + "{p0} locks in their production choice": "{p0} chốt lựa chọn sản xuất" } diff --git a/packages/viewer/src/localization/zh-TW.json b/packages/viewer/src/localization/zh-TW.json index 6636cf1..9b26e48 100644 --- a/packages/viewer/src/localization/zh-TW.json +++ b/packages/viewer/src/localization/zh-TW.json @@ -1179,5 +1179,8 @@ "Remaining upgrades": "Remaining upgrades", "Remaining Kicker cards": "Remaining Kicker cards", "Pass auctions I can't afford": "自動放棄無力支付的拍賣", - "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "當手牌和折扣不足以支付所需的出價時,自動放棄競標。這可能讓其他玩家知道你的手牌價值不足。" + "Automatically pass an auction when your cards and discounts cannot cover the required bid. This can reveal that your hand is too weak.": "當手牌和折扣不足以支付所需的出價時,自動放棄競標。這可能讓其他玩家知道你的手牌價值不足。", + "Choices stay hidden until everyone has confirmed.": "所有人確認前,選擇都會保持隱藏。", + "Production choice locked.": "生產選擇已確認。", + "{p0} locks in their production choice": "{p0} 確認了生產選擇" }