Browse Source

增加垫刀功能

master
许孟阳 2 weeks ago
parent
commit
10bce2d4a4
  1. 3
      src/config/i18n/zh.ts
  2. 38
      src/views/backpack/strengthen.vue

3
src/config/i18n/zh.ts

@ -106,6 +106,9 @@ export default class Zh { @@ -106,6 +106,9 @@ export default class Zh {
neaten = '一键整理';
use = '装备';
strengthen = '强化';
stren = ['需要金币', '强化至','垫一刀', '自动强化目标等级', '自动强化', '自动强化中', '中断自动强化'];
success= '成功';
fail= '失败';
stDesc = [
'强化说明',
'花费金币强化装备',

38
src/views/backpack/strengthen.vue

@ -31,17 +31,23 @@ @@ -31,17 +31,23 @@
</div>
</div>
<div class="btn-group" v-if='!auto'>
<p>需要金币<span :class="{ 'red': useCoins < needCoins }">{{ needCoins }}</span></p>
<button class="button" @click="strengthen">强化至+{{ parseInt(equip.strengthenLv) + 1 }}</button>
<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>
</div>
<div class="btn-group" v-if='!auto'>
<p>自动强化目标等级</p>
<p><input type="number" placeholder="目标等级" max="15" min="5" v-model="autoLv"></p>
<button class="button" @click="startAuto">自动强化</button>
<p>{{ t('stren.0') }}<span :class="{ 'red': useCoins < needCoins }">{{ needCoins }}</span></p>
<button class="button" @click="strengthen(true)">{{ t('stren.2') }}</button>
<span v-if="testFlag">{{equip.strengthenLv}}<span class="arror"></span>{{ testResult }}</span>
</div>
<div class="btn-group" v-if='!auto'>
<p>{{ t('stren.3') }}</p>
<p><input type="number" :placeholder="t('stren32')" max="15" min="5" v-model="autoLv"></p>
<button class="button" @click="startAuto">{{ t('stren.4') }}</button>
</div>
<div class="btn-group" v-if='auto'>
<p>自动强化中...</p>
<button class="button" @click="stopAuto">中断自动强化</button>
<p>{{ t('stren.5') }}...</p>
<button class="button" @click="stopAuto">{{ t('stren.6') }}</button>
</div>
<Tooltip :infos="[t('reforgeDesc.1'), t('reforgeDesc.2')]" width="8rem">
<div class="descript">- {{ t('reforgeDesc.0') }} -</div>
@ -80,6 +86,8 @@ const successLv = 5; @@ -80,6 +86,8 @@ const successLv = 5;
const rates = [0.8, 0.65, 0.45, 0.3, 0.2];
const reforgeFlag = ref(false);
const reforgeing = ref(false);
const testFlag = ref(false);
const testResult = ref(0);
const height = computed(() => {
if (prop.equip) {
return prop.equip.extraEntry.length * 2.5 + 'rem';
@ -108,7 +116,7 @@ const needCoins = computed(() => { @@ -108,7 +116,7 @@ const needCoins = computed(() => {
return Math.round((prop.equip.lv + 1) * (1.1 ** (prop.equip.strengthenLv) ** 1.1) * (10 + prop.equip.lv / 5) + 100);
})
const strengthen = () => {
const strengthen = (test?) => {
if (auto.value && prop.equip.strengthenLv >= autoLv.value) {
auto.value = false;
commit("set_sys_info", { msg: t('strengthenFinish'), type: "win", });
@ -127,11 +135,16 @@ const strengthen = () => { @@ -127,11 +135,16 @@ const strengthen = () => {
idx = idx > len ? len : idx;
rate = rates[idx] || 0.2;
}
if (Math.random() < rate) {
prop.equip.strengthenLv++
} else if (lv >= 5) {
prop.equip.strengthenLv--
const result = Math.random() < rate ? 1 : -1;
if (test) {
testFlag.value = true;
testResult.value = prop.equip.strengthenLv + result;
} else {
testFlag.value = false;
prop.equip.strengthenLv += result;
}
commit("add_player_coins", -1 * needCoins.value);
auto.value && setTimeout(strengthen, 200);
};
@ -181,6 +194,7 @@ onMounted(() => { }); @@ -181,6 +194,7 @@ onMounted(() => { });
padding: 0 1rem;
box-sizing: border-box;
}
.coins {
display: flex;
align-items: center !important;

Loading…
Cancel
Save