From bd29326775d1b4b763cfe413ac06b230c8c400c6 Mon Sep 17 00:00:00 2001 From: coyotte508 Date: Sat, 10 Oct 2026 23:26:39 +0200 Subject: [PATCH] Default to free economy actions and reveal drawn action cards --- web-client/README.md | 2 +- web-client/bgs-preferences.json | 1 - web-client/docs/viewer-publishing.md | 4 ++ web-client/index.html | 2 - web-client/package-lock.json | 4 +- web-client/package.json | 2 +- web-client/scripts/publish.mjs | 1 + web-client/src/App.svelte | 6 +- web-client/src/CardReveal.svelte | 31 +++++++-- web-client/src/card-draws.test.ts | 76 +++++++++++++++++++-- web-client/src/card-draws.ts | 3 + web-client/src/controller.test.ts | 51 +++++++++++--- web-client/src/controller.ts | 21 +++--- web-client/src/diplomatic-relations.test.ts | 2 - web-client/src/local-host.ts | 7 -- web-client/src/localization/da.json | 3 +- web-client/src/localization/de.json | 3 +- web-client/src/localization/el.json | 3 +- web-client/src/localization/en.json | 3 +- web-client/src/localization/fa.json | 3 +- web-client/src/localization/fr.json | 3 +- web-client/src/localization/hi.json | 3 +- web-client/src/localization/it.json | 3 +- web-client/src/localization/ko.json | 3 +- web-client/src/localization/nl.json | 3 +- web-client/src/localization/pl.json | 3 +- web-client/src/localization/pt-BR.json | 3 +- web-client/src/localization/ro.json | 3 +- web-client/src/localization/ru.json | 3 +- web-client/src/localization/vi.json | 3 +- web-client/src/localization/zh-TW.json | 3 +- web-client/src/map-actions.test.ts | 28 +------- web-client/src/map-actions.ts | 18 ----- web-client/src/preferences.test.ts | 8 +-- web-client/src/preferences.ts | 2 - web-client/src/types.ts | 5 +- 36 files changed, 199 insertions(+), 123 deletions(-) diff --git a/web-client/README.md b/web-client/README.md index 824dc499..c2779113 100644 --- a/web-client/README.md +++ b/web-client/README.md @@ -30,7 +30,7 @@ The local preview does not modify production games, catalog records, or chat roo - Moves whose result is public show immediately: the bundled engine runs them on the seat's filtered state, and only if a copy with resampled hidden piles, dice, unexplored tiles and opponent settings gives the same visible result. Later moves queue and are sent in order. A matching server state changes nothing on screen; a different one replaces the prediction, and a rejection rolls back. Exploration, card draws, battles, the status phase and a save's first recorded move wait for the server with a pending indicator. Tutorials never predict. - City management: buildings and Port placement, combined recruitment including leaders, supply replacements, and multi-city happiness with legal free-action variants. Payments and legal actions come from Rust; repeat activations warn about mood loss. Size and mood use accessible pictograms. The original capital is identified from the map setup, never city ordering, with a small gold crown on its model. - Unit selection highlights eligible hexes and opens a shared picker with enlarged portraits of the actual board models. Location tabs, selected counts and passenger labels work for event casualties and movement; selecting passengers clears their carrier, and deselecting all units keeps the hex open. Decision confirmation stays visible on phones; city/player strips make room during map interaction. -- Group movement for settlers, armies, and fleets: legal destinations, attacks, embarkation by carrier, disembarkation, Navigation, movement completion, and founding cities. Destination and collection options highlight their map tiles on hover or keyboard focus. Exploration uses the engine’s forced placements or offers both legal orientations with miniature maps and a board preview before confirmation. Clicking another hex with your units that is not a destination for the current group selects that hex’s units instead. Turning off the **Confirm unit moves** BGS preference (on by default) moves as soon as a destination is clicked; attacks, exploration, paid routes, boarding an allied pirate ship and hexes reachable in several ways still ask for confirmation. +- Group movement for settlers, armies, and fleets: legal destinations, attacks, embarkation by carrier, disembarkation, Navigation, movement completion, and founding cities. Destination and collection options highlight their map tiles on hover or keyboard focus. Exploration uses the engine’s forced placements or offers both legal orientations with miniature maps and a board preview before confirmation. Clicking another hex with your units that is not a destination for the current group selects that hex’s units instead. Moves require confirmation after choosing a destination. - Action cards (civil effects and tactics descriptions), wonder construction, cultural influence (a dedicated map mode: eligible targets and source cities are highlighted, and clicking a city or building chooses it before the cost/roll summary), and available civilization/research/wonder abilities. Free collection and happiness variants use the original engine action type. - Every persistent request variant has controls: adjustable payments, resource rewards, advances, players, positions, unit types/groups, structures, hand cards, government changes, yes/no, and exploration. Selection previews check membership, counts, special restrictions, and payment validity without executing a move. Combat casualties/tactics, incidents, and end-of-age decisions use these same controls. Civilization selection is also available. The **Choose 1 of 3** setup option deals three non-overlapping civilizations to each player. All players choose privately at the same time; locks survive reconnects. Civilizations reveal together and the map, starting cards and cities are created only after everyone has locked in. - Tile, unit and structure decisions (e.g. Heavy Earthquake) are selected directly on the board: clicking a unit or building model chooses exactly that piece, a hex with a single eligible piece is chosen by clicking it, and otherwise the hex opens its portraits or structure list. Selected buildings are marked on the 3D map. Every choice requires confirmation. Mobile decision panels and reference dialogs use compact spacing while keeping rules expandable. diff --git a/web-client/bgs-preferences.json b/web-client/bgs-preferences.json index 478a8c5a..cc4cc1f7 100644 --- a/web-client/bgs-preferences.json +++ b/web-client/bgs-preferences.json @@ -8,7 +8,6 @@ }, { "name": "unitBadges", "label": "Unit badges", "type": "checkbox", "default": false }, { "name": "availableOnly", "label": "Show available actions only", "type": "checkbox", "default": false }, - { "name": "confirmMoves", "label": "Confirm unit moves", "type": "checkbox", "default": true }, { "name": "replayAutoplay", "label": "Autoplay opponent recap", "type": "checkbox", "default": true }, { "name": "colorBlind", "label": "Color-blind mode", "type": "checkbox", "default": false }, { diff --git a/web-client/docs/viewer-publishing.md b/web-client/docs/viewer-publishing.md index a1ab3877..6d324e79 100644 --- a/web-client/docs/viewer-publishing.md +++ b/web-client/docs/viewer-publishing.md @@ -104,3 +104,7 @@ Replay keeps the action toolbar and Journal/Chat controls visible. Research, cit # Viewer 0.1.51 / engine 0.4.54 Single-route trade rewards include Alphabet's 2-idea option. The compact reward picker now lists complete engine-validated conversions instead of assuming every choice contains one resource. Existing saves and historical rewards are preserved. + +# Viewer 0.1.52 + +The action bar selects an available free Collect or Increase happiness variant first, including Free Economy and Voting. Drawn action cards appear in the existing card reveal queue with their action and battle rules, including end-of-age draws. The Confirm unit moves preference has been removed from BGS and the viewer; moves always wait for confirmation, including for accounts with a previously disabled preference. Engine 0.4.54 is unchanged. diff --git a/web-client/index.html b/web-client/index.html index 6dbc9ed2..02bdb58a 100644 --- a/web-client/index.html +++ b/web-client/index.html @@ -98,8 +98,6 @@ Connecting to local game… diff --git a/web-client/package-lock.json b/web-client/package-lock.json index 5e675e69..5c57079f 100644 --- a/web-client/package-lock.json +++ b/web-client/package-lock.json @@ -1,12 +1,12 @@ { "name": "@boardgamers/clash-web-client", - "version": "0.1.51", + "version": "0.1.52", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@boardgamers/clash-web-client", - "version": "0.1.51", + "version": "0.1.52", "dependencies": { "@boardgamers/protocol": "0.9.0", "lucide-svelte": "^0.577.0", diff --git a/web-client/package.json b/web-client/package.json index 60a55aef..7d93757f 100644 --- a/web-client/package.json +++ b/web-client/package.json @@ -1,6 +1,6 @@ { "name": "@boardgamers/clash-web-client", - "version": "0.1.51", + "version": "0.1.52", "private": true, "type": "module", "scripts": { diff --git a/web-client/scripts/publish.mjs b/web-client/scripts/publish.mjs index f9a9665d..38ca111c 100644 --- a/web-client/scripts/publish.mjs +++ b/web-client/scripts/publish.mjs @@ -49,6 +49,7 @@ const options = [ ]; const declaredPreferences = JSON.parse(await fs.readFile(path.join(root, 'bgs-preferences.json'), 'utf8')); const replacedPreferences = new Set([ + 'confirmMoves', // Removed; moves always require confirmation. 'skipRazeCity', // Migrated from account preferences to engine-managed player settings. 'ui_scale', 'world_zoom_factor', diff --git a/web-client/src/App.svelte b/web-client/src/App.svelte index 16b2d4fe..89334fdc 100644 --- a/web-client/src/App.svelte +++ b/web-client/src/App.svelte @@ -1175,7 +1175,7 @@ - {#if draw.kind === 'wonder'}{:else} + {#if draw.kind === 'wonder'}{:else if draw.kind === 'action'} +
+

{printedCardName(draw.card.name)}

+

{draw.card.free ? 'Free action' : 'Costs 1 action'}

+

+ {#if draw.card.tactics}
+
Or · Battle use
+

{printedCardName(draw.card.tactics.name)}

+

+
{/if} +
+ {:else}
{#each draw.card.objectives as objective, i}{#if i}or{/if} {/each}
{/if} View {draw.kind === 'wonder' ? 'wonders' : draw.kind === 'action' ? 'action cards' : 'objectives'} + {#if $session.cardDraws.length > 1} { - let raw = await engine.init( - 2, - [], - { civilization: 'Random' }, - 'clash-preview-20260927', - {}, - ); + let raw = await engine.init(2, [], { civilization: 'Random' }, 'clash-preview-20260927', {}); const seat = engine.currentPlayer(raw); const tracker = new CardDrawTracker(); const snapshot = () => { @@ -52,3 +47,70 @@ test('card reveals detect a confirmed draw once, stay silent on initial load or tracker.update(seat, later, discarded); assert.deepEqual(tracker.update(seat, after.game, after.view), []); }); + +test('Writing reveals the drawn action and objective cards once with full card details', async () => { + let raw = await engine.init(2, [], { civilization: 'Random' }, 'clash-preview-20260927', {}); + const seat = engine.currentPlayer(raw), + tracker = new CardDrawTracker(); + const snapshot = () => { + const game: Game = JSON.parse(engine.stripSecret(raw, seat)); + return { game, view: JSON.parse(engine.webView(JSON.stringify(game), seat)) as View }; + }; + const before = snapshot(); + tracker.update(seat, before.game, before.view); + raw = engine.tryMove( + raw, + JSON.stringify(before.view.advances.find((a) => a.id === 'Writing')!.action), + seat, + ); + const after = snapshot(), + drawn = tracker.update(seat, after.game, after.view); + assert.deepEqual( + drawn.map((draw) => draw.kind), + ['action', 'objective'], + ); + const action = drawn.find((draw) => draw.kind === 'action')!; + assert.ok(action.card.name); + assert.ok(action.card.description); + assert.ok(action.card.tactics?.description); + assert.deepEqual(tracker.update(seat, after.game, after.view), []); + const withoutCard = structuredClone(after.view); + withoutCard.actionCards = withoutCard.actionCards!.filter((card) => card.id !== action.card.id); + tracker.update(seat, { ...after.game, log_index: after.game.log_index + 1 }, withoutCard); + assert.deepEqual( + tracker.update(seat, after.game, after.view), + [], + 'undo must not reveal returned action cards', + ); +}); + +test('end-of-age draws reveal action and objective cards for the viewing player', async () => { + const initial = JSON.parse( + readFileSync( + new URL('../../server/tests/test_games/status_phase/free_advance.json', import.meta.url), + 'utf8', + ), + ); + initial.players = [ + ...initial.players.slice(0, 2), + ...JSON.parse(await engine.init(2, [], {}, 'draw-npcs', {})).players.slice(2), + ]; + let raw = JSON.stringify(initial); + const tracker = new CardDrawTracker(); + const snapshot = () => { + const game: Game = JSON.parse(engine.stripSecret(raw, 0)); + return { game, view: JSON.parse(engine.webView(JSON.stringify(game), 0)) as View }; + }; + const before = snapshot(); + tracker.update(0, before.game, before.view); + for (const action of [ + { Playing: 'EndTurn' }, + { Response: { SelectAdvance: 'Storage' } }, + { Response: { SelectAdvance: 'Philosophy' } }, + ]) { + raw = engine.tryMove(raw, JSON.stringify(action), engine.currentPlayer(raw)); + } + const after = snapshot(), + drawn = tracker.update(0, after.game, after.view); + assert.deepEqual(drawn.map((draw) => draw.kind).sort(), ['action', 'objective']); +}); diff --git a/web-client/src/card-draws.ts b/web-client/src/card-draws.ts index 09162612..557ae447 100644 --- a/web-client/src/card-draws.ts +++ b/web-client/src/card-draws.ts @@ -22,6 +22,9 @@ export class CardDrawTracker { if (!before || seat === undefined || before.seat !== seat || progress(game) <= progress(before.game)) return []; return [ + ...(view.actionCards ?? []) + .filter((card) => !before.view.actionCards?.some((old) => old.id === card.id)) + .map((card) => ({ kind: 'action' as const, card })), ...view.wonderCards .filter((card) => !before.view.wonderCards.some((old) => old.id === card.id)) .map((card) => ({ kind: 'wonder' as const, card })), diff --git a/web-client/src/controller.test.ts b/web-client/src/controller.test.ts index 27a48675..002be075 100644 --- a/web-client/src/controller.test.ts +++ b/web-client/src/controller.test.ts @@ -240,7 +240,7 @@ test('clicking another movable group switches selection, while legal destination } }); -test('turning off move confirmation submits plain map moves but still confirms attacks', async () => { +test('plain map moves and attacks always wait for confirmation', async () => { const app = paymentController(), c = app.controller; try { @@ -248,18 +248,14 @@ test('turning off move confirmation submits plain map moves but still confirms a g.players[0].advances.push('Tactics'); c.setPlayer(0); await c.load(engine.stripSecret(JSON.stringify(g), 0)); - assert.equal(app.session().confirmMoves, true); c.openUnits([4]); c.selectTile('C2'); assert.equal(app.session().moveTarget, 'C2'); assert.deepEqual(app.sent, [], 'Confirmation is on by default'); c.setPreferences({ confirmMoves: false }); c.focusUnitPosition('B2'); - const route = app.session().moveDestinations.find((d) => d.position === 'C2')!; c.selectTile('C2'); - assert.deepEqual(app.sent.map((m) => JSON.parse(m)), [route.action]); - assert.equal(app.session().pending, true); - c.patch({ pending: false }); + assert.deepEqual(app.sent, [], 'An old stored preference cannot bypass confirmation'); c.focusUnitPosition('C2'); const army = [0, 1, 2, 3]; c.selectUnits(army); @@ -267,17 +263,17 @@ test('turning off move confirmation submits plain map moves but still confirms a assert.ok(attack?.attack, 'C1 holds enemy units'); c.selectTile('C1'); assert.equal(app.session().moveTarget, 'C1'); - assert.equal(app.sent.length, 1, 'Attacks keep their confirmation'); + assert.equal(app.sent.length, 0, 'Attacks keep their confirmation'); // Picking units in the panel with a target already chosen never submits on its own. c.selectUnits([0, 1], 'C1'); c.selectUnits([4], 'C2'); - assert.equal(app.sent.length, 1); + assert.equal(app.sent.length, 0); } finally { app.close(); } }); -test('a diplomatic attack waits for explicit confirmation even with move confirmation disabled', async () => { +test('a diplomatic attack waits for explicit confirmation', async () => { const app = paymentController(), c = app.controller; try { @@ -308,6 +304,39 @@ test('a diplomatic attack waits for explicit confirmation even with move confirm } }); +test('action bar defaults to available free collection and happiness variants', async () => { + const app = paymentController(), + c = app.controller; + try { + c.setPlayer(0); + await c.load(engine.stripSecret(fixture('advances/collect_free_economy'), 0)); + c.beginCollect(undefined, true); + const economy = app.session().view!.collectActions!.find((offer) => offer.name === 'Free Economy')!; + assert.deepEqual(app.session().collectVariant, economy.value); + c.patch({ + view: { + ...app.session().view!, + collectActions: app.session().view!.collectActions!.filter((offer) => !offer.free), + }, + }); + c.beginCollect(undefined, true); + assert.deepEqual(app.session().collectVariant, app.session().view!.collectActions![0].value); + await c.load(engine.stripSecret(fixture('advances/increase_happiness_voting'), 0)); + c.beginHappiness(undefined, true); + assert.equal(app.session().view!.happinessActions![app.session().happinessVariant!].name, 'Voting'); + c.patch({ + view: { + ...app.session().view!, + happinessActions: app.session().view!.happinessActions!.filter((offer) => !offer.free), + }, + }); + c.beginHappiness(undefined, true); + assert.equal(app.session().happinessVariant, 0); + assert.deepEqual(app.sent, [], 'opening an action never submits it'); + } finally { + app.close(); + } +}); test('map happiness selects multiple cities, preserves them across variants, and confirms together', async () => { const app = paymentController(), c = app.controller; @@ -740,8 +769,8 @@ test('Free Economy pays the displayed fee once, with no second click or duplicat c.setPlayer(0); await c.load(engine.stripSecret(state, 0)); const fee = app.session().view!.collectActions!.find((a) => a.name === 'Free Economy')!; - c.beginCollect(); - c.patch({ collectVariant: fee.value }); + c.beginCollect(undefined, true); + assert.deepEqual(app.session().collectVariant, fee.value); c.toggleChoice( app.session().view!.cities.find((city) => city.position === app.session().city)!.choices[0], ); diff --git a/web-client/src/controller.ts b/web-client/src/controller.ts index 5c0a15d1..2ccb36f5 100644 --- a/web-client/src/controller.ts +++ b/web-client/src/controller.ts @@ -10,7 +10,7 @@ import { loadBridge } from './bridge'; import { readPreferences } from './preferences'; import { GameAudio, moveSound } from './audio'; import { CardDrawTracker } from './card-draws'; -import { canMoveOnMap, instantMove, moveOrigins, passengerLandings } from './map-actions'; +import { canMoveOnMap, moveOrigins, passengerLandings } from './map-actions'; import { movementBonus } from './movement-bonus'; import { activeCityAbility, groupAbilities } from './abilities'; import { recapStart, sinceLastTurn, frameAt, frameEffects } from './playback'; @@ -82,7 +82,6 @@ export class Controller { unitBadges: false, replayAutoplay: true, availableOnly: false, - confirmMoves: true, skipRazeCity: false, }); readonly chat = new ChatController(); @@ -536,7 +535,9 @@ export class Controller { cardDraws: [...old.cardDraws, ...drawn].filter((draw) => draw.kind === 'wonder' ? view.wonderCards.some((card) => card.id === draw.card.id) - : view.objectiveCards.some((card) => card.id === draw.card.id), + : draw.kind === 'action' + ? view.actionCards?.some((card) => card.id === draw.card.id) + : view.objectiveCards.some((card) => card.id === draw.card.id), ), }); const continuation = this.cardContinuation; @@ -1037,9 +1038,7 @@ export class Controller { } // A destination takes priority over pieces on it (boarding or attacking). if (s.mode === 'settlers' && s.moveDestinations.some((d) => d.position === position)) { - const instant = s.confirmMoves ? null : instantMove(s.moveDestinations, position); this.chooseMoveDestination(position); - if (instant) this.submit(instant.action); return; } if ( @@ -1258,10 +1257,12 @@ export class Controller { index < 0 ? (direction > 0 ? 0 : water.length - 1) : (index + direction + water.length) % water.length; this.patch({ seaRouteStart: water[next] }); } - beginCollect(position?: string) { + beginCollect(position?: string, preferFree = false) { const s = get(this.session); if (s.pending) return; - const variant = s.view?.collectActions?.[0]?.value ?? 'Collect'; + const offers = s.view?.collectActions ?? []; + const variant = + (preferFree ? offers.find((offer) => offer.free) : undefined)?.value ?? offers[0]?.value ?? 'Collect'; const city = position ?? defaultCity( @@ -1356,7 +1357,7 @@ export class Controller { error: '', }); } - beginHappiness(position?: string) { + beginHappiness(position?: string, preferFree = false) { const s = get(this.session); if (s.pending || s.seat === undefined) return; this.closeActivity(); @@ -1369,7 +1370,9 @@ export class Controller { abilitiesOpen: false, happinessSteps: {}, happinessCity: null, - happinessVariant: 0, + happinessVariant: preferFree + ? Math.max(0, s.view?.happinessActions?.findIndex((offer) => offer.free) ?? -1) + : 0, happinessLawgiver: null, error: '', }); diff --git a/web-client/src/diplomatic-relations.test.ts b/web-client/src/diplomatic-relations.test.ts index 56989489..d661eeca 100644 --- a/web-client/src/diplomatic-relations.test.ts +++ b/web-client/src/diplomatic-relations.test.ts @@ -2,7 +2,6 @@ import { test } from 'node:test'; import assert from 'node:assert/strict'; import { createRequire } from 'node:module'; import { readFileSync } from 'node:fs'; -import { instantMove } from './map-actions.ts'; const engine = createRequire(import.meta.url)('../.engine/server.js'); const npcs = JSON.parse(await engine.init(2, [], {}, 'diplomacy', {})).players.slice(2); @@ -40,7 +39,6 @@ for (const owner of [0, 1]) { assert.ok(attack?.attack); assert.equal(attack.breaksDiplomacy, true); assert.deepEqual(attack.payment, { culture_tokens: 2 }); - assert.equal(instantMove(offered, 'C1'), null, 'Breaking diplomacy always requires confirmation'); const after = move(game, attack.action); assert.equal(after.players[0].resources.culture_tokens, game.players[0].resources.culture_tokens - 2); assert.ok(!after.permanent_effects?.some((e: any) => e.DiplomaticRelations)); diff --git a/web-client/src/local-host.ts b/web-client/src/local-host.ts index 2865ca80..3455fe11 100644 --- a/web-client/src/local-host.ts +++ b/web-client/src/local-host.ts @@ -20,7 +20,6 @@ const preferences: Record = { unitBadges: false, availableOnly: false, replayAutoplay: true, - confirmMoves: true, }; try { const saved = JSON.parse(localStorage.getItem('clash-preview-preferences') ?? '{}'); @@ -31,7 +30,6 @@ try { 'unitBadges', 'availableOnly', 'replayAutoplay', - 'confirmMoves', 'skipRazeCity', ]) if (typeof saved[key] === 'boolean') preferences[key] = saved[key]; @@ -46,7 +44,6 @@ function savePreference(name: string, value: unknown) { 'unitBadges', 'availableOnly', 'replayAutoplay', - 'confirmMoves', ].includes(name) && typeof value === 'boolean') || (name === 'mapView' && (value === '3d' || value === 'strategy')) @@ -58,10 +55,6 @@ function savePreference(name: string, value: unknown) { } catch {} send('preferences', preferences); } -// BGS shows account preferences outside the viewer; the preview bar stands in for them. -const confirmMoves = document.querySelector('#confirm-moves')!; -confirmMoves.checked = preferences.confirmMoves !== false; -confirmMoves.onchange = () => savePreference('confirmMoves', confirmMoves.checked); function showError(message: string) { document.querySelector('#host-error')!.textContent = message; } diff --git a/web-client/src/localization/da.json b/web-client/src/localization/da.json index 40612e94..fda01c11 100644 --- a/web-client/src/localization/da.json +++ b/web-client/src/localization/da.json @@ -4750,5 +4750,6 @@ "Active effects": "Aktive effekter", "Active effects: {p0}": "Aktive effekter: {p0}", "Close active effects": "Luk aktive effekter", - "No active effects.": "Ingen aktive effekter." + "No active effects.": "Ingen aktive effekter.", + "action cards": "handlingskort" } diff --git a/web-client/src/localization/de.json b/web-client/src/localization/de.json index 9525ce22..db6f87b2 100644 --- a/web-client/src/localization/de.json +++ b/web-client/src/localization/de.json @@ -4750,5 +4750,6 @@ "Active effects": "Aktive Effekte", "Active effects: {p0}": "Aktive Effekte: {p0}", "Close active effects": "Aktive Effekte schließen", - "No active effects.": "Keine aktiven Effekte." + "No active effects.": "Keine aktiven Effekte.", + "action cards": "Aktionskarten" } diff --git a/web-client/src/localization/el.json b/web-client/src/localization/el.json index 1189364f..5b54618f 100644 --- a/web-client/src/localization/el.json +++ b/web-client/src/localization/el.json @@ -4750,5 +4750,6 @@ "Active effects": "Ενεργά αποτελέσματα", "Active effects: {p0}": "Ενεργά αποτελέσματα: {p0}", "Close active effects": "Κλείσιμο ενεργών αποτελεσμάτων", - "No active effects.": "Δεν υπάρχουν ενεργά αποτελέσματα." + "No active effects.": "Δεν υπάρχουν ενεργά αποτελέσματα.", + "action cards": "κάρτες ενέργειας" } diff --git a/web-client/src/localization/en.json b/web-client/src/localization/en.json index 65189f82..d5bfc224 100644 --- a/web-client/src/localization/en.json +++ b/web-client/src/localization/en.json @@ -4750,5 +4750,6 @@ "Active effects": "Active effects", "Active effects: {p0}": "Active effects: {p0}", "Close active effects": "Close active effects", - "No active effects.": "No active effects." + "No active effects.": "No active effects.", + "action cards": "action cards" } diff --git a/web-client/src/localization/fa.json b/web-client/src/localization/fa.json index 6259af05..8269093a 100644 --- a/web-client/src/localization/fa.json +++ b/web-client/src/localization/fa.json @@ -4750,5 +4750,6 @@ "Active effects": "اثرات فعال", "Active effects: {p0}": "اثرات فعال: {p0}", "Close active effects": "بستن اثرات فعال", - "No active effects.": "هیچ اثر فعالی وجود ندارد." + "No active effects.": "هیچ اثر فعالی وجود ندارد.", + "action cards": "کارت‌های اقدام" } diff --git a/web-client/src/localization/fr.json b/web-client/src/localization/fr.json index 78c27aef..2414bf90 100644 --- a/web-client/src/localization/fr.json +++ b/web-client/src/localization/fr.json @@ -4750,5 +4750,6 @@ "Active effects": "Effets actifs", "Active effects: {p0}": "Effets actifs: {p0}", "Close active effects": "Fermer les effets actifs", - "No active effects.": "Aucun effet actif." + "No active effects.": "Aucun effet actif.", + "action cards": "cartes Action" } diff --git a/web-client/src/localization/hi.json b/web-client/src/localization/hi.json index 21b68fa2..4fcbf3eb 100644 --- a/web-client/src/localization/hi.json +++ b/web-client/src/localization/hi.json @@ -4750,5 +4750,6 @@ "Active effects": "सक्रिय प्रभाव", "Active effects: {p0}": "सक्रिय प्रभाव: {p0}", "Close active effects": "सक्रिय प्रभाव बंद करें", - "No active effects.": "कोई सक्रिय प्रभाव नहीं।" + "No active effects.": "कोई सक्रिय प्रभाव नहीं।", + "action cards": "ऐक्शन कार्ड" } diff --git a/web-client/src/localization/it.json b/web-client/src/localization/it.json index 59687e20..8600d3bf 100644 --- a/web-client/src/localization/it.json +++ b/web-client/src/localization/it.json @@ -4750,5 +4750,6 @@ "Active effects": "Effetti attivi", "Active effects: {p0}": "Effetti attivi: {p0}", "Close active effects": "Chiudi effetti attivi", - "No active effects.": "Nessun effetto attivo." + "No active effects.": "Nessun effetto attivo.", + "action cards": "carte Azione" } diff --git a/web-client/src/localization/ko.json b/web-client/src/localization/ko.json index 5c08dabf..6d988228 100644 --- a/web-client/src/localization/ko.json +++ b/web-client/src/localization/ko.json @@ -4750,5 +4750,6 @@ "Active effects": "활성 효과", "Active effects: {p0}": "활성 효과: {p0}", "Close active effects": "활성 효과 닫기", - "No active effects.": "활성 효과가 없습니다." + "No active effects.": "활성 효과가 없습니다.", + "action cards": "행동 카드" } diff --git a/web-client/src/localization/nl.json b/web-client/src/localization/nl.json index 538c0688..7f2c3235 100644 --- a/web-client/src/localization/nl.json +++ b/web-client/src/localization/nl.json @@ -4750,5 +4750,6 @@ "Active effects": "Actieve effecten", "Active effects: {p0}": "Actieve effecten: {p0}", "Close active effects": "Actieve effecten sluiten", - "No active effects.": "Geen actieve effecten." + "No active effects.": "Geen actieve effecten.", + "action cards": "actiekaarten" } diff --git a/web-client/src/localization/pl.json b/web-client/src/localization/pl.json index e0a3ec67..4058819c 100644 --- a/web-client/src/localization/pl.json +++ b/web-client/src/localization/pl.json @@ -4750,5 +4750,6 @@ "Active effects": "Aktywne efekty", "Active effects: {p0}": "Aktywne efekty: {p0}", "Close active effects": "Zamknij aktywne efekty", - "No active effects.": "Brak aktywnych efektów." + "No active effects.": "Brak aktywnych efektów.", + "action cards": "karty akcji" } diff --git a/web-client/src/localization/pt-BR.json b/web-client/src/localization/pt-BR.json index 5da0f911..72dfcee3 100644 --- a/web-client/src/localization/pt-BR.json +++ b/web-client/src/localization/pt-BR.json @@ -4750,5 +4750,6 @@ "Active effects": "Efeitos ativos", "Active effects: {p0}": "Efeitos ativos: {p0}", "Close active effects": "Fechar efeitos ativos", - "No active effects.": "Nenhum efeito ativo." + "No active effects.": "Nenhum efeito ativo.", + "action cards": "cartas de ação" } diff --git a/web-client/src/localization/ro.json b/web-client/src/localization/ro.json index 31dad039..ac89f27c 100644 --- a/web-client/src/localization/ro.json +++ b/web-client/src/localization/ro.json @@ -4750,5 +4750,6 @@ "Active effects": "Efecte active", "Active effects: {p0}": "Efecte active: {p0}", "Close active effects": "Închide efectele active", - "No active effects.": "Nu există efecte active." + "No active effects.": "Nu există efecte active.", + "action cards": "cărți de acțiune" } diff --git a/web-client/src/localization/ru.json b/web-client/src/localization/ru.json index 9f40405a..12223919 100644 --- a/web-client/src/localization/ru.json +++ b/web-client/src/localization/ru.json @@ -4750,5 +4750,6 @@ "Active effects": "Активные эффекты", "Active effects: {p0}": "Активные эффекты: {p0}", "Close active effects": "Закрыть активные эффекты", - "No active effects.": "Нет активных эффектов." + "No active effects.": "Нет активных эффектов.", + "action cards": "карты действий" } diff --git a/web-client/src/localization/vi.json b/web-client/src/localization/vi.json index bd49b3e1..a7c38518 100644 --- a/web-client/src/localization/vi.json +++ b/web-client/src/localization/vi.json @@ -4750,5 +4750,6 @@ "Active effects": "Hiệu ứng đang hoạt động", "Active effects: {p0}": "Hiệu ứng đang hoạt động: {p0}", "Close active effects": "Đóng hiệu ứng đang hoạt động", - "No active effects.": "Không có hiệu ứng đang hoạt động." + "No active effects.": "Không có hiệu ứng đang hoạt động.", + "action cards": "thẻ hành động" } diff --git a/web-client/src/localization/zh-TW.json b/web-client/src/localization/zh-TW.json index fc186353..d7a886e2 100644 --- a/web-client/src/localization/zh-TW.json +++ b/web-client/src/localization/zh-TW.json @@ -4750,5 +4750,6 @@ "Active effects": "生效中的效果", "Active effects: {p0}": "生效中的效果: {p0}", "Close active effects": "關閉生效中的效果", - "No active effects.": "目前沒有生效中的效果。" + "No active effects.": "目前沒有生效中的效果。", + "action cards": "行動牌" } diff --git a/web-client/src/map-actions.test.ts b/web-client/src/map-actions.test.ts index dd605b1b..2688f308 100644 --- a/web-client/src/map-actions.test.ts +++ b/web-client/src/map-actions.test.ts @@ -2,7 +2,7 @@ import { test } from 'node:test'; import assert from 'node:assert/strict'; import { createRequire } from 'node:module'; import { readFileSync } from 'node:fs'; -import { canMoveOnMap, instantMove, moveOrigins } from './map-actions.ts'; +import { canMoveOnMap, moveOrigins } from './map-actions.ts'; import { movementBonus } from './movement-bonus.ts'; import { collectionYield } from './collection-yield.ts'; import { journal } from './journal.ts'; @@ -37,32 +37,6 @@ test('destination-first movement offers legal units and requires no game mutatio assert.deepEqual(after.cities, v.cities); }); -test('moves without confirmation only skip the confirm step for a single, undoable route', async () => { - const state = await initial(); - const seat = engine.currentPlayer(state); - const v = view(state, seat); - const offers: MoveDestination[] = v.units!.flatMap( - (u) => query(state, seat, { kind: 'movement', units: [u.id] }).destinations, - ); - const explore = offers.find((d) => d.terrain === 'Unexplored'); - assert.ok(explore, 'The starting position borders unexplored land'); - assert.equal(instantMove([explore], explore.position), null, 'Exploring reveals tiles and locks Undo'); - const plain = offers.find((d) => d.terrain !== 'Unexplored' && !d.attack)!; - assert.equal(instantMove([plain], plain.position), plain); - assert.equal(instantMove([plain], 'Z9'), null); - assert.equal(instantMove([{ ...plain, attack: true }], plain.position), null, 'Attacks roll dice'); - assert.equal(instantMove([{ ...plain, pirateCarrier: 4 }], plain.position), null); - assert.equal(instantMove([{ ...plain, payment: { food: 1, ore: 1 } }], plain.position), null); - assert.equal(instantMove([{ ...plain, payment: { food: 0 } }], plain.position)?.position, plain.position); - assert.equal( - instantMove([plain, { ...plain, carrier: 7 }], plain.position), - null, - 'Walking or boarding a ship stays an explicit choice', - ); - const moved = engine.tryMove(state, JSON.stringify(plain.action), seat); - assert.equal(view(moved, seat).canUndo, true, 'An instant move can still be undone'); -}); - test('map movement never offers opponent, spectator, exhausted or decision-bound actions', async () => { const state = await initial(); const seat = engine.currentPlayer(state); diff --git a/web-client/src/map-actions.ts b/web-client/src/map-actions.ts index 4165691c..a15edcb5 100644 --- a/web-client/src/map-actions.ts +++ b/web-client/src/map-actions.ts @@ -43,21 +43,3 @@ export function passengerLandings( } return [...targets].map(([position, units]) => ({ position, units })); } - -// With move confirmation turned off, a map click can submit the move directly only -// when there is exactly one way to reach the hex and the move is easy to take back. -// Attacks roll dice and exploration reveals tiles (both lock Undo); boarding an allied -// pirate ship and paid moves have extra consequences: those keep the confirm step. -export function instantMove(destinations: MoveDestination[], position: string) { - const options = destinations.filter((d) => d.position === position); - const [only] = options; - if ( - options.length !== 1 || - only.attack || - only.terrain === 'Unexplored' || - only.pirateCarrier != null || - Object.values(only.payment ?? {}).some(Boolean) - ) - return null; - return only; -} diff --git a/web-client/src/preferences.test.ts b/web-client/src/preferences.test.ts index ff9d003c..f3a8bed2 100644 --- a/web-client/src/preferences.test.ts +++ b/web-client/src/preferences.test.ts @@ -144,7 +144,6 @@ test('map view, orientation and unit badges round-trip through BGS preferences a unitBadges: true, replayAutoplay: true, availableOnly: false, - confirmMoves: true, }); assert.equal(writes, 1); viewer.updatePreference('unitBadges', false); @@ -178,11 +177,8 @@ test('availability filtering defaults on and restores the player’s show-all pr assert.equal(readPreferences({ availableOnly: false }).availableOnly, false); }); -test('unit moves keep their confirmation step unless the player explicitly turns it off', () => { - assert.equal(readPreferences({}).confirmMoves, true); - assert.equal(readPreferences({ confirmMoves: true }).confirmMoves, true); - assert.equal(readPreferences({ confirmMoves: 'false' }).confirmMoves, true); - assert.equal(readPreferences({ confirmMoves: false }).confirmMoves, false); +test('the removed move confirmation preference is ignored', () => { + assert.deepEqual(readPreferences({ confirmMoves: false }), readPreferences({})); }); test('tile and control hover sounds are throttled and obey global mute', () => { diff --git a/web-client/src/preferences.ts b/web-client/src/preferences.ts index 75f8fba5..8b3c7edf 100644 --- a/web-client/src/preferences.ts +++ b/web-client/src/preferences.ts @@ -27,7 +27,5 @@ export function readPreferences(preferences: Record) { unitBadges: preferences.unitBadges === true, replayAutoplay: preferences.replayAutoplay !== false, availableOnly: preferences.availableOnly === true, - // Confirmation stays on unless the player explicitly turns it off. - confirmMoves: preferences.confirmMoves !== false, }; } diff --git a/web-client/src/types.ts b/web-client/src/types.ts index 84d45e62..87d13bd8 100644 --- a/web-client/src/types.ts +++ b/web-client/src/types.ts @@ -249,7 +249,9 @@ export interface WonderCard { ownedPoints: number; } export type CardDraw = - { kind: 'wonder'; card: WonderCard } | { kind: 'objective'; card: View['objectiveCards'][number] }; + | { kind: 'wonder'; card: WonderCard } + | { kind: 'objective'; card: View['objectiveCards'][number] } + | { kind: 'action'; card: ActionCard }; export interface InfluenceContext { stage: 'payment' | 'range' | 'reroll' | 'boost'; source: string | null; @@ -606,7 +608,6 @@ export interface Session { unitBadges: boolean; replayAutoplay: boolean; availableOnly: boolean; - confirmMoves: boolean; skipRazeCity: boolean; } export interface MapPick {