import type { BuildingType } from "../types"; import { getEmptyResources } from "../utils"; import type { VillageState } from "../village"; export default [ { type: 'townhall', name: 'Town Hall', autoBuilt: true, cost: (level: number) => { return { wood: level * 10, stone: level * 10, iron: level * 10, food: 0, }; }, behavior: { storage: (_V: VillageState, _self: BuildingType) => { return { 'wood': 100, 'stone': 100, 'iron': 100, 'food': 100, } }, }, }, { type: 'woodcutter', name: 'Woodcutter', autoBuilt: true, cost: (level: number) => { return { wood: level * 10, stone: level * 10, iron: level * 10, food: 0, }; }, behavior: { production: (V: VillageState, self: BuildingType) => { const prod = getEmptyResources(); const outputPerMinute = 5 * (self.level * self.level); prod.wood = outputPerMinute; const intakePerMinute = Math.ceil(self.level / 5); prod.food = -intakePerMinute; return prod; }, }, }, { type: 'mine', name: 'Mine', autoBuilt: true, cost: (level: number) => { return { wood: level * 10, stone: level * 10, iron: level * 10, food: 0, }; }, behavior: { production: (V: VillageState, self: BuildingType) => { const prod = getEmptyResources(); const outputPerMinute = 5 * (self.level * self.level); prod.iron = outputPerMinute; const intakePerMinute = Math.ceil(self.level / 5); prod.food = -intakePerMinute; return prod; }, }, }, { type: 'pit', name: 'Pit', autoBuilt: true, cost: (level: number) => { return { wood: level * 10, stone: level * 10, iron: level * 10, food: 0, }; }, behavior: { production: (V: VillageState, self: BuildingType) => { const prod = getEmptyResources(); const outputPerMinute = 5 * (self.level * self.level); prod.stone = outputPerMinute; const intakePerMinute = Math.ceil(self.level / 5); prod.food = -intakePerMinute; return prod; }, }, }, { type: 'field', name: 'Field', autoBuilt: true, cost: (level: number) => { return { wood: level * 10, stone: level * 10, iron: level * 10, food: 0, }; }, behavior: { production: (V: VillageState, self: BuildingType) => { const prod = getEmptyResources(); const outputPerMinute = 5 * (self.level * self.level); prod.food = outputPerMinute; return prod; }, }, }, { type: 'warehouse', name: 'Warehouse', cost: (level: number) => { return { wood: level * 10, stone: level * 10, iron: level * 10, food: 0, }; }, behavior: { storage: (V: VillageState, self: BuildingType) => { const x = self.level; const capacity = ( ( ( x + ( x * x ) ) / 2 ) + 3 ) * 25; return { 'wood': capacity, 'stone': capacity, 'iron': capacity, 'food': 0, }; }, }, }, { type: 'granary', name: 'Granary', cost: (level: number) => { return { wood: level * 10, stone: level * 10, iron: level * 10, food: 0, }; }, behavior: { storage: (V: VillageState, self: BuildingType) => { const x = self.level; const capacity = ( ( ( x + ( x * x ) ) / 2 ) + 3 ) * 25; return { 'wood': 0, 'stone': 0, 'iron': 0, 'food': capacity, }; }, }, }, { type: 'university', name: 'University', cost: (level: number) => { return { wood: level * 100, stone: level * 100, iron: level * 100, food: 0, }; }, behavior: { production: (V: VillageState, self: BuildingType) => { const prod = getEmptyResources(); const intakePerMinute = self.level * 2; prod.food = -intakePerMinute; return prod; }, units: { type: 'philosopher', recruitmentTime: (V: VillageState, self: BuildingType) => 2 - 0.06 * self.level, }, }, }, { type: 'barracks', name: 'Barracks', cost: (level: number) => { return { wood: level * 100, stone: level * 100, iron: level * 100, food: 0, }; }, behavior: { production: (V: VillageState, self: BuildingType) => { const prod = getEmptyResources(); const intakePerMinute = Math.ceil(self.level / 3) * 3; prod.food = -intakePerMinute; return prod; }, units: { type: 'soldier', recruitmentTime: (V: VillageState, self: BuildingType) => 1 - 0.03 * self.level, }, }, }, ];