Default to free economy actions and reveal drawn action cards

This commit is contained in:
coyotte508 2026-10-10 23:26:39 +02:00
commit bd29326775
36 changed files with 199 additions and 123 deletions

View file

@ -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.

View file

@ -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 },
{

View file

@ -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.

View file

@ -98,8 +98,6 @@
<option value="1">Player 2</option>
<option value="spectator">Spectator</option></select
><button id="reset">New game</button><button id="theme">Theme</button
><label title="BGS account preference"
><input id="confirm-moves" type="checkbox" checked />Confirm unit moves</label
>
<span id="status">Connecting to local game…</span>
</div>

View file

@ -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",

View file

@ -1,6 +1,6 @@
{
"name": "@boardgamers/clash-web-client",
"version": "0.1.51",
"version": "0.1.52",
"private": true,
"type": "module",
"scripts": {

View file

@ -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',

View file

@ -1175,7 +1175,7 @@
<button
class:active={$session.mode === 'collect'}
title={collectAvailable
? 'Collect resources · 1 action'
? ($session.view?.collectActions?.find((offer) => offer.free)?.name ?? 'Collect resources · 1 action')
: (city?.reason ?? 'No city can collect resources')}
data-tutorial="collect"
aria-label="Collect resources"
@ -1184,7 +1184,7 @@
: !$session.view?.canPlay || !collectAvailable || $session.pending}
onclick={() => {
confirmEnd = false;
controller.beginCollect();
controller.beginCollect(undefined, true);
}}><Wheat size={21} /><span>Collect</span></button
>
<button
@ -1240,7 +1240,7 @@
disabled={!city || (!$session.playback && (!$session.view?.canPlay || $session.pending))}
onclick={() => {
confirmEnd = false;
controller.beginHappiness();
controller.beginHappiness(undefined, true);
}}><Smile size={21} /><span>Happiness</span></button
>
<button

View file

@ -1,5 +1,8 @@
<script lang="ts">
import { X, ArrowRight, Target, Landmark } from 'lucide-svelte';
import { X, ArrowRight, Target, Landmark, Layers, Zap, Swords } from 'lucide-svelte';
import { printedCardName } from './card-names';
import { handCardDescription } from './card-text';
import ResourceText from './ResourceText.svelte';
import WonderCard from './WonderCard.svelte';
import ObjectiveCondition from './ObjectiveCondition.svelte';
import type { Controller } from './controller';
@ -13,6 +16,7 @@
controller.patch({
wondersOpen: draw.kind === 'wonder',
objectivesOpen: draw.kind === 'objective',
cardsOpen: draw.kind === 'action',
cardDraws: [],
});
}
@ -23,21 +27,36 @@
<aside class="card-reveal" class:still={$session.reducedMotion} aria-label="New card" aria-live="polite">
<div class="reveal-title">
<span
>{#if draw.kind === 'wonder'}<Landmark size={16} />{:else}<Target size={16} />{/if} You drew {draw.kind ===
'wonder'
>{#if draw.kind === 'wonder'}<Landmark size={16} />{:else if draw.kind === 'action'}<Layers
size={16}
/>{:else}<Target size={16} />{/if} You drew {draw.kind === 'wonder'
? 'a wonder'
: 'an objective'}</span
: draw.kind === 'action'
? 'an action card'
: 'an objective'}</span
><button class="icon-button" aria-label="Dismiss drawn card" onclick={dismiss}><X size={17} /></button
>
</div>
{#if draw.kind === 'wonder'}<WonderCard card={draw.card} />{:else}
{#if draw.kind === 'wonder'}<WonderCard card={draw.card} />{:else if draw.kind === 'action'}
<article class="drawn-objective">
<h3>{printedCardName(draw.card.name)}</h3>
<p class="card-use-rule"><Zap size={14} />{draw.card.free ? 'Free action' : 'Costs 1 action'}</p>
<p><ResourceText text={handCardDescription(draw.card.description)} /></p>
{#if draw.card.tactics}<section class="card-battle-use">
<div class="card-use-label"><Swords size={15} />Or · Battle use</div>
<h4>{printedCardName(draw.card.tactics.name)}</h4>
<p><ResourceText text={draw.card.tactics.description} /></p>
</section>{/if}
</article>
{:else}
<div class="drawn-objective">
{#each draw.card.objectives as objective, i}{#if i}<span class="objective-divider">or</span>{/if}
<ObjectiveCondition {objective} />{/each}
</div>
{/if}
<button class="reveal-open" onclick={openHand}
>View {draw.kind === 'wonder' ? 'wonders' : 'objectives'} <ArrowRight size={16} /></button
>View {draw.kind === 'wonder' ? 'wonders' : draw.kind === 'action' ? 'action cards' : 'objectives'}
<ArrowRight size={16} /></button
>
{#if $session.cardDraws.length > 1}<button class="reveal-next" onclick={dismiss}
>Next card · {$session.cardDraws.length - 1} more</button

View file

@ -1,18 +1,13 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
import { readFileSync } from 'node:fs';
import { CardDrawTracker } from './card-draws.ts';
import type { View, Game } from './types.ts';
const engine = createRequire(import.meta.url)('../.engine/server.js');
test('card reveals detect a confirmed draw once, stay silent on initial load or seat changes, and ignore undo returns', async () => {
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']);
});

View file

@ -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 })),

View file

@ -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],
);

View file

@ -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: '',
});

