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
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
|
import type { BattleReport, VillageRef } from '~/types/game'
|
|
|
|
|
|
|
|
|
|
|
|
const props = defineProps<{ report: BattleReport; worldId: number }>()
|
|
|
|
|
|
const { t } = useI18n()
|
|
|
|
|
|
|
|
|
|
|
|
const sides = computed(() => [
|
|
|
|
|
|
{ key: 'attacker', label: t('reports.battle.attacker'), place: t('reports.battle.origin'), side: props.report.attacker },
|
|
|
|
|
|
{ key: 'defender', label: t('reports.battle.defender'), place: t('reports.battle.destination'), side: props.report.defender },
|
|
|
|
|
|
])
|
|
|
|
|
|
const mapLink = (v: VillageRef) => ({ path: `/map/${props.worldId}`, query: { x: v.x, y: v.y } })
|
|
|
|
|
|
const looted = computed(() => props.report.loot.wood + props.report.loot.clay + props.report.loot.iron)
|
|
|
|
|
|
/** Marker position on the luck bar, 0..100 from −25% to +25%. */
|
|
|
|
|
|
const luckAt = computed(() => Math.max(0, Math.min(100, ((props.report.luck + 25) / 50) * 100)))
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- A battle report laid out like Die Stämme's: who won, luck and morale, both sides' units, siege damage, haul. -->
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<div class="space-y-5 text-sm">
|
|
|
|
|
|
<h2 class="font-display text-xl font-semibold" :class="report.won ? 'text-moss-700' : 'text-blood-700'">
|
|
|
|
|
|
{{ report.won ? $t('reports.battle.attacker_won') : $t('reports.battle.defender_won') }}
|
|
|
|
|
|
</h2>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="flex flex-wrap items-center gap-x-8 gap-y-2">
|
|
|
|
|
|
<div class="flex items-center gap-3">
|
|
|
|
|
|
<span class="text-ink-500">{{ $t('reports.battle.luck') }}</span>
|
|
|
|
|
|
<!-- −25% … +25%, red on the left half, green on the right. -->
|
|
|
|
|
|
<span class="relative inline-flex h-3 w-40 overflow-hidden rounded-sm border border-wood-700" aria-hidden="true">
|
|
|
|
|
|
<span class="h-full w-1/2 bg-[#d9b3a8]" />
|
|
|
|
|
|
<span class="h-full w-1/2 bg-[#b9c79a]" />
|
|
|
|
|
|
<span class="absolute top-0 h-full w-1 bg-wood-900" :style="{ left: `calc(${luckAt}% - 2px)` }" />
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span class="font-semibold tabular-nums" :class="report.luck < 0 ? 'text-blood-700' : 'text-moss-700'">{{ report.luck > 0 ? '+' : '' }}{{ report.luck }}%</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<span class="text-ink-500">{{ $t('reports.battle.morale') }}</span>
|
|
|
|
|
|
<span class="ml-2 font-semibold tabular-nums">{{ report.morale }}%</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<p v-if="report.night" class="text-ink-700">{{ $t('reports.battle.night') }}</p>
|
|
|
|
|
|
|
|
|
|
|
|
<section v-for="s in sides" :key="s.key" class="rounded-sm border-2 border-wood-700 bg-parchment-50">
|
|
|
|
|
|
<dl class="grid grid-cols-[6rem_1fr] gap-x-3 gap-y-0.5 border-b border-wood-700 bg-parchment-200 px-3 py-1.5">
|
|
|
|
|
|
<dt class="font-semibold">{{ s.label }}</dt>
|
|
|
|
|
|
<dd>{{ s.side.village.player?.name ?? $t('common.barbarian') }}</dd>
|
|
|
|
|
|
<dt class="text-ink-500">{{ s.place }}</dt>
|
|
|
|
|
|
<dd>
|
|
|
|
|
|
<NuxtLink :to="mapLink(s.side.village)" class="font-semibold text-blood-700 hover:underline">{{ villageLabel(s.side.village) }}</NuxtLink>
|
|
|
|
|
|
</dd>
|
|
|
|
|
|
</dl>
|
|
|
|
|
|
<div class="px-3 py-2">
|
|
|
|
|
|
<p v-if="s.side.units === null" class="text-ink-500">{{ $t('reports.battle.no_info') }}</p>
|
|
|
|
|
|
<p v-else-if="!unitRows(s.side.units).length" class="text-ink-500">{{ $t('reports.battle.no_troops') }}</p>
|
|
|
|
|
|
<ReportUnits v-else :units="s.side.units" :lost="s.side.lost" />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
<div v-if="report.wall || report.building" class="space-y-1">
|
|
|
|
|
|
<p v-if="report.wall">
|
|
|
|
|
|
{{
|
|
|
|
|
|
report.wall.after < report.wall.before
|
|
|
|
|
|
? $t('reports.battle.wall', report.wall)
|
|
|
|
|
|
: $t('reports.battle.wall_held', { level: report.wall.after })
|
|
|
|
|
|
}}
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<p v-if="report.building">
|
|
|
|
|
|
{{
|
|
|
|
|
|
report.building.after < report.building.before
|
|
|
|
|
|
? $t('reports.battle.building', { ...report.building, type: $t(`buildings.${report.building.type}`) })
|
|
|
|
|
|
: $t('reports.battle.building_held', { type: $t(`buildings.${report.building.type}`), level: report.building.after })
|
|
|
|
|
|
}}
|
|
|
|
|
|
</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<section v-if="report.scouting" class="space-y-2">
|
|
|
|
|
|
<h3 class="font-semibold">{{ $t('reports.battle.scouting') }}</h3>
|
|
|
|
|
|
<p>
|
|
|
|
|
|
{{
|
|
|
|
|
|
report.scouting.through
|
|
|
|
|
|
? $t('reports.battle.scouts_through', { sent: report.scouting.sent, lost: report.scouting.lost })
|
|
|
|
|
|
: $t('reports.battle.scouts_failed', { sent: report.scouting.sent })
|
|
|
|
|
|
}}
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<div v-if="report.scouting.resources" class="flex flex-wrap items-center gap-x-4 gap-y-1">
|
|
|
|
|
|
<span class="text-ink-500">{{ $t('reports.battle.scouted_resources') }}</span>
|
|
|
|
|
|
<span v-for="r in (['wood', 'clay', 'iron'] as const)" :key="r" class="inline-flex items-center gap-1 tabular-nums">
|
|
|
|
|
|
<IconResource :resource="r" class="size-4" />{{ report.scouting.resources[r] }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-if="report.scouting.buildings">
|
|
|
|
|
|
<p class="mb-1 text-ink-500">{{ $t('reports.battle.scouted_buildings') }}</p>
|
|
|
|
|
|
<ul class="grid grid-cols-[repeat(auto-fill,minmax(11rem,1fr))] gap-x-4 gap-y-0.5">
|
|
|
|
|
|
<li v-for="type in BUILDING_TYPES.filter((b) => report.scouting!.buildings![b]?.length)" :key="type" class="flex items-center gap-2">
|
|
|
|
|
|
<IconBuilding :type="type" class="size-4 text-wood-800" />
|
|
|
|
|
|
<span class="flex-1">{{ $t(`buildings.${type}`) }}</span>
|
|
|
|
|
|
<span class="font-semibold tabular-nums">{{ report.scouting.buildings[type]!.join(', ') }}</span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
<div v-if="report.won && report.capacity > 0" class="flex flex-wrap items-center gap-x-4 gap-y-1">
|
|
|
|
|
|
<span class="font-semibold">{{ $t('reports.battle.haul') }}</span>
|
|
|
|
|
|
<span v-for="r in (['wood', 'clay', 'iron'] as const)" :key="r" class="inline-flex items-center gap-1 tabular-nums">
|
|
|
|
|
|
<IconResource :resource="r" class="size-4" />{{ report.loot[r] }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span class="text-ink-500 tabular-nums">{{ $t('reports.battle.haul_of', { loot: looted, capacity: report.capacity }) }}</span>
|
|
|
|
|
|
</div>
|
2026-10-29 09:33:26 +00:00
|
|
|
|
|
|
|
|
|
|
<p v-if="report.loyalty" class="font-semibold" :class="report.loyalty.conquered ? 'text-blood-700' : 'text-ink-700'">
|
|
|
|
|
|
{{ $t('reports.battle.loyalty', { before: report.loyalty.before, after: report.loyalty.after }) }}
|
|
|
|
|
|
<template v-if="report.loyalty.conquered">{{ $t('reports.battle.conquered') }}</template>
|
|
|
|
|
|
</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
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|