From 019d6bd23a0a20dcfe51fe753fe7d3600a0b1be0 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, 23 Jul 2019 21:50:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AE=A1=E7=AE=97=E9=98=9F?= =?UTF-8?q?=E5=91=98=E8=83=BD=E5=8A=9B=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- languages/en.css | 19 ++++--- languages/ja.css | 19 ++++--- languages/ko.css | 19 ++++--- languages/zh-TW.css | 19 ++++--- languages/zh.css | 19 ++++--- script.js | 116 ++++++++++++++++++++++++++++++++++++------ solo.html | 20 ++++++++ style.css | 52 ++++++++++++++++--- universal_function.js | 24 ++++++--- 9 files changed, 228 insertions(+), 79 deletions(-) diff --git a/languages/en.css b/languages/en.css index eedaf996..c4bc804a 100644 --- a/languages/en.css +++ b/languages/en.css @@ -6,12 +6,6 @@ .monster .level.max::before{ content: "Lv.Max"; } -.monster .plus .hp::before, -.monster .plus .atk::before, -.monster .plus .rcv::before, -.monster .plus ._297::before{ - content: "+"; -} .monster .level::before{ content: "Lv."; } @@ -30,6 +24,15 @@ .formation-B-box .formation-assist .member::before{ content: "▲Assist"; } +.abilitys .hp::before{ + content: "HP:"; +} +.abilitys .atk::before{ + content: "ATK:"; +} +.abilitys .rcv::before{ + content: "RCV:"; +} .edit-box .edit-box-title::before{ content: "Edit Member"; } @@ -66,10 +69,6 @@ .m-plus-rcv-li::before{ content: "RCV"; } -.m-plus-btn::before, -.m-plus-btn-297::before{ - content: "+"; -} .edit-box .setting-box .row-mon-latent::before{ content: "▼Latent Awoken"; } diff --git a/languages/ja.css b/languages/ja.css index 9617323b..2c73d0e9 100644 --- a/languages/ja.css +++ b/languages/ja.css @@ -5,12 +5,6 @@ .monster .level.max::before{ content: "Lv.最大"; } -.monster .plus .hp::before, -.monster .plus .atk::before, -.monster .plus .rcv::before, -.monster .plus ._297::before{ - content: "+"; -} .monster .level::before{ content: "Lv."; } @@ -47,6 +41,15 @@ .m-level-btn-max::before{ content: "最高Lv"; } +.abilitys .hp::before{ + content: "HP:"; +} +.abilitys .atk::before{ + content: "攻撃:"; +} +.abilitys .rcv::before{ + content: "回復:"; +} .edit-box .setting-box .row-mon-awoken::before{ content: "▼モンスター覚醒"; } @@ -65,10 +68,6 @@ .m-plus-rcv-li::before{ content: "回復"; } -.m-plus-btn::before, -.m-plus-btn-297::before{ - content: "+"; -} .edit-box .setting-box .row-mon-latent::before{ content: "▼モンスター潜在覚醒"; } diff --git a/languages/ko.css b/languages/ko.css index 1dac2b1c..660fd9ec 100644 --- a/languages/ko.css +++ b/languages/ko.css @@ -5,12 +5,6 @@ .monster .level.max::before{ content: "Lv.최대"; } -.monster .plus .hp::before, -.monster .plus .atk::before, -.monster .plus .rcv::before, -.monster .plus ._297::before{ - content: "+"; -} .monster .level::before{ content: "Lv."; } @@ -47,6 +41,15 @@ .m-level-btn-max::before{ content: "최고Lv"; } +.abilitys .hp::before{ + content: "HP:"; +} +.abilitys .atk::before{ + content: "공격:"; +} +.abilitys .rcv::before{ + content: "회복:"; +} .edit-box .setting-box .row-mon-awoken::before{ content: "▼몬스터 각성"; } @@ -65,10 +68,6 @@ .m-plus-rcv-li::before{ content: "회복"; } -.m-plus-btn::before, -.m-plus-btn-297::before{ - content: "+"; -} .edit-box .setting-box .row-mon-latent::before{ content: "▼몬스터 숨어있는"; } diff --git a/languages/zh-TW.css b/languages/zh-TW.css index c9c180d3..3fb4024d 100644 --- a/languages/zh-TW.css +++ b/languages/zh-TW.css @@ -5,12 +5,6 @@ .monster .level.max::before{ content: "Lv.最大"; } -.monster .plus .hp::before, -.monster .plus .atk::before, -.monster .plus .rcv::before, -.monster .plus ._297::before{ - content: "+"; -} .monster .level::before{ content: "Lv."; } @@ -47,6 +41,15 @@ .m-level-btn-max::before{ content: "最高Lv"; } +.abilitys .hp::before{ + content: "HP:"; +} +.abilitys .atk::before{ + content: "攻擊:"; +} +.abilitys .rcv::before{ + content: "回復:"; +} .edit-box .setting-box .row-mon-awoken::before{ content: "▼怪物覺醒"; } @@ -65,10 +68,6 @@ .m-plus-rcv-li::before{ content: "回復"; } -.m-plus-btn::before, -.m-plus-btn-297::before{ - content: "+"; -} .edit-box .setting-box .row-mon-latent::before{ content: "▼潛在覺醒"; } diff --git a/languages/zh.css b/languages/zh.css index 89b96ba2..f18ed7cb 100644 --- a/languages/zh.css +++ b/languages/zh.css @@ -5,12 +5,6 @@ .monster .level.max::before{ content: "Lv.最大"; } -.monster .plus .hp::before, -.monster .plus .atk::before, -.monster .plus .rcv::before, -.monster .plus ._297::before{ - content: "+"; -} .monster .level::before{ content: "Lv."; } @@ -29,6 +23,15 @@ .formation-B-box .formation-assist .member::before{ content: "▲辅助"; } +.abilitys .hp::before{ + content: "HP:"; +} +.abilitys .atk::before{ + content: "攻击:"; +} +.abilitys .rcv::before{ + content: "回复:"; +} .edit-box .edit-box-title::before{ content: "修改队员"; } @@ -65,10 +68,6 @@ .m-plus-rcv-li::before{ content: "回复"; } -.m-plus-btn::before, -.m-plus-btn-297::before{ - content: "+"; -} .edit-box .setting-box .row-mon-latent::before{ content: "▼潜在觉醒"; } diff --git a/script.js b/script.js index e8367e6c..38f4b34a 100644 --- a/script.js +++ b/script.js @@ -338,10 +338,13 @@ function initialize() parseInt(monEditAddRcv.value) ]; var latent = editBox.latent; - var abilitys = calculateAbility(monid,level,awoken,plus,latent); + var abilitys = calculateAbility(monid,level,plus,awoken,latent); [monEditHpValue,monEditAtkValue,monEditRcvValue].forEach(function(div,idx){ - div.innerHTML = abilitys[idx]; + if (abilitys) + div.innerHTML = abilitys[idx]; + else + div.innerHTML = 0; }) } @@ -397,6 +400,33 @@ function initialize() } changeid(mD,editBox.monsterBox,editBox.latentBox); + /* + var formationAbilityDom = document.querySelector(".formation-box .formation-ability"); + if (formationAbilityDom) + { + //另一个怪物数据 + var mD2 = formation.team[editBox.memberIdx[0]][editBox.memberIdx[1]?0:1][editBox.memberIdx[2]]; + var mainMD,assistMD; //主怪与辅助 + if (editBox.memberIdx[1]) + { + assistMD = mD; + mainMD = mD2; + }else + { + mainMD = mD; + assistMD = mD2; + } + + } + */ + var formationAbilityDom = document.querySelector(".formation-box .formation-ability"); + if (formationAbilityDom) + { + refreshAbility( + formationAbilityDom, + formation.team[editBox.memberIdx[0]], + editBox.memberIdx[2]); + } refreshAwokenCount(formation.team); creatNewUrl(); editBox.hide(); @@ -413,6 +443,14 @@ function initialize() btnNull.onclick = function(){ var mD = formation.team[editBox.memberIdx[0]][editBox.memberIdx[1]][editBox.memberIdx[2]] = {id:0}; changeid(mD,editBox.monsterBox,editBox.latentBox); + var formationAbilityDom = document.querySelector(".formation-box .formation-ability"); + if (formationAbilityDom) + { + refreshAbility( + formationAbilityDom, + formation.team[editBox.memberIdx[0]], + editBox.memberIdx[2]); + } refreshAwokenCount(formation.team); creatNewUrl(); editBox.hide(); @@ -420,6 +458,14 @@ function initialize() btnDelay.onclick = function(){ //应对威吓 var mD = formation.team[editBox.memberIdx[0]][editBox.memberIdx[1]][editBox.memberIdx[2]] = {id:-1}; changeid(mD,editBox.monsterBox,editBox.latentBox); + var formationAbilityDom = document.querySelector(".formation-box .formation-ability"); + if (formationAbilityDom) + { + refreshAbility( + formationAbilityDom, + formation.team[editBox.memberIdx[0]], + editBox.memberIdx[2]); + } refreshAwokenCount(formation.team); creatNewUrl(); editBox.hide(); @@ -499,18 +545,23 @@ function changeid(mon,monDom,latentDom) }else { awokenIcon.classList.remove("display-none"); - if (mon.awoken < md.awoken.length) //觉醒没满直接写数字 - { - awokenIcon.innerHTML = mon.awoken; - awokenIcon.classList.remove("allowable-assist"); - }else //满觉醒打星星 + awokenIcon.innerHTML = mon.awoken; + if (mon.awoken == md.awoken.length) { - awokenIcon.innerHTML = "★"; + awokenIcon.classList.add("full-awoken"); if (md.assist) + {//可以辅助的满觉醒打黄色星星 awokenIcon.classList.add("allowable-assist"); - else + }else + { awokenIcon.classList.remove("allowable-assist"); + } + }else + { + awokenIcon.classList.remove("full-awoken"); + awokenIcon.classList.remove("allowable-assist"); } + } } var sawoken = monDom.querySelector(".super-awoken"); @@ -627,7 +678,7 @@ function editMon(AorB,isAssist,tempIdx) var btnDelay = editBox.querySelector(".button-delay"); if (!isAssist) { - editBox.latent = mD.latent.concat() || []; + editBox.latent = mD.latent?mD.latent.concat():[]; editBox.refreshLatent(editBox.latent); btnDelay.classList.add("display-none"); settingBox.querySelector(".row-mon-latent").classList.remove("display-none"); @@ -778,10 +829,18 @@ function refreshAll(fmt){ var fBLatents = formationB.querySelectorAll(".formation-latents .latent-ul"); var fBAssist = formationB.querySelectorAll(".formation-assist .monster"); } + var formationAbilityDom = document.querySelector(".formation-box .formation-ability"); for (var ti=0;ti<(formationB?5:6);ti++) { changeid(fmt.team[0][0][ti],fATeam[ti],fALatents[ti]); changeid(fmt.team[0][1][ti],fAAssist[ti]); + if (formationAbilityDom) + { + refreshAbility( + formationAbilityDom, + fmt.team[0], + ti); + } if (formationB) { changeid(fmt.team[1][0][ti],fBTeam[ti],fBLatents[ti]); @@ -791,7 +850,7 @@ function refreshAll(fmt){ refreshAwokenCount(fmt.team); } //刷新觉醒总计 -function refreshAwokenCount(team){ +function refreshAwokenCount(teams){ var awokenUL = document.querySelector(".awoken-total-box .awoken-ul"); function setCount(idx,number){ var ali = awokenUL.querySelector(".a-c-" + idx); @@ -806,19 +865,46 @@ function refreshAwokenCount(team){ { if (ai == 10) //防封 { - setCount(ai,awokenCountInTeam(team,ai,solo)+awokenCountInTeam(team,52,solo)*2); + setCount(ai,awokenCountInTeam(teams,ai,solo)+awokenCountInTeam(teams,52,solo)*2); }else if (ai == 19) //手指 { - setCount(ai,awokenCountInTeam(team,ai,solo)+awokenCountInTeam(team,53,solo)*2); + setCount(ai,awokenCountInTeam(teams,ai,solo)+awokenCountInTeam(teams,53,solo)*2); }else if (ai == 21) //SB { - setCount(ai,awokenCountInTeam(team,ai,solo)+awokenCountInTeam(team,56,solo)*2); + setCount(ai,awokenCountInTeam(teams,ai,solo)+awokenCountInTeam(teams,56,solo)*2); }else if (ai == 52 || ai == 53 || ai == 56) //大防封、大手指,大SB { continue; }else { - setCount(ai,awokenCountInTeam(team,ai,solo)); + setCount(ai,awokenCountInTeam(teams,ai,solo)); } } +} +//刷新能力值 +function refreshAbility(dom,team,idx){ + var ali = dom.querySelector(".abilitys-" + (idx+1)); + var mainMD = team[0][idx]; + var assistMD = team[1][idx]; + var bonusScale = [0.1,0.05,0.15]; //辅助宠物附加的属性 + //如果辅助是武器,还要加上辅助的觉醒 + var mainAbility = calculateAbility(mainMD.id,mainMD.level,mainMD.plus,mainMD.awoken,mainMD.latent,assistMD.id,assistMD.awoken); + //如果辅助的主属性相等,辅助宠物只计算等级和加值,不计算觉醒 + var assistAbility = ms[mainMD.id].ppt[0]==ms[assistMD.id].ppt[0] + ?calculateAbility(assistMD.id,assistMD.level,assistMD.plus,null,null) + :[0,0,0]; + var hpDom = ali.querySelector(".hp"); + var atkDom = ali.querySelector(".atk"); + var rcvDom = ali.querySelector(".rcv"); + [hpDom,atkDom,rcvDom].forEach(function(div,ai){ + if (mainAbility) + { + div.classList.remove("display-none"); + div.innerHTML = mainAbility[ai] + Math.round(assistAbility[ai]*bonusScale[ai]); + }else + { + div.classList.add("display-none"); + div.innerHTML = 0; + } + }) } \ No newline at end of file diff --git a/solo.html b/solo.html index f781ded9..215d5555 100644 --- a/solo.html +++ b/solo.html @@ -247,6 +247,26 @@ var formation = { +
diff --git a/style.css b/style.css index fdd0bb3d..3fd0eff1 100644 --- a/style.css +++ b/style.css @@ -123,12 +123,12 @@ ul{ .null .monster>div,.delay .monster>div{ display:none; } -/*.monster .plus .hp::before, +.monster .plus .hp::before, .monster .plus .atk::before, .monster .plus .rcv::before, .monster .plus ._297::before{ content: "+"; -}*/ +} .monster .plus ._297{ /*297默认不显示*/ display:none; } @@ -143,8 +143,6 @@ ul{ /*怪物-觉醒*/ .monster .awoken-count{ color: yellow; - font-size: 20px; - line-height: 30px; text-shadow: black 0 0 4px; text-align: center; background-image: url(images/awoken-bg.png); @@ -156,6 +154,20 @@ ul{ right: 0; transform: scale(0.80) translateX(4px); } +.monster .awoken-count, +.monster .awoken-count.full-awoken::before{ + font-size: 20px; + line-height: 28px; +} +.monster .awoken-count.full-awoken{ + font-size: 0; +} +.monster .awoken-count.full-awoken::before{ + content: "★"; +} +.monster .awoken-count.allowable-assist.full-awoken::before{ + content: none; +} .monster .awoken-count.allowable-assist{ font-size: 0; text-shadow: none; @@ -212,7 +224,7 @@ ul{ content: "No."; }*/ /*辅助和队伍的每一只框架*/ -.member, .acquisitus-awoken-icon { +.member, .acquisitus-awoken-icon{ display: block; float: left; position: relative; @@ -312,6 +324,30 @@ ul{ .formation-B-box .formation-team .team-leader .monster{ border-color: blue; } + +/*三维计算值*/ +.formation-ability .abilitys{ + padding-left: 5px; + box-sizing: border-box; + font-size: 15px; + width: 108px; + display: inline-block; +} +.abilitys .hp::before,.abilitys .atk::before,.abilitys .rcv::before{ + width: 45px; + display: inline-block; +} +/*.abilitys .hp::before{ + content: "HP:"; +} +.abilitys .atk::before{ + content: "攻击:"; +} +.abilitys .rcv::before{ + content: "回复:"; +}*/ + + /*编辑窗口*/ .blur-bg{ filter:blur(5px); @@ -509,9 +545,9 @@ ul{ box-sizing: border-box; font-size: 25px; } -/*.m-plus-btn::before,.m-plus-btn-297::before{ +.m-plus-btn::before,.m-plus-btn-297::before{ content: "+"; -}*/ +} .m-plus-btn-297{ float:right; width: 85px; @@ -567,6 +603,7 @@ ul{ opacity: 0.3; } + .edit-box .button-box{ border-top: black solid 3px; background-color: rgba(0,0,0,0.5); @@ -610,6 +647,7 @@ ul{ }*/ .awoken-total-box::before{ font-size: 20px; + margin-top:5px; /*content: "觉醒总计:";*/ } .detail-box{ diff --git a/universal_function.js b/universal_function.js index 77534e28..b2874430 100644 --- a/universal_function.js +++ b/universal_function.js @@ -49,6 +49,7 @@ function getQueryString(name) { var r = window.location.search.substr(1).match(reg); if (r != null) return decodeURIComponent(r[2]); return null; } + //数组去重 /* https://www.cnblogs.com/baiyangyuanzi/p/6726258.html * 实现思路:获取没重复的最右一值放入新数组。 @@ -74,7 +75,7 @@ function usedHole(latent) return previous + (current>= 12?2:1); },0); } -//计算用了多少潜觉格子 +//计算队伍中有多少个该觉醒 function awokenCountInTeam(formationTeam,ak,solo) { var allAwokenCount = formationTeam.reduce(function(fc,fm){ @@ -86,7 +87,7 @@ function awokenCountInTeam(formationTeam,ak,solo) } var mdAwoken = ms[m.id].awoken; //这个怪物的觉醒数据 var mdSAwoken = ms[m.id].sAwoken; //这个怪物的超觉醒数据 - if ((!mdAwoken && !mdSAwoken) || (isAssist && mdAwoken[0] != 49)) + if ((!mdAwoken && !mdSAwoken) || (isAssist && mdAwoken.indexOf(49)<0)) { //如果没有觉醒和超觉醒 || (如果是辅助队 &&第一个不是武器觉醒) return c; } @@ -131,9 +132,10 @@ function returnMonsterNameArr(m,lsList) } //计算怪物的能力 -function calculateAbility(monid,level,awoken,plus,latent) +function calculateAbility(monid,level,plus,awoken,latent,weaponId,weaponAwoken) { - var m = ms[monid]; //怪物固定数据 + if (monid<=0) return null; + var m = ms[monid]; //怪物数据 var plusAdd = [10,5,3]; //加值的增加值 var awokenAdd = [ //对应加三维觉醒的序号与增加值 {index:1,value:500}, @@ -152,12 +154,20 @@ function calculateAbility(monid,level,awoken,plus,latent) n_base = Math.round(ab[1] + ab[1]*(m.a110/100)*(level-99)/11); } var n_plus = plus[idx]*plusAdd[idx]; //加值增加量 - var awokenCount = m.awoken.slice(0,awoken).filter(function(a){return a==awokenAdd[idx].index;}).length; //含有增加三维觉醒的数量 + var awokenList = m.awoken.slice(0,awoken); //储存生效的觉醒 + if (weaponId) + { + var weapon = ms[weaponId]; //武器的怪物数据 + var weaponAwokenList = weapon.awoken.slice(0,weaponAwoken); + if (weaponAwokenList.indexOf(49)>=0) + awokenList = awokenList.concat(weaponAwokenList); + } + var awokenCount = awoken?awokenList.filter(function(a){return a==awokenAdd[idx].index;}).length:0; //含有增加三维觉醒的数量 var n_awoken = Math.round(awokenCount*awokenAdd[idx].value); - var n_latent = Math.round(latentAdd[idx].reduce(function(previous,la){ + var n_latent = latent?Math.round(latentAdd[idx].reduce(function(previous,la){ var latentCount = latent.filter(function(l){return l==la.index;}).length; //每个潜觉的数量 return previous + n_base * la.scale * latentCount; //无加值与觉醒的基础值,乘以那么多个潜觉的增加倍数 - },0)); + },0)):0; //console.log("基础值:%d,加蛋值:%d,觉醒x%d增加:%d,潜觉增加:%d",n_base,n_plus,awokenCount,n_awoken,n_latent); return n_base + n_plus + n_awoken + n_latent; })