2026-10-28 18:58:42 +00:00
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
|
export type MapRelation = 'own' | 'player' | 'barbarian'
|
|
|
|
|
|
|
2026-10-28 23:48:34 +00:00
|
|
|
|
const props = defineProps<{ tier: 1 | 2 | 3 | 4 | 5; relation: MapRelation }>()
|
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'
|
|
|
|
|
|
? { wallLight: '#d6cfc2', wallDark: '#a99f90', roofLight: '#8e857a', roofDark: '#6c6459' }
|
2026-10-28 19:22:53 +00:00
|
|
|
|
: { wallLight: '#e3cfa2', wallDark: '#b49870', roofLight: '#9c4a26', roofDark: '#73321a' },
|
2026-10-28 18:58:42 +00:00
|
|
|
|
)
|
2026-10-28 23:48:34 +00:00
|
|
|
|
const STONE = { wallLight: '#b9b3a7', wallDark: '#8d877b', roofLight: '#5d636b', roofDark: '#464b52' }
|
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-28 23:48:34 +00:00
|
|
|
|
<ellipse cx="50" cy="72" rx="42" ry="18" fill="#5f7531" />
|
|
|
|
|
|
<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">
|
|
|
|
|
|
<rect v-for="(p, i) in ring" :key="i" :x="p.x - 2" :y="p.y - 9" width="4" height="10" :fill="i % 2 ? '#6a4526' : '#8a5f38'" />
|
|
|
|
|
|
</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)"
|
|
|
|
|
|
:fill="i % 2 ? '#8d877b' : '#a39d92'"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<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="#847e74" />
|
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" />
|
|
|
|
|
|
</g>
|
|
|
|
|
|
</template>
|