diff --git a/pages/index.vue b/pages/index.vue index 015e9cd..3e4ee42 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -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, diff --git a/store/index.js b/store/index.js index 8624bdd..b90d909 100644 --- a/store/index.js +++ b/store/index.js @@ -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) }, }, ],