2022-01-08 03:46:33 +00:00
|
|
|
<template>
|
2022-01-11 05:48:15 +00:00
|
|
|
<div class="missions grid">
|
2022-01-13 21:02:43 +00:00
|
|
|
<responsive-grid v-if="incomplete.length">
|
2022-01-11 05:48:15 +00:00
|
|
|
<mission-button
|
|
|
|
v-for="(mission, index) in incomplete"
|
|
|
|
:key="index"
|
|
|
|
:mission="mission"
|
|
|
|
@click="complete(mission)"
|
|
|
|
/>
|
|
|
|
</responsive-grid>
|
|
|
|
|
2022-01-13 21:02:43 +00:00
|
|
|
<div v-else>
|
2022-01-11 05:48:15 +00:00
|
|
|
<h3 class="text-center">No Missions Currently Available</h3>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<template v-if="completed.length">
|
2022-01-13 21:02:43 +00:00
|
|
|
<h2 class="pt-4 pb-2 md:pt-8 md:pb-4 font-semibold text-center text-xl">
|
|
|
|
Completed Missions
|
|
|
|
</h2>
|
2022-01-11 05:48:15 +00: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-08 03:46:33 +00:00
|
|
|
</template>
|
2022-01-11 05:48:15 +00: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)
|
|
|
|
)
|
|
|
|
} 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-12 06:23:41 +00:00
|
|
|
|
2022-01-11 06:01:14 +00:00
|
|
|
if (mission.completionCriteria.unit === 'spareTime') {
|
|
|
|
this.$store.commit('spendCurrency', mission.completionCriteria.value)
|
|
|
|
}
|
2022-01-12 06:23:41 +00: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')
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mission.name === 'Time to Cheat Death') {
|
|
|
|
this.$store.commit('unlockTab', 'Wisdom')
|
|
|
|
this.$store.commit('setPlayerAge', { year: 30 })
|
2022-01-13 05:37:30 +00:00
|
|
|
this.$store.commit('timeTravel', { year: 1400, era: 'Early Modern' })
|
2022-01-12 06:23:41 +00:00
|
|
|
this.$store.commit('tickLifetime')
|
|
|
|
}
|
2022-01-11 05:48:15 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.missions {
|
|
|
|
grid-template-rows: minmax(0, 1fr) auto auto;
|
|
|
|
}
|
|
|
|
</style>
|