From 4445b1df4235cd055ac9d6ef1143cfe52d6ce69b 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, 8 Jan 2020 20:47:25 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=B8=8E=E7=A9=BA=E7=99=BD?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E4=BA=A4=E6=8D=A2=E6=97=B6=E6=AE=8B=E7=95=99?= =?UTF-8?q?=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 | 53 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/script.js b/script.js index 847fcaeb..16f9cf32 100644 --- a/script.js +++ b/script.js @@ -932,12 +932,14 @@ function changeid(mon,monDom,latentDom) parentNode.classList.add("delay"); parentNode.classList.remove("null"); parentNode.appendChild(fragment); + if (latentDom) latentDom.classList.add("display-none"); return; }else if (monId==0) //如果是空 { parentNode.classList.add("null"); parentNode.classList.remove("delay"); parentNode.appendChild(fragment); + if (latentDom) latentDom.classList.add("display-none"); return; }else (monId>-1) //如果提供了id { @@ -1042,34 +1044,43 @@ function changeid(mon,monDom,latentDom) plusDom.classList.remove("has297"); } } - if (latentDom && mon.latent) //如果提供了潜觉 + if (latentDom) { - var latent = mon.latent.sort(function(a,b){ - if(b>=12 && a<12) {return 1;} //如果大于12,就排到前面 - else if(b<12 && a>=12) {return -1} //如果小于12就排到后面 - else {return 0} //其他情况不变 - }); - if (latent.length < 1) - latentDom.classList.add("display-none"); - else - latentDom.classList.remove("display-none"); - var latentDoms = Array.prototype.slice.call(latentDom.querySelectorAll("li")); - var usedHoleN = usedHole(latent); - let maxLatentCount = getMaxLatentCount(mon.id); //最大潜觉数量 - for (var ai=0;ai=12 && a<12) {return 1;} //如果大于12,就排到前面 + else if(b<12 && a>=12) {return -1} //如果小于12就排到后面 + else {return 0} //其他情况不变 + }); + if (latent.length < 1) { - latentDoms[ai].className = "latent-icon latent-icon-" + latent[ai]; - } - else if(ai<(maxLatentCount-usedHoleN+latent.length)) + latentDom.classList.add("display-none"); + }else { - latentDoms[ai].className = "latent-icon"; + latentDom.classList.remove("display-none"); } - else + let usedHoleN = usedHole(latent); //使用的格子数 + let maxLatentCount = getMaxLatentCount(mon.id); //最大潜觉数量 + for (let ai=0;ai