feat: track various stats and display on Wisdom tab

This commit is contained in:
John McCardle 2022-01-14 21:22:16 -05:00
parent 128387bede
commit 0457a5d7ec
2 changed files with 35 additions and 8 deletions

View File

@ -12,25 +12,25 @@
}}</span> }}</span>
<span align="left"><b>Total in-game time elapsed</b></span <span align="left"><b>Total in-game time elapsed</b></span
><span align="right"></span> ><span align="right">{{ $store.getters.gameTimeTotalText }}</span>
<span align="left"><b>Completed lifetimes</b></span <span align="left"><b>Completed lifetimes</b></span
><span align="right">{{ $store.state.lifetimes }}</span> ><span align="right">{{ $store.state.lifetimes }}</span>
<span align="left"><b>Longest lifetime</b></span
><span align="right"></span>
<span align="left"><b>Oldest age reached</b></span <span align="left"><b>Oldest age reached</b></span
><span align="right"></span> ><span align="right">{{ $store.getters.ageRecordText }}</span>
<span align="left"><b>Latest time reached</b></span <span align="left"><b>Latest time reached</b></span
><span align="right"></span> ><span align="right">{{ $store.getters.gameDateRecordText }}</span>
<span align="left"><b>Wisdom for next prestige</b></span <span align="left"><b>Wisdom for next prestige</b></span
><span align="right">{{ $store.state.wisdomGained }}</span> ><span align="right">{{ $store.state.wisdomGained }}</span>
<span align="left"><b>Wisdom from other timelines</b></span <span align="left"><b>Wisdom from other timelines</b></span
><span align="right">{{ $store.state.wisdomApplied }}</span> ><span align="right"
>{{ $store.state.wisdomApplied }}: +{{ $store.state.wisdomApplied }}% to
Spare Time, Energy, and Mana gained</span
>
</div> </div>
<hr /> <hr />

View File

@ -71,9 +71,12 @@ export const state = () => ({
gameDate: 1400 * 12, gameDate: 1400 * 12,
gameEra: 'Early Modern', gameEra: 'Early Modern',
gameTimeTotal: 0,
gameDateRecord: 0,
playerAge: 30 * 12, playerAge: 30 * 12,
playerAgeMax: 60 * 12, playerAgeMax: 60 * 12,
playerAgeRecord: 0,
playerLivedTotal: 0, playerLivedTotal: 0,
wisdomGained: 0, // wisdom gained so far on this run, not applied until player sends the book. wisdomGained: 0, // wisdom gained so far on this run, not applied until player sends the book.
@ -625,6 +628,19 @@ export const getters = {
gameYear: (state) => { gameYear: (state) => {
return Math.floor(state.gameDate / 12) return Math.floor(state.gameDate / 12)
}, },
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`
},
currencySpent: (state) => { currencySpent: (state) => {
return Decimal.subtract(state.currencyTotal, state.currency) return Decimal.subtract(state.currencyTotal, state.currency)
}, },
@ -640,6 +656,12 @@ export const getters = {
return `${year}y${month}m` return `${year}y${month}m`
}, },
ageRecordText: (state) => {
const year = Math.floor(state.playerAgeRecord / 12)
const month = state.playerAgeRecord % 12
return `${year}y${month}m`
},
missionIsCompleted: (state) => (missionName) => { missionIsCompleted: (state) => (missionName) => {
const mission = state.missions.find((m) => m.name === missionName) const mission = state.missions.find((m) => m.name === missionName)
@ -745,6 +767,11 @@ export const mutations = {
state.gameDate += 1 state.gameDate += 1
state.playerAge += 1 state.playerAge += 1
if (!(state.playerAge % 12)) state.wisdomGained++ if (!(state.playerAge % 12)) state.wisdomGained++
state.gameTimeTotal += 1
if (state.playerAge > state.playerAgeRecord)
state.playerAgeRecord = state.playerAge
if (state.gameDate > state.gameDateRecord)
state.gameDateRecord = state.gameDate
}, },
setPlayerAge: (state, { year, month = 0 }) => { setPlayerAge: (state, { year, month = 0 }) => {
state.playerAge = year * 12 + month state.playerAge = year * 12 + month
@ -854,7 +881,7 @@ export const mutations = {
// delete all apprentices // delete all apprentices
state.processes.forEach((e) => { state.processes.forEach((e) => {
e.visited = false // require re-travel to time period to hire // e.visited = false // require re-travel to time period to hire
e.workerLevel = 0 e.workerLevel = 0
e.nextWorkerCost = e.baseWorkerCost e.nextWorkerCost = e.baseWorkerCost
}) })