From 5f07622f2ae1fa487e65875af89d83310f45de06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=AB=E8=B0=B7=E5=89=91=E4=BB=99?= Date: Wed, 21 Oct 2020 20:06:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=8D=E6=AC=A1=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script-universal_function.js | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/script-universal_function.js b/script-universal_function.js index 69b1ffa1..f5dc6fb1 100644 --- a/script-universal_function.js +++ b/script-universal_function.js @@ -120,30 +120,24 @@ fetch("library/jy4340132-aaa/adpcm.wasm").then((response) => response.arrayBuffe //▲ADPCM播放相关 function latentUseHole(latentId) { - if (latentId < 12) + switch (true) { - return 1; - }else if (latentId === 12 || latentId >= 16 && latentId <= 36) - { - return 2; - }else if (latentId >= 13 && latentId <= 15 || latentId >= 37 && latentId <= 38) - { - return 6; - }else - { - return 1; + case (latentId === 12): + case (latentId >= 16 && latentId <= 36): + return 2; + case (latentId >= 13 && latentId <= 15): + case (latentId >= 37): + return 6; + case (latentId < 12): + default: + return 1; } } //获取最大潜觉数量 function getMaxLatentCount(id) { //转生2和超转生3为8个格子 - if (Cards[id]) - { - return Cards[id].is8Latent ? 8 : 6; - }else - { - return 6; - } + const card = Cards[id]; + return card && card.is8Latent ? 8 : 6; } //计算用了多少潜觉格子 function usedHole(latents)