From 47a7e030cdd46d42feb51aa362c7df847106a3be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=AB=E8=B0=B7=E5=89=91=E4=BB=99?= Date: Thu, 16 Apr 2020 19:11:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E7=94=A8set?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/script.js b/script.js index 516cd3d6..9092f37c 100644 --- a/script.js +++ b/script.js @@ -1988,12 +1988,17 @@ function editBoxChangeMonId(id) const rowPlus = settingBox.querySelector(".row-mon-plus"); const rowLatent = settingBox.querySelector(".row-mon-latent"); const monLatentAllowUl = rowLatent.querySelector(".m-latent-allowable-ul"); - //该宠Type允许的杀,uniq是去重的自定义函数 - const allowLatent = [].concat(...card.types.filter(i=>i>=0).map(type=>type_allowable_latent[type])).uniq(); + //该宠Type允许的杀,set不会出现重复的 + const allowLatent = new Set(); + card.types + .filter(i=>i>=0) + .map(type=>type_allowable_latent[type]) + .forEach(tA => tA.forEach(t=>allowLatent.add(t))); + typekiller_for_type.forEach(type=>{ //显示允许的杀,隐藏不允许的杀 const latentDom = monLatentAllowUl.querySelector(`.latent-icon[data-latent-icon='${type.latent}']`); if (!latentDom) return; - if (allowLatent.includes(type.latent)) + if (allowLatent.has(type.latent)) { latentDom.classList.remove("unallowable-latent"); }else