|
|
|
@ -32,12 +32,12 @@
@@ -32,12 +32,12 @@
|
|
|
|
|
</div> |
|
|
|
|
<div class="btn-group" v-if='!auto'> |
|
|
|
|
<p>{{ t('stren.0') }}:<span :class="{ 'red': useCoins < needCoins }">{{ needCoins }}</span></p> |
|
|
|
|
<button class="button" @click="strengthen(false)">{{ t('stren.1') }}+{{ parseInt(equip.strengthenLv) + 1 |
|
|
|
|
<button class="button" @click="strengthen()">{{ t('stren.1') }}+{{ parseInt(equip.strengthenLv) + 1 |
|
|
|
|
}}</button> |
|
|
|
|
</div> |
|
|
|
|
<div class="btn-group" v-if='!auto'> |
|
|
|
|
<p>{{ t('stren.0') }}:<span :class="{ 'red': useCoins < needCoins }">{{ needCoins }}</span></p> |
|
|
|
|
<button class="button" @click="strengthen(true)">{{ t('stren.2') }}</button> |
|
|
|
|
<button class="button" @click="strengthenTest">{{ t('stren.2') }}</button> |
|
|
|
|
<span v-if="testFlag">{{ equip.strengthenLv }}<span class="arror">➡</span>{{ testResult }}</span> |
|
|
|
|
</div> |
|
|
|
|
<div class="btn-group" v-if='!auto'> |
|
|
|
@ -58,9 +58,8 @@ import { reactive, onMounted, ref, computed, watch } from "vue";
@@ -58,9 +58,8 @@ import { reactive, onMounted, ref, computed, watch } from "vue";
|
|
|
|
|
import { useI18n } from "vue3-i18n"; |
|
|
|
|
import { Tooltip, EquipIcon } from "@/components" |
|
|
|
|
import { strengthenValue, strengthenCoins, replace } from "@/tool" |
|
|
|
|
import { extra_entry_num, weaponExtraEntry, armorExtraEntry, neckExtraEntry, ringExtraEntry, strengthen_rates, jewelryExtraEntry, pantsExtraEntry, shoesExtraEntry, bracersExtraEntry, Entry } from "@/config"; |
|
|
|
|
import { strengthen_rates } from "@/config"; |
|
|
|
|
import { createt } from "@/config/i18n"; |
|
|
|
|
import Reforge from "./reforge.vue"; |
|
|
|
|
|
|
|
|
|
const mt = createt('backpack.'); |
|
|
|
|
const { t } = useI18n(); |
|
|
|
@ -84,37 +83,56 @@ const needCoins = computed(() => {
@@ -84,37 +83,56 @@ const needCoins = computed(() => {
|
|
|
|
|
return strengthenCoins(prop.equip.lv, prop.equip.strengthenLv, prop.equip.quality.quality); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const strengthen = (test?) => { |
|
|
|
|
const strengthen = (times?) => { |
|
|
|
|
times = times || 1; |
|
|
|
|
if (!checkCoins(times)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
testFlag.value = false; |
|
|
|
|
let lv = prop.equip.strengthenLv; |
|
|
|
|
let i = 0; |
|
|
|
|
for (; i < times; i++) { |
|
|
|
|
if (auto.value && prop.equip.strengthenLv >= autoLv.value) { |
|
|
|
|
auto.value = false; |
|
|
|
|
commit("set_sys_info", { msg: t('strengthenFinish'), type: "win", }); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
lv += callResult(lv); |
|
|
|
|
} |
|
|
|
|
prop.equip.strengthenLv = lv; |
|
|
|
|
dispatch('saveGame'); |
|
|
|
|
commit("add_player_coins", -1 * needCoins.value * i); |
|
|
|
|
auto.value && setTimeout(() => strengthen(times), 200); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const strengthenTest = () => { |
|
|
|
|
if (!checkCoins(1)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (useCoins.value < needCoins.value) { |
|
|
|
|
const result = callResult(prop.equip.strengthenLv); |
|
|
|
|
testResult.value = prop.equip.strengthenLv + result; |
|
|
|
|
testFlag.value = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const checkCoins = (times) => { |
|
|
|
|
if (useCoins.value < needCoins.value * times) { |
|
|
|
|
auto.value = false; |
|
|
|
|
commit("set_sys_info", { msg: t('stNoCoins'), type: "warning", }); |
|
|
|
|
return |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
const lv = prop.equip.strengthenLv; |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const callResult = (lv) => { |
|
|
|
|
const len = strengthen_rates.length; |
|
|
|
|
const rate = lv < len ? strengthen_rates[lv] : strengthen_rates[len - 1]; |
|
|
|
|
const result = Math.random() < rate ? 1 : -1; |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (test) { |
|
|
|
|
testFlag.value = true; |
|
|
|
|
testResult.value = prop.equip.strengthenLv + result; |
|
|
|
|
} else { |
|
|
|
|
testFlag.value = false; |
|
|
|
|
prop.equip.strengthenLv += result; |
|
|
|
|
dispatch('saveGame'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
commit("add_player_coins", -1 * needCoins.value); |
|
|
|
|
auto.value && setTimeout(strengthen, 200 / state.speed); |
|
|
|
|
}; |
|
|
|
|
const startAuto = () => { |
|
|
|
|
auto.value = true; |
|
|
|
|
strengthen(); |
|
|
|
|
strengthen(state.speed); |
|
|
|
|
}; |
|
|
|
|
const stopAuto = () => { |
|
|
|
|
auto.value = false; |
|
|
|
|