game-village-politics-frontend/app/utils/demoVillage.ts

25 lines
1.4 KiB
TypeScript
Raw Permalink Normal View History

import type { Building, BuildingType, VillageState } from '~/types/game'
const SPACE: Partial<Record<BuildingType, number>> = {
headquarters: 9, storage: 4, farm: 4, timber_camp: 4, clay_pit: 4, iron_mine: 4, hiding_place: 1, wall: 0, rally_point: 1, barracks: 6, stable: 6, workshop: 6,
}
/**
* A grown village for the landing page: the diorama draws it like any other, so visitors
* see the game itself. Only the parts the scene reads are filled in.
*/
export function demoVillage(): VillageState {
const levels: [BuildingType, number][] = [
['headquarters', 14], ['storage', 11], ['storage', 7], ['farm', 10], ['farm', 6], ['timber_camp', 9], ['timber_camp', 7],
['clay_pit', 8], ['clay_pit', 6], ['iron_mine', 8], ['hiding_place', 3], ['wall', 9], ['rally_point', 1], ['barracks', 7], ['stable', 4], ['workshop', 2], ['hospital', 6], ['market', 8],
]
const buildings = levels.map(([type, level], i): Building => ({
id: i + 1, type, level, space: SPACE[type] ?? 4, priority: 5,
workers: { assigned: 4, required: 4 }, staffing: 1, production: null, upgrade: null, demolish: null, effects: [], next_effects: null, instance_share: 1,
}))
return {
id: 0, points: 2400, buildings, queue: [], troops: { spear: 160, sword: 90, light_cavalry: 30 },
support: { here: [], away: [] }, military: [], buildable: [], movements: [],
} as unknown as VillageState
}