feat: magic game flow 1

This commit is contained in:
pskfyi 2022-01-13 21:38:19 -08:00 committed by pskfyi
parent 45fc84b3db
commit 5029bb70fb
5 changed files with 278 additions and 61 deletions

View File

@ -0,0 +1,50 @@
<template>
<progress-button
:label="action.name"
:description="action.description"
:max="100"
:value="$store.state.mana"
:current="current"
:next="next"
@click="doAction"
/>
</template>
<script>
export default {
props: {
action: { type: Object, required: true },
},
computed: {
current() {
return this.action.name === 'Empower the Stone'
? this.$store.state.philosophersStoneIncrement
: undefined
},
next() {
return this.action.name === 'Empower the Stone'
? this.$store.state.philosophersStoneIncrement + 6
: undefined
},
},
methods: {
doAction() {
this.$store.commit('spendMana', 100)
if (this.action.name === 'Empower the Stone') {
this.$store.commit('increasePhilosophersStoneIncrement', 6)
} else if (this.action.name === 'Forever Young') {
this.$store.commit(
'decreaseAge',
this.$store.state.philosophersStoneIncrement
)
} else if (this.action.name === 'Necromancy') {
this.$store.commit(
'extendLifespan',
this.$store.state.philosophersStoneIncrement
)
}
},
},
}
</script>

View File

@ -0,0 +1,34 @@
<template>
<progress-button
:label="spell.name"
:description="spell.description"
:max="100"
:value="$store.state.mana"
:current="current"
:next="next"
@click="doAction"
/>
</template>
<script>
export default {
props: {
spell: { type: Object, required: true },
},
computed: {
current() {
//
return undefined
},
next() {
//
return undefined
},
},
methods: {
cast() {
//
},
},
}
</script>

View File

@ -41,6 +41,10 @@ export default {
return unlockCriteria.value.every((name) => return unlockCriteria.value.every((name) =>
this.$store.getters.missionIsCompleted(name) this.$store.getters.missionIsCompleted(name)
) )
} else if (unlockCriteria.unit === 'eraVisited') {
return this.$store.state.processes.find(
(p) => p.unlockEra === unlockCriteria.value
).visited
} else if (unlockCriteria.unit === 'timeJumpsBackwards') { } else if (unlockCriteria.unit === 'timeJumpsBackwards') {
return unlockCriteria.value <= this.$store.state.timeJumpsBackwards return unlockCriteria.value <= this.$store.state.timeJumpsBackwards
} else { } else {
@ -77,6 +81,10 @@ export default {
this.$store.commit('timeTravel', { year: 1400, era: 'Early Modern' }) this.$store.commit('timeTravel', { year: 1400, era: 'Early Modern' })
this.$store.commit('tickLifetime') this.$store.commit('tickLifetime')
} }
if (mission.name === 'Live Forever') {
this.$store.commit('unlockPhilosophersStone')
}
}, },
}, },
} }

View File

