2022-01-06 23:43:12 +00:00
|
|
|
import Decimal from 'break_infinity.js'
|
|
|
|
import { currencies } from './const.js'
|
2022-01-06 22:28:23 +00:00
|
|
|
|
|
|
|
export const state = () => ({
|
2022-01-06 23:43:12 +00:00
|
|
|
// use currencies from const as keys; initialize all values to zero
|
|
|
|
currency: Object.keys(currencies).reduce(function (obj, x) {
|
|
|
|
obj[x] = new Decimal(0)
|
|
|
|
return obj
|
|
|
|
}, {}),
|
2022-01-06 23:15:51 +00:00
|
|
|
|
2022-01-06 23:43:12 +00:00
|
|
|
processes: [
|
|
|
|
{
|
|
|
|
device: 'Star Chart',
|
|
|
|
worker: 'Shaman',
|
|
|
|
boughtWith: null,
|
|
|
|
produces: currencies.seasons,
|
2022-01-07 06:30:15 +00:00
|
|
|
buyWorkersWith: currencies.months,
|
2022-01-06 23:43:12 +00:00
|
|
|
deviceCount: new Decimal(0),
|
|
|
|
workerCount: new Decimal(0),
|
|
|
|
unlockThreshold: { [currencies.seasons]: 0, tech: null },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
device: 'Stone Calendar',
|
|
|
|
worker: 'Stonecarver',
|
|
|
|
boughtWith: currencies.seasons,
|
|
|
|
produces: currencies.months,
|
2022-01-07 06:30:15 +00:00
|
|
|
buyWorkersWith: currencies.days,
|
2022-01-06 23:43:12 +00:00
|
|
|
deviceCount: new Decimal(0),
|
|
|
|
workerCount: new Decimal(0),
|
|
|
|
unlockThreshold: { [currencies.seasons]: 1, tech: null },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
device: 'Astrolabes',
|
|
|
|
worker: 'Mathematician',
|
|
|
|
boughtWith: currencies.months,
|
2022-01-07 06:30:15 +00:00
|
|
|
buyWorkersWith: currencies.hours,
|
2022-01-06 23:43:12 +00:00
|
|
|
produces: currencies.days,
|
|
|
|
deviceCount: new Decimal(0),
|
|
|
|
workerCount: new Decimal(0),
|
|
|
|
unlockThreshold: { [currencies.days]: 10, tech: 0 },
|
|
|
|
},
|
|
|
|
],
|
2022-01-06 23:15:51 +00:00
|
|
|
|
2022-01-06 23:43:12 +00:00
|
|
|
upgrades: [
|
|
|
|
{
|
|
|
|
name: 'Mathematics',
|
|
|
|
boughtWith: currencies.seasons,
|
|
|
|
price: 100,
|
|
|
|
purchased: false,
|
|
|
|
},
|
|
|
|
],
|
2022-01-06 22:28:23 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
export const mutations = {
|
2022-01-06 23:43:12 +00:00
|
|
|
add(state, { key, value }) {
|
|
|
|
console.log(state.currency.keys())
|
|
|
|
state.currency[key] = Decimal.add(state.currency[key], value)
|
|
|
|
},
|
2022-01-06 22:28:23 +00:00
|
|
|
|
2022-01-06 23:43:12 +00:00
|
|
|
set(state, { key, value }) {
|
|
|
|
state.currency[key] = value
|
|
|
|
},
|
2022-01-06 22:28:23 +00:00
|
|
|
}
|