Show food storage beside event recipients

This commit is contained in:
coyotte508 2026-10-16 13:19:46 +02:00
commit 0891010990
4 changed files with 23 additions and 4 deletions

View file

@ -387,3 +387,5 @@ Viewer 0.1.133 shortens the Barbarian map guide and removes its two trailing cav
Viewer 0.1.134 lets the Barbarian, Pirate, Trade Routes and Regions guides collapse to a title bar while keeping their map overlays visible.
Viewer 0.1.135 / engine 0.4.96 exposes Rituals happiness payment allocation and allows food-distribution events to target other players at their storage limit; excess food is wasted normally.
Viewer 0.1.136 shows current food / storage limit with the food icon beside each food-distribution recipient, without warning text or disabling full recipients.

View file

@ -1,12 +1,12 @@
{
"name": "@boardgamers/clash-web-client",
"version": "0.1.135",
"version": "0.1.136",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@boardgamers/clash-web-client",
"version": "0.1.135",
"version": "0.1.136",
"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.135",
"version": "0.1.136",
"private": true,
"type": "module",
"scripts": {

View file

@ -2,7 +2,7 @@
import { printedCardName } from './card-names';
import { onDestroy } from 'svelte';
import { untrack } from 'svelte';
import { Check, Sparkles, Layers, BookOpen, ChevronRight, Zap } from 'lucide-svelte';
import { Check, Sparkles, Layers, BookOpen, ChevronRight, Zap, Wheat } from 'lucide-svelte';
import type { Controller } from './controller';
import type { Decision, Move, Pile, UnitKind } from './types';
import { unitInfo } from './city';
@ -162,6 +162,9 @@
typeof option.value === 'string'
? $session.view?.advances.find((a) => a.id === option.value)
: undefined}
{@const foodRecipient = decision.description === 'Select a player to gain 1 food'
? $session.game?.players.find((player) => player.id === option.value)
: undefined}
{@const Icon = unit?.icon ?? (advance ? researchPresentation(advance).icon : null)}
<button
class="decision-option"
@ -181,6 +184,11 @@
>
{#if option.terrain}<TerrainIcon terrain={option.terrain} />{:else if Icon}<Icon size={19} />{/if}
<DecisionOptionContent option={presented} id={`${panelId}-option-${i}`} />
{#if foodRecipient}
<span class="recipient-food" aria-label="Food">
{foodRecipient.resources?.food ?? 0}/{foodRecipient.resource_limit?.food ?? 0}<Wheat size={15} />
</span>
{/if}
<span class="decision-selection" aria-hidden="true"
>{#if selected.includes(i)}<Check size={13} />{/if}</span
>
@ -476,4 +484,13 @@
.decision-card-group { grid-column: 1 / -1; margin: 1rem 0 .25rem; font-size: .95rem; padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.decision-card-group:first-child { margin-top: 0; }
.decision-card-group small { font-weight: normal; color: var(--muted); }
.recipient-food {
display: inline-flex;
align-items: center;
gap: 0.3rem;
white-space: nowrap;
font-variant-numeric: tabular-nums;
flex-shrink: 0;
}
</style>