This repository has been archived on 2024-03-13. You can view files and clone it, but cannot push or open issues or pull requests.
timekeeper/components/InfinityTester.vue

66 lines
1.4 KiB
Vue
Raw Normal View History

2022-01-04 22:41:36 +00:00
<template>
<div>
2022-01-06 23:35:43 +00:00
<button @click="add">add {{ addIncrement }}</button>
<button @click="stepup">{{ mulIncrement }}x addition per step</button>
<button @click="jumpup">10x more multiplication per step</button>
<button @click="toggletimer">Tick automatically</button>
2022-01-04 22:41:36 +00:00
</div>
</template>
<script>
2022-01-06 23:35:43 +00:00
import Decimal from 'break_infinity.js'
2022-01-04 22:41:36 +00:00
export default {
name: 'InfinityTester',
2022-01-05 19:19:51 +00:00
data() {
2022-01-04 22:41:36 +00:00
return {
addIncrement: new Decimal(100),
mulIncrement: new Decimal(10),
bigValue: new Decimal(0),
2022-01-06 23:35:43 +00:00
timerRunning: false,
2022-01-04 22:41:36 +00:00
}
},
2022-01-06 23:35:43 +00:00
beforeMount() {
window.setInterval(() => {
this.gametick()
}, 250)
2022-01-05 19:19:51 +00:00
},
methods: {
2022-01-06 23:35:43 +00:00
add() {
// this.bigValue = Decimal.add(this.bigValue, this.addIncrement);
this.$store.commit('incremental/add', {
key: 'energy',
value: this.addIncrement,
})
},
2022-01-06 23:35:43 +00:00
stepup() {
this.addIncrement = Decimal.mul(this.addIncrement, this.mulIncrement)
},
2022-01-06 23:35:43 +00:00
jumpup() {
this.mulIncrement = Decimal.mul(this.mulIncrement, 10.0)
},
2022-01-06 23:35:43 +00:00
gametick() {
if (this.timerRunning) {
this.$store.commit('incremental/add', {
key: 'energy',
value: this.addIncrement,
})
}
},
2022-01-06 23:35:43 +00:00
toggletimer() {
this.timerRunning = !this.timerRunning
},
},
2022-01-04 22:41:36 +00:00
}
</script>
<style scoped>
button {
background-color: #42b983;
2022-01-04 22:41:36 +00:00
}
</style>