Show objective and wonder card counts still in hand
This commit is contained in:
parent
38133c849d
commit
4b02540ff1
7 changed files with 34 additions and 9 deletions
|
|
@ -303,3 +303,5 @@ Viewer 0.1.91 / engine 0.4.75 labels the optional end-of-age government payment
|
|||
Viewer 0.1.92 omits empty optional payments from journal prose, including older saved entries. Declining a government change now reads “Keep current government” without the stray “Pay ,” prefix. Actual payments and engine history are unchanged; engine remains 0.4.75.
|
||||
|
||||
Viewer 0.1.93 shows public action-card hand counts with a card icon on civilization panels and in civilization details. Counts use the already-redacted public hand arrays; no card identities are exposed. Replay frames without historical hand counts omit the number instead of showing current information. Engine remains 0.4.75.
|
||||
|
||||
Viewer 0.1.94 extends public hand counts to objective cards still in hand and unbuilt wonder cards. Each type has its own icon and tooltip on the player panel and an explicit label in civilization details. These counts exclude completed objectives and built wonders; historical frames without counts do not substitute current hands. Engine remains 0.4.75.
|
||||
|
|
|
|||
4
web-client/package-lock.json
generated
4
web-client/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.93",
|
||||
"version": "0.1.94",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.93",
|
||||
"version": "0.1.94",
|
||||
"dependencies": {
|
||||
"@boardgamers/protocol": "0.9.0",
|
||||
"lucide-svelte": "^0.577.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.93",
|
||||
"version": "0.1.94",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -899,7 +899,10 @@
|
|||
: null}
|
||||
{@const progressLabel =
|
||||
status === 'current' ? 'Turn in progress' : status === 'left' ? 'Left game' : null}
|
||||
{@const handCount = ($session.playback?.frame?.players ?? $session.game?.players ?? []).find(p => p.id === player.index)?.action_cards?.length}
|
||||
{@const hand = ($session.playback?.frame?.players ?? $session.game?.players ?? []).find(p => p.id === player.index)}
|
||||
{@const handCount = hand?.action_cards?.length ?? (!$session.playback && hand ? 0 : undefined)}
|
||||
{@const objectiveCount = hand?.objective_cards?.length ?? (!$session.playback && hand ? 0 : undefined)}
|
||||
{@const wonderCount = hand?.wonder_cards?.length ?? (!$session.playback && hand ? 0 : undefined)}
|
||||
<button
|
||||
class="player-card"
|
||||
class:active={!!turnLabel}
|
||||
|
|
@ -909,6 +912,8 @@
|
|||
`${translate(player.civilization)}: ${formatPoints(player.score)} ${translate('victory points')}`,
|
||||
player.index === $session.seat ? translate('You') : player.name,
|
||||
handCount !== undefined ? `${translate('Action cards')}: ${handCount}` : '',
|
||||
objectiveCount !== undefined ? `Objective cards in hand: ${objectiveCount}` : '',
|
||||
wonderCount !== undefined ? `Wonder cards in hand: ${wonderCount}` : '',
|
||||
order ? translate(`Turn order ${order}.`).replace(/\.$/u, '') : '',
|
||||
turnLabel ? translate(turnLabel) : '',
|
||||
progressLabel ? translate(progressLabel) : '',
|
||||
|
|
@ -951,8 +956,13 @@
|
|||
alt={$session.playerBadges[player.index]!.label}
|
||||
title={$session.playerBadges[player.index]!.label}
|
||||
/>{/if}</small
|
||||
><span class="player-events"><EventMarkers remaining={player.eventTokens} />{#if handCount !== undefined}<span class="player-hand-count" title={`Action cards: ${handCount}`} aria-hidden="true"><Layers size={12} />{handCount}</span>{/if}</span
|
||||
>{#if turnLabel || progressLabel}<span class="player-turn" class:round-inactive={!turnLabel}
|
||||
><span class="player-events"><EventMarkers remaining={player.eventTokens} /></span>
|
||||
<span class="player-hands">
|
||||
{#if handCount !== undefined}<span class="player-hand-count" title={`Action cards: ${handCount}`} aria-hidden="true"><Layers size={12} />{handCount}</span>{/if}
|
||||
{#if objectiveCount !== undefined}<span class="player-hand-count" title={`Objective cards in hand: ${objectiveCount}`} aria-hidden="true"><Target size={12} />{objectiveCount}</span>{/if}
|
||||
{#if wonderCount !== undefined}<span class="player-hand-count" title={`Wonder cards in hand: ${wonderCount}`} aria-hidden="true"><Landmark size={12} />{wonderCount}</span>{/if}
|
||||
</span>
|
||||
{#if turnLabel || progressLabel}<span class="player-turn" class:round-inactive={!turnLabel}
|
||||
>{#if turnLabel || status === 'current'}<ArrowRight
|
||||
size={12}
|
||||
aria-hidden="true"
|
||||
|
|
|
|||
|
|
@ -31,7 +31,12 @@
|
|||
const session = $derived(controller.session);
|
||||
let player = $derived($session.view?.players.find((p) => p.index === $session.scorePlayer));
|
||||
const publicPlayer = $derived($session.game?.players.find((p) => p.id === player?.index));
|
||||
const handCount = $derived(($session.playback?.frame?.players ?? $session.game?.players ?? []).find(p => p.id === player?.index)?.action_cards?.length);
|
||||
const hand = $derived(($session.playback?.frame?.players ?? $session.game?.players ?? []).find(p => p.id === player?.index));
|
||||
const handCounts = $derived([
|
||||
{ label: 'Action cards', icon: Layers, count: hand?.action_cards?.length ?? (!$session.playback && hand ? 0 : undefined) },
|
||||
{ label: 'Objective cards in hand', icon: Target, count: hand?.objective_cards?.length ?? (!$session.playback && hand ? 0 : undefined) },
|
||||
{ label: 'Wonder cards in hand', icon: Landmark, count: hand?.wonder_cards?.length ?? (!$session.playback && hand ? 0 : undefined) },
|
||||
]);
|
||||
const resources = $derived(
|
||||
Object.fromEntries(
|
||||
Object.keys(resourceNames)
|
||||
|
|
@ -111,7 +116,7 @@
|
|||
<div class="civilization-resources" role="group" aria-label={`${player.civilization} resources`}>
|
||||
<ResourceAmount pile={resources} showZero />
|
||||
</div>
|
||||
{#if handCount !== undefined}<p class="civilization-hand-count"><Layers size={17} /> Action cards <strong>{handCount}</strong></p>{/if}
|
||||
<div class="civilization-hands">{#each handCounts as item}{#if item.count !== undefined}<p class="civilization-hand-count"><item.icon size={17} /> {item.label} <strong>{item.count}</strong></p>{/if}{/each}</div>
|
||||
<nav class="civilization-tabs" aria-label="Civilization details">
|
||||
<button class:active={tab === 'score'} aria-pressed={tab === 'score'} onclick={() => setTab('score')}
|
||||
><Trophy size={16} /> Score</button
|
||||
|
|
|
|||
|
|
@ -1269,10 +1269,17 @@
|
|||
gap: 0.3rem;
|
||||
}
|
||||
.player-hand-count {
|
||||
margin-left: 0.5rem;
|
||||
font-size: 0.75rem;
|
||||
color: var(--muted);
|
||||
}
|
||||
.civilization-hand-count {
|
||||
margin: 0 0 1rem;
|
||||
}
|
||||
|
||||
.player-hands, .civilization-hands {
|
||||
display: flex;
|
||||
gap: 0.65rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.player-info .player-hands { grid-area: 3 / 1 / 4 / 4; }
|
||||
.player-card .player-info .player-turn { grid-area: 4 / 1 / 5 / 4; }
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ export interface Player {
|
|||
special_advances?: string[];
|
||||
action_cards?: number[];
|
||||
objective_cards?: number[];
|
||||
wonder_cards?: string[];
|
||||
}
|
||||
export interface PublicEffect {
|
||||
player: number;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue