2024-10-21 15:35:32 +00:00
|
|
|
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;
|
2024-10-22 15:15:35 +00:00
|
|
|
};
|
2024-10-21 15:35:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
let uid = 0;
|
|
|
|
|
|
|
|
const village = writable<VillageState>({
|
|
|
|
buildings: [
|
2024-10-22 15:15:35 +00:00
|
|
|
{ ...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++ },
|
2024-10-21 15:35:32 +00:00
|
|
|
],
|
|
|
|
resources: {
|
|
|
|
wood: 100,
|
|
|
|
stone: 100,
|
|
|
|
iron: 100,
|
|
|
|
food: 0,
|
|
|
|
culture: 0,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
export default village;
|