import type { Building } from "./types"; import { getEmptyResources } from "./utils"; import type { VillageState } from "./village"; export default { 'townhall': { name: 'Town Hall', cost: (level: number) => { return { wood: level * 10, stone: level * 10, iron: level * 10, food: 0, }; }, behavior: { storage: (_V: VillageState, _self: Building) => { return { 'wood': 100, 'stone': 100, 'iron': 100, 'food': 100, } }, }, }, 'woodcutter': { name: 'Woodcutter', cost: (level: number) => { return { wood: level * 10, stone: level * 10, iron: level * 10, food: 0, }; }, behavior: { production: (V: VillageState, self: Building) => { 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; }, }, }, 'mine': { name: 'Mine', cost: (level: number) => { return { wood: level * 10, stone: level * 10, iron: level * 10, food: 0, }; }, behavior: { production: (V: VillageState, self: Building) => { 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; }, }, }, 'pit': { name: 'Pit', cost: (level: number) => { return { wood: level * 10, stone: level * 10, iron: level * 10, food: 0, }; }, behavior: { production: (V: VillageState, self: Building) => { 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; }, }, }, 'field': { name: 'Field', cost: (level: number) => { return { wood: level * 10, stone: level * 10, iron: level * 10, food: 0, }; }, behavior: { production: (V: VillageState, self: Building) => { const prod = getEmptyResources(); const outputPerMinute = 5 * (self.level * self.level); prod.food = outputPerMinute; return prod; }, }, }, 'warehouse': { name: 'Warehouse', cost: (level: number) => { return { wood: level * 10, stone: level * 10, iron: level * 10, food: 0, }; }, behavior: { storage: (V: VillageState, self: Building) => { const x = self.level; const capacity = ( ( ( x + ( x * x ) ) / 2 ) + 3 ) * 25; return { 'wood': capacity, 'stone': capacity, 'iron': capacity, 'food': 0, }; }, }, }, 'granary': { name: 'Granary', cost: (level: number) => { return { wood: level * 10, stone: level * 10, iron: level * 10, food: 0, }; }, behavior: { storage: (V: VillageState, self: Building) => { const x = self.level; const capacity = ( ( ( x + ( x * x ) ) / 2 ) + 3 ) * 25; return { 'wood': 0, 'stone': 0, 'iron': 0, 'food': capacity, }; }, }, }, };