Simplify Great Person acquisition prompts

This commit is contained in:
coyotte508 2026-10-22 12:05:44 +02:00
commit 247b9631c4
8 changed files with 60 additions and 16 deletions

View file

@ -435,3 +435,5 @@ Viewer 0.1.155 / engine 0.4.106 measures effect ranges along revealed spaces, ne
Rule source: the official Monumental Edition rulebook, page 36, “Spaces”: https://wizkids.com/posters/repository/wizkids/Clash-of-Cultures---Rulebook---WEB---2021-02-05-compressed.pdf. Verified with 850 frontend/engine tests, 55 targeted Rust tests, locale validation, type checking and production build. Regression cases cover blocked paths, longer revealed detours, sea paths, off-board gaps, Tribute Empire and Colony. Synthetic range fixtures now place their contacts and connecting paths on revealed board spaces.
Viewer 0.1.156 / engine 0.4.107 lets combat estimates resolve the fixed “Pirate ship destroyed” gold reward between rounds, including zero-gold rewards. Estimates now continue from attack confirmation and tactics selection against pirates. Live game state and post-combat reward choices remain unchanged. Verified with 851 frontend/engine tests, deterministic non-mutation and tactics-step regression coverage, locale validation, type checking and production build.
Viewer 0.1.157 simplifies Great Person acquisition prompts: the Take card button carries the culture cost once, with a separate Pass button and an effect preview. Great Diplomat is labeled active when taken; hand cards show their action cost. Acquisition instructions are collapsible in event explanations, and public Great Person text no longer repeats them in the effect. Verified with 851 frontend tests, locale validation, type checking, production build and an approved local browser preview. Engine remains 0.4.107; no saved-data changes.

View file

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

View file