@ -27,9 +27,46 @@
now also gains now also gains
<b><span class="fas fa-star text-base" /> Mana</b> <b><span class="fas fa-star text-base" /> Mana</b>
</p> </p>
<h2 class="text-xl font-semibold text-center pt-8">Spells</h2>
<responsive-grid min="1" mid="1" max="1" class="pt-2 md:pt-4 text-center">
<p>Spells coming soon!</p>
</responsive-grid>
<h2 class="text-xl font-semibold text-center pt-8">Philosopher's Stone</h2>
<responsive-grid class="pt-2 md:pt-4">
<philosophers-stone-button
v-for="action in $store.state.philosophersStoneActions"
:key="action.name"
:action="action"
/>
</responsive-grid>
</div> </div>
</template> </template>
<script>
import PhilosophersStoneButton from '~/components/PhilosophersStoneButton.vue'
export default {
components: { PhilosophersStoneButton },
data() {
return {
riteOfChronosTime: 300,
}
},
methods: {
castSpell(name) {
this.$store.commit('spendMana', 100)
if (name === 'Rite of Chronos') {
//
}
},
},
}
</script>
<style scoped> <style scoped>
.mana-bar { .mana-bar {
width: 75%; width: 75%;

View File

@ -62,13 +62,17 @@ export const state = () => ({
currency: new Decimal(10000), currency: new Decimal(10000),
currencyTotal: new Decimal(0), currencyTotal: new Decimal(0),
energy: 0, gameDate: 1400 * 12,
energyMax: 600, // 60 seconds gameEra: 'Early Modern',
fluxCapacitorLevel: 1,
nextFluxCapacitorCost: 500,
mana: 0, playerAge: 30 * 12,
manaMax: 100, playerAgeMax: 60 * 12,
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,
processes: [ processes: [
{ {
@ -354,6 +358,7 @@ export const state = () => ({
}, },
], ],
// Missions
missions: [ missions: [
{ {
name: 'Train an Apprentice', name: 'Train an Apprentice',
@ -365,37 +370,20 @@ export const state = () => ({
}, },
completionCriteria: { completionCriteria: {
unit: 'apprenticeLevels', unit: 'apprenticeLevels',
value: 5, value: 3,
}, },
unlocked: true, unlocked: true,
viewed: false, viewed: false,
complete: false, complete: false,
resetOnPrestige: false, resetOnPrestige: false,
}, },
{
name: 'Study Time Magic',
description:
"As time ticks away you begin to ponder the mysteries of time's origins and possibilities.",
unlockCriteria: {
unit: 'apprenticeLevels',
value: 1,
},
completionCriteria: {
unit: 'spareTime',
value: 250,
},
unlocked: true,
viewed: false,
complete: false,
resetOnPrestige: true,
},
{ {
name: 'Create the Time Machine', name: 'Create the Time Machine',
description: description:
'Your magnum opus. Soon you will be able to control time itself.', 'Your magnum opus. Soon you will be able to control time itself.',
unlockCriteria: { unlockCriteria: {
unit: 'missionsCompleted', unit: 'missionsCompleted',
value: ['Train an Apprentice', 'Study Time Magic'], value: ['Train an Apprentice'],
}, },
completionCriteria: { completionCriteria: {
unit: 'spareTime', unit: 'spareTime',
@ -406,6 +394,23 @@ export const state = () => ({
complete: false, complete: false,
resetOnPrestige: false, resetOnPrestige: false,
}, },
{
name: 'Study Time Magic',
description:
"As time ticks away you begin to ponder the mysteries of time's origins and possibilities.",
unlockCriteria: {
unit: 'eraVisited',
value: 'Middle Ages',
},
completionCriteria: {
unit: 'spareTime',
value: 250,
},
unlocked: true,
viewed: false,
complete: false,
resetOnPrestige: true,
},
{ {
name: 'Time to Cheat Death', name: 'Time to Cheat Death',
description: description:
@ -424,25 +429,42 @@ export const state = () => ({
complete: false, complete: false,
resetOnPrestige: false, resetOnPrestige: false,
}, },
{ // {
// update doPrestige (mutation) if this is renamed // // update doPrestige (mutation) if this is renamed
name: 'Time Travel Precision', // name: 'Time Travel Precision',
description: // description:
'The time machine could target a certain month instead of a decade, ' + // 'The time machine could target a certain month instead of a decade, ' +
'with the proper calibration.', // 'with the proper calibration.',
unlockCriteria: { // unlockCriteria: {
unit: 'missionsCompleted', // unit: 'missionsCompleted',
value: ['Time to Cheat Death', 'Create the Time Machine'], // value: ['Time to Cheat Death', 'Create the Time Machine'],
}, // },
completionCriteria: { // completionCriteria: {
unit: 'spareTime', // unit: 'spareTime',
value: 10000, // value: 10000,
}, // },
unlocked: false, // unlocked: false,
viewed: false, // viewed: false,
complete: false, // complete: false,
resetOnPrestige: false, // resetOnPrestige: false,
}, // },
// {
// 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,
// },
{ {
name: 'Cheat Death... Again', name: 'Cheat Death... Again',
description: description:
@ -462,6 +484,12 @@ export const state = () => ({
}, },
], ],
// Time Machine
energy: 599,
energyMax: 600, // 60 seconds
fluxCapacitorLevel: 1,
nextFluxCapacitorCost: 500,
timeMachineActions: [ timeMachineActions: [
{ {
name: 'Activate!', name: 'Activate!',
@ -490,15 +518,55 @@ export const state = () => ({
}, },
], ],
gameDate: 1400 * 12, // Time Magic
gameEra: 'Early Modern', mana: 99,
playerAge: 30 * 12, manaMax: 100,
playerAgeMax: 60 * 12, philosophersStoneUnlocked: false,
playerLivedTotal: 0,
wisdomGained: 0, // wisdom gained so far on this run, not applied until player sends the book. spells: [
wisdomApplied: 0, // wisdom from previous runs {
lifetimes: 0, // comleted lifetimes name: 'Chrono Deluge',
timeJumpsBackwards: 0, 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,
}) })
export const getters = { export const getters = {
@ -693,14 +761,6 @@ export const mutations = {
state.fluxCapacitorLevel += 1 state.fluxCapacitorLevel += 1
state.nextFluxCapacitorCost *= 2 state.nextFluxCapacitorCost *= 2
}, },
tickMana: (state) => {
state.mana += 1
},
spendMana: (state, amount) => {
if (amount <= state.mana) {
state.mana -= amount
}
},
unlockTimeMachineAction: (state, name) => { unlockTimeMachineAction: (state, name) => {
const index = state.timeMachineActions.findIndex((t) => t.name === name) const index = state.timeMachineActions.findIndex((t) => t.name === name)
Vue.set(state.tabs[index], 'unlocked', true) Vue.set(state.tabs[index], 'unlocked', true)
@ -747,4 +807,32 @@ export const mutations = {
tickLifetime: (state) => { tickLifetime: (state) => {
state.lifetimes += 1 state.lifetimes += 1
}, },
// Time Magic
unlockSpell: (state, name) => {
const index = state.spells.findIndex((s) => s.name === name)
Vue.set(state.spells[index], 'unlocked', true)
},
tickMana: (state) => {
state.mana += 1
},
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
},
} }