feat: narrative modal and game flow draft 4

This commit is contained in:
pskfyi 2022-01-13 23:15:32 -08:00 committed by pskfyi
commit 08951244ab
5 changed files with 163 additions and 37 deletions

View file

@ -80,6 +80,15 @@ export default {
this.$store.commit('setPlayerAge', { year: 30 })
this.$store.commit('timeTravel', { year: 1400, era: 'Early Modern' })
this.$store.commit('tickLifetime')
this.$store.commit('spendCurrency', this.$store.state.currency)
this.$store.commit('startGame')
const message =
'You are young-ish once again and back in the year 1400 with all your wisdom intact.' +
'<br><br>' +
'Continue to explore the eras and unlock the secrets of time.'
this.$store.commit('openModal', message)
}
if (mission.name === 'Live Forever') {

View file

@ -62,6 +62,7 @@ export default {
},
isEnabled(process) {
const isCurrentEra = process.unlockEra === this.$store.state.gameEra
if (isCurrentEra) {
return false
} else if (process.visited) {
@ -78,9 +79,13 @@ export default {
const latestEraIndex = processes.map((p) => p.visited).lastIndexOf(true)
const nextLatestEraIndex = latestEraIndex + 1
const middleAges = this.$store.state.processes.find(
(p) => p.unlockEra === 'Middle Ages'
)
return (
processIndex === nextEarliestEraIndex ||
processIndex === nextLatestEraIndex
(middleAges.visited && processIndex === nextLatestEraIndex)
)
}
},
@ -91,13 +96,23 @@ export default {
}
},
travelToEra(process) {
const hadBeenVisited = process.visited // save this before we time travel
this.$store.commit('spendEnergy', process.travelCost)
this.$store.commit('timeTravel', {
era: process.unlockEra,
month: process.minDateUnlocked,
})
if (process.unlockEra === 'Middle Ages') {
// do era-specific things
if (process.unlockEra === 'Middle Ages' && !hadBeenVisited) {
this.$nextTick(() => {
const message =
'Congratulations! ' +
"You've successfully traveled through time and landed in the year 1100" +
'... though it was rather hard on your body.'
this.$store.commit('openModal', message)
})
}
},
},