Polish research alternatives and private wonder requirement hints
This commit is contained in:
parent
09ce6fc578
commit
9315a73ec9
27 changed files with 166 additions and 38 deletions
|
|
@ -908,3 +908,15 @@ Regression coverage includes real Arts and unit conversions, Darius's exact
|
|||
position, moved/missing leaders, uncapped rewards, Ashoka plus Conversion and
|
||||
used rerolls, manual selections, map/list reselection, and English/French desktop
|
||||
and mobile browser flows. Publish the matching viewer and engine together.
|
||||
|
||||
# Viewer 0.1.199 / engine unchanged (0.4.133)
|
||||
|
||||
Research highlights missing advances required by wonders in the viewing player's
|
||||
private hand, without exposing opponents' cards or highlighting requirements
|
||||
already satisfied. The compact two-line hint reads “Required for [wonder name]”
|
||||
and “Wonder in your hand”, translated in every supported locale.
|
||||
Alternative research cards and abilities use a compact inline
|
||||
layout with numeric action costs and action icons. Research payment allocation
|
||||
omits redundant explanatory text and totals while retaining explicit confirmation;
|
||||
other payment pickers are unchanged. Regression coverage includes private-hand
|
||||
filtering and English/French desktop/mobile research flows.
|
||||
|
|
|
|||
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.198",
|
||||
"version": "0.1.199",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.198",
|
||||
"version": "0.1.199",
|
||||
"dependencies": {
|
||||
"@boardgamers/protocol": "0.9.0",
|
||||
"lucide-svelte": "^0.577.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.198",
|
||||
"version": "0.1.199",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -59,12 +59,35 @@ try {
|
|||
const alternatives = detail.locator('.research-alternatives');
|
||||
const primary = detail.locator('.research-payment > .primary');
|
||||
|
||||
// Merely opening/selecting an advance never spends either resources or a card.
|
||||
// A wonder in the private hand highlights its missing required advance, without exposing an opponent's hand.
|
||||
let game = await fixture();
|
||||
game.players[0].wonder_cards = ['GreatLibrary'];
|
||||
assert.equal(v(game).wonderCards[0].requiredAdvance, 'Philosophy');
|
||||
await mount(game); await open('Philosophy');
|
||||
const wonderHint = page.locator('#research-Philosophy .research-wonder-hint');
|
||||
await wonderHint.waitFor();
|
||||
const hintText = await wonderHint.innerText();
|
||||
assert.equal(await wonderHint.locator('strong').innerText(), t('Required for {p0}').replace('{p0}', t('Great Library')));
|
||||
assert.equal(await wonderHint.locator('small').innerText(), t('Wonder in your hand'));
|
||||
assert(!hintText.includes(t('Requires')), hintText);
|
||||
assert.equal(await page.locator('.research-wonder-hint').count(), 1);
|
||||
assert.deepEqual(await sent(), []);
|
||||
await page.locator('#research-Philosophy').screenshot({ path: `/tmp/clash-wonder-research-${locale}-${width}.png` });
|
||||
game.players[0].wonder_cards = [];
|
||||
game.players[1].wonder_cards = ['GreatLibrary'];
|
||||
await mount(game); await open('Philosophy');
|
||||
assert.equal(await page.locator('.research-wonder-hint').count(), 0, 'opponent hand is private');
|
||||
game.players[0].wonder_cards = ['GreatLibrary'];
|
||||
game.players[0].advances.push('Philosophy');
|
||||
await mount(game); await open('Philosophy');
|
||||
assert.equal(await page.locator('.research-wonder-hint').count(), 0, 'already researched');
|
||||
|
||||
// Merely opening/selecting an advance never spends either resources or a card.
|
||||
game = await fixture();
|
||||
await mount(game); await open('Medicine');
|
||||
const provinceLink = page.locator('.research-civilization-link').filter({ hasText: t('Provinces') }).first();
|
||||
assert.equal(await provinceLink.getByText(t('Unlocks'), { exact: true }).count(), 1);
|
||||
await alternatives.getByText(t('Alternative research available'), { exact: true }).waitFor();
|
||||
await alternatives.waitFor();
|
||||
assert((await alternatives.innerText()).includes(t('No research resource cost')));
|
||||
assert.deepEqual(await sent(), []);
|
||||
assert(await primary.isEnabled(), 'normal paid research remains an explicit separate option');
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
reward = false,
|
||||
variableAmount = false,
|
||||
label = 'Payment',
|
||||
minimal = false,
|
||||
}: {
|
||||
options: { payment: Pile; disabled?: boolean }[];
|
||||
value: Pile;
|
||||
|
|
@ -24,6 +25,7 @@
|
|||
reward?: boolean;
|
||||
variableAmount?: boolean;
|
||||
label?: string;
|
||||
minimal?: boolean;
|
||||
} = $props();
|
||||
const icons = {
|
||||
food: Wheat,
|
||||
|
|
@ -117,7 +119,7 @@
|
|||
{/if}
|
||||
{#if !onPay && samePayment(option.payment, value)}<Check size={14} />{/if}
|
||||
</button>
|
||||
{:else}<p class="inline-error">No affordable payment available.</p>{/each}
|
||||
{:else}{#if !minimal}<p class="inline-error">No affordable payment available.</p>{/if}{/each}
|
||||
</div>
|
||||
{:else}
|
||||
<div class="payment-builder" role="group" aria-label={label}>
|
||||
|
|
@ -143,12 +145,12 @@
|
|||
</label>
|
||||
{/each}
|
||||
</div>
|
||||
<small class="payment-builder-hint"
|
||||
{#if !minimal}<small class="payment-builder-hint"
|
||||
>Choose an amount; other resources adjust automatically.</small
|
||||
>
|
||||
<div class="payment-builder-total">
|
||||
<span>{reward ? 'You gain' : 'You pay'}</span><ResourceAmount pile={allocation} />
|
||||
</div>
|
||||
</div>{/if}
|
||||
<div class="payment-builder-actions">
|
||||
{#if emptyOption}<button
|
||||
class="secondary"
|
||||
|
|
@ -174,6 +176,6 @@
|
|||
onclick={() => selected && onPay?.(selected.payment)}>{emptyLabel}</button
|
||||
>{:else}<span>{optional ? 'Declined' : 'Free'}</span>{/if}
|
||||
</div>
|
||||
{:else}<p class="inline-error">No affordable payment available.</p>{/if}
|
||||
{:else if !minimal}<p class="inline-error">No affordable payment available.</p>{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
Map,
|
||||
Layers,
|
||||
Info,
|
||||
Landmark,
|
||||
Zap,
|
||||
} from 'lucide-svelte';
|
||||
import type { Controller } from './controller';
|
||||
import CardReferenceDialog from './CardReferenceDialog.svelte';
|
||||
|
|
@ -42,9 +44,10 @@
|
|||
type View,
|
||||
} from './types';
|
||||
import { buildingInfo } from './city';
|
||||
import { manGodAbility, researchOwners, researchFreeHints, aqueductResearch, researchCardHints, researchAbilityHints, type ResearchReference } from './research-links';
|
||||
import { manGodAbility, researchOwners, researchFreeHints, aqueductResearch, researchCardHints, researchAbilityHints, wonderResearchHints, type ResearchReference } from './research-links';
|
||||
import { actionReason, pileText } from './model';
|
||||
import { groupIcons, researchPresentation } from './research';
|
||||
import { wonderIcons } from './wonder-icons';
|
||||
import { researchDecision } from './decision-controls';
|
||||
let {
|
||||
controller,
|
||||
|
|
@ -427,6 +430,12 @@
|
|||
+<ResourceAmount pile={bonus.pile} compact /> · {bonus.source}
|
||||
</span>{/each}
|
||||
</div>
|
||||
{#each wonderResearchHints(view, advance) as card (card.id)}{@const WonderIcon = wonderIcons[card.id] ?? Landmark}
|
||||
<div class="research-wonder-hint">
|
||||
<WonderIcon size={16} aria-hidden="true" />
|
||||
<span class="research-wonder-hint-text"><strong>{`Required for ${printedCardName(card.name)}`}</strong><small>Wonder in your hand</small></span>
|
||||
</div>
|
||||
{/each}
|
||||
{#if !advance.owned && (!choice || advance.action) && (!early || warnsEvent)}<div class="research-node-cost">
|
||||
{#if !early}<span
|
||||
class="research-flexible-cost"
|
||||
|
|
@ -565,8 +574,7 @@
|
|||
{#if unavailableReason(selected) && !selected.owned}<small>{unavailableReason(selected)}</small>{/if}
|
||||
{#if cardHints(selected).length || abilityHints(selected).length}
|
||||
<section class="research-alternatives" aria-label="Alternative research available">
|
||||
<strong>Alternative research available</strong>
|
||||
<p>Use a card or ability below instead of normal research. Its own costs and effects still apply.</p>
|
||||
|
||||
{#each cardHints(selected) as card}
|
||||
<div class="research-source-row">
|
||||
<button class="secondary research-source" disabled={$session.pending}
|
||||
|
|
@ -575,7 +583,7 @@
|
|||
<span class="research-source-cost">
|
||||
{card.freeResearch ? 'No research resource cost' : 'Pay research cost next'}
|
||||
{#if Object.values(card.cost).some(Boolean)}<ResourceAmount pile={card.cost} compact />{/if}
|
||||
· {card.free ? 'Free action' : '1 action'}
|
||||
· <span class="research-action-cost" title={card.free ? 'Free action' : 'Costs 1 action'} aria-label={card.free ? 'Free action' : 'Costs 1 action'}>{card.free ? 0 : 1}<Zap size={13} aria-hidden="true" /></span>
|
||||
</span>
|
||||
</button>
|
||||
<button class="icon-button" aria-label={`Details of ${printedCardName(card.name)}`}
|
||||
|
|
@ -589,7 +597,7 @@
|
|||
<span class="research-source-cost">
|
||||
{ability.freeResearch ? 'No research resource cost' : 'Pay research cost next'}
|
||||
{#if ability.cost && Object.values(ability.cost).some(Boolean)}<ResourceAmount pile={ability.cost} compact />{/if}
|
||||
· {ability.free ? 'Free action' : '1 action'}
|
||||
· <span class="research-action-cost" title={ability.free ? 'Free action' : 'Costs 1 action'} aria-label={ability.free ? 'Free action' : 'Costs 1 action'}>{ability.free ? 0 : 1}<Zap size={13} aria-hidden="true" /></span>
|
||||
</span>
|
||||
</button>
|
||||
{/each}
|
||||
|
|
@ -613,6 +621,7 @@
|
|||
}}
|
||||
pending={$session.pending}
|
||||
label="Research payment"
|
||||
minimal
|
||||
/>
|
||||
{/if}
|
||||
{#if selectedAqueduct}
|
||||
|
|
@ -668,7 +677,7 @@
|
|||
: selectedPayment.payment}
|
||||
compact
|
||||
/> ·
|
||||
{/if}1 action{/if}</span
|
||||
{/if}<span class="research-action-cost" title="Costs 1 action" aria-label="Costs 1 action">1<Zap size={13} aria-hidden="true" /></span>{/if}</span
|
||||
>{/if}
|
||||
</button>
|
||||
</div>{/if}
|
||||
|
|
@ -694,12 +703,10 @@
|
|||
.research-card-hint .research-advance-link { display: flex; align-items: center; gap: .35rem; text-align: left; font-size: .8rem; }
|
||||
.research-card-hint .icon-button { flex-shrink: 0; }
|
||||
.research-card-hint small { display: block; color: var(--muted); font-size: .7rem; }
|
||||
.research-alternatives { margin-top: .7rem; padding: .65rem; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 5px; background: var(--paper); }
|
||||
.research-alternatives > strong { font-size: .85rem; }
|
||||
.research-alternatives > p { margin: .25rem 0 .5rem; }
|
||||
.research-alternatives { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .6rem; }
|
||||
.research-source-row { display: flex; align-items: center; gap: .35rem; }
|
||||
.research-source-row .icon-button { flex-shrink: 0; }
|
||||
.research-source { display: flex; flex: 1; flex-direction: column; align-items: flex-start; gap: .3rem; margin-top: .3rem; min-width: 0; width: 100%; text-align: left; white-space: normal; }
|
||||
.research-source { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; padding: .45rem .6rem; min-width: 0; max-width: 100%; text-align: left; white-space: normal; }
|
||||
.research-source > span { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem; }
|
||||
.research-source .research-source-cost { font-size: .72rem; font-weight: normal; }
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -261,3 +261,15 @@ test('ambiguous adjacent parameters are not guessed, and nested caches do not po
|
|||
assert.equal(t.translate('Forest · city size 3, Fortress · 2 army (1 aboard)'), 'Forêt · ville de taille 3, Forteresse · 2 armée (1 à bord)');
|
||||
assert.equal(t.translate('city size 3, Fortress'), 'ville de taille 3, Forteresse');
|
||||
});
|
||||
|
||||
test('wonder research hints translate the complete required-for caption and private-hand subtitle', async () => {
|
||||
const { readFile } = await import('node:fs/promises');
|
||||
for (const locale of ['en', 'fr', 'de', 'da', 'el', 'fa', 'hi', 'it', 'ko', 'nl', 'pl', 'pt-BR', 'ro', 'ru', 'vi', 'zh-CN', 'zh-TW']) {
|
||||
const catalog = JSON.parse(await readFile(new URL(`./localization/${locale}.json`, import.meta.url), 'utf8'));
|
||||
const translator = createTranslator({ [locale]: catalog }, locale);
|
||||
for (const name of ['Great Library', 'Great Gardens']) {
|
||||
assert.equal(translator.translate(`Required for ${name}`), catalog['Required for {p0}'].replace('{p0}', catalog[name] ?? name), locale);
|
||||
}
|
||||
assert.equal(translator.translate('Wonder in your hand'), catalog['Wonder in your hand'], locale);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -5244,5 +5244,7 @@
|
|||
"Calendar is waiting for a response": "Kalender afventer et svar",
|
||||
"Alternative research available": "En anden forskningsmulighed er tilgængelig",
|
||||
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Brug et kort eller en evne nedenfor i stedet for normal forskning. Dets egne omkostninger og effekter gælder stadig.",
|
||||
"No research resource cost": "Ingen ressourceomkostning for forskning"
|
||||
"No research resource cost": "Ingen ressourceomkostning for forskning",
|
||||
"Required for {p0}": "Påkrævet til {p0}",
|
||||
"Wonder in your hand": "Vidunder på din hånd"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5244,5 +5244,7 @@
|
|||
"Calendar is waiting for a response": "Kalender wartet auf eine Antwort",
|
||||
"Alternative research available": "Andere Forschungsmöglichkeit verfügbar",
|
||||
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Nutze eine der folgenden Karten oder Fähigkeiten statt der normalen Forschung. Ihre eigenen Kosten und Effekte gelten weiterhin.",
|
||||
"No research resource cost": "Keine Ressourcenkosten für die Forschung"
|
||||
"No research resource cost": "Keine Ressourcenkosten für die Forschung",
|
||||
"Required for {p0}": "Erforderlich für {p0}",
|
||||
"Wonder in your hand": "Wunder auf deiner Hand"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5244,5 +5244,7 @@
|
|||
"Calendar is waiting for a response": "Το Ημερολόγιο περιμένει απάντηση",
|
||||
"Alternative research available": "Διαθέσιμος εναλλακτικός τρόπος έρευνας",
|
||||
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Χρησιμοποιήστε μία από τις παρακάτω κάρτες ή ικανότητες αντί για κανονική έρευνα. Το κόστος και οι επιδράσεις της εξακολουθούν να ισχύουν.",
|
||||
"No research resource cost": "Έρευνα χωρίς κόστος πόρων"
|
||||
"No research resource cost": "Έρευνα χωρίς κόστος πόρων",
|
||||
"Required for {p0}": "Απαιτείται για {p0}",
|
||||
"Wonder in your hand": "Θαύμα στο χέρι σας"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5244,5 +5244,7 @@
|
|||
"Calendar is waiting for a response": "Calendar is waiting for a response",
|
||||
"Alternative research available": "Alternative research available",
|
||||
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Use a card or ability below instead of normal research. Its own costs and effects still apply.",
|
||||
"No research resource cost": "No research resource cost"
|
||||
"No research resource cost": "No research resource cost",
|
||||
"Required for {p0}": "Required for {p0}",
|
||||
"Wonder in your hand": "Wonder in your hand"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5244,5 +5244,7 @@
|
|||
"Calendar is waiting for a response": "تقویم منتظر پاسخ است",
|
||||
"Alternative research available": "روش دیگری برای پژوهش در دسترس است",
|
||||
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "بهجای پژوهش معمول، از یکی از کارتها یا تواناییهای زیر استفاده کنید. هزینهها و اثرهای خود آن همچنان اعمال میشوند.",
|
||||
"No research resource cost": "پژوهش بدون هزینهٔ منابع"
|
||||
"No research resource cost": "پژوهش بدون هزینهٔ منابع",
|
||||
"Required for {p0}": "لازم برای {p0}",
|
||||
"Wonder in your hand": "عجایب در دست شما"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5244,5 +5244,7 @@
|
|||
"Calendar is waiting for a response": "Calendrier attend une réponse",
|
||||
"Alternative research available": "Autre moyen d'obtenir ce progrès",
|
||||
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Vous pouvez utiliser une carte ou une capacité ci-dessous au lieu de la recherche normale. Ses coûts et ses effets s'appliquent.",
|
||||
"No research resource cost": "Recherche sans coût en ressources"
|
||||
"No research resource cost": "Recherche sans coût en ressources",
|
||||
"Required for {p0}": "Nécessaire pour {p0}",
|
||||
"Wonder in your hand": "Merveille dans votre main"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5244,5 +5244,7 @@
|
|||
"Calendar is waiting for a response": "कैलेंडर उत्तर की प्रतीक्षा कर रहा है",
|
||||
"Alternative research available": "शोध का वैकल्पिक तरीका उपलब्ध है",
|
||||
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "सामान्य शोध के बजाय नीचे दिया गया कार्ड या क्षमता इस्तेमाल करें। उसके अपने खर्च और प्रभाव फिर भी लागू होंगे।",
|
||||
"No research resource cost": "शोध के लिए संसाधन खर्च नहीं"
|
||||
"No research resource cost": "शोध के लिए संसाधन खर्च नहीं",
|
||||
"Required for {p0}": "{p0} के लिए आवश्यक",
|
||||
"Wonder in your hand": "आपके हाथ में अजूबा"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5244,5 +5244,7 @@
|
|||
"Calendar is waiting for a response": "Il Calendario attende una risposta",
|
||||
"Alternative research available": "È disponibile un altro modo di ricercare",
|
||||
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Usa una carta o un'abilità qui sotto invece della ricerca normale. I suoi costi ed effetti si applicano comunque.",
|
||||
"No research resource cost": "Ricerca senza costo in risorse"
|
||||
"No research resource cost": "Ricerca senza costo in risorse",
|
||||
"Required for {p0}": "Richiesto per {p0}",
|
||||
"Wonder in your hand": "Meraviglia nella tua mano"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5244,5 +5244,7 @@
|
|||
"Calendar is waiting for a response": "달력이 응답을 기다리고 있습니다",
|
||||
"Alternative research available": "다른 연구 방법 사용 가능",
|
||||
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "일반 연구 대신 아래 카드나 능력을 사용하세요. 해당 카드나 능력의 비용과 효과는 그대로 적용됩니다.",
|
||||
"No research resource cost": "연구 자원 비용 없음"
|
||||
"No research resource cost": "연구 자원 비용 없음",
|
||||
"Required for {p0}": "{p0}에 필요",
|
||||
"Wonder in your hand": "손에 있는 불가사의"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5244,5 +5244,7 @@
|
|||
"Calendar is waiting for a response": "Kalender wacht op een antwoord",
|
||||
"Alternative research available": "Andere onderzoeksmogelijkheid beschikbaar",
|
||||
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Gebruik een kaart of vaardigheid hieronder in plaats van normaal onderzoek. De eigen kosten en effecten blijven gelden.",
|
||||
"No research resource cost": "Geen grondstofkosten voor onderzoek"
|
||||
"No research resource cost": "Geen grondstofkosten voor onderzoek",
|
||||
"Required for {p0}": "Vereist voor {p0}",
|
||||
"Wonder in your hand": "Wereldwonder in je hand"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5244,5 +5244,7 @@
|
|||
"Calendar is waiting for a response": "Kalendarz czeka na odpowiedź",
|
||||
"Alternative research available": "Dostępny inny sposób badań",
|
||||
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Użyj poniższej karty lub zdolności zamiast zwykłych badań. Jej własne koszty i efekty nadal obowiązują.",
|
||||
"No research resource cost": "Badania bez kosztu w zasobach"
|
||||
"No research resource cost": "Badania bez kosztu w zasobach",
|
||||
"Required for {p0}": "Wymagane dla {p0}",
|
||||
"Wonder in your hand": "Cud na twojej ręce"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5244,5 +5244,7 @@
|
|||
"Calendar is waiting for a response": "O Calendário está aguardando uma resposta",
|
||||
"Alternative research available": "Alternativa de pesquisa disponível",
|
||||
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Use uma carta ou habilidade abaixo em vez da pesquisa normal. Seus próprios custos e efeitos continuam se aplicando.",
|
||||
"No research resource cost": "Pesquisa sem custo em recursos"
|
||||
"No research resource cost": "Pesquisa sem custo em recursos",
|
||||
"Required for {p0}": "Necessário para {p0}",
|
||||
"Wonder in your hand": "Maravilha na sua mão"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5244,5 +5244,7 @@
|
|||
"Calendar is waiting for a response": "Calendar așteaptă un răspuns",
|
||||
"Alternative research available": "Alternativă de cercetare disponibilă",
|
||||
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Folosește o carte sau o abilitate de mai jos în locul cercetării normale. Costurile și efectele proprii se aplică în continuare.",
|
||||
"No research resource cost": "Cercetare fără cost în resurse"
|
||||
"No research resource cost": "Cercetare fără cost în resurse",
|
||||
"Required for {p0}": "Necesar pentru {p0}",
|
||||
"Wonder in your hand": "Minune în mâna ta"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5244,5 +5244,7 @@
|
|||
"Calendar is waiting for a response": "Календарь ожидает ответа",
|
||||
"Alternative research available": "Доступен другой способ исследования",
|
||||
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Используйте указанную ниже карту или способность вместо обычного исследования. Её собственные затраты и эффекты по-прежнему применяются.",
|
||||
"No research resource cost": "Исследование без затрат ресурсов"
|
||||
"No research resource cost": "Исследование без затрат ресурсов",
|
||||
"Required for {p0}": "Требуется для {p0}",
|
||||
"Wonder in your hand": "Чудо у вас на руке"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5244,5 +5244,7 @@
|
|||
"Calendar is waiting for a response": "Lịch đang chờ phản hồi",
|
||||
"Alternative research available": "Có cách nghiên cứu khác",
|
||||
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "Dùng một lá bài hoặc khả năng bên dưới thay cho nghiên cứu thông thường. Chi phí và hiệu ứng riêng của nó vẫn áp dụng.",
|
||||
"No research resource cost": "Nghiên cứu không tốn tài nguyên"
|
||||
"No research resource cost": "Nghiên cứu không tốn tài nguyên",
|
||||
"Required for {p0}": "Cần cho {p0}",
|
||||
"Wonder in your hand": "Kỳ quan trên tay bạn"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5244,5 +5244,7 @@
|
|||
"Calendar is waiting for a response": "历法正在等待回应",
|
||||
"Alternative research available": "有其他研究方式可用",
|
||||
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "可以使用下方的卡牌或能力代替普通研究。该卡牌或能力自身的费用与效果仍然适用。",
|
||||
"No research resource cost": "研究无需支付资源"
|
||||
"No research resource cost": "研究无需支付资源",
|
||||
"Required for {p0}": "{p0}所需",
|
||||
"Wonder in your hand": "你手中的奇迹"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5244,5 +5244,7 @@
|
|||
"Calendar is waiting for a response": "曆法正在等待回應",
|
||||
"Alternative research available": "有其他研究方式可用",
|
||||
"Use a card or ability below instead of normal research. Its own costs and effects still apply.": "可以使用下方的卡牌或能力代替一般研究。該卡牌或能力本身的費用與效果仍然適用。",
|
||||
"No research resource cost": "研究無需支付資源"
|
||||
"No research resource cost": "研究無需支付資源",
|
||||
"Required for {p0}": "{p0}所需",
|
||||
"Wonder in your hand": "你手中的奇蹟"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { manGodAbility, researchReferences, researchTextParts, researchOwners } from './research-links.ts';
|
||||
import type { View } from './types.ts';
|
||||
import { manGodAbility, researchReferences, researchTextParts, researchOwners, wonderResearchHints } from './research-links.ts';
|
||||
import type { AdvanceView, View } from './types.ts';
|
||||
|
||||
const advances = ['Irrigation', 'Education', 'Public Education', 'Mining'].map((name) => ({
|
||||
id: name.replaceAll(' ', ''),
|
||||
|
|
@ -78,6 +78,19 @@ test('research ownership badges use public permanent advances and exclude the vi
|
|||
assert.deepEqual(researchOwners(view, 'Mining', 0), []);
|
||||
});
|
||||
|
||||
test('research highlights only missing advances needed by wonder cards in the viewing hand', () => {
|
||||
const library = { id: 'GreatLibrary', name: 'Great Library', requiredAdvance: 'Philosophy', requiredAdvanceOwned: false };
|
||||
const garden = { id: 'GreatGardens', name: 'Great Gardens', requiredAdvance: 'Irrigation', requiredAdvanceOwned: false };
|
||||
const view = { wonderCards: [library, garden] } as View;
|
||||
const philosophy = { id: 'Philosophy', name: 'Philosophy', owned: false } as AdvanceView;
|
||||
assert.deepEqual(wonderResearchHints(view, philosophy), [library]);
|
||||
assert.deepEqual(wonderResearchHints(view, { ...philosophy, name: 'Education' }), []);
|
||||
assert.deepEqual(wonderResearchHints(view, { ...philosophy, owned: true }), []);
|
||||
assert.deepEqual(wonderResearchHints({ wonderCards: [{ ...library, requiredAdvanceOwned: true }] } as View, philosophy), []);
|
||||
assert.deepEqual(wonderResearchHints({ wonderCards: [] } as unknown as View, philosophy), []);
|
||||
assert.deepEqual(wonderResearchHints(null, philosophy), []);
|
||||
});
|
||||
|
||||
test('Man God indicator distinguishes granted abilities from research and Great Library loans', () => {
|
||||
const advance = { id: 'Nationalism', owned: false };
|
||||
const abilities = [{ ...advances[0], id: 'Nationalism', borrowed: true, borrowedSource: 'Man God', description: '', group: 'Autocracy', order: 0 }];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,13 @@
|
|||
import type { AdvanceView, PublicAdvance, View } from './types.ts';
|
||||
|
||||
/** Only the viewing seat's private hand is exposed as wonderCards. A borrowed advance may already satisfy a card's requirement. */
|
||||
export function wonderResearchHints(view: View | null | undefined, advance: AdvanceView) {
|
||||
if (advance.owned) return [];
|
||||
return (view?.wonderCards ?? []).filter(
|
||||
(card) => !card.requiredAdvanceOwned && card.requiredAdvance === advance.name,
|
||||
);
|
||||
}
|
||||
|
||||
/** Ability access is not ownership and must never affect research eligibility. */
|
||||
export function manGodAbility(advance: Pick<AdvanceView, 'id' | 'owned'>, abilities: PublicAdvance[] = []): boolean {
|
||||
return !advance.owned && abilities.some(
|
||||
|
|
|
|||
|
|
@ -300,6 +300,23 @@
|
|||
.research-node-cost svg {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.research-wonder-hint {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
margin: 0 12px 9px;
|
||||
padding: 6px 8px;
|
||||
border-radius: 5px;
|
||||
background: color-mix(in srgb, var(--gold) 12%, transparent);
|
||||
color: var(--ink);
|
||||
font-size: 11px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.research-wonder-hint svg { flex-shrink: 0; color: var(--gold); }
|
||||
.research-wonder-hint-text { display: flex; flex-direction: column; gap: 1px; }
|
||||
.research-wonder-hint strong { font-weight: 700; }
|
||||
.research-wonder-hint small { color: var(--muted); font-size: 10px; }
|
||||
.research-action-cost { display: inline-flex; align-items: center; gap: 3px; }
|
||||
.research-node-cost {
|
||||
border-top: 1px solid var(--line);
|
||||
padding-top: 8px;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue