Align influence payment costs and boost labels
This commit is contained in:
parent
b5670fc27e
commit
2c112e3e12
5 changed files with 26 additions and 5 deletions
|
|
@ -337,3 +337,5 @@ Viewer 0.1.108 / engine 0.4.81 fixes pirate events when Carthage controls pirate
|
|||
Viewer 0.1.109 defaults reclaim attempts to the cheapest eligible other city that permits roll boosts. Self-targeting remains available and is the fallback when no boostable city exists; explicit source selections are preserved. The cheaper-source warning no longer recommends losing roll boosts just to save range cost. Influence regression tests and Svelte/build checks pass. Engine remains 0.4.81.
|
||||
|
||||
Viewer 0.1.110 splits cultural influence into map-only hex selection, a building choice limited to that hex when needed, source selection, and payment. Single eligible buildings skip the second choice. Undo/Back navigates setup locally. Payment has one direct Influence/Arts button per method with its cost and maximum roll boost; same-hex sources show a no-boost warning. Regression checks cover map-only selection, backwards navigation without submission, and desktop/mobile confirmation. Engine remains 0.4.81.
|
||||
|
||||
Viewer 0.1.111 replaces influence payment action text with a numeric action cost and the shared action icon, retaining accessible labels and tooltips. Action details and maximum boost share a row on desktop, with responsive wrapping when space is limited. Engine remains 0.4.81.
|
||||
|
|
|
|||
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.110",
|
||||
"version": "0.1.111",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.110",
|
||||
"version": "0.1.111",
|
||||
"dependencies": {
|
||||
"@boardgamers/protocol": "0.9.0",
|
||||
"lucide-svelte": "^0.577.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.110",
|
||||
"version": "0.1.111",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -133,6 +133,17 @@ try {
|
|||
const confirm = methods.getByRole('button', { name: strategy ? /^Influence/ : /^Arts/ });
|
||||
const confirmBounds = await confirm.boundingBox();
|
||||
const panelBounds = await panel.boundingBox();
|
||||
const actionCost = confirm.locator('.influence-action-cost');
|
||||
assert.equal(await actionCost.getAttribute('aria-label'), strategy ? 'Costs 1 action' : 'Free action');
|
||||
const layout = await confirm.evaluate(button => {
|
||||
const title = button.querySelector('.method-title').getBoundingClientRect();
|
||||
const boost = button.querySelector(':scope > small').getBoundingClientRect();
|
||||
const action = button.querySelector('.influence-action-cost');
|
||||
return { titleY: title.y + title.height / 2, boostY: boost.y + boost.height / 2,
|
||||
actionColor: getComputedStyle(action).color, buttonColor: getComputedStyle(button).color };
|
||||
});
|
||||
assert.equal(layout.actionColor, layout.buttonColor, 'action cost inherits button contrast');
|
||||
if (width >= 700) assert.ok(Math.abs(layout.titleY - layout.boostY) < 2, 'desktop label, costs and boost share a row');
|
||||
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');
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<script lang="ts">
|
||||
import {
|
||||
Drama,
|
||||
Zap,
|
||||
ArrowRight,
|
||||
ArrowLeft,
|
||||
Landmark,
|
||||
|
|
@ -176,14 +177,14 @@
|
|||
: 'Boost after rolling · 1 culture per +1.'}</span>
|
||||
{#if origin?.reroll}<span>Buddhism · One optional reroll</span>{/if}
|
||||
</div>
|
||||
<div class="decision-options influence-methods" aria-label="Influence payment method">
|
||||
<div class="influence-methods" aria-label="Influence payment method">
|
||||
{#each methods as method}
|
||||
{@const from = method.origins?.find(o => o.position === origin?.position)}
|
||||
{@const cost = influenceUpfrontCost(from?.actionPayment ?? method.actionPayment, from?.payment ?? method.payment)}
|
||||
{@const maxBoost = origin?.position === target.position || (from?.preventBoost ?? method.preventBoost) ? 0 : Math.min(Math.max(0, 4 - (from?.rollBonus ?? method.rollBonus ?? 0)), Math.max(0, culture - (cost.culture_tokens ?? 0)))}
|
||||
<button class="primary" disabled={$session.pending} onclick={() => roll(method)}>
|
||||
<span class="method-title">{method.variant === 'Arts' ? 'Arts' : 'Influence'}
|
||||
<ResourceAmount pile={cost} compact /><small>{(from?.free ?? method.free) ? 'Free action' : '1 action'}</small>
|
||||
<ResourceAmount pile={cost} compact /><span class="influence-action-cost" aria-label={(from?.free ?? method.free) ? 'Free action' : 'Costs 1 action'} title={(from?.free ?? method.free) ? 'Free action' : 'Costs 1 action'}>{(from?.free ?? method.free) ? 0 : 1}<Zap size={13} /></span>
|
||||
</span>
|
||||
<small>Maximum roll boost: +{maxBoost}</small>
|
||||
</button>
|
||||
|
|
@ -206,8 +207,15 @@
|
|||
.route-target { flex: 1; min-width: 0; }
|
||||
.influence-methods { display: flex; gap: 0.5rem; margin: 0; }
|
||||
.influence-methods button { flex: 1; flex-direction: column; align-items: stretch; gap: 0.3rem; }
|
||||
.influence-action-cost { display: inline-flex; align-items: center; gap: 0.2rem; color: inherit; font-size: inherit; line-height: 1; }
|
||||
.method-title { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
|
||||
.influence-methods small { font-size: 11px; color: inherit; }
|
||||
@media (min-width: 700px) {
|
||||
.influence-methods { flex-direction: column; }
|
||||
.influence-methods button { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
|
||||
.method-title { flex-wrap: nowrap; }
|
||||
.influence-methods button > small { white-space: nowrap; }
|
||||
}
|
||||
.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); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue