Simplify influence confirmation and keep roll controls visible

This commit is contained in:
coyotte508 2026-10-13 04:27:20 +02:00
commit 52bd5dbf68
6 changed files with 60 additions and 38 deletions

View file

@ -327,3 +327,5 @@ Viewer 0.1.103 fixes journal “Action card · Card 0” entries. Redacted card-
Viewer 0.1.104 removes the duplicate Cultural Influence entry from Abilities and keeps its dedicated action-bar button. Abilities availability now depends only on abilities, and the influence tutorial targets the dedicated button. Checked Svelte and desktop/mobile influence selection flows. Engine remains 0.4.79.
Viewer 0.1.105 / engine 0.4.80 allows reclaiming influenced buildings from another eligible city with normal range and roll boosts. Self-targeted attempts remain unboostable and now say so in the payment preview. Regression coverage verifies remote reclaim and boosting, self-target failure without spending, and rejection of another influenced source.
Viewer 0.1.106 simplifies cultural influence confirmation: editable source/target fields, payment choices with combined costs, no duplicate action and empty-range rows, and a pinned roll summary/button. The influence panel has room for its choices on mobile while longer content scrolls independently. Desktop/mobile map selection and confirmation checks pass, including visible roll-button bounds. Engine remains 0.4.80.

View file

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

View file

@ -120,6 +120,9 @@ try {
await methods.getByRole('button', { name: /Arts/ }).click();
assert.equal(await methods.getByRole('button', { name: /Arts/ }).getAttribute('aria-pressed'), 'true');
}
const confirmBounds = await panel.getByRole('button', { name: /Pay & roll|Roll for influence/ }).boundingBox();
const panelBounds = await panel.boundingBox();
assert.ok(confirmBounds && panelBounds && confirmBounds.y >= panelBounds.y && confirmBounds.y + confirmBounds.height <= panelBounds.y + panelBounds.height, 'roll confirmation stays visible within the panel');
await page.screenshot({ path: `/tmp/clash-influence-payment-${width}-${strategy ? 'strategy' : '3d'}.png` });
assert.deepEqual(sent, [], 'source confirmation does not spend or roll');
await panel.getByRole('button', { name: /Pay & roll|Roll for influence/ }).click();

View file

