好像修好了血条的bug

This commit is contained in:
Fang_Zhijian 2024-06-01 17:24:20 +08:00
parent 7367c9047f
commit 9f6b3acf9a

View File

@ -112,6 +112,7 @@ const warnWindowCountdown = ref(5);
// //
const showTestWindow = ref(false) const showTestWindow = ref(false)
const maxHP = ref(1000) const maxHP = ref(1000)
const HP = ref(maxHP.value)
// //
const gameState = ref(false) const gameState = ref(false)
@ -159,6 +160,10 @@ watch(showWarnWindow, (newVal) => {
} }
}); });
watch(waveCounter, () => {
HP.value = Math.max(0, HP.value - channelAStrength.value)
});
const fansMedal = computed({ const fansMedal = computed({
get: () => settings.value.fansMedal, get: () => settings.value.fansMedal,
set: (value) => { settings.value.fansMedal = value === 'true' } set: (value) => { settings.value.fansMedal = value === 'true' }
@ -460,7 +465,7 @@ const guardLevelText = computed(() => {
<h2>测试界面</h2> <h2>测试界面</h2>
<hr /> <hr />
<p>绿色背景方便用色度键抠像最大 HP <input v-model="maxHP" size="2" /></p> <p>绿色背景方便用色度键抠像最大 HP <input v-model="maxHP" size="2" /></p>
<p><button @click="waveCounter = 0">重置伤害</button> <button @click="waveCounter++">造成伤害</button></p> <p><button @click="HP = maxHP">重置伤害</button> <button @click="HP -= 10">造成伤害</button></p>
<hr /> <hr />
<div class="attack-box" style="padding-top: 25px;"> <div class="attack-box" style="padding-top: 25px;">
<div style="display: flex;"> <div style="display: flex;">
@ -492,8 +497,8 @@ const guardLevelText = computed(() => {
HP HP
</div> </div>
<div class="attribute-hp-board"> <div class="attribute-hp-board">
<div class="attribute-hp-bg" :style="{ width: ((maxHP - channelAStrength*waveCounter) / maxHP) * 100 + '%' }"> <div class="attribute-hp-bg" :style="{ width: (HP / maxHP) * 100 + '%' }">
{{ (maxHP - channelAStrength*waveCounter) + "/" + maxHP }} {{ HP + "/" + maxHP }}
</div> </div>
</div> </div>
</div> </div>