2026-10-28 18:58:42 +00:00
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
|
export type MapRelation = 'own' | 'player' | 'barbarian'
|
|
|
|
|
|
|
2026-10-29 15:34:42 +00:00
|
|
|
|
const props = defineProps<{ tier: 1 | 2 | 3 | 4 | 5; relation: MapRelation; crown?: boolean }>()
|
2026-10-28 18:58:42 +00:00
|
|
|
|
|
2026-10-28 23:48:34 +00:00
|
|
|
|
// Low-poly settlements in a 100 × 100 box that grow with the village's points, like the
|
|
|
|
|
|
// five village sizes on the Die Stämme map: a hut, a hamlet, a village with a tower, a
|
|
|
|
|
|
// town behind a palisade, and a stone keep behind walls. Each block has two lit wall
|
2026-10-28 18:58:42 +00:00
|
|
|
|
// faces and a two-facet roof, so it reads as 3D like the village diorama.
|
|
|
|
|
|
const tones = computed(() =>
|
|
|
|
|
|
props.relation === 'barbarian'
|
2026-10-30 09:35:47 +00:00
|
|
|
|
? { wallLight: '#aaa498', wallDark: '#827d74', roofLight: '#6e685f', roofDark: '#524c45' }
|
|
|
|
|
|
: { wallLight: '#b5a486', wallDark: '#8b7c62', roofLight: '#7f4430', roofDark: '#5a3020' },
|
2026-10-28 18:58:42 +00:00
|
|
|
|
)
|
2026-10-30 09:35:47 +00:00
|
|
|
|
const STONE = { wallLight: '#9d988f', wallDark: '#77736c', roofLight: '#5a5f66', roofDark: '#45494f' }
|
2026-10-28 19:22:53 +00:00
|
|
|
|
const flag = computed(() => ({ own: '#d9b44a', player: '#962a1f', barbarian: '#8b9094' })[props.relation])
|
2026-10-28 18:58:42 +00:00
|
|
|
|
|
2026-10-28 23:48:34 +00:00
|
|
|
|
interface Block {
|
2026-10-28 18:58:42 +00:00
|
|
|
|
cx: number
|
|
|
|
|
|
cy: number
|
|
|
|
|
|
w: number
|
|
|
|
|
|
d: number
|
|
|
|
|
|
h: number
|
|
|
|
|
|
roof: number
|
2026-10-28 23:48:34 +00:00
|
|
|
|
stone?: boolean
|
2026-10-28 18:58:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-28 23:48:34 +00:00
|
|
|
|
const blocks = computed<Block[]>(() => {
|
|
|
|
|
|
switch (props.tier) {
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
return [{ cx: 50, cy: 66, w: 18, d: 10, h: 14, roof: 14 }]
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
return [
|
|
|
|
|
|
{ cx: 36, cy: 60, w: 15, d: 8, h: 12, roof: 12 },
|
|
|
|
|
|
{ cx: 62, cy: 70, w: 18, d: 10, h: 14, roof: 14 },
|
|
|
|
|
|
]
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
return [
|
|
|
|
|
|
{ cx: 50, cy: 52, w: 10, d: 6, h: 30, roof: 13 },
|
|
|
|
|
|
{ cx: 30, cy: 66, w: 15, d: 8, h: 13, roof: 12 },
|
|
|
|
|
|
{ cx: 70, cy: 70, w: 16, d: 9, h: 14, roof: 13 },
|
|
|
|
|
|
]
|
|
|
|
|
|
case 4:
|
|
|
|
|
|
return [
|
|
|
|
|
|
{ cx: 50, cy: 46, w: 11, d: 6, h: 34, roof: 14 },
|
|
|
|
|
|
{ cx: 28, cy: 58, w: 14, d: 8, h: 13, roof: 12 },
|
|
|
|
|
|
{ cx: 72, cy: 60, w: 15, d: 8, h: 14, roof: 12 },
|
|
|
|
|
|
{ cx: 48, cy: 70, w: 16, d: 8, h: 12, roof: 11 },
|
|
|
|
|
|
]
|
|
|
|
|
|
default:
|
|
|
|
|
|
return [
|
|
|
|
|
|
{ cx: 50, cy: 50, w: 17, d: 10, h: 38, roof: 16, stone: true },
|
|
|
|
|
|
{ cx: 26, cy: 58, w: 13, d: 7, h: 12, roof: 11 },
|
|
|
|
|
|
{ cx: 74, cy: 60, w: 13, d: 7, h: 12, roof: 11 },
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
2026-10-28 18:58:42 +00:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const pts = (...p: number[]) => {
|
|
|
|
|
|
const out: string[] = []
|
|
|
|
|
|
for (let i = 0; i < p.length; i += 2) out.push(`${p[i]},${p[i + 1]}`)
|
|
|
|
|
|
return out.join(' ')
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-28 23:48:34 +00:00
|
|
|
|
function faces(b: Block) {
|
|
|
|
|
|
const { cx, cy, w, d } = b
|
|
|
|
|
|
const top = cy - b.h
|
|
|
|
|
|
const apex = top - b.roof
|
2026-10-28 18:58:42 +00:00
|
|
|
|
return {
|
2026-10-28 23:48:34 +00:00
|
|
|
|
left: pts(cx - w, cy, cx, cy + d, cx, cy + d - b.h, cx - w, top),
|
|
|
|
|
|
right: pts(cx, cy + d, cx + w, cy, cx + w, top, cx, cy + d - b.h),
|
|
|
|
|
|
roofLeft: pts(cx - w - 2, top + 1, cx, cy + d - b.h + 2, cx, apex),
|
|
|
|
|
|
roofRight: pts(cx, cy + d - b.h + 2, cx + w + 2, top + 1, cx, apex),
|
|
|
|
|
|
colors: b.stone ? STONE : tones.value,
|
2026-10-28 18:58:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-28 23:48:34 +00:00
|
|
|
|
/** Points along the front half of the ring a palisade or wall stands on. */
|
|
|
|
|
|
const ring = computed(() =>
|
|
|
|
|
|
Array.from({ length: 15 }, (_, i) => {
|
|
|
|
|
|
const a = Math.PI * (0.02 + (i / 14) * 0.96)
|
|
|
|
|
|
return { x: 50 + Math.cos(a) * 44, y: 66 + Math.sin(a) * 19 }
|
|
|
|
|
|
}),
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2026-10-28 18:58:42 +00:00
|
|
|
|
const pole = computed(() => {
|
2026-10-28 23:48:34 +00:00
|
|
|
|
const first = blocks.value[0]!
|
|
|
|
|
|
return { x: first.cx, y: first.cy - first.h - first.roof }
|
2026-10-28 18:58:42 +00:00
|
|
|
|
})
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<g>
|
2026-10-30 09:35:47 +00:00
|
|
|
|
<ellipse cx="50" cy="72" rx="42" ry="18" fill="#5f5640" />
|
2026-10-28 23:48:34 +00:00
|
|
|
|
<g v-for="(b, i) in blocks" :key="i">
|
|
|
|
|
|
<polygon :points="faces(b).left" :fill="faces(b).colors.wallDark" />
|
|
|
|
|
|
<polygon :points="faces(b).right" :fill="faces(b).colors.wallLight" />
|
|
|
|
|
|
<polygon :points="faces(b).roofLeft" :fill="faces(b).colors.roofDark" />
|
|
|
|
|
|
<polygon :points="faces(b).roofRight" :fill="faces(b).colors.roofLight" />
|
|
|
|
|
|
</g>
|
|
|
|
|
|
<!-- A town's palisade or a keep's stone wall along the front of the ring. -->
|
|
|
|
|
|
<g v-if="tier === 4">
|
2026-10-30 09:35:47 +00:00
|
|
|
|
<rect v-for="(p, i) in ring" :key="i" :x="p.x - 2" :y="p.y - 9" width="4" height="10" :fill="i % 2 ? '#574536' : '#7a6249'" />
|
2026-10-28 23:48:34 +00:00
|
|
|
|
</g>
|
|
|
|
|
|
<g v-else-if="tier === 5">
|
|
|
|
|
|
<polygon
|
|
|
|
|
|
v-for="(p, i) in ring.slice(0, -1)"
|
|
|
|
|
|
:key="i"
|
|
|
|
|
|
:points="pts(p.x, p.y, ring[i + 1]!.x, ring[i + 1]!.y, ring[i + 1]!.x, ring[i + 1]!.y - 10, p.x, p.y - 10)"
|
2026-10-30 09:35:47 +00:00
|
|
|
|
:fill="i % 2 ? '#77736c' : '#928d84'"
|
2026-10-28 23:48:34 +00:00
|
|
|
|
/>
|
2026-10-30 09:35:47 +00:00
|
|
|
|
<rect v-for="i in [0, 7, 14]" :key="`t${i}`" :x="ring[i]!.x - 4" :y="ring[i]!.y - 16" width="8" height="16" fill="#74716a" />
|
2026-10-28 18:58:42 +00:00
|
|
|
|
</g>
|
|
|
|
|
|
<line :x1="pole.x" :y1="pole.y" :x2="pole.x" :y2="pole.y - 20" stroke="#4a3b2e" stroke-width="2" />
|
|
|
|
|
|
<polygon :points="pts(pole.x, pole.y - 20, pole.x + 15, pole.y - 15, pole.x, pole.y - 10)" :fill="flag" stroke="#2b2118" stroke-width="0.8" />
|
2026-10-29 15:34:42 +00:00
|
|
|
|
<!-- A crown fort of the season wears a gold crown over its flag. -->
|
|
|
|
|
|
<g v-if="crown">
|
|
|
|
|
|
<polygon
|
|
|
|
|
|
:points="pts(pole.x - 12, pole.y - 22, pole.x - 12, pole.y - 36, pole.x - 6, pole.y - 29, pole.x, pole.y - 40, pole.x + 6, pole.y - 29, pole.x + 12, pole.y - 36, pole.x + 12, pole.y - 22)"
|
|
|
|
|
|
fill="#d9b44a"
|
|
|
|
|
|
stroke="#6b4f16"
|
|
|
|
|
|
stroke-width="1.2"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<rect :x="pole.x - 12" :y="pole.y - 26" width="24" height="4" fill="#a8842e" />
|
|
|
|
|
|
</g>
|
2026-10-28 18:58:42 +00:00
|
|
|
|
</g>
|
|
|
|
|
|
</template>
|