@ -6,7 +6,6 @@
Landmark,
Footprints,
RotateCcw,
Zap,
X,
TriangleAlert,
} from 'lucide-svelte';
@ -89,7 +88,7 @@
</div>{:else}<p class="settler-empty">No eligible targets.</p>{/each}
</div>
{/if}
{#if target || influence?.position}<button
{#if !target && influence?.position}<button
class="secondary compact influence-change"
onclick={() => {
controller.patch({ influencePosition: null, influenceTarget: null, influenceOrigin: null });
@ -99,9 +98,14 @@
{#if target}
<div class="influence-preview">
<div class="influence-route">
<b>{origin?.position ?? target.origin}</b><ArrowRight size={15} /><span
>{target.name} at <b>{target.position}</b></span
>
<button class="route-choice" aria-label="Change source" onclick={() => paymentStep = false}>
<small>From</small><strong>{origin?.position ?? target.origin}</strong>
</button>
<ArrowRight size={16} />
<button class="route-choice route-target" aria-label="Change target" onclick={() => {
controller.patch({ influencePosition: null, influenceTarget: null, influenceOrigin: null });
onHighlight(null);
}}><small>Target</small><strong>{target.name} at {target.position}</strong></button>
</div>
{#if !paymentStep && (target.origins?.length ?? 0) > 0}<div class="influence-origins" aria-label="Influence from">
<span>From</span>{#each target.origins ?? [] as from}<button
@ -126,8 +130,7 @@
<p class="movement-hint">Choose the source on the map or above. The lowest-cost source is preselected.</p>
<button class="primary wide" onclick={() => paymentStep = true}>Choose payment<ArrowRight size={16} /></button>
{:else}
<button class="secondary compact" onclick={() => paymentStep = false}>Change source</button>
<div class="decision-options" aria-label="Influence payment method">
<div class="decision-options influence-methods" aria-label="Influence payment method">
{#each methods as method}
{@const from = method.origins?.find(o => o.position === origin?.position)}
<button class:selected={method === target} aria-pressed={method === target} onclick={() => {
@ -141,31 +144,10 @@
</button>
{/each}
</div>
<div class="influence-cost-line">
<span>Action</span><span
>{#if origin?.free ?? target.free}Free action{:else}<Zap size={14} />1 action{/if}{#if Object.values(actionPayment).some(Boolean)}<ResourceAmount
pile={actionPayment}
compact
/>{/if}</span
>
</div>
<div class="influence-cost-line">
<span>Extra range</span><span
>{#if Object.values(rangePayment).some(Boolean)}<ResourceAmount
pile={rangePayment}
compact
/>{:else}None needed{/if}</span
>
</div>
<p class="movement-hint">
Roll {Math.max(1, 5 - bonus)}+{#if bonus}
(+{bonus} bonus){/if} to succeed. {origin?.position === target?.position
? 'A city targeting itself cannot spend culture to boost the roll.'
: preventBoost
? 'This target prevents spending culture to boost range or the roll.'
: 'After rolling, you can choose whether to spend culture to reach 5.'}{#if origin?.reroll}
Buddhism offers one optional reroll.{/if}
</p>
{#if Object.values(rangePayment).some(Boolean)}
<p class="range-note">Includes <ResourceAmount pile={rangePayment} compact /> for extra range.</p>
{/if}
{#if cheaper}
<div class="influence-source-warning" role="status">
<p>
@ -190,6 +172,23 @@
</button>
</div>
{/if}
{/if}
</div>
{/if}
</div>
{#if target && paymentStep}
<div class="influence-submit">
<div class="roll-summary">
<strong>Roll {Math.max(1, 5 - bonus)}+ to succeed</strong>
<span>{origin?.position === target?.position
? 'Self-targeting · No roll boost'
: preventBoost
? 'Protected target · No range or roll boost'
: 'You may boost the roll with culture.'}</span>
{#if origin?.reroll}<span>Buddhism · One optional reroll</span>{/if}
</div>
<button class="primary wide" disabled={$session.pending} onclick={roll}>
{cheaper && confirmedSource === attemptKey
? `Use ${origin?.position ?? target.origin} anyway`
@ -200,12 +199,24 @@
compact
/>{/if}<ArrowRight size={16} />
</button>
{/if}
</div>
{/if}
</div>
{/if}
<style>
.influence-picker { min-height: 0; overflow-y: auto; }
.influence-submit { flex-shrink: 0; padding-top: 0.4rem; border-top: 1px solid var(--line); }
.movement-heading { flex-shrink: 0; }
.influence-route { display: flex; flex-wrap: nowrap; gap: 0.75rem; margin-bottom: 0.65rem; }
.route-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; padding: 0.6rem 0.8rem; text-align: left; }
.route-choice small { color: var(--muted); font-size: 11px; }
.route-choice strong { font-size: 14px; }
.route-target { flex: 1; min-width: 0; }
.influence-methods { margin: 0 0 0.8rem; }
.roll-summary { display: grid; gap: 0.3rem; margin: 0.2rem 0 0.6rem; font-size: 12px; color: var(--muted); line-height: 1.5; }
.roll-summary strong { color: var(--ink); font-size: 14px; }
.range-note { display: flex; align-items: center; gap: 0.35rem; font-size: 12px; color: var(--muted); }
.influence-source-warning {
margin: 0.8rem 0;
padding: 0.75rem;

View file

@ -1273,3 +1273,9 @@
border: 1px solid var(--line); border-radius: 6px; color: var(--muted);
}
.civilization-hand-count strong { margin-left: auto; color: var(--ink); font-size: .95rem; }
/* Keep influence's route, payment choices and pinned roll summary together. */
.game-shell .play-layout .action-panel.floating-panel.selection-tray.influence-mode {
max-height: min(440px, 65%);
overflow: hidden;
}