2022-01-07 16:10:23 -05:00
import Decimal from 'break_infinity.js'
2022-01-07 17:28:21 -05:00
import Vue from 'vue'
2022-01-07 16:10:23 -05:00
2022-01-06 17:17:26 -08:00
export const state = ( ) => ( {
tabs : [
{
2022-01-08 15:42:22 -08:00
route : '/' ,
label : 'fas fa-clock' ,
title : 'Timekeeping Instruments' ,
2022-01-09 00:04:24 -08:00
darkColor : 'amber-900' ,
2022-01-09 22:08:59 -08:00
color : 'amber-400' ,
2022-01-09 00:04:24 -08:00
lightColor : 'amber-200' ,
2022-01-11 22:23:41 -08:00
unlocked : true ,
2022-01-06 17:17:26 -08:00
} ,
{
2022-01-08 15:42:22 -08:00
route : '/apprentices' ,
label : 'fas fa-user-friends' ,
title : 'Apprentices' ,
2022-01-09 00:04:24 -08:00
darkColor : 'rose-900' ,
2022-01-09 22:08:59 -08:00
color : 'rose-400' ,
2022-01-09 00:04:24 -08:00
lightColor : 'rose-200' ,
2022-01-11 22:23:41 -08:00
unlocked : false ,
2022-01-06 17:17:26 -08:00
} ,
{
2022-01-08 15:42:22 -08:00
route : '/missions' ,
label : 'fas fa-th-list' ,
2022-01-07 19:46:33 -08:00
title : 'Missions' ,
2022-01-09 00:04:24 -08:00
darkColor : 'sky-900' ,
2022-01-09 22:08:59 -08:00
color : 'sky-400' ,
2022-01-09 00:04:24 -08:00
lightColor : 'sky-200' ,
2022-01-11 22:23:41 -08:00
unlocked : false ,
2022-01-06 17:17:26 -08:00
} ,
{
2022-01-08 15:42:22 -08:00
route : '/timemachine' ,
label : 'fas fa-fast-forward' ,
2022-01-07 19:46:33 -08:00
title : 'Time Machine' ,
2022-01-09 00:04:24 -08:00
darkColor : 'lime-900' ,
2022-01-09 22:08:59 -08:00
color : 'lime-400' ,
2022-01-06 17:17:26 -08:00
lightColor : 'lime-200' ,
2022-01-11 22:23:41 -08:00
unlocked : false ,
2022-01-06 17:17:26 -08:00
} ,
{
2022-01-08 15:42:22 -08:00
route : '/timemagic' ,
label : 'fas fa-eye' ,
2022-01-07 19:46:33 -08:00
title : 'Time Magic' ,
2022-01-09 00:04:24 -08:00
darkColor : 'violet-900' ,
2022-01-09 22:08:59 -08:00
color : 'violet-400' ,
2022-01-09 00:04:24 -08:00
lightColor : 'violet-200' ,
2022-01-11 22:23:41 -08:00
unlocked : false ,
2022-01-06 17:17:26 -08:00
} ,
{
2022-01-08 15:42:22 -08:00
route : '/wisdom' ,
label : 'fas fa-book-open' ,
title : 'Wisdom' ,
2022-01-09 00:04:24 -08:00
darkColor : 'teal-900' ,
2022-01-09 22:08:59 -08:00
color : 'teal-400' ,
2022-01-09 00:04:24 -08:00
lightColor : 'teal-100' ,
2022-01-11 22:23:41 -08:00
unlocked : false ,
2022-01-06 17:17:26 -08:00
} ,
] ,
2022-01-14 22:02:55 -08:00
modalText : '' ,
modalIsOpen : false ,
2022-01-11 22:23:41 -08:00
2022-01-13 23:15:32 -08:00
gameStopped : false ,
currency : new Decimal ( 0 ) ,
2022-01-07 16:10:23 -05:00
currencyTotal : new Decimal ( 0 ) ,
2022-01-11 22:23:41 -08:00
2022-01-13 21:38:19 -08:00
gameDate : 1400 * 12 ,
gameEra : 'Early Modern' ,
2022-01-14 21:22:16 -05:00
gameTimeTotal : 0 ,
gameDateRecord : 0 ,
2022-01-12 21:37:30 -08:00
2022-01-13 21:38:19 -08:00
playerAge : 30 * 12 ,
playerAgeMax : 60 * 12 ,
2022-01-14 21:22:16 -05:00
playerAgeRecord : 0 ,
2022-01-13 21:38:19 -08:00
playerLivedTotal : 0 ,
wisdomGained : 0 , // wisdom gained so far on this run, not applied until player sends the book.
wisdomApplied : 0 , // wisdom from previous runs
lifetimes : 0 , // comleted lifetimes
timeJumpsBackwards : 0 ,
2022-01-11 22:23:41 -08:00
2022-01-07 16:10:23 -05:00
processes : [
{
2022-01-11 20:24:29 -08:00
instrument : 'Atlantean Clock' ,
worker : 'Chronomancer' ,
2022-01-12 21:37:30 -08:00
created : false ,
cost : 1000000000000 ,
2022-01-10 02:16:25 -08:00
2022-01-11 20:24:29 -08:00
unlockEra : 'Prehistoric' ,
2022-01-12 21:37:30 -08:00
minDateUnlocked : - 12000 * 12 ,
travelCost : 2400 ,
visited : false ,
2022-01-10 02:16:25 -08:00
2022-01-11 17:47:12 -05:00
completion : 0 ,
2022-01-11 20:24:29 -08:00
completionRequired : 320 ,
baseReward : 500000000000 ,
2022-01-10 02:16:25 -08:00
2022-01-11 17:47:12 -05:00
workerLevel : 0 ,
2022-01-11 20:24:29 -08:00
nextWorkerCost : 5000000000000 ,
2022-01-14 20:42:18 -05:00
baseWorkerCost : 5000000000000 ,
2022-01-11 17:47:12 -05:00
nextWorkerFactor : 1.8 ,
2022-01-10 02:16:25 -08:00
2022-01-11 17:47:12 -05:00
unlockThreshold : { tech : null , currency : new Decimal ( 1e1 ) } ,
} ,
{
2022-01-11 18:49:18 -05:00
instrument : 'Sundial' ,
2022-01-11 20:24:29 -08:00
worker : 'Shaman' ,
2022-01-12 21:37:30 -08:00
created : false ,
cost : 10000000000 ,
2022-01-11 17:47:12 -05:00
2022-01-11 20:24:29 -08:00
unlockEra : 'Antiquity' ,
2022-01-12 21:37:30 -08:00
minDateUnlocked : - 1500 * 12 ,
travelCost : 2200 ,
visited : false ,
2022-01-11 17:47:12 -05:00
completion : 0 ,
2022-01-11 18:49:18 -05:00
completionRequired : 160 ,
2022-01-11 20:24:29 -08:00
baseReward : 50000000000 ,
workerLevel : 0 ,
nextWorkerCost : 50000000000 ,
2022-01-14 20:42:18 -05:00
baseWorkerCost : 50000000000 ,
2022-01-11 20:24:29 -08:00
nextWorkerFactor : 1.8 ,
unlockThreshold : { tech : null , currency : new Decimal ( 1e1 ) } ,
} ,
{
instrument : 'Star Chart' ,
worker : 'Astrologer' ,
cost : 100000000 ,
created : false ,
2022-01-12 21:37:30 -08:00
unlockEra : 'Early Classical' ,
minDateUnlocked : - 500 * 12 ,
travelCost : 1800 ,
visited : false ,
2022-01-11 20:24:29 -08:00
completion : 0 ,
completionRequired : 80 ,
baseReward : 50000000 ,
2022-01-11 17:47:12 -05:00
workerLevel : 0 ,
2022-01-11 20:24:29 -08:00
nextWorkerCost : 500000000 ,
2022-01-14 20:42:18 -05:00
baseWorkerCost : 500000000 ,
2022-01-11 20:24:29 -08:00
nextWorkerFactor : 1.8 ,
unlockThreshold : { tech : null , currency : new Decimal ( 1e1 ) } ,
} ,
{
instrument : 'Incense Clock' ,
worker : 'Oracle' ,
cost : 1000000 ,
created : false ,
2022-01-12 21:37:30 -08:00
unlockEra : 'Classical' ,
minDateUnlocked : 400 * 12 ,
travelCost : 1400 ,
visited : false ,
2022-01-11 20:24:29 -08:00
completion : 0 ,
completionRequired : 40 ,
baseReward : 500000 ,
workerLevel : 0 ,
nextWorkerCost : 5000000 ,
2022-01-14 20:42:18 -05:00
baseWorkerCost : 5000000 ,
2022-01-11 17:47:12 -05:00
nextWorkerFactor : 1.8 ,
unlockThreshold : { tech : null , currency : new Decimal ( 1e1 ) } ,
} ,
{
instrument : 'Astrolabe' ,
worker : 'Mathematician' ,
2022-01-11 20:24:29 -08:00
cost : 10000 ,
2022-01-11 17:47:12 -05:00
created : false ,
2022-01-12 21:37:30 -08:00
unlockEra : 'Late Classical' ,
minDateUnlocked : 700 * 12 ,
travelCost : 1000 ,
visited : false ,
2022-01-11 17:47:12 -05:00
completion : 0 ,
2022-01-11 18:49:18 -05:00
completionRequired : 20 ,
2022-01-11 20:24:29 -08:00
baseReward : 5000 ,
2022-01-11 17:47:12 -05:00
workerLevel : 0 ,
2022-01-11 20:24:29 -08:00
nextWorkerCost : 50000 ,
2022-01-14 20:42:18 -05:00
baseWorkerCost : 50000 ,
2022-01-11 17:47:12 -05:00
nextWorkerFactor : 1.8 ,
unlockThreshold : { tech : null , currency : new Decimal ( 1e1 ) } ,
2022-01-07 16:10:23 -05:00
} ,
{
2022-01-10 02:16:25 -08:00
instrument : 'Hourglass' ,
worker : 'Glassblower' ,
cost : 100 ,
created : false ,
2022-01-12 21:37:30 -08:00
unlockEra : 'Middle Ages' ,
minDateUnlocked : 1100 * 12 ,
travelCost : 600 ,
visited : false ,
2022-01-07 17:28:21 -05:00
completion : 0 ,
2022-01-11 18:49:18 -05:00
completionRequired : 10 ,
2022-01-11 20:24:29 -08:00
baseReward : 50 ,
2022-01-10 02:16:25 -08:00
workerLevel : 0 ,
2022-01-11 20:24:29 -08:00
nextWorkerCost : 500 ,
2022-01-14 20:42:18 -05:00
baseWorkerCost : 500 ,
2022-01-09 12:52:17 -05:00
nextWorkerFactor : 1.6 ,
2022-01-10 02:16:25 -08:00
2022-01-07 16:10:23 -05:00
unlockThreshold : { tech : null , currency : 10000 } ,
} ,
2022-01-11 20:24:29 -08:00
{
instrument : 'Mechanical Clock' ,
worker : 'Machinist' ,
2022-01-12 21:37:30 -08:00
cost : 10 ,
created : false ,
2022-01-11 20:24:29 -08:00
minDateUnlocked : 1400 * 12 ,
unlockEra : 'Early Modern' ,
2022-01-12 21:37:30 -08:00
travelCost : 400 ,
visited : true ,
2022-01-11 20:24:29 -08:00
completion : 0 , // how close it is to giving currency. 10 gained per second.
completionRequired : 10 , // should be divisible by 10
baseReward : 5 , // currency added when the bar is completed
workerLevel : 0 , // 0 = not hired; 1+ = hired
nextWorkerCost : 50 , // currency cost of next worker
2022-01-14 20:42:18 -05:00
baseWorkerCost : 50 , // currency cost of first worker (for prestige reset)
2022-01-11 20:24:29 -08:00
nextWorkerFactor : 1.5 , // worker cost *= this factor after each purchase
unlockThreshold : { tech : null , currency : 0 } ,
} ,
2022-01-07 16:10:23 -05:00
{
2022-01-10 02:16:25 -08:00
instrument : 'Pocket Watch' ,
2022-01-11 20:24:29 -08:00
worker : 'Engineer' ,
2022-01-10 02:16:25 -08:00
cost : 1000 ,
created : false ,
2022-01-12 21:37:30 -08:00
unlockEra : 'Modern' ,
minDateUnlocked : 1600 * 12 ,
travelCost : 800 ,
visited : false ,
2022-01-07 17:28:21 -05:00
completion : 0 ,
2022-01-11 20:24:29 -08:00
completionRequired : 8 ,
baseReward : 500 ,
2022-01-10 02:16:25 -08:00
workerLevel : 0 ,
2022-01-11 20:24:29 -08:00
nextWorkerCost : 5000 ,
2022-01-14 20:42:18 -05:00
baseWorkerCost : 5000 ,
2022-01-09 12:52:17 -05:00
nextWorkerFactor : 1.8 ,
2022-01-10 02:16:25 -08:00
2022-01-07 16:10:23 -05:00
unlockThreshold : { tech : 0 , currency : new Decimal ( 10e5 ) } ,
} ,
2022-01-11 17:47:12 -05:00
{
2022-01-11 20:24:29 -08:00
instrument : 'Electric Clock' ,
worker : 'Electrician' ,
cost : 100000 ,
2022-01-11 17:47:12 -05:00
created : false ,
2022-01-12 21:37:30 -08:00
unlockEra : 'Late Modern' ,
minDateUnlocked : 1840 * 12 ,
travelCost : 1200 ,
visited : false ,
2022-01-11 17:47:12 -05:00
completion : 0 ,
2022-01-11 20:24:29 -08:00
completionRequired : 6 ,
baseReward : 50000 ,
2022-01-11 17:47:12 -05:00
workerLevel : 0 ,
2022-01-11 20:24:29 -08:00
nextWorkerCost : 500000 ,
2022-01-14 20:42:18 -05:00
baseWorkerCost : 500000 ,
2022-01-11 17:47:12 -05:00
nextWorkerFactor : 1.8 ,
unlockThreshold : { tech : null , currency : new Decimal ( 1e1 ) } ,
} ,
{
2022-01-11 20:24:29 -08:00
instrument : 'Atomic Clock' ,
worker : 'Scientist' ,
cost : 10000000 ,
2022-01-11 17:47:12 -05:00
created : false ,
2022-01-12 21:37:30 -08:00
unlockEra : 'Post-Modern' ,
minDateUnlocked : 1950 * 12 ,
travelCost : 1600 ,
visited : false ,
2022-01-11 17:47:12 -05:00
completion : 0 ,
2022-01-11 20:24:29 -08:00
completionRequired : 4 ,
baseReward : 5000000 ,
2022-01-11 17:47:12 -05:00
workerLevel : 0 ,
2022-01-11 20:24:29 -08:00
nextWorkerCost : 50000000 ,
2022-01-14 20:42:18 -05:00
baseWorkerCost : 50000000 ,
2022-01-11 17:47:12 -05:00
nextWorkerFactor : 1.8 ,
unlockThreshold : { tech : null , currency : new Decimal ( 1e1 ) } ,
} ,
{
2022-01-11 20:24:29 -08:00
instrument : 'Quantum Clock' ,
worker : 'Artificial Intelligence' ,
cost : 1000000000 ,
2022-01-11 17:47:12 -05:00
created : false ,
2022-01-12 21:37:30 -08:00
unlockEra : 'Near Future' ,
minDateUnlocked : 2200 * 12 ,
travelCost : 2000 ,
visited : false ,
2022-01-11 20:24:29 -08:00
completion : 0 ,
completionRequired : 3 ,
baseReward : 500000000 ,
2022-01-11 17:47:12 -05:00
2022-01-11 20:24:29 -08:00
workerLevel : 0 ,
nextWorkerCost : 5000000000 ,
2022-01-14 20:42:18 -05:00
baseWorkerCost : 5000000000 ,
2022-01-11 20:24:29 -08:00
nextWorkerFactor : 1.8 ,
2022-01-11 17:47:12 -05:00
2022-01-11 20:24:29 -08:00
unlockThreshold : { tech : null , currency : new Decimal ( 1e1 ) } ,
2022-01-11 17:47:12 -05:00
} ,
{
2022-01-11 20:24:29 -08:00
instrument : 'Non-Euclidian Clock' ,
worker : 'Befuddled Scientist' ,
cost : 100000000000 ,
2022-01-11 17:47:12 -05:00
created : false ,
2022-01-12 21:37:30 -08:00
unlockEra : 'Future' ,
minDateUnlocked : 3333 * 12 ,
travelCost : 2400 ,
visited : false ,
2022-01-11 17:47:12 -05:00
completion : 0 ,
2022-01-11 20:24:29 -08:00
completionRequired : 2 ,
baseReward : 50000000000 ,
2022-01-11 17:47:12 -05:00
workerLevel : 0 ,
2022-01-11 20:24:29 -08:00
nextWorkerCost : 500000000000 ,
2022-01-14 20:42:18 -05:00
baseWorkerCost : 500000000000 ,
2022-01-11 17:47:12 -05:00
nextWorkerFactor : 1.8 ,
unlockThreshold : { tech : null , currency : new Decimal ( 1e1 ) } ,
} ,
{
2022-01-11 20:24:29 -08:00
instrument : 'Pulsar Clock' ,
worker : 'Deep-Space Satellite' ,
2022-01-12 21:37:30 -08:00
created : false ,
cost : 10000000000000 ,
2022-01-11 17:47:12 -05:00
2022-01-11 20:24:29 -08:00
unlockEra : 'Deep Future' ,
2022-01-12 21:37:30 -08:00
minDateUnlocked : 9000 * 12 ,
travelCost : 2800 ,
visited : false ,
2022-01-11 17:47:12 -05:00
completion : 0 ,
2022-01-11 20:24:29 -08:00
completionRequired : 1 ,
baseReward : 5000000000000 ,
2022-01-11 17:47:12 -05:00
workerLevel : 0 ,
2022-01-11 20:24:29 -08:00
nextWorkerCost : 50000000000000 ,
2022-01-14 20:42:18 -05:00
baseWorkerCost : 50000000000000 ,
2022-01-11 17:47:12 -05:00
nextWorkerFactor : 1.8 ,
unlockThreshold : { tech : null , currency : new Decimal ( 1e1 ) } ,
} ,
2022-01-07 16:10:23 -05:00
] ,
upgrades : [
{
name : 'Mathematics' ,
price : 100 ,
purchased : false ,
} ,
] ,
2022-01-07 19:46:33 -08:00
2022-01-13 21:38:19 -08:00
// Missions
2022-01-07 19:46:33 -08:00
missions : [
2022-01-10 21:48:15 -08:00
{
name : 'Train an Apprentice' ,
description :
'One man can only spend so much time staring at clocks each day. Hiring a second may make this easier.' ,
unlockCriteria : {
unit : 'instruments' ,
value : 1 ,
} ,
completionCriteria : {
unit : 'apprenticeLevels' ,
2022-01-13 21:38:19 -08:00
value : 3 ,
2022-01-10 21:48:15 -08:00
} ,
unlocked : true ,
viewed : false ,
complete : false ,
2022-01-11 17:30:14 -05:00
resetOnPrestige : false ,
2022-01-10 21:48:15 -08:00
} ,
{
2022-01-13 21:38:19 -08:00
name : 'Create the Time Machine' ,
2022-01-10 21:48:15 -08:00
description :
2022-01-13 21:38:19 -08:00
'Your magnum opus. Soon you will be able to control time itself.' ,
2022-01-10 21:48:15 -08:00
unlockCriteria : {
2022-01-13 21:38:19 -08:00
unit : 'missionsCompleted' ,
value : [ 'Train an Apprentice' ] ,
2022-01-10 21:48:15 -08:00
} ,
completionCriteria : {
unit : 'spareTime' ,
2022-01-13 23:15:32 -08:00
value : 300 ,
2022-01-10 21:48:15 -08:00
} ,
2022-01-13 21:38:19 -08:00
unlocked : false ,
2022-01-10 21:48:15 -08:00
viewed : false ,
complete : false ,
2022-01-13 21:38:19 -08:00
resetOnPrestige : false ,
2022-01-10 21:48:15 -08:00
} ,
2022-01-07 19:46:33 -08:00
{
2022-01-13 21:38:19 -08:00
name : 'Study Time Magic' ,
2022-01-10 21:48:15 -08:00
description :
2022-01-13 21:38:19 -08:00
"As time ticks away you begin to ponder the mysteries of time's origins and possibilities." ,
2022-01-10 21:48:15 -08:00
unlockCriteria : {
2022-01-13 21:38:19 -08:00
unit : 'eraVisited' ,
value : 'Middle Ages' ,
2022-01-10 21:48:15 -08:00
} ,
2022-01-07 19:46:33 -08:00
completionCriteria : {
2022-01-10 21:48:15 -08:00
unit : 'spareTime' ,
2022-01-13 21:38:19 -08:00
value : 250 ,
2022-01-07 19:46:33 -08:00
} ,
2022-01-13 21:38:19 -08:00
unlocked : true ,
2022-01-07 19:46:33 -08:00
viewed : false ,
complete : false ,
2022-01-13 21:38:19 -08:00
resetOnPrestige : true ,
2022-01-07 19:46:33 -08:00
} ,
{
2022-01-11 17:30:14 -05:00
name : 'Time to Cheat Death' ,
2022-01-07 19:46:33 -08:00
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..." ,
2022-01-10 21:48:15 -08:00
unlockCriteria : {
2022-01-11 22:23:41 -08:00
unit : 'missionsCompleted' ,
value : [ 'Create the Time Machine' ] ,
2022-01-07 19:46:33 -08:00
} ,
2022-01-09 13:12:52 -05:00
completionCriteria : {
2022-01-10 21:48:15 -08:00
unit : 'maxAge' ,
2022-01-09 13:12:52 -05:00
} ,
2022-01-10 21:48:15 -08:00
unlocked : false ,
2022-01-07 19:46:33 -08:00
viewed : false ,
complete : false ,
2022-01-11 17:30:14 -05:00
resetOnPrestige : false ,
} ,
2022-01-14 20:42:18 -05:00
{
// update doPrestige (mutation) if this is renamed
name : 'Time Travel Precision' ,
description :
'The time machine could target a certain month instead of a decade, ' +
'with the proper calibration. Send it to yourself as a child and ' +
'give your past self even more of a head start.' ,
unlockCriteria : {
unit : 'missionsCompleted' ,
value : [ 'Time to Cheat Death' , 'Create the Time Machine' ] ,
} ,
completionCriteria : {
unit : 'spareTime' ,
value : 1e15 ,
} ,
unlocked : false ,
viewed : false ,
complete : false ,
resetOnPrestige : false ,
} ,
2022-01-13 21:38:19 -08:00
// {
// name: 'Live Forever',
// description:
// "Seek out the philosopher's stone so that you can extend your lifespan.",
// unlockCriteria: {
// unit: 'eraVisited',
// value: 'Middle Ages',
// },
// completionCriteria: {
// unit: 'spareTime',
// value: 2000,
// },
// unlocked: false,
// viewed: false,
// complete: false,
// resetOnPrestige: false,
// },
2022-01-11 17:30:14 -05:00
{
2022-01-11 22:23:41 -08:00
name : 'Cheat Death... Again' ,
2022-01-11 17:30:14 -05:00
description :
'Another life well lived. ' +
'Add a few chapters to the tome you received and send it back again.' ,
unlockCriteria : {
unit : 'missionsCompleted' ,
value : [ 'Time to Cheat Death' , 'Create the Time Machine' ] ,
} ,
completionCriteria : {
unit : 'maxAge' ,
} ,
unlocked : false ,
viewed : false ,
complete : false ,
resetOnPrestige : true ,
2022-01-07 19:46:33 -08:00
} ,
] ,
2022-01-10 21:48:15 -08:00
2022-01-13 21:38:19 -08:00
// Time Machine
2022-01-13 23:15:32 -08:00
energy : 0 ,
2022-01-13 21:38:19 -08:00
energyMax : 600 , // 60 seconds
fluxCapacitorLevel : 1 ,
nextFluxCapacitorCost : 500 ,
2022-01-11 22:23:41 -08:00
timeMachineActions : [
{
name : 'Activate!' ,
description : 'Will it work?? Only one way to find out!' ,
cost : 600 ,
unlocked : true ,
} ,
{
name : 'Jump Forwards a Lot' ,
description : 'This time is boring. You yearn for more interesting times.' ,
cost : 1000 ,
unlocked : true ,
} ,
{
name : 'Loop Back Around' ,
description : '...' ,
cost : 2000 ,
unlocked : true ,
} ,
{
name : 'Jump Forwards a Little' ,
description :
'Visit your apprentices a few years into the future to benefit from the fruits of their labor.' ,
cost : 300 ,
unlocked : true ,
} ,
] ,
2022-01-13 21:38:19 -08:00
// Time Magic
2022-01-13 23:15:32 -08:00
mana : 0 ,
2022-01-13 21:38:19 -08:00
manaMax : 100 ,
philosophersStoneUnlocked : false ,
spells : [
{
name : 'Chrono Deluge' ,
description :
'For 30 seconds, your taps gain additional spare time equal to the total level of your Apprentices. (x{{apprenticeLevels}})' ,
cost : 100 ,
duration : 300 ,
elapsed : 0 ,
unlocked : true ,
} ,
{
name : 'Electric Touch' ,
description : 'For 15 seconds, your taps gain 5 energy as well.' ,
cost : 100 ,
duration : 150 ,
elapsed : 0 ,
unlocked : false ,
} ,
{
name : 'Thermodynamic Loophole' ,
description : 'For 60 seconds, your taps gain triple mana.' ,
cost : 100 ,
duration : 600 ,
elapsed : 0 ,
unlocked : false ,
} ,
] ,
philosophersStoneActions : [
{
name : 'Empower the Stone' ,
description :
'Increase the number of months the stone adds or subtracts to your lifespan.' ,
} ,
{
name : 'Forever Young' ,
description : 'Decrease curreny age.' ,
} ,
{
name : 'Necromancy' ,
description : 'Increase maximum lifespan.' ,
} ,
] ,
philosophersStoneIncrement : 6 ,
2022-01-06 17:17:26 -08:00
} )
export const getters = {
2022-01-09 19:28:09 -08:00
activeTab ( state ) {
return state . tabs . find (
// eslint-disable-next-line no-undef
( tab ) => tab . route === $nuxt . $route . path
)
2022-01-06 17:17:26 -08:00
} ,
2022-01-11 22:23:41 -08:00
isTabUnlocked : ( state ) => ( title ) => {
return state . tabs . find ( ( t ) => t . title === title ) . unlocked
} ,
2022-01-09 18:29:13 -05:00
canTimeTravel : ( state ) => {
2022-01-09 18:34:50 -05: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-09 19:05:58 -05:00
gameMonth : ( state ) => {
2022-01-14 14:59:12 -05:00
const gd = state . gameDate < 0 ? state . gameDate + 1440000 : state . gameDate
2022-01-09 19:05:58 -05:00
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.' ,
2022-01-14 14:59:12 -05:00
} [ ( gd % 12 ) + 1 ]
2022-01-10 18:19:34 -05:00
} ,
gameYear : ( state ) => {
return Math . floor ( state . gameDate / 12 )
2022-01-09 19:05:58 -05:00
} ,
2022-01-14 21:22:16 -05:00
gameDateRecordText : ( state ) => {
return (
( state . gameDateRecord % 12 ) +
1 +
'/' +
Math . floor ( state . gameDateRecord / 12 )
)
} ,
gameTimeTotalText : ( state ) => {
return ` ${ Math . floor ( state . gameTimeTotal / 12 ) } y ${
state . gameTimeTotal % 12
} m `
} ,
2022-01-09 19:29:57 -05:00
currencySpent : ( state ) => {
return Decimal . subtract ( state . currencyTotal , state . currency )
} ,
2022-01-10 21:09:32 -05:00
ageText : ( state ) => {
const year = Math . floor ( state . playerAge / 12 )
const month = state . playerAge % 12
return ` ${ year } y ${ month } m `
} ,
ageMaxText : ( state ) => {
const year = Math . floor ( state . playerAgeMax / 12 )
const month = state . playerAgeMax % 12
return ` ${ year } y ${ month } m `
} ,
2022-01-14 21:22:16 -05:00
ageRecordText : ( state ) => {
const year = Math . floor ( state . playerAgeRecord / 12 )
const month = state . playerAgeRecord % 12
return ` ${ year } y ${ month } m `
} ,
2022-01-10 21:48:15 -08:00
missionIsCompleted : ( state ) => ( missionName ) => {
const mission = state . missions . find ( ( m ) => m . name === missionName )
return mission && mission . complete
} ,
apprenticeLevels : ( state ) =>
state . processes . reduce (
( totalLevels , process ) => ( totalLevels += process . workerLevel ) ,
0
) ,
instruments : ( state ) =>
state . processes . reduce (
( totalInstruments , process ) =>
process . created ? totalInstruments + 1 : totalInstruments ,
0
) ,
2022-01-13 20:28:19 -05:00
suffixedDecimalText : ( state ) => ( n ) => {
2022-01-13 19:29:46 -08:00
const DIGITS _AFTER _DP = 2
2022-01-13 20:28:19 -05:00
const suffixValues = { Z : 0 , k : 1e3 , M : 1e6 , B : 1e9 , T : 1e12 , X : 1e15 }
n = new Decimal ( n )
// iterate over object above to find text suffix and divsior value
let largestSuffix = ''
let largestValue = 0
for ( const suffix in suffixValues ) {
if (
n . greaterThanOrEqualTo ( suffixValues [ suffix ] ) &&
suffixValues [ suffix ] > largestValue
) {
largestSuffix = suffix
largestValue = suffixValues [ suffix ]
}
}
// Special case: Small numbers are just displayed
if ( largestValue === 0 ) return Math . floor ( n )
// Special case: wicked large numbers are shown in scientific notation
if ( largestSuffix === 'X' ) {
largestSuffix = 'e' + n . exponent
largestValue = new Decimal . fromMantissaExponent ( 1 , n . exponent ) // eslint-disable-line new-cap
}
// display value is always in [1, 1000)
let displayValue = n . divide ( largestValue ) . toString ( )
// whole exact millions, billions, etc. have no decimal part, and need one built from text
if ( ! displayValue . includes ( '.' ) ) displayValue += '.'
// All suffixes should always show exactly DIGITS_AFTER_DP digits; add zeros or truncate
const valuesBeforeDP = displayValue . substr (
0 ,
displayValue . indexOf ( '.' )
) . length
let valuesAfterDP = displayValue . substr ( displayValue . indexOf ( '.' ) ) . length
if ( valuesAfterDP > DIGITS _AFTER _DP - 1 ) {
displayValue = displayValue . substr (
0 ,
valuesBeforeDP + DIGITS _AFTER _DP + 1
)
}
while ( valuesAfterDP < DIGITS _AFTER _DP + 1 ) {
valuesAfterDP += 1
displayValue += '0'
}
return displayValue + largestSuffix
} ,
2022-01-06 17:17:26 -08:00
}
export const mutations = {
2022-01-13 23:15:32 -08:00
// UI
unlockTab : ( state , title ) => {
const index = state . tabs . findIndex ( ( t ) => t . title === title )
Vue . set ( state . tabs [ index ] , 'unlocked' , true )
} ,
openModal : ( state , text ) => {
state . modalText = text
state . modalIsOpen = true
} ,
closeModal : ( state ) => {
state . modalIsOpen = false
state . modalText = ''
} ,
stopGame : ( state ) => {
state . gameStopped = true
} ,
startGame : ( state ) => {
state . gameStopped = false
} ,
// Currency
2022-01-07 16:10:23 -05: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 16:19:21 -05:00
} ,
2022-01-13 23:15:32 -08:00
// Dates
tickGameDate : ( state ) => {
state . gameDate += 1
state . playerAge += 1
if ( ! ( state . playerAge % 12 ) ) state . wisdomGained ++
2022-01-14 21:22:16 -05:00
state . gameTimeTotal += 1
if ( state . playerAge > state . playerAgeRecord )
state . playerAgeRecord = state . playerAge
if ( state . gameDate > state . gameDateRecord )
state . gameDateRecord = state . gameDate
2022-01-11 22:23:41 -08:00
} ,
2022-01-13 23:15:32 -08:00
setPlayerAge : ( state , { year , month = 0 } ) => {
state . playerAge = year * 12 + month
} ,
tickLifetime : ( state ) => {
state . lifetimes += 1
} ,
// Instruments
2022-01-10 02:16:25 -08:00
createInstrument : ( state , instrument ) => {
const index = state . processes . findIndex ( ( p ) => p . instrument === instrument )
Vue . set ( state . processes [ index ] , 'created' , true )
} ,
2022-01-11 20:24:29 -08:00
tickProcess : ( state , { process } ) => {
const index = state . processes . findIndex (
( p ) => p . instrument === process . instrument
)
Vue . set ( state . processes [ index ] , 'completion' , process . completion + 1 )
} ,
resetProcess : ( state , { process } ) => {
const index = state . processes . findIndex (
( p ) => p . instrument === process . instrument
)
Vue . set ( state . processes [ index ] , 'completion' , 0 )
2022-01-07 17:28:21 -05:00
} ,
2022-01-13 23:15:32 -08:00
// Apprentices
2022-01-10 02:16:25 -08:00
levelUpApprentice : ( state , process ) => {
if ( process . nextWorkerCost > state . currency ) {
return
}
const index = state . processes . findIndex ( ( p ) => p . worker === process . worker )
state . currency = Decimal . subtract ( state . currency , process . nextWorkerCost )
Vue . set ( state . processes [ index ] , 'workerLevel' , process . workerLevel + 1 )
2022-01-09 12:52:17 -05:00
Vue . set (
2022-01-10 02:16:25 -08:00
state . processes [ index ] ,
2022-01-09 12:52:17 -05:00
'nextWorkerCost' ,
2022-01-10 02:16:25 -08:00
Math . floor ( process . nextWorkerCost * process . nextWorkerFactor )
2022-01-09 12:52:17 -05:00
)
} ,
2022-01-13 23:15:32 -08:00
// Missions
setMissionAvailable : ( state , missionIndex ) => {
Vue . set ( state . missions [ missionIndex ] , 'available' , true )
} ,
setMissionViewed : ( state , missionIndex ) => {
Vue . set ( state . missions [ missionIndex ] , 'viewed' , true )
2022-01-09 18:29:13 -05:00
} ,
2022-01-13 23:15:32 -08:00
completeMission : ( state , missionName ) => {
const index = state . missions . findIndex ( ( m ) => m . name === missionName )
Vue . set ( state . missions [ index ] , 'complete' , true )
} ,
unlockMission : ( state , missionName ) => {
const index = state . missions . findIndex ( ( m ) => m . name === missionName )
Vue . set ( state . missions [ index ] , 'unlocked' , true )
} ,
// Time Machine
2022-01-11 22:23:41 -08:00
tickEnergy : ( state ) => {
2022-01-14 20:42:18 -05:00
state . energy += 1 + Math . floor ( state . wisdomApplied / 100 )
if ( state . energy > state . energyMax ) state . energy = state . energyMax
2022-01-11 22:23:41 -08:00
} ,
spendEnergy : ( state , amount ) => {
if ( amount <= state . energy ) {
state . energy -= amount
}
} ,
2022-01-12 21:37:30 -08:00
upgradeMaxEnergy : ( state ) => {
state . energyMax += 200
state . fluxCapacitorLevel += 1
2022-01-13 23:15:32 -08:00
state . nextFluxCapacitorCost *= 10
2022-01-12 21:37:30 -08:00
} ,
2022-01-11 22:23:41 -08:00
unlockTimeMachineAction : ( state , name ) => {
const index = state . timeMachineActions . findIndex ( ( t ) => t . name === name )
Vue . set ( state . tabs [ index ] , 'unlocked' , true )
} ,
2022-01-10 18:19:34 -05:00
travelGameDate : ( state , month ) => {
state . gameDate = month
2022-01-09 18:29:13 -05:00
} ,
2022-01-11 17:30:14 -05:00
doPrestige : ( state ) => {
2022-01-14 20:42:18 -05:00
// sum up statistics for Wisdom tab
2022-01-11 17:30:14 -05:00
state . currency = new Decimal ( 0 )
state . wisdomApplied += state . wisdomGained
state . wisdomGained = 0
2022-01-11 22:23:41 -08:00
state . lifetimes += 1
2022-01-11 17:30:14 -05:00
state . timeJumpsBackwards += 1
state . playerLivedTotal += state . playerAge
2022-01-14 20:42:18 -05:00
// If the "Time Travel Precision" mission is done, send players back as a child for +20ish more years of life
2022-01-11 17:30:14 -05:00
// TODO: refactor next 3 lines if getters can be used in mutators: missionIsCompleted('Time Travel Precision')
const precisionMissionIndex = state . missions . findIndex (
( m ) => m . name === 'Time Travel Precision'
)
const precisionMission = state . missions [ precisionMissionIndex ]
2022-01-14 20:42:18 -05:00
if ( precisionMission . complete ) {
2022-01-11 17:30:14 -05:00
state . playerAge = 8 * 12
state . gameDate = 1378 * 12
2022-01-14 20:42:18 -05:00
} else {
state . playerAge = 30 * 12
state . gameDate = 1400 * 12
2022-01-11 17:30:14 -05:00
}
2022-01-14 20:42:18 -05:00
// restart missions as appropriate
state . missions . forEach ( ( e ) => {
if ( e . resetOnPrestige ) e . complete = false
} )
// delete all apprentices
state . processes . forEach ( ( e ) => {
2022-01-14 21:22:16 -05:00
// e.visited = false // require re-travel to time period to hire
2022-01-14 20:42:18 -05:00
e . workerLevel = 0
e . nextWorkerCost = e . baseWorkerCost
} )
2022-01-11 17:30:14 -05:00
} ,
2022-01-12 21:37:30 -08:00
timeTravel : ( state , { era , year = 0 , month = 0 } ) => {
2022-01-11 22:23:41 -08:00
const newYear = year * 12 + month
if ( newYear < state . gameDate ) {
state . timeJumpsBackwards += 1
}
state . gameDate = newYear
2022-01-12 21:37:30 -08:00
state . gameEra = era
const processIndex = state . processes . findIndex ( ( p ) => p . unlockEra === era )
Vue . set ( state . processes [ processIndex ] , 'visited' , true )
2022-01-11 22:23:41 -08:00
} ,
2022-01-13 21:38:19 -08:00
// Time Magic
unlockSpell : ( state , name ) => {
const index = state . spells . findIndex ( ( s ) => s . name === name )
Vue . set ( state . spells [ index ] , 'unlocked' , true )
} ,
tickMana : ( state ) => {
2022-01-14 20:42:18 -05:00
state . mana += 1 + Math . floor ( state . wisdomApplied / 100 )
// apply a n% chance of extra mana for wisdom not part of a full hundred
if ( Math . random ( ) * 100 < state . wisdomApplied % 100 ) state . mana += 1
if ( state . mana > state . manaMax ) state . mana = state . manaMax
2022-01-13 21:38:19 -08:00
} ,
spendMana : ( state , amount ) => {
if ( amount <= state . mana ) {
state . mana -= amount
}
} ,
// Philosper's Stone
unlockPhilosophersStone : ( state ) => {
state . philosophersStoneUnlocked = true
} ,
increasePhilosophersStoneIncrement : ( state , months ) => {
state . philosophersStoneIncrement += months
} ,
extendLifespan : ( state , months ) => {
state . playerAgeMax += months
} ,
decreaseAge : ( state , months ) => {
state . playerAge -= months
} ,
2022-01-06 17:17:26 -08:00
}