Add fields and food consumption.
This commit is contained in:
parent
6f1c3b3070
commit
16db8ee0be
@ -22,8 +22,8 @@ export default {
|
|||||||
'iron': 100,
|
'iron': 100,
|
||||||
'food': 100,
|
'food': 100,
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
'woodcutter': {
|
'woodcutter': {
|
||||||
name: 'Woodcutter',
|
name: 'Woodcutter',
|
||||||
@ -40,9 +40,13 @@ export default {
|
|||||||
const prod = getEmptyResources();
|
const prod = getEmptyResources();
|
||||||
const outputPerMinute = 5 * (self.level * self.level);
|
const outputPerMinute = 5 * (self.level * self.level);
|
||||||
prod.wood = outputPerMinute;
|
prod.wood = outputPerMinute;
|
||||||
|
|
||||||
|
const intakePerMinute = Math.ceil(self.level / 5);
|
||||||
|
prod.food = -intakePerMinute;
|
||||||
|
|
||||||
return prod;
|
return prod;
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
'mine': {
|
'mine': {
|
||||||
name: 'Mine',
|
name: 'Mine',
|
||||||
@ -59,9 +63,13 @@ export default {
|
|||||||
const prod = getEmptyResources();
|
const prod = getEmptyResources();
|
||||||
const outputPerMinute = 5 * (self.level * self.level);
|
const outputPerMinute = 5 * (self.level * self.level);
|
||||||
prod.iron = outputPerMinute;
|
prod.iron = outputPerMinute;
|
||||||
|
|
||||||
|
const intakePerMinute = Math.ceil(self.level / 5);
|
||||||
|
prod.food = -intakePerMinute;
|
||||||
|
|
||||||
return prod;
|
return prod;
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
'pit': {
|
'pit': {
|
||||||
name: 'Pit',
|
name: 'Pit',
|
||||||
@ -78,9 +86,32 @@ export default {
|
|||||||
const prod = getEmptyResources();
|
const prod = getEmptyResources();
|
||||||
const outputPerMinute = 5 * (self.level * self.level);
|
const outputPerMinute = 5 * (self.level * self.level);
|
||||||
prod.stone = outputPerMinute;
|
prod.stone = outputPerMinute;
|
||||||
|
|
||||||
|
const intakePerMinute = Math.ceil(self.level / 5);
|
||||||
|
prod.food = -intakePerMinute;
|
||||||
|
|
||||||
return prod;
|
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': {
|
'warehouse': {
|
||||||
name: 'Warehouse',
|
name: 'Warehouse',
|
||||||
@ -101,8 +132,8 @@ export default {
|
|||||||
'stone': capacity,
|
'stone': capacity,
|
||||||
'iron': capacity,
|
'iron': capacity,
|
||||||
'food': 0,
|
'food': 0,
|
||||||
}
|
};
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'granary': {
|
'granary': {
|
||||||
@ -124,8 +155,8 @@ export default {
|
|||||||
'stone': 0,
|
'stone': 0,
|
||||||
'iron': 0,
|
'iron': 0,
|
||||||
'food': capacity,
|
'food': capacity,
|
||||||
}
|
};
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { writable } from "svelte/store";
|
import { writable } from "svelte/store";
|
||||||
|
|
||||||
import buildings from "./buildings";
|
import buildings from "./buildings";
|
||||||
import { createBuilding } from "./create";
|
import { createBuilding } from "./create";
|
||||||
import type { Building } from "./types";
|
import type { Building } from "./types";
|
||||||
@ -19,12 +20,16 @@ export interface VillageState {
|
|||||||
const village = writable<VillageState>({
|
const village = writable<VillageState>({
|
||||||
buildings: [
|
buildings: [
|
||||||
createBuilding(buildings.townhall),
|
createBuilding(buildings.townhall),
|
||||||
|
createBuilding(buildings.woodcutter),
|
||||||
|
createBuilding(buildings.pit),
|
||||||
|
createBuilding(buildings.mine),
|
||||||
|
createBuilding(buildings.field),
|
||||||
],
|
],
|
||||||
resources: {
|
resources: {
|
||||||
wood: 100,
|
wood: 60,
|
||||||
stone: 100,
|
stone: 60,
|
||||||
iron: 100,
|
iron: 60,
|
||||||
food: 0,
|
food: 50,
|
||||||
culture: 0,
|
culture: 0,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user