From 6c795df7d7687ffdb6b0cd1b3077e2474aea29b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=AB=E8=B0=B7=E5=89=91=E4=BB=99?= Date: Tue, 3 Jan 2023 19:06:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=A7U=E4=B8=8D=E7=82=B9?= =?UTF-8?q?=E4=BA=AE=E6=BD=9C=E8=A7=89=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script.js | 20 +++++++++++++++++--- service-worker.js | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/script.js b/script.js index 6619fc4e..6b740f6e 100644 --- a/script.js +++ b/script.js @@ -4545,6 +4545,7 @@ function refreshLatent(latents, member, latentsNode, option) { latentsNode.classList.toggle("block-8", maxLatentCount>6); latents = latents.concat(); if (option?.sort) latents.sort((a, b) => latentUseHole(b) - latentUseHole(a)); + //如果传入了辅助,才进行有效觉醒的计算,否则算作只有本人的。 let effectiveAwokens = option?.assist instanceof Member ? member.effectiveAwokens(option.assist) : null; let latentIndex = 0, usedHoleN = 0; //如果传入了武器,就添加有效觉醒 @@ -4556,9 +4557,22 @@ function refreshLatent(latents, member, latentsNode, option) { icon.setAttribute("data-latent-icon", latent); icon.setAttribute("data-latent-hole", thisHoleN); let enableLatent = true; - if (effectiveAwokens) { - let obj = allowable_latent.needAwoken.find(obj=>obj.latent == latent); - if (obj && !effectiveAwokens.includes(obj.awoken)) enableLatent = false; + //搜索需要觉醒的潜觉 + if (effectiveAwokens) { //如果有有效觉醒,说明需要计算辅助,否则在单人编辑状态是不需要判断是否需要觉醒的 + let needAwokenLatent = allowable_latent.needAwoken.find(obj=>obj.latent == latent); + if (needAwokenLatent) { //如果是需要觉醒的潜觉 + let needAwokens = new Set([needAwokenLatent.awoken]); + equivalent_awoken.forEach(obj=>{ + //如果搜索到等效觉醒,把大小值都添加到需要的觉醒 + if (obj.small === needAwokenLatent.awoken || obj.big === needAwokenLatent.awoken) { + needAwokens.add(obj.small); + needAwokens.add(obj.big); + } + }); + //如果需要的觉醒,在有效觉醒里全都没有 + if ([...needAwokens].every(ak=>!effectiveAwokens.includes(ak))) + enableLatent = false; + } } icon.classList.toggle('unallowable-latent', !enableLatent); usedHoleN += thisHoleN; diff --git a/service-worker.js b/service-worker.js index b6aa3d48..45b25f30 100644 --- a/service-worker.js +++ b/service-worker.js @@ -8071,7 +8071,7 @@ const cachesMap = new Map([ ], [ "script.js", - "e7baa9224af3134c62a8b62e19d12197" + "a4090df41cf38ae6903771338aa84ac1" ], [ "solo.html",