2022-01-07 21:10:23 +00:00
|
|
|
import Decimal from 'break_infinity.js'
|
2022-01-07 22:28:21 +00:00
|
|
|
import Vue from 'vue'
|
2022-01-07 21:10:23 +00:00
|
|
|
|
2022-01-07 01:17:26 +00:00
|
|
|
export const state = () => ({
|
|
|
|
activeTabIndex: 0,
|
|
|
|
tabs: [
|
|
|
|
{
|
2022-01-08 23:42:22 +00:00
|
|
|
route: '/',
|
|
|
|
label: 'fas fa-clock',
|
|
|
|
title: 'Timekeeping Instruments',
|
2022-01-09 08:04:24 +00:00
|
|
|
darkColor: 'amber-900',
|
|
|
|
lightColor: 'amber-200',
|
2022-01-08 20:45:07 +00:00
|
|
|
locked: false,
|
2022-01-07 01:17:26 +00:00
|
|
|
},
|
|
|
|
{
|
2022-01-08 23:42:22 +00:00
|
|
|
route: '/apprentices',
|
|
|
|
label: 'fas fa-user-friends',
|
|
|
|
title: 'Apprentices',
|
2022-01-09 08:04:24 +00:00
|
|
|
darkColor: 'rose-900',
|
|
|
|
lightColor: 'rose-200',
|
2022-01-08 20:45:07 +00:00
|
|
|
locked: false,
|
2022-01-07 01:17:26 +00:00
|
|
|
},
|
|
|
|
{
|
2022-01-08 23:42:22 +00:00
|
|
|
route: '/missions',
|
|
|
|
label: 'fas fa-th-list',
|
2022-01-08 03:46:33 +00:00
|
|
|
title: 'Missions',
|
2022-01-09 08:04:24 +00:00
|
|
|
darkColor: 'sky-900',
|
|
|
|
lightColor: 'sky-200',
|
2022-01-08 23:42:22 +00:00
|
|
|
locked: false,
|
2022-01-07 01:17:26 +00:00
|
|
|
},
|
|
|
|
{
|
2022-01-08 23:42:22 +00:00
|
|
|
route: '/timemachine',
|
|
|
|
label: 'fas fa-fast-forward',
|
2022-01-08 03:46:33 +00:00
|
|
|
title: 'Time Machine',
|
2022-01-09 08:04:24 +00:00
|
|
|
darkColor: 'lime-900',
|
2022-01-07 01:17:26 +00:00
|
|
|
lightColor: 'lime-200',
|
2022-01-08 23:42:22 +00:00
|
|
|
locked: false,
|
2022-01-07 01:17:26 +00:00
|
|
|
},
|
|
|
|
{
|
2022-01-08 23:42:22 +00:00
|
|
|
route: '/timemagic',
|
|
|
|
label: 'fas fa-eye',
|
2022-01-08 03:46:33 +00:00
|
|
|
title: 'Time Magic',
|
2022-01-09 08:04:24 +00:00
|
|
|
darkColor: 'violet-900',
|
|
|
|
lightColor: 'violet-200',
|
2022-01-08 23:42:22 +00:00
|
|
|
locked: false,
|
2022-01-07 01:17:26 +00:00
|
|
|
},
|
|
|
|
{
|
2022-01-08 23:42:22 +00:00
|
|
|
route: '/wisdom',
|
|
|
|
label: 'fas fa-book-open',
|
|
|
|
title: 'Wisdom',
|
2022-01-09 08:04:24 +00:00
|
|
|
darkColor: 'teal-900',
|
|
|
|
lightColor: 'teal-100',
|
2022-01-08 23:42:22 +00:00
|
|
|
locked: false,
|
2022-01-07 01:17:26 +00:00
|
|
|
},
|
|
|
|
],
|
2022-01-07 21:10:23 +00:00
|
|
|
currency: new Decimal(0),
|
|
|
|
currencyTotal: new Decimal(0),
|
|
|
|
processes: [
|
|
|
|
{
|
2022-01-07 22:28:21 +00:00
|
|
|
instrument: 'Star Chart',
|
2022-01-07 21:10:23 +00:00
|
|
|
worker: 'Shaman',
|
|
|
|
deviceCount: new Decimal(0),
|
2022-01-09 17:52:17 +00:00
|
|
|
workerCount: 0,
|
2022-01-07 22:28:21 +00:00
|
|
|
completion: 0,
|
2022-01-09 17:52:17 +00:00
|
|
|
workerRate: 6.0, // amount added to "completion" (100=full bar) per worker
|
|
|
|
reward: 8, // currency added when the bar is completed
|
|
|
|
nextWorkerCost: 15, // currency cost of next worker
|
|
|
|
nextWorkerFactor: 1.4, // worker cost *= this factor after each purchase
|
2022-01-07 21:10:23 +00:00
|
|
|
unlockThreshold: { tech: null, currency: 0 },
|
|
|
|
},
|
|
|
|
{
|
2022-01-07 22:28:21 +00:00
|
|
|
instrument: 'Stone Calendar',
|
2022-01-07 21:10:23 +00:00
|
|
|
worker: 'Stonecarver',
|
|
|
|
deviceCount: new Decimal(0),
|
2022-01-09 17:52:17 +00:00
|
|
|
workerCount: 0,
|
2022-01-07 22:28:21 +00:00
|
|
|
completion: 0,
|
2022-01-09 03:56:36 +00:00
|
|
|
workerRate: 4.0,
|
|
|
|
reward: 35,
|
2022-01-09 17:52:17 +00:00
|
|
|
nextWorkerCost: 60,
|
|
|
|
nextWorkerFactor: 1.6,
|
2022-01-07 21:10:23 +00:00
|
|
|
unlockThreshold: { tech: null, currency: 10000 },
|
|
|
|
},
|
|
|
|
{
|
2022-01-07 22:28:21 +00:00
|
|
|
instrument: 'Astrolabes',
|
2022-01-07 21:10:23 +00:00
|
|
|
worker: 'Mathematician',
|
|
|
|
deviceCount: new Decimal(0),
|
2022-01-09 17:52:17 +00:00
|
|
|
workerCount: 0,
|
2022-01-07 22:28:21 +00:00
|
|
|
completion: 0,
|
2022-01-09 03:56:36 +00:00
|
|
|
workerRate: 1.5,
|
|
|
|
reward: 80,
|
2022-01-09 17:52:17 +00:00
|
|
|
nextWorkerCost: 90,
|
|
|
|
nextWorkerFactor: 1.8,
|
2022-01-07 21:10:23 +00:00
|
|
|
unlockThreshold: { tech: 0, currency: new Decimal(10e5) },
|
|
|
|
},
|
|
|
|
],
|
|
|
|
|
|
|
|
upgrades: [
|
|
|
|
{
|
|
|
|
name: 'Mathematics',
|
|
|
|
price: 100,
|
|
|
|
purchased: false,
|
|
|
|
},
|
|
|
|
],
|
2022-01-08 03:46:33 +00:00
|
|
|
|
|
|
|
missions: [
|
|
|
|
{
|
|
|
|
name: 'Create the Time Machine',
|
|
|
|
description: 'Soon you will be able to control time itself.',
|
|
|
|
completionCriteria: {
|
2022-01-09 18:12:52 +00:00
|
|
|
cost: 50000,
|
2022-01-08 03:46:33 +00:00
|
|
|
},
|
|
|
|
available: true,
|
|
|
|
viewed: false,
|
|
|
|
complete: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Time To Cheat Death',
|
|
|
|
description:
|
|
|
|
'Your body seems to be failing you. ' +
|
|
|
|
'Write a book to pass your knowedge to your younger self through the time machine. ' +
|
|
|
|
"Now where's your pen...",
|
|
|
|
appearanceCriteria: {
|
|
|
|
age: 100,
|
|
|
|
},
|
2022-01-09 18:12:52 +00:00
|
|
|
completionCriteria: {
|
|
|
|
cost: 150000,
|
|
|
|
},
|
2022-01-08 03:46:33 +00:00
|
|
|
available: true,
|
|
|
|
viewed: false,
|
|
|
|
complete: false,
|
|
|
|
},
|
|
|
|
],
|
2022-01-09 23:29:13 +00:00
|
|
|
gameDate: {
|
2022-01-09 23:34:50 +00:00
|
|
|
month: 12,
|
|
|
|
year: 1990,
|
2022-01-09 23:29:13 +00:00
|
|
|
},
|
|
|
|
playerAge: {
|
2022-01-09 23:34:50 +00:00
|
|
|
month: 0,
|
|
|
|
year: 34,
|
2022-01-09 23:29:13 +00:00
|
|
|
},
|
|
|
|
playerAgeMax: {
|
2022-01-09 23:34:50 +00:00
|
|
|
month: 0,
|
|
|
|
year: 80,
|
2022-01-09 23:29:13 +00:00
|
|
|
},
|
|
|
|
playerLivedTotal: {
|
2022-01-09 23:34:50 +00:00
|
|
|
month: 0,
|
|
|
|
year: 0,
|
2022-01-09 23:29:13 +00:00
|
|
|
},
|
|
|
|
wisdomGained: 0, // wisdom gained so far on this run, not applied until player sends the book.
|
|
|
|
wisdomApplied: 0, // wisdom from previous runs
|
2022-01-10 00:29:57 +00:00
|
|
|
totalLifetimes: 1,
|
2022-01-07 01:17:26 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
export const getters = {
|
|
|
|
activeTab: (state) => {
|
|
|
|
return state.tabs[state.activeTabIndex]
|
|
|
|
},
|
|
|
|
activeColorClasses: (state) => (index) => {
|
|
|
|
const { darkColor, lightColor } = state.tabs[index]
|
|
|
|
return `bg-${lightColor} text-${darkColor}`
|
|
|
|
},
|
|
|
|
inactiveColorClasses: (state) => (index) => {
|
|
|
|
const { darkColor, lightColor } = state.tabs[index]
|
|
|
|
return `bg-${darkColor} text-${lightColor}`
|
|
|
|
},
|
|
|
|
activeTabColorClasses: (state, getters) => {
|
|
|
|
return getters.activeColorClasses(state.activeTabIndex)
|
|
|
|
},
|
2022-01-09 23:29:13 +00:00
|
|
|
canTimeTravel: (state) => {
|
2022-01-09 23:34:50 +00:00
|
|
|
if (state.playerAge.year < state.playerAgeMax.year) return true
|
|
|
|
if (state.playerAge.year > state.playerAgeMax.year) return false
|
|
|
|
return state.playerAge.month < state.playerAgeMax.month
|
|
|
|
},
|
2022-01-10 00:05:58 +00:00
|
|
|
gameMonth: (state) => {
|
|
|
|
return {
|
|
|
|
1: 'Jan.',
|
|
|
|
2: 'Feb.',
|
|
|
|
3: 'Mar.',
|
|
|
|
4: 'Apr.',
|
|
|
|
5: 'May.',
|
|
|
|
6: 'Jun.',
|
|
|
|
7: 'Jul.',
|
|
|
|
8: 'Aug.',
|
|
|
|
9: 'Sep.',
|
|
|
|
10: 'Oct.',
|
|
|
|
11: 'Nov.',
|
|
|
|
12: 'Dec.',
|
|
|
|
}[state.gameDate.month]
|
|
|
|
},
|
2022-01-10 00:29:57 +00:00
|
|
|
currencySpent: (state) => {
|
|
|
|
return Decimal.subtract(state.currencyTotal, state.currency)
|
|
|
|
},
|
2022-01-07 01:17:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const mutations = {
|
|
|
|
setActiveTab: (state, index) => {
|
2022-01-08 20:45:07 +00:00
|
|
|
if (state.tabs[index].locked) return
|
2022-01-07 01:17:26 +00:00
|
|
|
state.activeTabIndex = index
|
|
|
|
},
|
2022-01-07 21:10:23 +00:00
|
|
|
addCurrency: (state, value) => {
|
|
|
|
state.currency = Decimal.add(state.currency, value)
|
|
|
|
state.currencyTotal = Decimal.add(state.currencyTotal, value)
|
|
|
|
},
|
|
|
|
spendCurrency: (state, value) => {
|
|
|
|
value = Decimal.mul(value, -1)
|
|
|
|
state.currency = Decimal.add(state.currency, value)
|
2022-01-07 21:19:21 +00:00
|
|
|
},
|
2022-01-07 22:28:21 +00:00
|
|
|
setProcessCompletion: (state, { processIndex, value }) => {
|
|
|
|
Vue.set(state.processes[processIndex], 'completion', value)
|
|
|
|
},
|
2022-01-08 03:46:33 +00:00
|
|
|
setMissionAvailable: (state, missionIndex) => {
|
|
|
|
Vue.set(state.missions[missionIndex], 'available', true)
|
|
|
|
},
|
|
|
|
setMissionViewed: (state, missionIndex) => {
|
|
|
|
Vue.set(state.missions[missionIndex], 'viewed', true)
|
|
|
|
},
|
|
|
|
completeMission: (state, missionIndex) => {
|
|
|
|
state.missions[missionIndex].complete = true
|
|
|
|
},
|
2022-01-09 17:52:17 +00:00
|
|
|
purchaseWorker: (state, processIndex) => {
|
|
|
|
const p = state.processes[processIndex]
|
|
|
|
if (p.nextWorkerCost > state.currency) return
|
|
|
|
state.currency = Decimal.subtract(state.currency, p.nextWorkerCost)
|
|
|
|
Vue.set(state.processes[processIndex], 'workerCount', p.workerCount + 1)
|
|
|
|
Vue.set(
|
|
|
|
state.processes[processIndex],
|
|
|
|
'nextWorkerCost',
|
|
|
|
Math.floor(p.nextWorkerCost * p.nextWorkerFactor)
|
|
|
|
)
|
|
|
|
},
|
2022-01-09 23:29:13 +00:00
|
|
|
tickGameDate: (state) => {
|
|
|
|
let gameYear = state.gameDate.year
|
|
|
|
let gameMonth = state.gameDate.month + 1
|
2022-01-10 00:05:58 +00:00
|
|
|
// Intentional: Months are 1 through 12, ages are 0 through 11.
|
2022-01-09 23:29:13 +00:00
|
|
|
if (gameMonth > 12) {
|
2022-01-09 23:34:50 +00:00
|
|
|
gameMonth = 1
|
|
|
|
gameYear = gameYear + 1
|
2022-01-09 23:29:13 +00:00
|
|
|
}
|
|
|
|
let ageYear = state.playerAge.year
|
|
|
|
let ageMonth = state.playerAge.month + 1
|
|
|
|
let wisdomGained = 0
|
2022-01-10 00:05:58 +00:00
|
|
|
if (ageMonth >= 12) {
|
|
|
|
ageMonth = 0
|
2022-01-09 23:34:50 +00:00
|
|
|
ageYear = ageYear + 1
|
|
|
|
wisdomGained += 1
|
2022-01-09 23:29:13 +00:00
|
|
|
}
|
|
|
|
Vue.set(state.gameDate, 'year', gameYear)
|
|
|
|
Vue.set(state.gameDate, 'month', gameMonth)
|
|
|
|
Vue.set(state.playerAge, 'year', ageYear)
|
|
|
|
Vue.set(state.playerAge, 'month', ageMonth)
|
|
|
|
state.wisdomGained = state.wisdomGained + wisdomGained
|
|
|
|
},
|
|
|
|
travelGameDate: (state, { month, year }) => {
|
|
|
|
Vue.set(state.gameDate, 'month', month)
|
|
|
|
Vue.set(state.gameDate, 'year', year)
|
|
|
|
},
|
2022-01-07 01:17:26 +00:00
|
|
|
}
|