@ -1,4 +1,5 @@
<script lang="ts">
import { handCardDescription } from './card-text';
import CombatEstimate from './CombatEstimate.svelte';
import { printedCardName } from './card-names';
import { onDestroy } from 'svelte';
@ -36,6 +37,9 @@
? steelWeaponsBenefit($session.game, $session.view, $session.view?.activePlayer ?? $session.seat)
: null,
);
const cardOffer = $derived(decision.eventContext?.card && !decision.eventContext.card.later
&& decision.fields.some((field) => field.name === 'Pay to gain the Action Card')
? decision.eventContext.card : null);
const description = $derived(
combatBenefit ??
(decision.tacticsSelection && decision.name === 'Tactics'
@ -224,7 +228,7 @@
<div class="decision-event-context" class:full-context={!!context.card}>
{#if context.card}
{@const card = context.card}
<div class="event-card-offer">
{#if !cardOffer}<div class="event-card-offer">
<Layers size={16} />
<span
>{card.later
@ -235,9 +239,10 @@
>
<ResourceAmount pile={card.cost} />
</div>
{/if}
<details class="event-rules">
<summary aria-label={`${printedCardName(card.name)} event details`}
><BookOpen size={13} />{printedCardName(card.name)}<ChevronRight size={13} /></summary
><BookOpen size={13} />Event rules<ChevronRight size={13} /></summary
>
{#if context.placement}<p>{context.placement}</p>{/if}
{#if context.raid}<p class="event-raid"><ResourceText text={context.raid} /></p>{/if}
@ -248,11 +253,11 @@
pile={{ culture_tokens: 2 }}
/>.
</p>
<p>
{#if !cardOffer}<p>
<span class="event-card-use">Play <Zap size={13} />{card.free ? 0 : 1}</span><ResourceText
text={card.description}
text={handCardDescription(card.description)}
/>
</p>
</p>{/if}
</details>
{:else}
<details class="event-rules">
@ -267,7 +272,13 @@
</div>
{/if}
</header>
{#if description && !$session.view?.influenceContext}<p class="decision-description">
{#if cardOffer}
<div class="great-person-effect">
<span class="event-card-use">{#if cardOffer.description.startsWith("You make place")}Active when taken{:else}Play <span aria-label={`${cardOffer.free ? 0 : 1} actions`}>{cardOffer.free ? 0 : 1} <Zap size={13} /></span>{/if}</span>
<ResourceText text={handCardDescription(cardOffer.description)} />
</div>
{/if}
{#if description && !cardOffer && !$session.view?.influenceContext}<p class="decision-description">
<ResourceText
text={description.replaceAll('Status Phase', 'End of age').replaceAll('status phase', 'end of age')}
/>
@ -323,12 +334,23 @@
!field.optional &&
directPayments.length > 0 &&
directPayments.every((choice) => !Object.values(choice.payment).some(Boolean))}
{#if field.name !== decision.name && !combatBenefit && !$session.view?.influenceContext}<p
{#if field.name !== decision.name && !cardOffer && !combatBenefit && !$session.view?.influenceContext}<p
class="decision-description"
>
<ResourceText text={noResourceCost ? 'Free' : field.name} />
</p>{/if}
{#if $session.view?.influenceContext}
{#if cardOffer}
<div class="great-person-actions">
{#each directPayments as choice}
{@const paid = Object.values(choice.payment).some(Boolean)}
<button class:primary={paid} class:secondary={!paid}
disabled={!choice.action || $session.pending}
onclick={() => choice.action && controller.submit(choice.action)}>
{#if paid}<Layers size={16} />Take card <ResourceAmount pile={choice.payment} />{:else}Pass{/if}
</button>
{/each}
</div>
{:else if $session.view?.influenceContext}
{@const context = $session.view.influenceContext}
<div class="influence-decisions">
{#each directPayments as choice}

View file

@ -1,4 +1,5 @@
<script lang="ts">
import { handCardDescription } from './card-text';
import { Sparkles } from 'lucide-svelte';
import { printedCardName } from './card-names';
import ResourceText from './ResourceText.svelte';
@ -7,7 +8,12 @@
</script>
<article class="event-explanation" aria-label={`${printedCardName(notice.name)} event`}>
<h3><Sparkles size={18} />{printedCardName(notice.name)}</h3>
{#each notice.rules as rule}<p><ResourceText text={rule} /></p>{/each}
{#each notice.rules as rule}
<p><ResourceText text={handCardDescription(rule)} /></p>
{#if handCardDescription(rule) !== rule}
<details><summary>Acquiring the card</summary><p><ResourceText text={rule.slice(0, rule.length - handCardDescription(rule).length).replace(/Action card: $/, '').replace(/: $/, '.')} /></p></details>
{/if}
{/each}
</article>
<style>
.event-explanation { display:block; width:100%; min-width:0; }

View file

@ -6,12 +6,17 @@ import { handCardDescription } from './card-text.ts';
test('held Elder Statesman shows its playable effect and ordinary cards retain all wording', async () => {
const engine = createRequire(import.meta.url)('../.engine/server.js');
const game = JSON.parse(await engine.init(2, [], {}, 'great-people-hand', {}));
game.players[0].action_cards = [123, 29];
game.players[0].action_cards = [123, 157, 29];
const cards = JSON.parse(engine.webView(JSON.stringify(game), 0)).actionCards;
const elder = cards.find((card: { name: string }) => card.name === 'Elder Statesman');
assert.ok(elder);
const diplomat = cards.find((card: { name: string }) => card.name === 'Great Diplomat');
assert.ok(diplomat);
assert.equal(handCardDescription(diplomat.description),
'Choose another player. You cannot attack each other, unless you pay 2 culture tokens. Discard this card if either player attacks the other. You may discard the card as a regular action.');
for (const card of cards) {
const [prefix, effect] = card.description.split('Action card: ');
if (card === diplomat) continue;
if (!effect) {
assert.equal(handCardDescription(card.description), card.description);
continue;

View file

@ -3,7 +3,9 @@ const greatPersonAcquisition =
'You may take the Event Card to your hand for 1 culture token. If you pass, any other player (in player order) may take it for 2 culture tokens: Action card: ';
export function handCardDescription(description: string) {
return description.startsWith(greatPersonAcquisition)
? description.slice(greatPersonAcquisition.length).trim()
: description;
const prefixes = [greatPersonAcquisition,
'You make place the Event Card in front of you 1 culture token. If you pass, any other player (in player order) may do so for 2 culture tokens: ',
];
const prefix = prefixes.find((value) => description.startsWith(value));
return prefix ? description.slice(prefix.length).trim() : description;
}

View file

@ -1284,3 +1284,10 @@
max-height: min(440px, 65%);
overflow: hidden;
}
.great-person-effect { margin: 16px 0; line-height: 1.6; }
.great-person-effect .event-card-use { font-size: 12px; color: var(--muted); }
.great-person-effect .event-card-use > span { display: inline-flex; align-items: center; gap: 3px; }
.great-person-actions { display: flex; gap: 8px; }
.great-person-actions .primary { flex: 1; justify-content: flex-start; }
.great-person-actions .resource-amount { margin-left: auto; }