feat: Issue 34 - instruments now produce spare time, at a rate proportional to the number of workers

This commit is contained in:
John McCardle 2022-01-08 22:56:36 -05:00
parent af96580125
commit 095938e8eb
2 changed files with 18 additions and 8 deletions

View File

@ -102,11 +102,15 @@ export default {
},
methods: {
gametick() {
for (let i = 0; i <= 4; i++) {
const currentCompletion = this.$store.state.processes[i].completion
const step = 100.0 / (6.0 * (i + 1)) // go at different rates
let newValue = currentCompletion + step
if (newValue >= 100) newValue = newValue - 100
for (let i = 0; i < this.$store.state.processes.length; i++) {
const p = this.$store.state.processes[i]
// const step = 100.0 / (6.0 * (i + 1)) // go at different rates
const step = p.workerRate * p.workerCount
let newValue = p.completion + step
while (newValue >= 100) {
newValue = newValue - 100
this.$store.commit('addCurrency', p.reward)
}
this.$store.commit('setProcessCompletion', {
processIndex: i,
value: newValue,

View File

@ -60,24 +60,30 @@ export const state = () => ({
instrument: 'Star Chart',
worker: 'Shaman',
deviceCount: new Decimal(0),
workerCount: 0,
workerCount: 1,
completion: 0,
workerRate: 8.0, // amount added to "completion" (100=full bar) per worker
reward: 10, // currency added when the bar is completed
unlockThreshold: { tech: null, currency: 0 },
},
{
instrument: 'Stone Calendar',
worker: 'Stonecarver',
deviceCount: new Decimal(0),
workerCount: 0,
workerCount: 1,
completion: 0,
workerRate: 4.0,
reward: 35,
unlockThreshold: { tech: null, currency: 10000 },
},
{
instrument: 'Astrolabes',
worker: 'Mathematician',
deviceCount: new Decimal(0),
workerCount: 0,
workerCount: 1,
completion: 0,
workerRate: 1.5,
reward: 80,
unlockThreshold: { tech: 0, currency: new Decimal(10e5) },
},
],