2022-01-07 19:46:33 -08:00
< template >
2022-01-15 00:56:54 -08:00
< div class = "missions pb-20" >
2022-01-13 13:02:43 -08:00
< responsive-grid v-if = "incomplete.length" >
2022-01-10 21:48:15 -08:00
< mission-button
v - for = "(mission, index) in incomplete"
: key = "index"
: mission = "mission"
@ click = "complete(mission)"
/ >
< / responsive-grid >
2022-01-13 13:02:43 -08:00
< div v-else >
2022-01-10 21:48:15 -08:00
< h3 class = "text-center" > No Missions Currently Available < / h3 >
< / div >
< template v-if = "completed.length" >
2022-01-13 19:30:59 -08:00
< h2 class = "pb-2 pt-8 md:pb-4 font-semibold text-center text-xl" >
2022-01-13 13:02:43 -08:00
Completed Missions
< / h2 >
2022-01-10 21:48:15 -08:00
< responsive-grid min = "1" mid = "3" max = "6" >
< completed-mission
v - for = "(mission, index) in completed"
: key = "index"
: mission = "mission"
/ >
< / responsive-grid >
< / template >
< / div >
2022-01-07 19:46:33 -08:00
< / template >
2022-01-10 21:48:15 -08:00
< script >
export default {
computed : {
unlocked ( ) {
return this . $store . state . missions . filter ( ( { unlockCriteria } ) => {
if ( unlockCriteria . unit === 'instruments' ) {
return unlockCriteria . value <= this . $store . getters . instruments
} else if ( unlockCriteria . unit === 'apprenticeLevels' ) {
return unlockCriteria . value <= this . $store . getters . apprenticeLevels
} else if ( unlockCriteria . unit === 'missionsCompleted' ) {
return unlockCriteria . value . every ( ( name ) =>
this . $store . getters . missionIsCompleted ( name )
)
2022-01-13 21:38:19 -08:00
} else if ( unlockCriteria . unit === 'eraVisited' ) {
return this . $store . state . processes . find (
( p ) => p . unlockEra === unlockCriteria . value
) . visited
2022-01-10 21:48:15 -08:00
} else if ( unlockCriteria . unit === 'timeJumpsBackwards' ) {
return unlockCriteria . value <= this . $store . state . timeJumpsBackwards
} else {
return false
}
} )
} ,
incomplete ( ) {
return this . unlocked . filter ( ( m ) => ! m . complete )
} ,
completed ( ) {
return this . unlocked . filter ( ( m ) => m . complete )
} ,
} ,
methods : {
complete ( mission ) {
this . $store . commit ( 'completeMission' , mission . name )
2022-01-11 22:23:41 -08:00
2022-01-10 22:01:14 -08:00
if ( mission . completionCriteria . unit === 'spareTime' ) {
this . $store . commit ( 'spendCurrency' , mission . completionCriteria . value )
}
2022-01-11 22:23:41 -08:00
if ( mission . name === 'Study Time Magic' ) {
this . $store . commit ( 'unlockTab' , 'Time Magic' )
}
if ( mission . name === 'Create the Time Machine' ) {
this . $store . commit ( 'unlockTab' , 'Time Machine' )
}
2022-01-14 20:42:18 -05:00
if (
mission . name === 'Time to Cheat Death' ||
mission . name === 'Cheat Death... Again'
) {
2022-01-11 22:23:41 -08:00
this . $store . commit ( 'unlockTab' , 'Wisdom' )
2022-01-14 20:42:18 -05:00
// 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 ( 'doPrestige' )
2022-01-13 23:15:32 -08:00
this . $store . commit ( 'startGame' )
2022-01-15 00:56:54 -08:00
const message = this . $store . getters . missionIsCompleted (
'Time Travel Precision'
)
? 'Having increased the precision of the time machine, you were able to bring your wisdom ' +
'to yourself as a child and get an earlier start on this next shot at life. You are now ' +
'in the year 1372, a young person with a full life ahead of yourself to explore the depths of time.'
: '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.'
2022-01-13 23:15:32 -08:00
this . $store . commit ( 'openModal' , message )
2022-01-11 22:23:41 -08:00
}
2022-01-13 21:38:19 -08:00
if ( mission . name === 'Live Forever' ) {
this . $store . commit ( 'unlockPhilosophersStone' )
}
2022-01-10 21:48:15 -08:00
} ,
} ,
}
< / script >