Commit a9ff147f authored by Matthew Odle's avatar Matthew Odle

calculate building production rate

parent bfe83d01
......@@ -2,99 +2,73 @@ import KNOBS_AND_LEVERS from './knobs-and-levers';
let theBuildings = [
{type: 'production',
id: 100,
priority: 100,
name: 'SMITHY',
label: 'Smithy',
description: 'workers are more efficient with the right tools',
materials: {'wood': 1, 'iron': 1},
goods: {'tool': 1},
assignedVillagers: [],
capacity: KNOBS_AND_LEVERS.defaultCapacity,
progress: 0,
baseProductionRate: KNOBS_AND_LEVERS.defaultProductionRate,
producing: false
},
{type: 'extraction',
id: 10,
priority: 10,
name: 'FORESTER_HUT',
label: "Forester's Hut",
description: "it's big, it's heavy, it's wood",
goods: {'wood': 1},
assignedVillagers: [],
capacity: KNOBS_AND_LEVERS.defaultCapacity,
progress: 0,
baseProductionRate: KNOBS_AND_LEVERS.defaultProductionRate,
producing: false
},
{type: 'extraction',
id: 20,
priority: 20,
name: 'GATHERER_HUT',
label: "Gatherer's Hut",
description: "nuts, berries, and tubers are packed with nutrients",
goods: {'food': 2},
assignedVillagers: [],
capacity: KNOBS_AND_LEVERS.defaultCapacity,
progress: 0,
baseProductionRate: KNOBS_AND_LEVERS.defaultProductionRate,
producing: false
},
{type: 'extraction',
id: 30,
priority: 30,
name: 'HUNTER_LODGE',
label: "Hunter's Lodge",
description: "take advantage of nature's bounty",
goods: {'food': 1, 'hide': 1},
assignedVillagers: [],
capacity: KNOBS_AND_LEVERS.defaultCapacity,
progress: 0,
baseProductionRate: KNOBS_AND_LEVERS.defaultProductionRate,
producing: false
},
{type: 'extraction',
id: 40,
priority: 40,
name: 'MINE',
label: "Mine",
description: "the strength of the earth to forge the tools",
goods: {'iron': 1},
assignedVillagers: [],
capacity: KNOBS_AND_LEVERS.defaultCapacity,
progress: 0,
baseProductionRate: KNOBS_AND_LEVERS.defaultProductionRate,
producing: false
},
{type: 'production',
id: 110,
priority: 110,
name: 'WOODCUTTER',
label: 'Woodcutter',
description: "it's big, it's heavy, it's wood",
materials: {'wood': 1},
goods: {'firewood': 3},
assignedVillagers: [],
capacity: KNOBS_AND_LEVERS.defaultCapacity,
progress: 0,
baseProductionRate: KNOBS_AND_LEVERS.defaultProductionRate,
producing: false
},
{type: 'production',
id: 120,
priority: 120,
name: 'TAILOR',
label: 'Tailor',
description: "clothing to keep warm",
materials: {'hide': 1},
goods: {'clothing': 1},
assignedVillagers: [],
capacity: KNOBS_AND_LEVERS.defaultCapacity,
progress: 0,
baseProductionRate: KNOBS_AND_LEVERS.defaultProductionRate,
producing: false
}
]
const setDefaults = () => {
let currentId = 0;
theBuildings.map( building => {
building.id = currentId;
currentId += 1;
building.capacity = KNOBS_AND_LEVERS.defaultCapacity;
building.progress = 0;
building.baseProductionRate = KNOBS_AND_LEVERS.defaultBaseProductionRate;
building.productionRate = 0;
building.producing = false;
building.assignedVillagers = [];
});
}
setDefaults();
export default theBuildings;
......@@ -33,7 +33,7 @@ const knobsAndLevers = {
productionComplete: 100,
defaultCapacity: 20,
defaultProductionRate: 1,
defaultBaseProductionRate: 1,
// defaultToolStores: 0,
// defaultFirewoodStores: 0,
......
......@@ -191,7 +191,8 @@ export class Village extends React.Component {
}
updateProductionStatus = (building, multiplier) => {
building.progress += building.baseProductionRate * multiplier;
building.productionRate = building.baseProductionRate * multiplier;
building.progress += building.productionRate;
this.degradeTools(building.assignedVillagers);
building.producing = true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment