2026-10-28 21:14:56 +00:00
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
|
import type { BuildOrder, UnitType, VillageState } from '~/types/game'
|
|
|
|
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
|
|
village: VillageState
|
|
|
|
|
|
/** The village page path, for the links to its screens. */
|
|
|
|
|
|
base: string
|
|
|
|
|
|
secondsUntil: (iso: string) => number
|
|
|
|
|
|
}>()
|
|
|
|
|
|
const { t } = useI18n()
|
|
|
|
|
|
|
|
|
|
|
|
const production = computed(() => (['wood', 'clay', 'iron', 'food'] as const).map((r) => ({ r, rate: props.village.rates[r] })))
|
|
|
|
|
|
const troops = computed(() => (Object.entries(props.village.troops) as [UnitType, number][]).filter(([, n]) => n > 0))
|
|
|
|
|
|
const idle = computed(() => props.village.population.villagers - props.village.population.workers - props.village.levy.militia)
|
|
|
|
|
|
const spaceShare = computed(() => props.village.space.used / props.village.space.max)
|
feat: rally point, troop movements, support, reports, scouts, battle simulator and village rename
Send attacks and support from the rally point with a live travel-time preview, see own
commands and spotted incoming attacks with countdowns and call-back, send support home
or withdraw it, read battle and support reports with an unread badge, run the battle
simulator, rename villages, and send troops straight from the map. The watchtower gets
a diorama model; the mock server answers every new intent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 23:16:06 +00:00
|
|
|
|
const incoming = computed(() => props.village.movements.filter((m) => m.direction === 'in' && m.type === 'attack'))
|
|
|
|
|
|
const commands = computed(() => props.village.movements.filter((m) => m.direction !== 'in').length)
|
2026-10-28 21:14:56 +00:00
|
|
|
|
|
|
|
|
|
|
function order(o: BuildOrder) {
|
|
|
|
|
|
const type = t(`buildings.${o.type}`)
|
|
|
|
|
|
if (o.action === 'build') return type
|
2026-10-28 21:26:50 +00:00
|
|
|
|
return `${type} ${o.target_level < 1 ? '×' : `→ ${o.target_level}`}`
|
2026-10-28 21:14:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- The column beside the village: small boxes with the numbers that matter at a glance. -->
|
|
|
|
|
|
<template>
|
2026-10-29 13:09:03 +00:00
|
|
|
|
<aside class="space-y-2 p-2 text-sm">
|
feat: rally point, troop movements, support, reports, scouts, battle simulator and village rename
Send attacks and support from the rally point with a live travel-time preview, see own
commands and spotted incoming attacks with countdowns and call-back, send support home
or withdraw it, read battle and support reports with an unread badge, run the battle
simulator, rename villages, and send troops straight from the map. The watchtower gets
a diorama model; the mock server answers every new intent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 23:16:06 +00:00
|
|
|
|
<section v-if="incoming.length" class="side-box border-blood-700">
|
2026-10-29 14:25:26 +00:00
|
|
|
|
<h2 class="panel-head panel-title side-alarm">{{ $t('village.side.incoming') }}</h2>
|
feat: rally point, troop movements, support, reports, scouts, battle simulator and village rename
Send attacks and support from the rally point with a live travel-time preview, see own
commands and spotted incoming attacks with countdowns and call-back, send support home
or withdraw it, read battle and support reports with an unread badge, run the battle
simulator, rename villages, and send troops straight from the map. The watchtower gets
a diorama model; the mock server answers every new intent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 23:16:06 +00:00
|
|
|
|
<ul class="side-body">
|
|
|
|
|
|
<li v-for="m in incoming" :key="m.id" class="flex items-center gap-2 text-blood-700">
|
|
|
|
|
|
<IconUi name="attack" class="size-4" />
|
|
|
|
|
|
<span class="min-w-0 flex-1 truncate">{{ villageLabel(m.from) }}</span>
|
|
|
|
|
|
<span class="font-semibold tabular-nums">{{ formatDuration(secondsUntil(m.arrives_at)) }}</span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
2026-10-28 21:14:56 +00:00
|
|
|
|
<section class="side-box">
|
2026-10-29 14:25:26 +00:00
|
|
|
|
<h2 class="panel-head panel-title">{{ $t('village.side.production') }}</h2>
|
2026-10-28 21:14:56 +00:00
|
|
|
|
<ul class="side-body">
|
|
|
|
|
|
<li v-for="{ r, rate } in production" :key="r" class="flex items-center gap-2">
|
|
|
|
|
|
<IconResource :resource="r" class="size-4" />
|
|
|
|
|
|
<span class="flex-1">{{ $t(`resources.${r}`) }}</span>
|
|
|
|
|
|
<span class="font-semibold tabular-nums" :class="rate < 0 ? 'text-blood-700' : ''">
|
|
|
|
|
|
{{ $t('village.resources.per_hour', { rate: formatRate(rate) }) }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
<section class="side-box">
|
2026-10-29 14:25:26 +00:00
|
|
|
|
<h2 class="panel-head panel-title">{{ $t('village.side.units') }}</h2>
|
2026-10-28 21:14:56 +00:00
|
|
|
|
<div class="side-body">
|
|
|
|
|
|
<ul v-if="troops.length || village.levy.militia">
|
|
|
|
|
|
<li v-for="[unit, count] in troops" :key="unit" class="flex items-center gap-2">
|
|
|
|
|
|
<IconUnit :unit="unit" class="size-4 text-wood-800" />
|
|
|
|
|
|
<span class="font-semibold tabular-nums">{{ count }}</span>
|
|
|
|
|
|
<span class="truncate">{{ $t(`units.${unit}`) }}</span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
<li v-if="village.levy.militia" class="flex items-center gap-2">
|
|
|
|
|
|
<IconUnit unit="militia" class="size-4 text-wood-800" />
|
|
|
|
|
|
<span class="font-semibold tabular-nums">{{ village.levy.militia }}</span>
|
|
|
|
|
|
<span>{{ $t('village.levy.militia') }}</span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
<p v-else class="text-ink-500">{{ $t('village.troops.none') }}</p>
|
|
|
|
|
|
<p v-if="village.population.training" class="text-xs text-ink-500">{{ $t('village.troops.training', { count: village.population.training }) }}</p>
|
feat: rally point, troop movements, support, reports, scouts, battle simulator and village rename
Send attacks and support from the rally point with a live travel-time preview, see own
commands and spotted incoming attacks with countdowns and call-back, send support home
or withdraw it, read battle and support reports with an unread badge, run the battle
simulator, rename villages, and send troops straight from the map. The watchtower gets
a diorama model; the mock server answers every new intent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 23:16:06 +00:00
|
|
|
|
<p v-if="commands" class="text-xs text-ink-500">{{ $t('village.side.commands') }}: {{ commands }}</p>
|
2026-10-29 13:09:03 +00:00
|
|
|
|
<div class="side-actions">
|
|
|
|
|
|
<NuxtLink :to="`${base}/recruit`" class="btn btn-outline">{{ $t('village.side.recruit') }}</NuxtLink>
|
|
|
|
|
|
<NuxtLink :to="`${base}/rally`" class="btn btn-outline">{{ $t('village.side.rally') }}</NuxtLink>
|
|
|
|
|
|
</div>
|
2026-10-28 21:14:56 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
<section class="side-box">
|
2026-10-29 14:25:26 +00:00
|
|
|
|
<h2 class="panel-head panel-title">{{ $t('village.population.title') }}</h2>
|
2026-10-28 21:14:56 +00:00
|
|
|
|
<dl class="grid grid-cols-[1fr_auto] gap-x-2 gap-y-1 px-2.5 py-1.5">
|
|
|
|
|
|
<dt>{{ $t('village.population.villagers') }}</dt>
|
|
|
|
|
|
<dd class="text-right font-semibold tabular-nums">{{ village.population.villagers }}</dd>
|
|
|
|
|
|
<dt>{{ $t('village.population.workers') }}</dt>
|
|
|
|
|
|
<dd class="text-right tabular-nums">{{ village.population.workers }}</dd>
|
|
|
|
|
|
<dt>{{ $t('village.population.idle') }}</dt>
|
|
|
|
|
|
<dd class="text-right tabular-nums">{{ idle }}</dd>
|
|
|
|
|
|
<dt>{{ $t('village.population.upkeep') }}</dt>
|
|
|
|
|
|
<dd class="text-right tabular-nums">{{ village.population.upkeep }}/{{ village.population.food_budget }}</dd>
|
|
|
|
|
|
</dl>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
<section class="side-box">
|
2026-10-29 14:25:26 +00:00
|
|
|
|
<h2 class="panel-head panel-title">{{ $t('village.side.construction') }}</h2>
|
2026-10-28 21:14:56 +00:00
|
|
|
|
<div class="side-body">
|
|
|
|
|
|
<ol v-if="village.queue.length">
|
|
|
|
|
|
<li v-for="o in village.queue" :key="o.id" class="flex items-center gap-2">
|
|
|
|
|
|
<IconBuilding :type="o.type" class="size-4 text-wood-800" />
|
|
|
|
|
|
<span class="min-w-0 flex-1 truncate">{{ order(o) }}</span>
|
|
|
|
|
|
<span class="tabular-nums" :class="o.finishes_at ? 'font-semibold' : 'text-ink-500'">
|
|
|
|
|
|
{{ o.finishes_at ? formatDuration(secondsUntil(o.finishes_at)) : $t('village.queue.waiting') }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
</ol>
|
|
|
|
|
|
<p v-else class="text-ink-500">{{ $t('village.queue.empty') }}</p>
|
|
|
|
|
|
<div class="pt-1">
|
|
|
|
|
|
<div class="mb-1 flex justify-between text-xs text-ink-500">
|
|
|
|
|
|
<span>{{ $t('village.diorama.space') }}</span>
|
|
|
|
|
|
<span class="tabular-nums">{{ village.space.used }}/{{ village.space.max }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<UiBar :value="spaceShare" :tone="spaceShare >= 1 ? 'rose' : 'emerald'" />
|
|
|
|
|
|
</div>
|
2026-10-29 13:09:03 +00:00
|
|
|
|
<div class="side-actions">
|
|
|
|
|
|
<NuxtLink :to="`${base}/build`" class="btn btn-outline">{{ $t('village.screens.build') }}</NuxtLink>
|
|
|
|
|
|
</div>
|
2026-10-28 21:14:56 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
</aside>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
@reference "~/assets/css/main.css";
|
|
|
|
|
|
|
2026-10-29 14:25:26 +00:00
|
|
|
|
/* The same panel as everywhere; the column around them is the frame. */
|
2026-10-28 21:14:56 +00:00
|
|
|
|
.side-box {
|
2026-10-29 00:26:08 +00:00
|
|
|
|
@apply border border-wood-700 bg-parchment-50;
|
2026-10-29 14:25:26 +00:00
|
|
|
|
background-image: var(--pat-parchment-50);
|
2026-10-28 21:14:56 +00:00
|
|
|
|
}
|
2026-10-29 14:25:26 +00:00
|
|
|
|
/* Incoming attacks: the band in oxblood, no cloth texture. */
|
|
|
|
|
|
.side-alarm {
|
|
|
|
|
|
@apply border-blood-800 bg-blood-700 text-parchment-50;
|
|
|
|
|
|
background-image: none;
|
2026-10-28 21:14:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
.side-body {
|
2026-10-29 00:26:08 +00:00
|
|
|
|
@apply space-y-0.5 px-1.5 py-1;
|
2026-10-28 21:14:56 +00:00
|
|
|
|
}
|
2026-10-29 13:09:03 +00:00
|
|
|
|
/* Links to the screens as small buttons on one line, never wrapped. */
|
|
|
|
|
|
.side-actions {
|
|
|
|
|
|
@apply flex flex-nowrap gap-1 pt-1 whitespace-nowrap;
|
2026-10-28 21:14:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|