From 5fdd60e3014e80015b4e8788afeb4e1a0c3e63f6 Mon Sep 17 00:00:00 2001 From: coyotte508 Date: Sat, 3 Oct 2026 22:59:07 +0200 Subject: [PATCH] Clarify government exclusivity and Draft research rules --- web-client/src/ResearchTree.svelte | 60 ++++++++++++++++++++++++------ web-client/src/research.css | 39 +++++++++++++++++++ web-client/src/research.ts | 5 ++- 3 files changed, 92 insertions(+), 12 deletions(-) diff --git a/web-client/src/ResearchTree.svelte b/web-client/src/ResearchTree.svelte index 37c42e84..028f4f15 100644 --- a/web-client/src/ResearchTree.svelte +++ b/web-client/src/ResearchTree.svelte @@ -66,6 +66,23 @@ captives: Link, }; let advances = $derived([...($session.view?.advances ?? [])].sort((a, b) => a.order - b.order)); + const governmentGroups = ['Democracy', 'Autocracy', 'Theocracy']; + const currentGovernment = $derived( + advances.find((a) => a.owned && governmentGroups.includes(a.group))?.group, + ); + function governmentLocked(group: string) { + return ( + !!currentGovernment && + governmentGroups.includes(group) && + group !== currentGovernment && + !advances.some((a) => a.group === group && a.action) + ); + } + function unavailableReason(advance: AdvanceView) { + return !advance.owned && governmentLocked(advance.group) + ? `Your government is ${currentGovernment}. Switch to ${advance.group} at the end of an age for 1 mood token + 1 culture token. You must meet its prerequisite; your government advances are replaced with the same number from the new government.` + : actionReason(advance.reason); + } const availableAdvances = $derived( advances.filter((a) => (researchedOnly ? a.owned : !$session.availableOnly || !!a.action)), ); @@ -100,7 +117,8 @@ groups.filter( (group) => (category === 'All' || group === category) && - availableAdvances.some((a) => a.group === group && matches(a)), + (availableAdvances.some((a) => a.group === group && matches(a)) || + (category === group && governmentLocked(group) && !researchedOnly)), ), ); const selectedAction = $derived(choice ? selected?.action : selectedPayment?.action); @@ -215,8 +233,27 @@ /> {/if} {#each visibleGroups as group}{@const GroupIcon = groupIcons[group] ?? BookOpen} -
-

{group}

+ {@const lockedGovernment = governmentLocked(group)} +
+

+ {group} + {#if group === currentGovernment}Current government + {:else if lockedGovernment}{/if} +

+ {#if governmentGroups.includes(group)}

+ {#if lockedGovernment} + Only one government at a time. + Switch at end of age · + {:else if !currentGovernment}Only one government at a time. You can switch at the end of an age.{/if} +

{/if} + {#if lockedGovernment && statusFilter === 'available'}{/if} {#each availableAdvances.filter((a) => a.group === group) as advance, index}{@const presentation = researchPresentation(advance)}{@const Icon = presentation.icon}{@const parent = advances.find( (a) => a.id === advance.required, @@ -242,11 +279,13 @@ >{#if advance.owned}{:else if !advance.action && (actionReason(advance.reason) || (parent && !parent.owned))}{:else if !advance.action && (lockedGovernment || actionReason(advance.reason) || (parent && !parent.owned))}{/if} @@ -295,7 +334,7 @@ title={`View ${parent.name}`} onclick={() => showAdvance(parent.id)}>Needs {parent.name} - {:else}{actionReason(advance.reason)}{/if}{/if} {#each advances.filter((a) => a.required === advance.id && a.group !== advance.group) as unlocked} @@ -352,8 +391,7 @@ ? 'Ships sail through connected sea tiles. Navigation adds a clockwise or counterclockwise shortcut around the edge to the next sea area. Unexplored regions must be explored before sailing farther.' : selected.description}

- {#if actionReason(selected.reason) && !selected.owned}{actionReason(selected.reason)}{/if} + {#if unavailableReason(selected) && !selected.owned}{unavailableReason(selected)}{/if} {#if $session.error}{/if}
@@ -373,7 +411,7 @@ {/if}