feat: Issue 34 - instruments now produce spare time, at a rate proportional to the number of workers
This commit is contained in:
parent
af96580125
commit
095938e8eb
|
@ -102,11 +102,15 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
gametick() {
|
gametick() {
|
||||||
for (let i = 0; i <= 4; i++) {
|
for (let i = 0; i < this.$store.state.processes.length; i++) {
|
||||||
const currentCompletion = this.$store.state.processes[i].completion
|
const p = this.$store.state.processes[i]
|
||||||
const step = 100.0 / (6.0 * (i + 1)) // go at different rates
|
// const step = 100.0 / (6.0 * (i + 1)) // go at different rates
|
||||||
let newValue = currentCompletion + step
|
const step = p.workerRate * p.workerCount
|
||||||
if (newValue >= 100) newValue = newValue - 100
|
let newValue = p.completion + step
|
||||||
|
while (newValue >= 100) {
|
||||||
|
newValue = newValue - 100
|
||||||
|
this.$store.commit('addCurrency', p.reward)
|
||||||
|
}
|
||||||
this.$store.commit('setProcessCompletion', {
|
this.$store.commit('setProcessCompletion', {
|
||||||
processIndex: i,
|
processIndex: i,
|
||||||
value: newValue,
|
value: newValue,
|
||||||
|
|
|
@ -60,24 +60,30 @@ export const state = () => ({
|
||||||
instrument: 'Star Chart',
|
instrument: 'Star Chart',
|
||||||
worker: 'Shaman',
|
worker: 'Shaman',
|
||||||
deviceCount: new Decimal(0),
|
deviceCount: new Decimal(0),
|
||||||
workerCount: 0,
|
workerCount: 1,
|
||||||
completion: 0,
|
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 },
|
unlockThreshold: { tech: null, currency: 0 },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
instrument: 'Stone Calendar',
|
instrument: 'Stone Calendar',
|
||||||
worker: 'Stonecarver',
|
worker: 'Stonecarver',
|
||||||
deviceCount: new Decimal(0),
|
deviceCount: new Decimal(0),
|
||||||
workerCount: 0,
|
workerCount: 1,
|
||||||
completion: 0,
|
completion: 0,
|
||||||
|
workerRate: 4.0,
|
||||||
|
reward: 35,
|
||||||
unlockThreshold: { tech: null, currency: 10000 },
|
unlockThreshold: { tech: null, currency: 10000 },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
instrument: 'Astrolabes',
|
instrument: 'Astrolabes',
|
||||||
worker: 'Mathematician',
|
worker: 'Mathematician',
|
||||||
deviceCount: new Decimal(0),
|
deviceCount: new Decimal(0),
|
||||||
workerCount: 0,
|
workerCount: 1,
|
||||||
completion: 0,
|
completion: 0,
|
||||||
|
workerRate: 1.5,
|
||||||
|
reward: 80,
|
||||||
unlockThreshold: { tech: 0, currency: new Decimal(10e5) },
|
unlockThreshold: { tech: 0, currency: new Decimal(10e5) },
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
Reference in New Issue