feat: clicking a building enters it: a close-up with its workers at work, what it does now and one level up, and its actions
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8da574292d
commit
01809247a2
|
|
@ -8,9 +8,9 @@ This is the Nuxt client for a browser strategy game in the style of Tribal Wars.
|
||||||
- **`ssr: false` for every target**, so one static build serves both the web and Steam. Code must not rely on Nuxt server routes or SSR-only APIs.
|
- **`ssr: false` for every target**, so one static build serves both the web and Steam. Code must not rely on Nuxt server routes or SSR-only APIs.
|
||||||
- **Transport** is WS-first through the `ws` singleton from `@blax-software/networking`, the same as learn-atc. HTTP is only for login and register, which return the bearer token. Load the `blax-websockets` skill before you write `ws.send` or `ws.listen` code.
|
- **Transport** is WS-first through the `ws` singleton from `@blax-software/networking`, the same as learn-atc. HTTP is only for login and register, which return the bearer token. Load the `blax-websockets` skill before you write `ws.send` or `ws.listen` code.
|
||||||
- **Dense and plain, like the old browser strategy games** (the reference is Die Stämme; notes and screenshots in the sibling repo `game-village-politics-research` (`../game-village-politics-research/die-staemme/`), kept out of this repo). A 16 px root (17 px from 1800 px wide; rem sizes only, `text-sm` for body text, no fixed `text-[13px]`), square frames with thin lines, tan header bands, tight table rows (`.grid-table`), small squared buttons (`.btn-primary` dark wood, `.btn-attack` red for attacks only), thin notice bars. Actions are buttons, not text links: `.btn` for screen links and commands, `.btn-fill` for the "(20)" that fills an amount field; names inside lists and tables stay links. Bigger text must not add line wraps: keep rows `whitespace-nowrap` where they were one line. No rounded cards, pills, big padding or decorative icons: an icon only where it carries meaning. Theme and component classes live in `app/assets/css/main.css`; hand-written inline SVG graphics in `app/components/icon/`, colours in `app/utils/palette.ts`. No paid, hosted or licensed assets: no icon packs, web fonts or images from outside the repo, and nothing copied from Die Stämme.
|
- **Dense and plain, like the old browser strategy games** (the reference is Die Stämme; notes and screenshots in the sibling repo `game-village-politics-research` (`../game-village-politics-research/die-staemme/`), kept out of this repo). A 16 px root (17 px from 1800 px wide; rem sizes only, `text-sm` for body text, no fixed `text-[13px]`), square frames with thin lines, tan header bands, tight table rows (`.grid-table`), small squared buttons (`.btn-primary` dark wood, `.btn-attack` red for attacks only), thin notice bars. Actions are buttons, not text links: `.btn` for screen links and commands, `.btn-fill` for the "(20)" that fills an amount field; names inside lists and tables stay links. Bigger text must not add line wraps: keep rows `whitespace-nowrap` where they were one line. No rounded cards, pills, big padding or decorative icons: an icon only where it carries meaning. Theme and component classes live in `app/assets/css/main.css`; hand-written inline SVG graphics in `app/components/icon/`, colours in `app/utils/palette.ts`. No paid, hosted or licensed assets: no icon packs, web fonts or images from outside the repo, and nothing copied from Die Stämme.
|
||||||
- **The village is a ground-level land view** (`app/components/village/Diorama.vue`, geometry in `app/diorama/`): isometric low-poly, drawn as inline SVG, no WebGL. The land fills the frame edge to edge (no island, no sky), cut to the container's shape; narrow screens scroll sideways. There are no tiles or positions: the server only sends each building's `space` and the village's `space.used/max`, and the client lays everything out deterministically in id order. The village core sits in the middle (headquarters on the plaza, storage, hiding places and rally point around it, inside the wall ring when there is one, a dirt edge without). Resource sites stand outside in their zones: iron mines at the rocky hill (upper left), clay pits on clay ground (lower left), timber camps at the forest edge (lower right), farms with fields (right); dirt roads lead from the gates to each zone and forest fills the rest. Levels start at 1. Each type has a model per level tier (1–4, 5–14, 15+); the wall goes stakes → timber → stone with towers. Buildings are focusable buttons that open their details card, clickable anywhere on their outline (`hit`, a convex hull round their polygons and ground ring), the thin wall also along a wide band on its ring, and their level badges and countdowns as well; a type that doesn't stand yet keeps an invisible empty plot that opens its build card. Buildings never move or light up on hover: only a click outlines the ground under them. Ambient life is welcome and stays out of the way: flat ground shadows, smoke from chimneys, forges and kilns, villagers walking the roads to the zones they work in; all motion stops under `prefers-reduced-motion`. The same models draw the building portraits on screen headers, the HQ list and the building cards (`VillageBuildingPortrait`). The world map groups forests, lakes and rocky hills by smooth noise of the coordinates, and village markers grow in five sizes with points. Map coordinates run around 0|0, negative included (−500 to 499 on a 1000-field map, lowest value from `map.view`'s `min`); continents are named from the top-left like Die Stämme, so 0|0 is the corner of K44, K45, K54 and K55. Use `app/utils/map.ts` for bounds and continents, never `0` or `500` literals.
|
- **The village is a ground-level land view** (`app/components/village/Diorama.vue`, geometry in `app/diorama/`): isometric low-poly, drawn as inline SVG, no WebGL. The land fills the frame edge to edge (no island, no sky), cut to the container's shape; narrow screens scroll sideways. There are no tiles or positions: the server only sends each building's `space` and the village's `space.used/max`, and the client lays everything out deterministically in id order. The village core sits in the middle (headquarters on the plaza, storage, hiding places and rally point around it, inside the wall ring when there is one, a dirt edge without). Resource sites stand outside in their zones: iron mines at the rocky hill (upper left), clay pits on clay ground (lower left), timber camps at the forest edge (lower right), farms with fields (right); dirt roads lead from the gates to each zone and forest fills the rest. Levels start at 1. Each type has a model per level tier (1–4, 5–14, 15+); the wall goes stakes → timber → stone with towers. Buildings are focusable buttons that enter the building (`buildingRoute`): the headquarters opens construction, the rally point its commands, a military building its recruiting, every other building its own screen (`/village/<id>/building/<bid>`); each of these screens starts with `VillageBuildingHeader`: a close-up (`VillageCloseup`, `app/diorama/closeup.ts`: the building large on its ground, its props and forest, its assigned workers walking to where they work and back carrying what they make), what it does now and one level up (`effects`/`next_effects` from the server), workers, priority, upgrade and demolish. The open building stays outlined in the village, and clicking it again returns to the overview. Buildings are clickable anywhere on their outline (`hit`, a convex hull round their polygons and ground ring), the thin wall also along a wide band on its ring, and their level badges and countdowns as well; a type that doesn't stand yet keeps an invisible empty plot that opens its build card. Buildings never move or light up on hover: only a click outlines the ground under them. Ambient life is welcome and stays out of the way: flat ground shadows, smoke from chimneys, forges and kilns, villagers walking the roads to the zones they work in; all motion stops under `prefers-reduced-motion`. The same models draw the building portraits on screen headers, the HQ list and the building cards (`VillageBuildingPortrait`). The world map groups forests, lakes and rocky hills by smooth noise of the coordinates, and village markers grow in five sizes with points. Map coordinates run around 0|0, negative included (−500 to 499 on a 1000-field map, lowest value from `map.view`'s `min`); continents are named from the top-left like Die Stämme, so 0|0 is the corner of K44, K45, K54 and K55. Use `app/utils/map.ts` for bounds and continents, never `0` or `500` literals.
|
||||||
- **Flat medieval colours only**, in the diorama and everywhere else: no gradients (CSS or SVG), no blur or backdrop-blur, no SVG filters or glows, no translucent overlays. Depth comes from the three flat shades per face in `app/diorama/iso.ts`, solid borders and hard shadows. Keep components small and typed, with state in composables (`useVillage`, `useWorld`).
|
- **Flat medieval colours only**, in the diorama and everywhere else: no gradients (CSS or SVG), no blur or backdrop-blur, no SVG filters or glows, no translucent overlays. Depth comes from the three flat shades per face in `app/diorama/iso.ts`, solid borders and hard shadows. Keep components small and typed, with state in composables (`useVillage`, `useWorld`).
|
||||||
- **The village fills the screen.** On the village's own screens (`/village/<id>/…`) `GameVillageFrame` draws the diorama fixed across the whole browser window and docks everything over it, solid and opaque: the menu and the village bar along the top, the overview boxes in a right column (on phones a bottom sheet on the overview), and the open screen (headquarters, recruit, rally point, workforce) in a `UiWindow` on the left that folds and closes back to the overview; on the overview the left slot holds the card of the building picked in the village (`useVillageSelection`). Screen grids inside a window use container queries (`@4xl:`), not viewport breakpoints. The village scales to fit, no pan: the frame measures what the bars, the right column, the phone tab bar and the bottom sheet cover (`inset`), `buildScene` fits the whole village into the rest, and ground and forest are generated for the whole stage, so nothing of the village is ever cut off. Windows are docked now and meant to become draggable later, so `UiWindow` holds no position logic. This is where the game deliberately leaves Die Stämme's look behind.
|
- **The village fills the screen.** On the village's own screens (`/village/<id>/…`) `GameVillageFrame` draws the diorama fixed across the whole browser window and docks everything over it, solid and opaque: the menu and the village bar along the top, the overview boxes in a right column (on phones a bottom sheet on the overview), and the open screen (headquarters, recruit, rally point, workforce) in a `UiWindow` on the left that folds and closes back to the overview; on the overview the left slot holds the build card of an empty plot picked in the village (`useVillageSelection`). Screen grids inside a window use container queries (`@4xl:`), not viewport breakpoints. The village scales to fit, no pan: the frame measures what the bars, the right column, the phone tab bar and the bottom sheet cover (`inset`), `buildScene` fits the whole village into the rest, and ground and forest are generated for the whole stage, so nothing of the village is ever cut off. Windows are docked now and meant to become draggable later, so `UiWindow` holds no position logic. This is where the game deliberately leaves Die Stämme's look behind.
|
||||||
- **One game shell for the rest.** The map and reports sit in one centred column (1100 px). All world pages use `layouts/game.vue` (on village screens `GameVillageFrame` draws the same parts over the village): the dark main menu (`GameMenuBar`: village, map, reports with its count inline, each with a hover dropdown of its sub-pages; server clock; account dropdown), then the village header (`GameVillageBar`, in two pieces with the village showing between them: on the left the quick bar with the village's screens over the village row, on the right the stock in thin cells and incoming troops; the space between lets clicks through), thin notices, and the content in a `.frame`. On phones the screens move to a bottom tab bar (`GameTabBar`). The header's village is the URL's on village screens and the last opened one elsewhere; `GameVillageFrame` holds its one `useVillage()` and shares it through `useVillageContext()`. Pages outside a world use `layouts/default.vue` (menu only). A page has one of two shapes: a title with box tabs (`UiSubTabs`: buildings like the rally point) or a title with a sub-menu on the left (`UiSideMenu`: lists like reports). One key per screen (`useShortcuts`): V overview, H headquarters, T recruit, P rally point, W workforce, M map, R reports. The overview stays clean: the village and a narrow column of boxes (incoming attacks, production, units, population, construction); tables live on the building screens. The map shows a popup over a hovered village and actions under a clicked one. The village row starts with the quest book (`QuestBook`, a native `<dialog>` without a veil): it opens by itself when `quests.claimable` goes up, and a goal's "show me" opens its screen, a building goal the headquarters with `?hint=<type>` marking that row.
|
- **One game shell for the rest.** The map and reports sit in one centred column (1100 px). All world pages use `layouts/game.vue` (on village screens `GameVillageFrame` draws the same parts over the village): the dark main menu (`GameMenuBar`: village, map, reports with its count inline, each with a hover dropdown of its sub-pages; server clock; account dropdown), then the village header (`GameVillageBar`, in two pieces with the village showing between them: on the left the quick bar with the village's screens over the village row, on the right the stock in thin cells and incoming troops; the space between lets clicks through), thin notices, and the content in a `.frame`. On phones the screens move to a bottom tab bar (`GameTabBar`). The header's village is the URL's on village screens and the last opened one elsewhere; `GameVillageFrame` holds its one `useVillage()` and shares it through `useVillageContext()`. Pages outside a world use `layouts/default.vue` (menu only). A page has one of two shapes: a title with box tabs (`UiSubTabs`: buildings like the rally point) or a title with a sub-menu on the left (`UiSideMenu`: lists like reports). One key per screen (`useShortcuts`): V overview, H headquarters, T recruit, P rally point, W workforce, M map, R reports. The overview stays clean: the village and a narrow column of boxes (incoming attacks, production, units, population, construction); tables live on the building screens. The map shows a popup over a hovered village and actions under a clicked one. The village row starts with the quest book (`QuestBook`, a native `<dialog>` without a veil): it opens by itself when `quests.claimable` goes up, and a goal's "show me" opens its screen, a building goal the headquarters with `?hint=<type>` marking that row.
|
||||||
- All user-facing text goes through i18n keys, with `en` as the first locale. Sources are `i18n/locales/` and `i18n/pages/` (`@blax-software/i18n` layout); register a new page file in `i18n/messageloader.ts`. vue-i18n reads a bare `|` as a plural separator and drops what follows, so coordinates in messages are written `"{x}{'|'}{y}"` inside a double-quoted string.
|
- All user-facing text goes through i18n keys, with `en` as the first locale. Sources are `i18n/locales/` and `i18n/pages/` (`@blax-software/i18n` layout); register a new page file in `i18n/messageloader.ts`. vue-i18n reads a bare `|` as a plural separator and drops what follows, so coordinates in messages are written `"{x}{'|'}{y}"` inside a double-quoted string.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,18 +38,32 @@ const route = useRoute()
|
||||||
const base = computed(() => `/village/${props.villageId}`)
|
const base = computed(() => `/village/${props.villageId}`)
|
||||||
const stage = computed(() => route.path.startsWith(base.value))
|
const stage = computed(() => route.path.startsWith(base.value))
|
||||||
const overview = computed(() => route.path === base.value || route.path === `${base.value}/`)
|
const overview = computed(() => route.path === base.value || route.path === `${base.value}/`)
|
||||||
const { selected, plot, clear } = useVillageSelection()
|
const { plot, clear } = useVillageSelection()
|
||||||
clear()
|
clear()
|
||||||
// Picking something in the village opens its card, which lives on the overview.
|
// An empty plot's build card lives on the overview.
|
||||||
watch([selected, plot], ([b, p]) => {
|
watch(plot, (p) => {
|
||||||
if ((b || p) && stage.value && !overview.value) navigateTo(base.value)
|
if (p && stage.value && !overview.value) navigateTo(base.value)
|
||||||
|
})
|
||||||
|
// Clicking a building enters it: its screen opens in the window, and the building stays
|
||||||
|
// outlined in the village while it is open. Clicking it again goes back to the overview.
|
||||||
|
const openBuilding = computed(() => (v.village.value ? buildingOfRoute(v.village.value, route.path, route.query) : null))
|
||||||
|
const selected = computed<number | null>({
|
||||||
|
get: () => openBuilding.value?.id ?? null,
|
||||||
|
set: (id) => {
|
||||||
|
const village = v.village.value
|
||||||
|
const building = id !== null ? village?.buildings.find((b) => b.id === id) : null
|
||||||
|
navigateTo(village && building ? buildingRoute(village, building) : base.value)
|
||||||
|
},
|
||||||
})
|
})
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const screenTitle = computed(() => {
|
const screenTitle = computed(() => {
|
||||||
|
if (route.path.startsWith(`${base.value}/building/`) && openBuilding.value && v.village.value) {
|
||||||
|
return buildingName(v.village.value, openBuilding.value, t)
|
||||||
|
}
|
||||||
const s = VILLAGE_SCREENS.find((s) => s.path && route.path.startsWith(`${base.value}${s.path}`))
|
const s = VILLAGE_SCREENS.find((s) => s.path && route.path.startsWith(`${base.value}${s.path}`))
|
||||||
return s ? t(`village.screens.${s.name}`) : ''
|
return s ? t(`village.screens.${s.name}`) : ''
|
||||||
})
|
})
|
||||||
const picked = computed(() => !!(selected.value || plot.value))
|
const picked = computed(() => !!plot.value)
|
||||||
|
|
||||||
|
|
||||||
// What the bars, the right column and the phone tab bar cover, so the whole village fits
|
// What the bars, the right column and the phone tab bar cover, so the whole village fits
|
||||||
|
|
|
||||||
|
|
@ -1,113 +0,0 @@
|
||||||
<script setup lang="ts">
|
|
||||||
import type { RouteLocationRaw } from 'vue-router'
|
|
||||||
import type { Building, Cost, Resources } from '~/types/game'
|
|
||||||
|
|
||||||
defineProps<{
|
|
||||||
building: Building
|
|
||||||
resources: Resources
|
|
||||||
canAfford: (cost: Cost) => boolean
|
|
||||||
busy: boolean
|
|
||||||
/** The building's own screen, e.g. construction for the headquarters, recruiting for a barracks. */
|
|
||||||
link?: { to: RouteLocationRaw; label: string } | null
|
|
||||||
}>()
|
|
||||||
const emit = defineEmits<{
|
|
||||||
upgrade: [buildingId: number]
|
|
||||||
demolish: [buildingId: number]
|
|
||||||
priority: [buildingId: number, priority: number]
|
|
||||||
close: []
|
|
||||||
}>()
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- Details of the building selected in the diorama, with its actions. -->
|
|
||||||
<template>
|
|
||||||
<section class="panel" :aria-label="$t(`buildings.${building.type}`)">
|
|
||||||
<div class="flex items-center gap-3 border-b-2 border-wood-700 bg-parchment-200 px-4 py-3">
|
|
||||||
<VillagePortraitTile :type="building.type" :level="building.level" class="size-14" />
|
|
||||||
<div class="min-w-0 flex-1">
|
|
||||||
<h2 class="truncate font-display text-base font-bold text-wood-950">{{ $t(`buildings.${building.type}`) }}</h2>
|
|
||||||
<p class="text-xs text-ink-500">
|
|
||||||
{{ $t('village.buildings.level_n', { level: building.level }) }}
|
|
||||||
<template v-if="building.space"> · {{ $t('village.build.space', { space: building.space }) }}</template>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<button type="button" class="btn btn-ghost p-1.5" :aria-label="$t('common.close')" :title="$t('common.close')" @click="emit('close')">
|
|
||||||
<IconUi name="close" class="size-4" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="space-y-4 px-4 py-3">
|
|
||||||
<div class="grid grid-cols-2 gap-3 text-sm">
|
|
||||||
<div>
|
|
||||||
<p class="text-xs text-ink-500">{{ $t('village.buildings.workers') }}</p>
|
|
||||||
<p class="tabular-nums">{{ building.workers.assigned }}/{{ building.workers.required }}</p>
|
|
||||||
<UiBar class="mt-1" :value="building.staffing" :tone="building.staffing < 1 ? 'rose' : 'emerald'" />
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<p class="text-xs text-ink-500">{{ $t('village.buildings.output') }}</p>
|
|
||||||
<p v-if="building.production" class="flex items-center gap-1 tabular-nums">
|
|
||||||
<IconResource :resource="building.production.resource" class="size-4" />
|
|
||||||
{{ $t('village.resources.per_hour', { rate: formatRate(building.production.per_hour) }) }}
|
|
||||||
</p>
|
|
||||||
<p v-else class="text-ink-400">–</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex items-center justify-between gap-3 text-sm">
|
|
||||||
<span class="text-ink-500">{{ $t('village.buildings.priority') }}</span>
|
|
||||||
<div class="inline-flex items-center rounded-sm border border-wood-600 bg-parchment-50">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-ghost rounded-r-none p-1"
|
|
||||||
:aria-label="$t('village.buildings.priority_down')"
|
|
||||||
:disabled="busy || building.priority <= 0"
|
|
||||||
@click="emit('priority', building.id, building.priority - 1)"
|
|
||||||
>
|
|
||||||
<IconUi name="minus" class="size-3.5" />
|
|
||||||
</button>
|
|
||||||
<span class="w-6 text-center font-semibold tabular-nums">{{ building.priority }}</span>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-ghost rounded-l-none p-1"
|
|
||||||
:aria-label="$t('village.buildings.priority_up')"
|
|
||||||
:disabled="busy || building.priority >= 9"
|
|
||||||
@click="emit('priority', building.id, building.priority + 1)"
|
|
||||||
>
|
|
||||||
<IconUi name="plus" class="size-3.5" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<NuxtLink v-if="link" :to="link.to" class="btn btn-outline w-full">{{ link.label }}</NuxtLink>
|
|
||||||
|
|
||||||
<div v-if="building.upgrade" class="space-y-1.5 rounded-sm border border-wood-600/50 bg-parchment-100 p-3">
|
|
||||||
<div class="flex items-center justify-between gap-2 text-xs text-ink-500">
|
|
||||||
<UiCost :cost="building.upgrade.cost" :have="resources" />
|
|
||||||
<span class="flex items-center gap-1 tabular-nums">
|
|
||||||
<IconUi name="clock" class="size-3" />
|
|
||||||
{{ formatDuration(building.upgrade.seconds) }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary w-full"
|
|
||||||
:disabled="busy || !canAfford(building.upgrade.cost)"
|
|
||||||
@click="emit('upgrade', building.id)"
|
|
||||||
>
|
|
||||||
<IconUi name="up" class="size-3.5" />
|
|
||||||
{{ $t('village.buildings.upgrade', { level: building.upgrade.target_level }) }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<p v-else class="text-sm text-ink-500">{{ $t('village.blocked.max_level') }}</p>
|
|
||||||
|
|
||||||
<div v-if="building.demolish" class="flex items-center justify-between gap-2 text-xs text-ink-500">
|
|
||||||
<span class="flex flex-wrap items-center gap-1.5">
|
|
||||||
{{ $t('village.buildings.refund') }}
|
|
||||||
<UiCost :cost="building.demolish.refund" />
|
|
||||||
</span>
|
|
||||||
<button type="button" class="btn btn-danger" :disabled="busy" @click="emit('demolish', building.id)">
|
|
||||||
{{ $t('village.buildings.demolish') }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</template>
|
|
||||||
|
|
@ -0,0 +1,149 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { Building, BuildingEffect, Cost, Resources } from '~/types/game'
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
building: Building
|
||||||
|
resources: Resources
|
||||||
|
canAfford: (cost: Cost) => boolean
|
||||||
|
busy: boolean
|
||||||
|
/** "Timber camp 2" when the village has more than one of the type. */
|
||||||
|
title: string
|
||||||
|
}>()
|
||||||
|
const emit = defineEmits<{
|
||||||
|
upgrade: [buildingId: number]
|
||||||
|
demolish: [buildingId: number]
|
||||||
|
priority: [buildingId: number, priority: number]
|
||||||
|
}>()
|
||||||
|
const { t } = useI18n()
|
||||||
|
|
||||||
|
/** Effects side by side: now and one level up (null at max level). */
|
||||||
|
const rows = computed(() =>
|
||||||
|
props.building.effects.map((e) => ({ e, next: props.building.next_effects?.find((n) => n.key === e.key) ?? null })),
|
||||||
|
)
|
||||||
|
|
||||||
|
function value(e: BuildingEffect) {
|
||||||
|
switch (e.key) {
|
||||||
|
case 'production':
|
||||||
|
return t('village.resources.per_hour', { rate: formatRate(e.value) })
|
||||||
|
case 'wall_defense':
|
||||||
|
return `+${e.value}`
|
||||||
|
case 'wall_bonus':
|
||||||
|
case 'build_speed':
|
||||||
|
case 'recruit_speed':
|
||||||
|
return `+${e.value}%`
|
||||||
|
case 'detection':
|
||||||
|
return t('village.effects.fields', { n: e.value })
|
||||||
|
default:
|
||||||
|
return String(e.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
The top of a building's own screen: the building up close with its workers at work,
|
||||||
|
then what it is, what it does now and one level up, who works there, and its actions.
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<section class="grid gap-3 @3xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]">
|
||||||
|
<div class="h-52 border border-wood-700 @3xl:h-auto @3xl:min-h-60">
|
||||||
|
<VillageCloseup :type="building.type" :level="building.level" :workers="building.workers.assigned" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="space-y-2.5 text-sm">
|
||||||
|
<div>
|
||||||
|
<h1 class="font-display text-lg leading-tight font-bold text-wood-950">
|
||||||
|
{{ title }} <span class="font-normal">({{ $t('village.buildings.level_n', { level: building.level }) }})</span>
|
||||||
|
</h1>
|
||||||
|
<p class="mt-0.5 text-ink-700">{{ $t(`village.building_about.${building.type}`) }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table v-if="rows.length" class="grid-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th />
|
||||||
|
<th class="text-right">{{ $t('village.effects.now') }}</th>
|
||||||
|
<th class="text-right">{{ building.next_effects ? $t('village.buildings.level_n', { level: building.level + 1 }) : '' }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr v-for="{ e, next } in rows" :key="e.key">
|
||||||
|
<td class="whitespace-nowrap">
|
||||||
|
<span class="inline-flex items-center gap-1">
|
||||||
|
<IconResource v-if="e.resource" :resource="e.resource" class="size-4" />
|
||||||
|
{{ $t(`village.effects.${e.key}`) }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td class="text-right font-semibold whitespace-nowrap tabular-nums">{{ value(e) }}</td>
|
||||||
|
<td class="text-right whitespace-nowrap text-moss-700 tabular-nums">{{ next ? value(next) : '' }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-2 gap-3">
|
||||||
|
<div>
|
||||||
|
<p class="text-xs text-ink-500">{{ $t('village.buildings.workers') }}</p>
|
||||||
|
<p class="tabular-nums">{{ building.workers.assigned }}/{{ building.workers.required }}</p>
|
||||||
|
<UiBar class="mt-1" :value="building.staffing" :tone="building.staffing < 1 ? 'rose' : 'emerald'" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p class="text-xs text-ink-500">{{ $t('village.buildings.output') }}</p>
|
||||||
|
<p v-if="building.production" class="flex items-center gap-1 font-semibold whitespace-nowrap tabular-nums">
|
||||||
|
<IconResource :resource="building.production.resource" class="size-4" />
|
||||||
|
{{ $t('village.resources.per_hour', { rate: formatRate(building.production.per_hour) }) }}
|
||||||
|
</p>
|
||||||
|
<p v-else class="text-ink-400">–</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex items-center justify-between gap-3">
|
||||||
|
<span class="text-ink-500">{{ $t('village.buildings.priority') }}</span>
|
||||||
|
<div class="inline-flex items-center border border-wood-600 bg-parchment-50">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn btn-ghost p-1"
|
||||||
|
:aria-label="$t('village.buildings.priority_down')"
|
||||||
|
:disabled="busy || building.priority <= 0"
|
||||||
|
@click="emit('priority', building.id, building.priority - 1)"
|
||||||
|
>
|
||||||
|
<IconUi name="minus" class="size-4" />
|
||||||
|
</button>
|
||||||
|
<span class="w-7 text-center font-semibold tabular-nums">{{ building.priority }}</span>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn btn-ghost p-1"
|
||||||
|
:aria-label="$t('village.buildings.priority_up')"
|
||||||
|
:disabled="busy || building.priority >= 9"
|
||||||
|
@click="emit('priority', building.id, building.priority + 1)"
|
||||||
|
>
|
||||||
|
<IconUi name="plus" class="size-4" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="building.upgrade" class="flex flex-wrap items-center justify-between gap-2 border border-wood-600/50 bg-parchment-100 p-2">
|
||||||
|
<span class="flex items-center gap-2.5">
|
||||||
|
<UiCost :cost="building.upgrade.cost" :have="resources" nowrap />
|
||||||
|
<span class="flex items-center gap-1 text-xs text-ink-500 tabular-nums">
|
||||||
|
<IconUi name="clock" class="size-3.5" />
|
||||||
|
{{ formatDuration(building.upgrade.seconds) }}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<button type="button" class="btn btn-primary" :disabled="busy || !canAfford(building.upgrade.cost)" @click="emit('upgrade', building.id)">
|
||||||
|
<IconUi name="up" class="size-4" />
|
||||||
|
{{ $t('village.buildings.upgrade', { level: building.upgrade.target_level }) }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<p v-else class="text-ink-500">{{ $t('village.blocked.max_level') }}</p>
|
||||||
|
|
||||||
|
<div v-if="building.demolish" class="flex flex-wrap items-center justify-between gap-2 text-xs text-ink-500">
|
||||||
|
<span class="flex items-center gap-1.5">
|
||||||
|
{{ $t('village.buildings.refund') }}
|
||||||
|
<UiCost :cost="building.demolish.refund" nowrap />
|
||||||
|
</span>
|
||||||
|
<button type="button" class="btn btn-danger" :disabled="busy" @click="emit('demolish', building.id)">
|
||||||
|
{{ $t('village.buildings.demolish') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { BuildingType } from '~/types/game'
|
||||||
|
import { buildCloseup } from '~/diorama/closeup'
|
||||||
|
|
||||||
|
const props = defineProps<{ type: BuildingType; level: number; workers: number }>()
|
||||||
|
|
||||||
|
// Drawn for the stage's own shape, so land and forest fill it edge to edge.
|
||||||
|
const stage = ref<HTMLElement | null>(null)
|
||||||
|
const aspect = ref(2)
|
||||||
|
let observer: ResizeObserver | undefined
|
||||||
|
onMounted(() => {
|
||||||
|
const measure = () => {
|
||||||
|
const el = stage.value
|
||||||
|
if (el?.clientWidth && el.clientHeight) aspect.value = Math.round((el.clientWidth / el.clientHeight) * 10) / 10
|
||||||
|
}
|
||||||
|
measure()
|
||||||
|
observer = new ResizeObserver(measure)
|
||||||
|
if (stage.value) observer.observe(stage.value)
|
||||||
|
})
|
||||||
|
onBeforeUnmount(() => observer?.disconnect())
|
||||||
|
|
||||||
|
const scene = computed(() => buildCloseup(props.type, props.level, props.workers, aspect.value))
|
||||||
|
|
||||||
|
// Workers only walk for players who don't ask for reduced motion.
|
||||||
|
const motion = ref(false)
|
||||||
|
onMounted(() => (motion.value = !window.matchMedia('(prefers-reduced-motion: reduce)').matches))
|
||||||
|
const SHIRTS = ['#6b4f3a', '#7b1e16', '#3d5a26', '#57391f', '#5a5f63']
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- The building up close, its workers walking between it and where they work. -->
|
||||||
|
<template>
|
||||||
|
<div ref="stage" class="h-full w-full overflow-hidden bg-[#74864a]">
|
||||||
|
<svg class="block h-full w-full select-none" :viewBox="scene.viewBox" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
|
||||||
|
<g stroke-width="0.6" stroke-linejoin="round">
|
||||||
|
<polygon v-for="(p, i) in scene.terrain" :key="`t${i}`" :points="p.points" :fill="p.fill" :stroke="p.stroke" />
|
||||||
|
<polygon v-for="(p, i) in scene.decals" :key="`d${i}`" :points="p.points" :fill="p.fill" :stroke="p.stroke" />
|
||||||
|
</g>
|
||||||
|
<g v-if="motion" stroke="#2f2013" stroke-width="0.5">
|
||||||
|
<g v-for="(w, i) in scene.walks" :key="`walk-${i}-${w.d.length}`">
|
||||||
|
<g transform="scale(2.6)">
|
||||||
|
<rect x="-1.7" y="-7" width="3.4" height="5.4" rx="0.6" :fill="SHIRTS[i % SHIRTS.length]" />
|
||||||
|
<circle cy="-8.8" r="1.7" fill="#d8a982" />
|
||||||
|
<path d="M-1 -1.6v1.8M1 -1.6v1.8" fill="none" stroke-width="0.9" />
|
||||||
|
<rect v-if="w.carry" x="0.6" y="-9.6" width="3.6" height="2.4" :fill="w.carry" />
|
||||||
|
</g>
|
||||||
|
<animateMotion :dur="`${w.seconds}s`" :begin="`${w.delay}s`" repeatCount="indefinite" keyPoints="0;1;0" keyTimes="0;0.5;1" calcMode="linear" :path="w.d" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g v-for="obj in scene.objects" :key="obj.key" v-memo="[obj]" stroke-width="0.6" stroke-linejoin="round">
|
||||||
|
<polygon v-for="(p, i) in obj.polys" :key="i" :points="p.points" :fill="p.fill" :stroke="p.stroke" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
@ -1,15 +1,13 @@
|
||||||
import type { BuildingType } from '~/types/game'
|
import type { BuildingType } from '~/types/game'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What is picked in the fullscreen village: a building (its card opens in the window)
|
* The empty plot picked in the fullscreen village: a type that doesn't stand yet, whose
|
||||||
* or the empty plot of a type that doesn't stand yet (its build card).
|
* build card opens on the overview. Buildings open their own screens instead.
|
||||||
*/
|
*/
|
||||||
export function useVillageSelection() {
|
export function useVillageSelection() {
|
||||||
const selected = useState<number | null>('village.selected', () => null)
|
|
||||||
const plot = useState<BuildingType | null>('village.plot', () => null)
|
const plot = useState<BuildingType | null>('village.plot', () => null)
|
||||||
const clear = () => {
|
const clear = () => {
|
||||||
selected.value = null
|
|
||||||
plot.value = null
|
plot.value = null
|
||||||
}
|
}
|
||||||
return { selected, plot, clear }
|
return { plot, clear }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,160 @@
|
||||||
|
// A close-up of one building, for its own screen: the building larger, the ground and
|
||||||
|
// props of its kind around it, forest beyond, and its workers walking between the
|
||||||
|
// building and the spots where they work (trees for a timber camp, pits for a clay pit,
|
||||||
|
// rocks for an iron mine, fields for a farm, the wall walk for the wall).
|
||||||
|
|
||||||
|
import type { BuildingType } from '~/types/game'
|
||||||
|
import { type Face, hash, plane, type Poly, project, rect, scale, toPolys, type V2, type V3 } from './iso'
|
||||||
|
import { broadleaf, buildingModel, bush, C, conifer, rock } from './models'
|
||||||
|
import { disc, ground, shadow, U, wallSegments } from './scene'
|
||||||
|
|
||||||
|
export interface Closeup {
|
||||||
|
viewBox: string
|
||||||
|
width: number
|
||||||
|
height: number
|
||||||
|
terrain: Poly[]
|
||||||
|
decals: Poly[]
|
||||||
|
objects: { key: string; polys: Poly[] }[]
|
||||||
|
/** One per worker shown: a screen path walked there and back, with what they carry. */
|
||||||
|
walks: { d: string; seconds: number; delay: number; carry: string | null }[]
|
||||||
|
}
|
||||||
|
|
||||||
|
type Kind = 'timber' | 'clay' | 'iron' | 'farm' | 'wall' | 'core'
|
||||||
|
const KIND: Partial<Record<BuildingType, Kind>> = { timber_camp: 'timber', clay_pit: 'clay', iron_mine: 'iron', farm: 'farm', wall: 'wall' }
|
||||||
|
const GROUND: Record<Kind, string> = {
|
||||||
|
timber: '#76703f',
|
||||||
|
clay: '#8d5a3b',
|
||||||
|
iron: '#7c776a',
|
||||||
|
farm: '#7f8f4b',
|
||||||
|
wall: '#8c7350',
|
||||||
|
core: '#a3885c',
|
||||||
|
}
|
||||||
|
/** What a worker carries home: logs, clay, ore, sheaves; core buildings move crates. */
|
||||||
|
const CARRY: Record<Kind, string | null> = { timber: C.wood, clay: C.clay, iron: C.ore, farm: C.wheat, wall: null, core: C.plank }
|
||||||
|
/** Workers drawn at most; more would crowd the scene. */
|
||||||
|
const MAX_WALKERS = 8
|
||||||
|
|
||||||
|
const S = U * 1.7
|
||||||
|
const deg = (d: number) => (d * Math.PI) / 180
|
||||||
|
const at = (a: number, r: number): V2 => [Math.cos(a) * r, Math.sin(a) * r]
|
||||||
|
const screen = ([x, y]: V2, z = 1.2) => project([x, y, z])
|
||||||
|
const line = (pts: V2[]) => pts.map((p, i) => `${i ? 'L' : 'M'}${screen(p).map((v) => v.toFixed(1)).join(' ')}`).join(' ')
|
||||||
|
|
||||||
|
export function buildCloseup(type: BuildingType, level: number, workers: number, aspect = 2): Closeup {
|
||||||
|
const kind = KIND[type] ?? 'core'
|
||||||
|
const objects: { key: string; depth: number; polys: Poly[] }[] = []
|
||||||
|
const decals: Face[] = [plane(disc(0, 0, S * 2.3, 16, 7, 0.5), GROUND[kind])]
|
||||||
|
const shadows: Face[] = []
|
||||||
|
const taken: { x: number; y: number; r: number }[] = [{ x: 0, y: 0, r: S * 1.5 }]
|
||||||
|
/** Where workers go; the door is at the front, towards the viewer. */
|
||||||
|
const spots: V2[] = []
|
||||||
|
const door: V2 = at(deg(45), S * 0.95)
|
||||||
|
const put = (key: string, x: number, y: number, faces: Face[], r: number) => {
|
||||||
|
objects.push({ key, depth: x + y, polys: toPolys(faces) })
|
||||||
|
taken.push({ x, y, r })
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kind === 'wall') {
|
||||||
|
// A small fort: the wall round an empty yard, guards walking along it.
|
||||||
|
const Rw = S * 2.2
|
||||||
|
wallSegments(Rw, level, [deg(45)]).forEach((seg, i) => objects.push({ key: `w${i}`, depth: seg.depth, polys: toPolys(seg.faces) }))
|
||||||
|
taken[0] = { x: 0, y: 0, r: Rw + U }
|
||||||
|
} else {
|
||||||
|
const model = buildingModel(type, level, S)
|
||||||
|
objects.push({ key: 'building', depth: 0, polys: toPolys(model.faces) })
|
||||||
|
shadows.push(shadow(0, 0, S * 0.95, scale(GROUND[kind], 0.8), 3))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kind === 'timber') {
|
||||||
|
for (let i = 0; i < 6; i++) {
|
||||||
|
const [x, y] = at(deg(-80 + i * 34 + (hash(i, 1) - 0.5) * 14), S * (2.4 + 0.5 * hash(i, 2)))
|
||||||
|
put(`tree${i}`, x, y, conifer(x, y, U * (1.4 + 0.4 * hash(i, 3)), i), U * 0.7)
|
||||||
|
spots.push([x * 0.85, y * 0.85])
|
||||||
|
}
|
||||||
|
} else if (kind === 'clay') {
|
||||||
|
for (let i = 0; i < 4; i++) {
|
||||||
|
const [x, y] = at(deg(-20 + i * 42), S * 2.2)
|
||||||
|
decals.push(plane(disc(x, y, U * 0.75, 9, 20 + i, 0.8), C.clayWet))
|
||||||
|
spots.push([x, y])
|
||||||
|
}
|
||||||
|
} else if (kind === 'iron') {
|
||||||
|
for (let i = 0; i < 5; i++) {
|
||||||
|
const [x, y] = at(deg(150 + i * 26), S * (2.5 + 0.3 * hash(i, 4)))
|
||||||
|
put(`rock${i}`, x, y, rock(x, y, U * (1.5 + 0.6 * hash(i, 5)), 40 + i, i % 2 ? C.stoneDark : C.rock), U * 0.9)
|
||||||
|
spots.push([x * 0.8, y * 0.8])
|
||||||
|
}
|
||||||
|
} else if (kind === 'farm') {
|
||||||
|
for (let i = 0; i < 4; i++) {
|
||||||
|
const [x, y] = at(deg(-40 + i * 50), S * 2.5)
|
||||||
|
decals.push(plane(rect(x, y, U * 2.2, U * 1.5).map(([px, py]): V3 => [px, py, 0.7]), i % 2 ? C.wheat : C.field))
|
||||||
|
taken.push({ x, y, r: U * 1.4 })
|
||||||
|
spots.push([x, y])
|
||||||
|
}
|
||||||
|
} else if (kind === 'wall') {
|
||||||
|
// Guards walk stretches of the wall walk.
|
||||||
|
for (let i = 0; i < 4; i++) spots.push(at(deg(i * 90 + 20), S * 2.0))
|
||||||
|
} else {
|
||||||
|
for (let i = 0; i < 4; i++) spots.push(at(deg(-10 + i * 55), S * 2.0))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Forest and bushes beyond, thicker further out.
|
||||||
|
const R = S * 2.75
|
||||||
|
const f = U * 1.25
|
||||||
|
for (let i = -14; i <= 14; i++) {
|
||||||
|
for (let j = -14; j <= 14; j++) {
|
||||||
|
const x = (i + hash(i, j, 61) * 0.8) * f
|
||||||
|
const y = (j + hash(i, j, 62) * 0.8) * f
|
||||||
|
const r = Math.hypot(x, y)
|
||||||
|
if (r < S * 2.6 || r > S * 7) continue
|
||||||
|
if (taken.some((t) => Math.hypot(x - t.x, y - t.y) < t.r + U * 0.4)) continue
|
||||||
|
if (Math.abs(Math.atan2(y, x) - deg(45)) < 0.25 && r < S * 5) continue
|
||||||
|
const density = 0.15 + 0.6 * Math.min(1, (r - S * 2.6) / (S * 2.5))
|
||||||
|
if (hash(i, j, 63) > density) continue
|
||||||
|
const kindRoll = hash(i, j, 64)
|
||||||
|
const size = U * (1.0 + 0.5 * hash(i, j, 65))
|
||||||
|
const seed = i * 131 + j
|
||||||
|
put(`t${i}:${j}`, x, y, kindRoll < 0.15 ? bush(x, y, size * 0.8, seed) : kindRoll < 0.7 ? conifer(x, y, size, seed) : broadleaf(x, y, size, seed), size * 0.3)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Frame: the building, its spots and a ring of land round them, widened to the stage.
|
||||||
|
const pts: V2[] = []
|
||||||
|
for (let i = 0; i < 24; i++) pts.push(screen(at((i / 24) * Math.PI * 2, R), 0))
|
||||||
|
let minX = Math.min(...pts.map((p) => p[0]))
|
||||||
|
let maxX = Math.max(...pts.map((p) => p[0]))
|
||||||
|
let minY = Math.min(...pts.map((p) => p[1])) - S * 1.2
|
||||||
|
let maxY = Math.max(...pts.map((p) => p[1]))
|
||||||
|
let w = maxX - minX
|
||||||
|
let h = maxY - minY
|
||||||
|
if (w / h < aspect) {
|
||||||
|
minX -= (h * aspect - w) / 2
|
||||||
|
w = h * aspect
|
||||||
|
} else {
|
||||||
|
minY -= (w / aspect - h) / 2
|
||||||
|
h = w / aspect
|
||||||
|
}
|
||||||
|
maxX = minX + w
|
||||||
|
maxY = minY + h
|
||||||
|
const view = { x: minX, y: minY, w, h }
|
||||||
|
|
||||||
|
const shown = Math.min(MAX_WALKERS, Math.max(0, workers))
|
||||||
|
const walks: Closeup['walks'] = []
|
||||||
|
for (let i = 0; i < shown && spots.length; i++) {
|
||||||
|
const spot = spots[i % spots.length]!
|
||||||
|
const path = kind === 'wall' ? [at(deg(i * 90), S * 2.0), at(deg(i * 90 + 45), S * 2.0), at(deg(i * 90 + 90), S * 2.0)] : [door, spot]
|
||||||
|
const length = Math.hypot(spot[0] - door[0], spot[1] - door[1])
|
||||||
|
const seconds = Math.max(7, (length / U) * 2.4)
|
||||||
|
walks.push({ d: line(path), seconds, delay: -(i * seconds) / Math.max(1, shown), carry: CARRY[kind] })
|
||||||
|
}
|
||||||
|
|
||||||
|
objects.sort((a, b) => a.depth - b.depth)
|
||||||
|
return {
|
||||||
|
viewBox: `${view.x.toFixed(1)} ${view.y.toFixed(1)} ${w.toFixed(1)} ${h.toFixed(1)}`,
|
||||||
|
width: w,
|
||||||
|
height: h,
|
||||||
|
terrain: ground(view),
|
||||||
|
decals: [...decals, ...shadows].flatMap((face) => toPolys([face])),
|
||||||
|
objects: objects.map(({ key, polys }) => ({ key, polys })),
|
||||||
|
walks,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -14,7 +14,7 @@ import { type Face, hash, ngon, plane, type Poly, prism, project, pyramid, scale
|
||||||
import { broadleaf, buildingModel, bush, C, conifer, crane, rock, scaffold, well } from './models'
|
import { broadleaf, buildingModel, bush, C, conifer, crane, rock, scaffold, well } from './models'
|
||||||
|
|
||||||
/** World units per unit of building space, roughly. */
|
/** World units per unit of building space, roughly. */
|
||||||
const U = 24
|
export const U = 24
|
||||||
const GOLDEN = Math.PI * (3 - Math.sqrt(5))
|
const GOLDEN = Math.PI * (3 - Math.sqrt(5))
|
||||||
const deg = (d: number) => (d * Math.PI) / 180
|
const deg = (d: number) => (d * Math.PI) / 180
|
||||||
const dir = (a: number): V2 => [Math.cos(a), Math.sin(a)]
|
const dir = (a: number): V2 => [Math.cos(a), Math.sin(a)]
|
||||||
|
|
@ -207,7 +207,7 @@ function inverse([X, Y]: V2): V2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A low-poly ground mesh that covers the view; vertices hash from their grid index, so it never shifts. */
|
/** A low-poly ground mesh that covers the view; vertices hash from their grid index, so it never shifts. */
|
||||||
function ground(view: { x: number; y: number; w: number; h: number }): Poly[] {
|
export function ground(view: { x: number; y: number; w: number; h: number }): Poly[] {
|
||||||
const g = U * 2.6
|
const g = U * 2.6
|
||||||
const corners = [
|
const corners = [
|
||||||
inverse([view.x, view.y]),
|
inverse([view.x, view.y]),
|
||||||
|
|
@ -244,7 +244,7 @@ function ground(view: { x: number; y: number; w: number; h: number }): Poly[] {
|
||||||
return toPolys(faces).map((p) => ({ ...p, stroke: p.fill }))
|
return toPolys(faces).map((p) => ({ ...p, stroke: p.fill }))
|
||||||
}
|
}
|
||||||
|
|
||||||
function disc(cx: number, cy: number, r: number, n: number, seed: number, z = 0.6): V3[] {
|
export function disc(cx: number, cy: number, r: number, n: number, seed: number, z = 0.6): V3[] {
|
||||||
return ngon(cx, cy, r, n, hash(seed, 1) * 6).map(([x, y], i): V3 => {
|
return ngon(cx, cy, r, n, hash(seed, 1) * 6).map(([x, y], i): V3 => {
|
||||||
const k = 0.82 + 0.3 * hash(seed, i)
|
const k = 0.82 + 0.3 * hash(seed, i)
|
||||||
return [cx + (x - cx) * k, cy + (y - cy) * k, z]
|
return [cx + (x - cx) * k, cy + (y - cy) * k, z]
|
||||||
|
|
@ -286,7 +286,7 @@ function walkPath(a: number, r0: number, r1: number, seed: number, from: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A flat shadow on the ground, cast away from the light (to the right on screen). */
|
/** A flat shadow on the ground, cast away from the light (to the right on screen). */
|
||||||
function shadow(x: number, y: number, r: number, color: string, seed: number): Face {
|
export function shadow(x: number, y: number, r: number, color: string, seed: number): Face {
|
||||||
return plane(disc(x + r * 0.42, y - r * 0.32, r, 10, seed, 1.4), color)
|
return plane(disc(x + r * 0.42, y - r * 0.32, r, 10, seed, 1.4), color)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -317,7 +317,7 @@ function ringBand(r: number, width: number, color: string): Face[] {
|
||||||
// The wall rings the village; its look follows the level like the buildings, and each
|
// The wall rings the village; its look follows the level like the buildings, and each
|
||||||
// segment is its own object so it sorts correctly against buildings inside and out.
|
// segment is its own object so it sorts correctly against buildings inside and out.
|
||||||
|
|
||||||
function wallSegments(Rv: number, level: number, gates: number[]): { faces: Face[]; depth: number }[] {
|
export function wallSegments(Rv: number, level: number, gates: number[]): { faces: Face[]; depth: number }[] {
|
||||||
const steps = Math.max(28, Math.round((Math.PI * 2 * Rv) / (U * 0.55)))
|
const steps = Math.max(28, Math.round((Math.PI * 2 * Rv) / (U * 0.55)))
|
||||||
const gateHalf = (PATH_HALF + U * 0.3) / Rv
|
const gateHalf = (PATH_HALF + U * 0.3) / Rv
|
||||||
const h = U * (0.5 + Math.min(level, 20) * 0.035)
|
const h = U * (0.5 + Math.min(level, 20) * 0.035)
|
||||||
|
|
|
||||||
|
|
@ -581,6 +581,9 @@ function view(state: MockState, v: MockVillage, now: number): VillageState {
|
||||||
production: p ? { resource: p.resource, per_hour: round(p.per_hour) } : null,
|
production: p ? { resource: p.resource, per_hour: round(p.per_hour) } : null,
|
||||||
upgrade: upgradeOffer(v, b),
|
upgrade: upgradeOffer(v, b),
|
||||||
demolish: demolishOffer(v, b),
|
demolish: demolishOffer(v, b),
|
||||||
|
// Placeholder: production only; the backend lists every effect.
|
||||||
|
effects: p ? [{ key: 'production', value: round(p.per_hour), resource: p.resource }] : [],
|
||||||
|
next_effects: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,29 @@ const resources = computed(() => v.resources.value!)
|
||||||
/** Show a building in the village overview, with its card open. */
|
/** Show a building in the village overview, with its card open. */
|
||||||
const hq = computed(() => village.value.buildings.find((b) => b.type === 'headquarters') ?? null)
|
const hq = computed(() => village.value.buildings.find((b) => b.type === 'headquarters') ?? null)
|
||||||
|
|
||||||
const showInVillage = (id: number) => navigateTo({ path: `/village/${route.params.id}`, query: { b: id } })
|
const { t } = useI18n()
|
||||||
|
/** A building's name opens its own screen. */
|
||||||
|
function showBuilding(id: number) {
|
||||||
|
const b = village.value.buildings.find((x) => x.id === id)
|
||||||
|
if (b) navigateTo(buildingRoute(village.value, b))
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- The headquarters screen: every building to construct, upgrade or tear down, and the queue. -->
|
<!-- The headquarters screen: every building to construct, upgrade or tear down, and the queue. -->
|
||||||
<template>
|
<template>
|
||||||
<div class="space-y-3 p-2.5">
|
<div class="space-y-3 p-2.5">
|
||||||
<VillageScreenHeader type="headquarters" :level="hq?.level ?? null" :title="$t('buildings.headquarters')" :description="$t('village.about.build')" />
|
<VillageBuildingHeader
|
||||||
|
v-if="hq"
|
||||||
|
:building="hq"
|
||||||
|
:title="buildingName(village, hq, t)"
|
||||||
|
:resources="v.resources.value!"
|
||||||
|
:can-afford="v.canAfford"
|
||||||
|
:busy="v.busy.value"
|
||||||
|
@upgrade="v.upgrade"
|
||||||
|
@demolish="v.demolish"
|
||||||
|
@priority="v.setPriority"
|
||||||
|
/>
|
||||||
|
<VillageScreenHeader v-else type="headquarters" :level="null" :title="$t('buildings.headquarters')" :description="$t('village.about.build')" />
|
||||||
<div class="grid gap-3 @4xl:grid-cols-[minmax(0,1fr)_18rem]">
|
<div class="grid gap-3 @4xl:grid-cols-[minmax(0,1fr)_18rem]">
|
||||||
<VillageBuildForm
|
<VillageBuildForm
|
||||||
:options="village.buildable"
|
:options="village.buildable"
|
||||||
|
|
@ -26,7 +42,7 @@ const showInVillage = (id: number) => navigateTo({ path: `/village/${route.param
|
||||||
@build="v.build"
|
@build="v.build"
|
||||||
@upgrade="v.upgrade"
|
@upgrade="v.upgrade"
|
||||||
@demolish="v.demolish"
|
@demolish="v.demolish"
|
||||||
@select="showInVillage"
|
@select="showBuilding"
|
||||||
/>
|
/>
|
||||||
<VillageBuildQueue
|
<VillageBuildQueue
|
||||||
:queue="village.queue"
|
:queue="village.queue"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
const route = useRoute()
|
||||||
|
const v = useVillageContext()
|
||||||
|
const village = computed(() => v.village.value!)
|
||||||
|
const resources = computed(() => v.resources.value!)
|
||||||
|
const { t } = useI18n()
|
||||||
|
|
||||||
|
const building = computed(() => village.value.buildings.find((b) => b.id === Number(route.params.bid)) ?? null)
|
||||||
|
// Torn down or taken away: back to the village.
|
||||||
|
watch(building, (b) => {
|
||||||
|
if (!b) navigateTo(`/village/${route.params.id}`)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- Inside one building: the close-up, what it does and what can be done with it. -->
|
||||||
|
<template>
|
||||||
|
<div v-if="building" class="p-2.5">
|
||||||
|
<VillageBuildingHeader
|
||||||
|
:building="building"
|
||||||
|
:title="buildingName(village, building, t)"
|
||||||
|
:resources="resources"
|
||||||
|
:can-afford="v.canAfford"
|
||||||
|
:busy="v.busy.value"
|
||||||
|
@upgrade="v.upgrade"
|
||||||
|
@demolish="v.demolish"
|
||||||
|
@priority="v.setPriority"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
@ -6,30 +6,15 @@ const v = useVillageContext()
|
||||||
const village = computed(() => v.village.value!)
|
const village = computed(() => v.village.value!)
|
||||||
const resources = computed(() => v.resources.value!)
|
const resources = computed(() => v.resources.value!)
|
||||||
const base = `/village/${route.params.id}`
|
const base = `/village/${route.params.id}`
|
||||||
const { t } = useI18n()
|
|
||||||
|
|
||||||
// The village itself fills the screen behind (GameVillageFrame); here is only the card of
|
// The village fills the screen behind (GameVillageFrame); buildings open their own
|
||||||
// what is picked in it, shown in the window. `?b=` opens a building's card.
|
// screens. Here is only the build card of an empty plot picked in the village.
|
||||||
const { selected, plot } = useVillageSelection()
|
// An old `?b=` link opens that building's screen.
|
||||||
if (Number(route.query.b)) selected.value = Number(route.query.b)
|
const linked = village.value.buildings.find((b) => b.id === Number(route.query.b))
|
||||||
|
if (linked) navigateTo(buildingRoute(village.value, linked), { replace: true })
|
||||||
|
|
||||||
const selectedBuilding = computed(() => village.value.buildings.find((b) => b.id === selected.value) ?? null)
|
const { plot } = useVillageSelection()
|
||||||
const plotOption = computed(() => village.value.buildable.find((o) => o.type === plot.value) ?? null)
|
const plotOption = computed(() => village.value.buildable.find((o) => o.type === plot.value) ?? null)
|
||||||
watch(selectedBuilding, (b) => {
|
|
||||||
if (!b) selected.value = null
|
|
||||||
})
|
|
||||||
|
|
||||||
/** Where the card of the selected building leads: its own screen, if it has one. */
|
|
||||||
const screenLink = computed(() => {
|
|
||||||
const b = selectedBuilding.value
|
|
||||||
if (!b) return null
|
|
||||||
if (b.type === 'headquarters') return { to: `${base}/build`, label: t('village.screens.build') }
|
|
||||||
if (b.type === 'rally_point') return { to: `${base}/rally`, label: t('village.screens.rally') }
|
|
||||||
if (village.value.military.some((m) => m.building_id === b.id)) {
|
|
||||||
return { to: { path: `${base}/recruit`, query: { at: b.id } }, label: t('village.buildings.recruit') }
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
})
|
|
||||||
|
|
||||||
async function build(type: BuildingType) {
|
async function build(type: BuildingType) {
|
||||||
await v.build(type)
|
await v.build(type)
|
||||||
|
|
@ -38,20 +23,8 @@ async function build(type: BuildingType) {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VillageBuildingCard
|
|
||||||
v-if="selectedBuilding"
|
|
||||||
:building="selectedBuilding"
|
|
||||||
:resources="resources"
|
|
||||||
:can-afford="v.canAfford"
|
|
||||||
:busy="v.busy.value"
|
|
||||||
:link="screenLink"
|
|
||||||
@upgrade="v.upgrade"
|
|
||||||
@demolish="v.demolish"
|
|
||||||
@priority="v.setPriority"
|
|
||||||
@close="selected = null"
|
|
||||||
/>
|
|
||||||
<VillagePlotCard
|
<VillagePlotCard
|
||||||
v-else-if="plotOption"
|
v-if="plotOption"
|
||||||
:option="plotOption"
|
:option="plotOption"
|
||||||
:resources="resources"
|
:resources="resources"
|
||||||
:can-afford="v.canAfford"
|
:can-afford="v.canAfford"
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,18 @@ const home = computed(() => unitRows(village.value.troops))
|
||||||
<!-- The rally point: send troops and follow them, see where the troops are, and simulate battles. -->
|
<!-- The rally point: send troops and follow them, see where the troops are, and simulate battles. -->
|
||||||
<template>
|
<template>
|
||||||
<div class="space-y-3 p-2.5">
|
<div class="space-y-3 p-2.5">
|
||||||
<VillageScreenHeader type="rally_point" :level="rallyPoint?.level ?? null" :title="$t('buildings.rally_point')" :description="$t('village.about.rally')" />
|
<VillageBuildingHeader
|
||||||
|
v-if="rallyPoint"
|
||||||
|
:building="rallyPoint"
|
||||||
|
:title="buildingName(village, rallyPoint, t)"
|
||||||
|
:resources="v.resources.value!"
|
||||||
|
:can-afford="v.canAfford"
|
||||||
|
:busy="v.busy.value"
|
||||||
|
@upgrade="v.upgrade"
|
||||||
|
@demolish="v.demolish"
|
||||||
|
@priority="v.setPriority"
|
||||||
|
/>
|
||||||
|
<VillageScreenHeader v-else type="rally_point" :level="null" :title="$t('buildings.rally_point')" :description="$t('village.about.rally')" />
|
||||||
<UiSubTabs v-model="tab" :tabs="tabs" />
|
<UiSubTabs v-model="tab" :tabs="tabs" />
|
||||||
|
|
||||||
<div v-if="tab === 'commands'" class="grid gap-3 @4xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]">
|
<div v-if="tab === 'commands'" class="grid gap-3 @4xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]">
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,26 @@ watch(
|
||||||
(at) => (recruitAt.value = Number(at) || recruitAt.value),
|
(at) => (recruitAt.value = Number(at) || recruitAt.value),
|
||||||
)
|
)
|
||||||
const shown = computed(() => village.value.military.find((m) => m.building_id === recruitAt.value) ?? village.value.military[0] ?? null)
|
const shown = computed(() => village.value.military.find((m) => m.building_id === recruitAt.value) ?? village.value.military[0] ?? null)
|
||||||
|
const shownBuilding = computed(() => village.value.buildings.find((b) => b.id === shown.value?.building_id) ?? null)
|
||||||
|
const { t } = useI18n()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- Recruiting at every military building, the troops at home and the levy. -->
|
<!-- Recruiting at every military building, the troops at home and the levy. -->
|
||||||
<template>
|
<template>
|
||||||
<div class="space-y-3 p-2.5">
|
<div class="space-y-3 p-2.5">
|
||||||
|
<VillageBuildingHeader
|
||||||
|
v-if="shownBuilding"
|
||||||
|
:building="shownBuilding"
|
||||||
|
:title="buildingName(village, shownBuilding, t)"
|
||||||
|
:resources="v.resources.value!"
|
||||||
|
:can-afford="v.canAfford"
|
||||||
|
:busy="v.busy.value"
|
||||||
|
@upgrade="v.upgrade"
|
||||||
|
@demolish="v.demolish"
|
||||||
|
@priority="v.setPriority"
|
||||||
|
/>
|
||||||
<VillageScreenHeader
|
<VillageScreenHeader
|
||||||
|
v-else
|
||||||
:type="shown?.type ?? 'barracks'"
|
:type="shown?.type ?? 'barracks'"
|
||||||
:level="shown?.level ?? null"
|
:level="shown?.level ?? null"
|
||||||
:title="shown ? $t(`buildings.${shown.type}`) : $t('village.screens.recruit')"
|
:title="shown ? $t(`buildings.${shown.type}`) : $t('village.screens.recruit')"
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,11 @@ const village = computed(() => v.village.value!)
|
||||||
|
|
||||||
const farm = computed(() => [...village.value.buildings].filter((b) => b.type === 'farm').sort((a, b) => b.level - a.level)[0] ?? null)
|
const farm = computed(() => [...village.value.buildings].filter((b) => b.type === 'farm').sort((a, b) => b.level - a.level)[0] ?? null)
|
||||||
|
|
||||||
const showInVillage = (id: number) => navigateTo({ path: `/village/${route.params.id}`, query: { b: id } })
|
/** A building's name opens its own screen. */
|
||||||
|
function showBuilding(id: number) {
|
||||||
|
const b = village.value.buildings.find((x) => x.id === id)
|
||||||
|
if (b) navigateTo(buildingRoute(village.value, b))
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- Who works where: staffing and priorities per building, and the population behind it. -->
|
<!-- Who works where: staffing and priorities per building, and the population behind it. -->
|
||||||
|
|
@ -13,7 +17,7 @@ const showInVillage = (id: number) => navigateTo({ path: `/village/${route.param
|
||||||
<div class="space-y-3 p-2.5">
|
<div class="space-y-3 p-2.5">
|
||||||
<VillageScreenHeader type="farm" :level="farm?.level ?? null" :title="$t('village.screens.workforce')" :description="$t('village.about.workforce')" />
|
<VillageScreenHeader type="farm" :level="farm?.level ?? null" :title="$t('village.screens.workforce')" :description="$t('village.about.workforce')" />
|
||||||
<div class="grid gap-3 @4xl:grid-cols-[minmax(0,1fr)_18rem]">
|
<div class="grid gap-3 @4xl:grid-cols-[minmax(0,1fr)_18rem]">
|
||||||
<VillageBuildingTable :buildings="village.buildings" :busy="v.busy.value" @select="showInVillage" @priority="v.setPriority" />
|
<VillageBuildingTable :buildings="village.buildings" :busy="v.busy.value" @select="showBuilding" @priority="v.setPriority" />
|
||||||
<VillagePopulationPanel :population="village.population" :militia="village.levy.militia" />
|
<VillagePopulationPanel :population="village.population" :militia="village.levy.militia" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -327,6 +327,16 @@ export interface Building {
|
||||||
upgrade: Offer | null
|
upgrade: Offer | null
|
||||||
/** null when the building cannot go lower (core buildings at level 1); target level 0 removes it. */
|
/** null when the building cannot go lower (core buildings at level 1); target level 0 removes it. */
|
||||||
demolish: { target_level: number; refund: Cost; seconds: number } | null
|
demolish: { target_level: number; refund: Cost; seconds: number } | null
|
||||||
|
/** What one instance does at its level, and one level up (null at max level). */
|
||||||
|
effects: BuildingEffect[]
|
||||||
|
next_effects: BuildingEffect[] | null
|
||||||
|
}
|
||||||
|
|
||||||
|
/** One line of what a building does: production at full staffing (per hour), percentages as whole numbers. */
|
||||||
|
export interface BuildingEffect {
|
||||||
|
key: 'production' | 'capacity' | 'hides' | 'detection' | 'wall_defense' | 'wall_bonus' | 'build_speed' | 'builders' | 'space' | 'recruit_speed'
|
||||||
|
value: number
|
||||||
|
resource?: Resource
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Whether it is affordable is left to the client, which compares the cost to projected resources. */
|
/** Whether it is affordable is left to the client, which compares the cost to projected resources. */
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import type { BuildingType } from '~/types/game'
|
import type { Building, BuildingType, VillageState } from '~/types/game'
|
||||||
|
|
||||||
/** A village's own screens, like the building links of Die Stämme: the bar's tabs and the phone's tab bar. */
|
/** A village's own screens, like the building links of Die Stämme: the bar's tabs and the phone's tab bar. */
|
||||||
export const VILLAGE_SCREENS: { name: 'overview' | 'build' | 'recruit' | 'rally' | 'workforce'; path: string; icon: BuildingType }[] = [
|
export const VILLAGE_SCREENS: { name: 'overview' | 'build' | 'recruit' | 'rally' | 'workforce'; path: string; icon: BuildingType }[] = [
|
||||||
|
|
@ -8,3 +8,36 @@ export const VILLAGE_SCREENS: { name: 'overview' | 'build' | 'recruit' | 'rally'
|
||||||
{ name: 'rally', path: '/rally', icon: 'rally_point' },
|
{ name: 'rally', path: '/rally', icon: 'rally_point' },
|
||||||
{ name: 'workforce', path: '/workforce', icon: 'farm' },
|
{ name: 'workforce', path: '/workforce', icon: 'farm' },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The screen a building opens when it is clicked: the headquarters its construction, the
|
||||||
|
* rally point its commands, a military building its recruiting, every other its own screen.
|
||||||
|
*/
|
||||||
|
export function buildingRoute(village: VillageState, building: Building) {
|
||||||
|
const base = `/village/${village.id}`
|
||||||
|
if (building.type === 'headquarters') return `${base}/build`
|
||||||
|
if (building.type === 'rally_point') return `${base}/rally`
|
||||||
|
if (village.military.some((m) => m.building_id === building.id)) return { path: `${base}/recruit`, query: { at: building.id } }
|
||||||
|
return `${base}/building/${building.id}`
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The building whose screen the route shows, if any. */
|
||||||
|
export function buildingOfRoute(village: VillageState, path: string, query: Record<string, unknown>): Building | null {
|
||||||
|
const base = `/village/${village.id}`
|
||||||
|
const find = (pick: (b: Building) => boolean) => village.buildings.find(pick) ?? null
|
||||||
|
if (path.startsWith(`${base}/building/`)) return find((b) => b.id === Number(path.slice(`${base}/building/`.length)))
|
||||||
|
if (path === `${base}/build`) return find((b) => b.type === 'headquarters')
|
||||||
|
if (path === `${base}/rally`) return find((b) => b.type === 'rally_point')
|
||||||
|
if (path === `${base}/recruit`) {
|
||||||
|
const at = Number(query.at) || village.military[0]?.building_id
|
||||||
|
return find((b) => b.id === at)
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A building's name, numbered ("Timber camp 2") when the village has more than one of its type. */
|
||||||
|
export function buildingName(village: VillageState, building: Building, t: (key: string, params?: Record<string, unknown>) => string) {
|
||||||
|
const same = village.buildings.filter((b) => b.type === building.type)
|
||||||
|
const name = t(`buildings.${building.type}`)
|
||||||
|
return same.length > 1 ? t('village.build.nth', { name, n: same.findIndex((b) => b.id === building.id) + 1 }) : name
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,36 @@ export default {
|
||||||
rally: 'Troops gather here before they march. Send attacks and support, follow your troop movements and see who is coming.',
|
rally: 'Troops gather here before they march. Send attacks and support, follow your troop movements and see who is coming.',
|
||||||
workforce: 'Villagers staff your buildings, the farms first. Priorities decide who works where; understaffed buildings produce less.',
|
workforce: 'Villagers staff your buildings, the farms first. Priorities decide who works where; understaffed buildings produce less.',
|
||||||
},
|
},
|
||||||
|
building_about: {
|
||||||
|
headquarters: "The heart of your village. Builders work from here; every level builds faster, adds building space and in time a builder.",
|
||||||
|
storage: "Keeps wood, clay, iron and food. What doesn't fit is lost, so build storage before the stock fills up.",
|
||||||
|
farm: "Grows the food that feeds your villagers and soldiers. Farms are staffed before anything else.",
|
||||||
|
timber_camp: "Woodcutters fell trees at the forest edge and bring the logs home.",
|
||||||
|
clay_pit: "Diggers cut clay from the pits and fire it in the kiln.",
|
||||||
|
iron_mine: "Miners dig ore out of the rocky hill.",
|
||||||
|
hiding_place: "Raiders don't find what lies hidden here: this much of each resource stays safe.",
|
||||||
|
wall: "Every defender counts for more behind the wall. Rams break it down level by level.",
|
||||||
|
rally_point: "Troops gather here before they march.",
|
||||||
|
watchtower: "Spots groups on their way further out, so attacks show up earlier.",
|
||||||
|
barracks: "Trains spear fighters, swordsmen and archers. A higher level trains faster.",
|
||||||
|
stable: "Trains scouts and cavalry. A higher level trains faster.",
|
||||||
|
workshop: "Builds rams and catapults. A higher level builds faster.",
|
||||||
|
academy: "Trains noblemen and mints the coins that pay for them.",
|
||||||
|
},
|
||||||
|
effects: {
|
||||||
|
now: "Now",
|
||||||
|
production: "Production at full staffing",
|
||||||
|
capacity: "Storage per resource",
|
||||||
|
hides: "Hidden per resource",
|
||||||
|
detection: "Spots groups further out",
|
||||||
|
fields: "{n} fields",
|
||||||
|
wall_defense: "Defence for every defender",
|
||||||
|
wall_bonus: "Defence bonus",
|
||||||
|
build_speed: "Build speed",
|
||||||
|
builders: "Builders",
|
||||||
|
space: "Building space",
|
||||||
|
recruit_speed: "Training speed",
|
||||||
|
},
|
||||||
side: {
|
side: {
|
||||||
production: 'Production',
|
production: 'Production',
|
||||||
units: 'Units',
|
units: 'Units',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue