bourgade/src/village.ts

47 lines
1.3 KiB
TypeScript
Raw Normal View History

import { writable } from "svelte/store";
import buildings from "./buildings";
import type { Building } from "./types";
export interface VillageState {
buildings: Building[];
resources: {
wood: number;
stone: number;
iron: number;
food: number;
culture: number;
};
}
let uid = 0;
const village = writable<VillageState>({
buildings: [
{ ...buildings.woodcutter, level: 1, id: uid++ },
{ ...buildings.woodcutter, level: 1, id: uid++ },
{ ...buildings.woodcutter, level: 1, id: uid++ },
{ ...buildings.woodcutter, level: 1, id: uid++ },
{ ...buildings.mine, level: 1, id: uid++ },
{ ...buildings.mine, level: 1, id: uid++ },
{ ...buildings.mine, level: 1, id: uid++ },
{ ...buildings.mine, level: 1, id: uid++ },
{ ...buildings.pit, level: 1, id: uid++ },
{ ...buildings.pit, level: 1, id: uid++ },
{ ...buildings.pit, level: 1, id: uid++ },
{ ...buildings.pit, level: 1, id: uid++ },
{ ...buildings.warehouse, level: 1, id: uid++ },
{ ...buildings.granary, level: 1, id: uid++ },
],
resources: {
wood: 100,
stone: 100,
iron: 100,
food: 0,
culture: 0,
},
});
export default village;