2026-10-28 18:54:20 +00:00
|
|
|
|
<script setup lang="ts">
|
2026-10-28 21:14:56 +00:00
|
|
|
|
import type { RouteLocationRaw } from 'vue-router'
|
2026-10-28 18:54:20 +00:00
|
|
|
|
import type { Building, Cost, Resources } from '~/types/game'
|
|
|
|
|
|
|
|
|
|
|
|
defineProps<{
|
|
|
|
|
|
building: Building
|
|
|
|
|
|
resources: Resources
|
|
|
|
|
|
canAfford: (cost: Cost) => boolean
|
|
|
|
|
|
busy: boolean
|
2026-10-28 21:14:56 +00:00
|
|
|
|
/** The building's own screen, e.g. construction for the headquarters, recruiting for a barracks. */
|
|
|
|
|
|
link?: { to: RouteLocationRaw; label: string } | null
|
2026-10-28 18:54:20 +00:00
|
|
|
|
}>()
|
|
|
|
|
|
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>
|
2026-10-28 19:33:14 +00:00
|
|
|
|
<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">
|
feat: building portraits, screen headers and a livelier village: shadows, smoke, walkers, a pond
Each building screen opens with the building drawn as it stands, its level and what it
does; the HQ list and the building cards show the same portraits. In the village,
buildings and trees cast flat shadows, chimneys, forges and kilns smoke, villagers walk
the roads to the zones they work in (more where more work), and a pond lies in the
meadow. Motion stops for players who prefer reduced motion.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 23:46:15 +00:00
|
|
|
|
<VillagePortraitTile :type="building.type" :level="building.level" class="size-14" />
|
2026-10-28 18:54:20 +00:00
|
|
|
|
<div class="min-w-0 flex-1">
|
2026-10-29 00:26:08 +00:00
|
|
|
|
<h2 class="truncate font-display text-base font-bold text-wood-950">{{ $t(`buildings.${building.type}`) }}</h2>
|
2026-10-28 18:54:20 +00:00
|
|
|
|
<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>
|
2026-10-28 19:33:14 +00:00
|
|
|
|
<div class="inline-flex items-center rounded-sm border border-wood-600 bg-parchment-50">
|
2026-10-28 18:54:20 +00:00
|
|
|
|
<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>
|
|
|
|
|
|
|
2026-10-28 21:14:56 +00:00
|
|
|
|
<NuxtLink v-if="link" :to="link.to" class="btn btn-outline w-full">{{ link.label }}</NuxtLink>
|
2026-10-28 20:51:43 +00:00
|
|
|
|
|
2026-10-28 19:33:14 +00:00
|
|
|
|
<div v-if="building.upgrade" class="space-y-1.5 rounded-sm border border-wood-600/50 bg-parchment-100 p-3">
|
2026-10-28 18:54:20 +00:00
|
|
|
|
<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>
|