diff --git a/frontend/src/components/Counter.vue b/frontend/src/components/Counter.vue
index be27065..4f3f3db 100644
--- a/frontend/src/components/Counter.vue
+++ b/frontend/src/components/Counter.vue
@@ -121,13 +121,12 @@ function toggleStopping() {
isStopping.value = !isStopping.value;
}
-function switchBuff() {
- const [buff, prevBuff] = state.switchBuff();
+function nextBuff() {
+ const [buff, prevBuff] = state.nextBuff();
const difference = state.refs.targetDate.value - nowTime.value;
let distance = Math.abs(difference);
if (difference < 0) {
- distance *= prevBuff;
- distance /= buff;
+ distance = distance * prevBuff / buff;
state.refs.targetDate.value = nowTime.value - distance;
}
}
@@ -140,7 +139,7 @@ function switchBuff() {
-
+
-
+
diff --git a/frontend/src/state.ts b/frontend/src/state.ts
index a9ea709..ab08b88 100644
--- a/frontend/src/state.ts
+++ b/frontend/src/state.ts
@@ -4,7 +4,7 @@ import { hoursToMilliseconds } from "@/utils";
export class State {
consts = {
- availableBuffs: [1.00, 1.25, 1.50, 1.75, 2.00],
+ buffs: Array(1 / 0.05 + 1).fill(undefined).map((_, i) => 1 + Math.round(0.05 * i * 100) / 100),
};
refs = {
@@ -16,14 +16,14 @@ export class State {
computed = {
buff: computed(() => {
- return this.consts.availableBuffs[this.refs.buffIndex.value]!;
+ return this.consts.buffs[this.refs.buffIndex.value]!;
}),
};
- switchBuff(): [number, number] {
- const prevBuff = this.consts.availableBuffs[this.refs.buffIndex.value]!;
- this.refs.buffIndex.value = (this.refs.buffIndex.value + 1) % this.consts.availableBuffs.length;
- const buff = this.consts.availableBuffs[this.refs.buffIndex.value]!;
+ nextBuff(): [number, number] {
+ const prevBuff = this.consts.buffs[this.refs.buffIndex.value]!;
+ this.refs.buffIndex.value = (this.refs.buffIndex.value + 1) % this.consts.buffs.length;
+ const buff = this.consts.buffs[this.refs.buffIndex.value]!;
return [buff, prevBuff];
}