View file

@ -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));

View file

@ -20,7 +20,6 @@ const preferences: Record<string, unknown> = {
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<HTMLInputElement>('#confirm-moves')!;
confirmMoves.checked = preferences.confirmMoves !== false;
confirmMoves.onchange = () => savePreference('confirmMoves', confirmMoves.checked);
function showError(message: string) {
document.querySelector('#host-error')!.textContent = message;
}

View file

@ -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"
}

View file

@ -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"
}

View file

@ -4750,5 +4750,6 @@
"Active effects": "Ενεργά αποτελέσματα",
"Active effects: {p0}": "Ενεργά αποτελέσματα: {p0}",
"Close active effects": "Κλείσιμο ενεργών αποτελεσμάτων",
"No active effects.": "Δεν υπάρχουν ενεργά αποτελέσματα."
"No active effects.": "Δεν υπάρχουν ενεργά αποτελέσματα.",
"action cards": "κάρτες ενέργειας"
}

View file

@ -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"
}

View file

@ -4750,5 +4750,6 @@
"Active effects": "اثرات فعال",
"Active effects: {p0}": "اثرات فعال: {p0}",
"Close active effects": "بستن اثرات فعال",
"No active effects.": "هیچ اثر فعالی وجود ندارد."
"No active effects.": "هیچ اثر فعالی وجود ندارد.",
"action cards": "کارت‌های اقدام"
}

View file

@ -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"
}

View file

@ -4750,5 +4750,6 @@
"Active effects": "सक्रिय प्रभाव",
"Active effects: {p0}": "सक्रिय प्रभाव: {p0}",
"Close active effects": "सक्रिय प्रभाव बंद करें",
"No active effects.": "कोई सक्रिय प्रभाव नहीं।"
"No active effects.": "कोई सक्रिय प्रभाव नहीं।",
"action cards": "ऐक्शन कार्ड"
}

View file

@ -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"
}

View file

@ -4750,5 +4750,6 @@
"Active effects": "활성 효과",
"Active effects: {p0}": "활성 효과: {p0}",
"Close active effects": "활성 효과 닫기",
"No active effects.": "활성 효과가 없습니다."
"No active effects.": "활성 효과가 없습니다.",
"action cards": "행동 카드"
}

View file

@ -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"
}

View file

@ -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"
}

View file

@ -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"
}

View file

@ -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"
}

View file

@ -4750,5 +4750,6 @@
"Active effects": "Активные эффекты",
"Active effects: {p0}": "Активные эффекты: {p0}",
"Close active effects": "Закрыть активные эффекты",
"No active effects.": "Нет активных эффектов."
"No active effects.": "Нет активных эффектов.",
"action cards": "карты действий"
}

View file

@ -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"
}

View file

@ -4750,5 +4750,6 @@
"Active effects": "生效中的效果",
"Active effects: {p0}": "生效中的效果: {p0}",
"Close active effects": "關閉生效中的效果",
"No active effects.": "目前沒有生效中的效果。"
"No active effects.": "目前沒有生效中的效果。",
"action cards": "行動牌"
}

View file

@ -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);

View file

@ -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;
}

View file

@ -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', () => {

View file

@ -27,7 +27,5 @@ export function readPreferences(preferences: Record<string, unknown>) {
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,
};
}

View file

@ -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 {