diff --git a/languages/en.js b/languages/en.js index 0f7a7ad0..1418ff10 100644 --- a/languages/en.js +++ b/languages/en.js @@ -8,6 +8,7 @@ Number.prototype.bigNumberToString = function() { let numTemp = negative ? Math.abs(this) : this.valueOf(); if (!numTemp) return "0"; + if (numTemp == Infinity) return "Infinity"; const grouping = 1e3; const unit = ['', 'K', 'M', 'G', 'T', 'P']; const numParts = []; diff --git a/languages/zh-TW.js b/languages/zh-TW.js index c94b0790..4ab130e6 100644 --- a/languages/zh-TW.js +++ b/languages/zh-TW.js @@ -394,6 +394,7 @@ Number.prototype.bigNumberToString = function() { let numTemp = negative ? Math.abs(this) : this.valueOf(); if (!numTemp) return "0"; + if (numTemp == Infinity) return "無窮大"; const grouping = 1e4; const unit = ['','萬','億','兆','京','垓']; const numParts = []; diff --git a/languages/zh.js b/languages/zh.js index 335b450b..a82d23e3 100644 --- a/languages/zh.js +++ b/languages/zh.js @@ -393,6 +393,7 @@ Number.prototype.bigNumberToString = function() { let numTemp = negative ? Math.abs(this) : this.valueOf(); if (!numTemp) return "0"; + if (numTemp == Infinity) return "无穷大"; const grouping = 1e4; const unit = ['', '万', '亿', '兆', '京', '垓']; const numParts = []; diff --git a/script-universal_function.js b/script-universal_function.js index 6aafcce7..4e26139f 100644 --- a/script-universal_function.js +++ b/script-universal_function.js @@ -1391,7 +1391,7 @@ function countMoveTime(team, leader1id, leader2id, teamIdx) { moveTime.duration.awoken += latentMoveTime.reduce((duration, la) => duration + team[0].reduce((count, member) => - count + (member.latent ? member.latent.filter(l => l == la.index).length : 0), 0) * la.value, 0); + count + (member?.latent?.filter(l => l == la.index)?.length ?? 0), 0) * la.value, 0); } @@ -1464,6 +1464,36 @@ function getReduceRange(reduceScales) }); return attrsRanges; } +//获取盾潜觉的减伤比例组 +function getAttrShieldAwokenReduceScales(team) { + //5种盾潜觉 + return [ + {awoken:4,latent1:6,latent2:32}, + {awoken:5,latent1:7,latent2:33}, + {awoken:6,latent1:8,latent2:34}, + {awoken:7,latent1:9,latent2:35}, + {awoken:8,latent1:10,latent2:36}, + ].map((shield, attrIdx)=>{ + const akNum = awokenCountInTeam(team, shield.awoken, solo, teamsCount); //获取盾觉醒个数,没有大觉醒 + const latent1Num = team[0].reduce((count, member) => count + (member?.latent?.filter(l => l == shield.latent1)?.length ?? 0), 0); + const latent2Num = team[0].reduce((count, member) => count + (member?.latent?.filter(l => l == shield.latent2)?.length ?? 0), 0); + + const reduce = { + scale: 0, + hp: { + max: 100, + min: 0 + }, + probability: 1, + attrs: 31, //5色是31 + }; + + reduce.scale = Math.min(akNum * 0.07 + latent1Num * 0.01 + latent2Num * 0.025, 1); + if (reduce.scale == 0) return false; + reduce.attrs = 1 << attrIdx; + return reduce; + }).filter(Boolean); +} //获取盾减伤比例组 function getReduceScales(leaderid) { const searchTypeArray = [16, 17, 36, 38, 43, 129, 163, 130, 131, 178, 151, 169, 198, 170, 182, 193, 171, 183, 235]; diff --git a/script.js b/script.js index 6b740f6e..51eb3ca8 100644 --- a/script.js +++ b/script.js @@ -2724,12 +2724,12 @@ function initialize() { //显示HP的详细值 const hpDetailDialog = formationBox.querySelector(".dialog-hp-detail"); - hpDetailDialog.initialing = function(reduceAttrRanges, tHP, tHPNoAwoken) + hpDetailDialog.initialing = function(reduceAttrRanges, reduceAttrRangesWithOutAwoken, tHP, tHPNoAwoken) { const dialogContent = this.querySelector(".dialog-content"); const fragment = document.createDocumentFragment(); - function insertHpRangeTable(reduceRanges, tHP, tHPNoAwoken, attr) + function insertHpRangeTable(reduceRanges, reduceRangesWithOutAwoken, tHP, tHPNoAwoken, attr) { const table = document.createElement("table"); table.className = "hp-range-table"; @@ -2751,11 +2751,17 @@ function initialize() { reduceRow.appendChild(document.createElement("th")); const reduceHpRow = tBody.insertRow(); reduceHpRow.className = "reduce-general"; - reduceHpRow.appendChild(document.createElement("th")); + const reduceHpRowTitle = reduceHpRow.appendChild(document.createElement("th")); + const reduceHpRowTitleSheild = reduceHpRowTitle.appendChild(document.createElement("icon")); + reduceHpRowTitleSheild.className = "sheild"; const reduceHpNoAwokenRow = tBody.insertRow(); reduceHpNoAwokenRow.className = "reduce-awoken-bind"; - reduceHpNoAwokenRow.appendChild(document.createElement("th")); - reduceRanges.forEach(range=>{ + const reduceHpNoAwokenRowTitle = reduceHpNoAwokenRow.appendChild(document.createElement("th")); + const reduceHpNoAwokenRowTitleSheild = reduceHpNoAwokenRowTitle.appendChild(document.createElement("icon")); + reduceHpNoAwokenRowTitleSheild.className = "sheild"; + for (let ri=0;rir != reduceAttrRanges[0])) //有指定属性减伤 { - reduceAttrRanges.forEach((reduceRanges, ridx)=>fragment.appendChild(insertHpRangeTable(reduceRanges, tHP, tHPNoAwoken, ridx))); + for (let ri=0;ri { bar.onclick = function(){ - hpDetailDialog.show(this.reduceAttrRanges, this.tHP, this.tHPNoAwoken); + hpDetailDialog.show(this.reduceAttrRangesWithShieldAwoken, this.reduceAttrRanges, this.tHP, this.tHPNoAwoken); }; }); @@ -5338,15 +5350,19 @@ function refreshTeamTotalHP(totalDom, team, teamIdx) { if (tHpDom) { const reduceScales1 = getReduceScales(leader1id); const reduceScales2 = getReduceScales(leader2id); + const reduceAttrSeildAwokenScales = getAttrShieldAwokenReduceScales(team); const reduceAttrRanges = getReduceRange(reduceScales1.concat(reduceScales2)); + const reduceAttrRangesWithShieldAwoken = getReduceRange(reduceScales1.concat(reduceScales2, reduceAttrSeildAwokenScales)); //将所有范围平铺,然后选择盾最少那个作为基础盾值 const leastScale = reduceAttrRanges.flat().sort((a,b)=>a.scale-b.scale)[0]; const hpBar = totalDom.querySelector(".reduce-details"); - if (reduceAttrRanges.some(r=>r != reduceAttrRanges[0]) || reduceAttrRanges[0].length > 1 || reduceAttrRanges[0][0].probability < 1) //有阶梯盾或者有指定属性减伤或者减伤比例不是100% + if (reduceAttrRangesWithShieldAwoken.some(r=>r != reduceAttrRangesWithShieldAwoken[0]) || + reduceAttrRangesWithShieldAwoken[0].length > 1 || + reduceAttrRangesWithShieldAwoken[0][0].probability < 1) //有HP阶梯盾或者有指定属性减伤或者减伤几率不是100% { - drawHpInfo(hpBar, reduceAttrRanges); + drawHpInfo(hpBar, reduceAttrRangesWithShieldAwoken); hpBar.classList.remove(className_displayNone); }else { @@ -5377,11 +5393,13 @@ function refreshTeamTotalHP(totalDom, team, teamIdx) { tHPNoAwoken = Math.round(Math.round(tHPNoAwoken) * badgeHPScale); //记录到bar中,方便打开详情时调用 - hpBar.reduceAttrRanges = reduceAttrRanges; + hpBar.reduceAttrRangesWithShieldAwoken = reduceAttrRangesWithShieldAwoken; //有盾觉醒的 + hpBar.reduceAttrRanges = reduceAttrRanges; //没有盾觉醒的 hpBar.tHP = tHP; hpBar.tHPNoAwoken = tHPNoAwoken; const tReduceHP = Math.floor(tHP / (1 - totalReduce)); //队伍正常满血加上盾能承受的最大伤害 + const tReduceHPNoAwoken = Math.floor(tHPNoAwoken / (1 - totalReduce)); //队伍封觉醒满血加上盾能承受的最大伤害 const tHpDom_general = tHpDom.querySelector(".general"); diff --git a/service-worker.js b/service-worker.js index e761d6ae..161350dc 100644 --- a/service-worker.js +++ b/service-worker.js @@ -8043,7 +8043,7 @@ const cachesMap = new Map([ ], [ "browser-compatibility.js", - "cd34f33d1c77c7fff4ae17b448eac5ad" + "1d3c87e415212a226eb81ed0de77e4ed" ], [ "index.html", @@ -8067,11 +8067,11 @@ const cachesMap = new Map([ ], [ "script-universal_function.js", - "a586571c5e43f8f52bc2fe1d36b1afd7" + "429cfed7bc5fc12a2152555e45241e61" ], [ "script.js", - "a4090df41cf38ae6903771338aa84ac1" + "d51fccfd2c12a45a632b10313a58520b" ], [ "solo.html", @@ -8091,7 +8091,7 @@ const cachesMap = new Map([ ], [ "triple.html", - "a7858b668418ca1c2f37f75c85fd0dac" + "a5deb7b8a7a1c2a9e077e079fb18271c" ], [ "languages/en.css", @@ -8099,7 +8099,7 @@ const cachesMap = new Map([ ], [ "languages/en.js", - "aee402fff8b70ee1fa4ad042cf05fb53" + "e4985277782847d8a82be1da633a4d3d" ], [ "languages/ja.css", @@ -8135,7 +8135,7 @@ const cachesMap = new Map([ ], [ "languages/zh-TW.js", - "ee248d17912a7986676f190f7fb215d6" + "b97067d6ff6412a2ace98f8aa425dc08" ], [ "languages/zh.css", @@ -8143,7 +8143,7 @@ const cachesMap = new Map([ ], [ "languages/zh.js", - "8b4ac347a5894174b258b95e84799f75" + "c7d9f3adbcaf1d71bb8326ea2b33f0af" ], [ "images/attrs.png",