43 lines
2.4 KiB
TypeScript
43 lines
2.4 KiB
TypeScript
import type { BuildingType, Cost, Resource, Resources } from '~/types/game'
|
|
|
|
// Placeholder numbers so the PoC has something to show. They scale linearly with the
|
|
// level on purpose: the real values and formulas belong to the backend
|
|
// (config/game/buildings.php and app/Game/), not to the client.
|
|
|
|
export interface CatalogEntry {
|
|
/** Building space an instance takes (0 for the wall). */
|
|
space: number
|
|
max_per_village: number | null
|
|
/** Level 0 values. Level n costs, takes, needs and produces (n + 1) times as much. */
|
|
cost: Cost
|
|
seconds: number
|
|
workers: number
|
|
production: { resource: Resource; per_hour: number } | null
|
|
capacity?: number
|
|
}
|
|
|
|
export const MAX_LEVEL = 30
|
|
export const BUILDERS = 2
|
|
export const BASE_TRICKLE = 5
|
|
export const VILLAGER_UPKEEP = 1
|
|
export const DEMOLISH_REFUND = 0.5
|
|
export const DEFAULT_PRIORITY = 5
|
|
export const MAX_SPACE = 50
|
|
export const START_RESOURCES: Resources = { wood: 500, clay: 500, iron: 500, food: 100 }
|
|
|
|
export const CATALOG: Record<BuildingType, CatalogEntry> = {
|
|
headquarters: { space: 9, max_per_village: 1, cost: { wood: 90, clay: 80, iron: 70 }, seconds: 20, workers: 2, production: null },
|
|
storage: { space: 4, max_per_village: null, cost: { wood: 60, clay: 50, iron: 40 }, seconds: 15, workers: 1, production: null, capacity: 1000 },
|
|
farm: { space: 4, max_per_village: null, cost: { wood: 45, clay: 40, iron: 30 }, seconds: 15, workers: 2, production: { resource: 'food', per_hour: 20 } },
|
|
timber_camp: { space: 4, max_per_village: null, cost: { wood: 50, clay: 60, iron: 40 }, seconds: 12, workers: 2, production: { resource: 'wood', per_hour: 30 } },
|
|
clay_pit: { space: 4, max_per_village: null, cost: { wood: 65, clay: 50, iron: 40 }, seconds: 12, workers: 2, production: { resource: 'clay', per_hour: 30 } },
|
|
iron_mine: { space: 4, max_per_village: null, cost: { wood: 75, clay: 65, iron: 70 }, seconds: 14, workers: 2, production: { resource: 'iron', per_hour: 30 } },
|
|
hiding_place: { space: 1, max_per_village: null, cost: { wood: 50, clay: 60, iron: 50 }, seconds: 10, workers: 0, production: null },
|
|
wall: { space: 0, max_per_village: 1, cost: { wood: 50, clay: 100, iron: 20 }, seconds: 20, workers: 1, production: null },
|
|
rally_point: { space: 1, max_per_village: 1, cost: { wood: 10, clay: 40, iron: 30 }, seconds: 10, workers: 0, production: null },
|
|
}
|
|
|
|
export const BUILDING_TYPES = Object.keys(CATALOG) as BuildingType[]
|
|
|
|
export const atLevel = (base: number, level: number) => base * (level + 1)
|