From fc9563313e26fd49e528aca182ace52be3525279 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, 23 Sep 2020 03:12:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=AE=8C=E6=88=90=E6=89=8B?= =?UTF-8?q?=E6=8C=87=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- languages/en.css | 9 ++++ languages/ja.css | 9 ++++ languages/ko.css | 9 ++++ languages/zh-TW.css | 9 ++++ languages/zh.css | 9 ++++ multi.html | 2 + script-universal_function.js | 97 +++++++++++++++++++++++++++++++++++- script.js | 31 ++++++++---- solo.html | 2 +- triple.html | 6 +-- 10 files changed, 168 insertions(+), 15 deletions(-) diff --git a/languages/en.css b/languages/en.css index dc42c910..82b10578 100644 --- a/languages/en.css +++ b/languages/en.css @@ -255,6 +255,15 @@ .team-total-info .tIf-total-rcv::before{ content: "Team RCV(Team Awoken & Badge): "; } +.team-total-info .tIf-total-move::before{ + content: "Team Move Time: "; +} +.team-total-info .tIf-total-move::after{ + content: "s"; +} +.team-total-info .tIf-total-move.fixed-move-time::after{ + content: "s (Fiexd)"; +} .formation-total-info .tIf-total-hp::before{ content: "Total HP(Team Awoken): "; } diff --git a/languages/ja.css b/languages/ja.css index e328e569..d9c7683c 100644 --- a/languages/ja.css +++ b/languages/ja.css @@ -248,6 +248,15 @@ .team-total-info .tIf-total-rcv::before{ content: "チーム回復(チーム覚醒とバッジ):"; } +.team-total-info .tIf-total-move::before{ + content: "チーム操作時間:"; +} +.team-total-info .tIf-total-move::after{ + content: "秒"; +} +.team-total-info .tIf-total-move.fixed-move-time::after{ + content: "秒 (固定)"; +} .formation-total-info .tIf-total-hp::before{ content: "総HP(チーム覚醒):"; } diff --git a/languages/ko.css b/languages/ko.css index fb00ef88..7d6406ac 100644 --- a/languages/ko.css +++ b/languages/ko.css @@ -248,6 +248,15 @@ .team-total-info .tIf-total-rcv::before{ content: "팀 회복(팀 각성 및 배지):"; } +.team-total-info .tIf-total-move::before{ + content: "팀 운영 시간입니다:"; +} +.team-total-info .tIf-total-move::after{ + content: "초"; +} +.team-total-info .tIf-total-move.fixed-move-time::after{ + content: "초 (고정합니다)"; +} .formation-total-info .tIf-total-hp::before{ content: "총 HP(팀 각성):"; } diff --git a/languages/zh-TW.css b/languages/zh-TW.css index b801d7e3..e98ab14b 100644 --- a/languages/zh-TW.css +++ b/languages/zh-TW.css @@ -254,6 +254,15 @@ .team-total-info .tIf-total-rcv::before{ content: "隊伍回復(隊伍覺醒和徽章):"; } +.team-total-info .tIf-total-move::before{ + content: "隊伍移動時間:"; +} +.team-total-info .tIf-total-move::after{ + content: " 秒"; +} +.team-total-info .tIf-total-move.fixed-move-time::after{ + content: " 秒(固定)"; +} .formation-total-info .tIf-total-hp::before{ content: "總HP(隊伍覺醒):"; } diff --git a/languages/zh.css b/languages/zh.css index e0a9062a..9ee140f3 100644 --- a/languages/zh.css +++ b/languages/zh.css @@ -254,6 +254,15 @@ .team-total-info .tIf-total-rcv::before{ content: "队伍回复(队伍觉醒和徽章):"; } +.team-total-info .tIf-total-move::before{ + content: "队伍移动时间:"; +} +.team-total-info .tIf-total-move::after{ + content: " 秒"; +} +.team-total-info .tIf-total-move.fixed-move-time::after{ + content: " 秒(固定)"; +} .formation-total-info .tIf-total-hp::before{ content: "总HP(队伍觉醒和徽章):"; } diff --git a/multi.html b/multi.html index 5b170562..26d5cdfa 100644 --- a/multi.html +++ b/multi.html @@ -57,6 +57,7 @@ var formation = new Formation(teamsCount,5);
diff --git a/script-universal_function.js b/script-universal_function.js index 3373c77b..c3e97e81 100644 --- a/script-universal_function.js +++ b/script-universal_function.js @@ -297,7 +297,7 @@ function calculateAbility(member, assist = null, solo = true, teamsCount = 1) const bonusScale = [0.1,0.05,0.15]; //辅助宠物附加的属性倍率 const plusAdd = [10,5,3]; //加值的增加值 - console.log(currentDataSource.code) + const awokenAdd = [ //对应加三维觉醒的序号与增加值 [{index:1,value:500},{index:65,value:currentDataSource.code=="ja"?-2500:-5000}], //HP [{index:2,value:100},{index:66,value:-1000}], //ATK @@ -647,4 +647,99 @@ function countTeamHp(memberArr, leader1id, leader2id, solo) return scale || 1; } return mHpArr; +} +//计算队伍操作时间 +function countMoveTime(team, leader1id, leader2id, teamIdx) +{ + const ls1 = Skills[Cards[leader1id].leaderSkillId]; + const ls2 = Skills[Cards[leader2id].leaderSkillId]; + const time1 = leaderSkillMoveTime(ls1); + const time2 = leaderSkillMoveTime(ls2); + + let moveTime = {fixed:false,duration:5}; //基础5秒 + //固定操作时间的直接返回 + if (time1.fixed || time2.fixed) + { + moveTime.fixed = true; + moveTime.duration = time1.fixed ? + (time2.fixed && time2.duration < time1.duration ? time2.duration : time1.duration) : + time2.duration; + } else + { + moveTime.duration += time1.duration + time2.duration + //2人协力时的特殊处理 + if (teamsCount === 2) + { + const teams = formation.teams; + const team2 = teamIdx === 1 ? teams[0] : teams[1]; //获取队伍2 + //复制队伍1 + team = [ + team[0].concat(), + team[1].concat() + ]; + //把队伍2的队长和武器添加到复制的队伍1里面 + team[0].push(team2[0][0]); + team[1].push(team2[1][0]); + } + + //徽章部分 + if (team[2] == 1 && (solo || teamsCount === 3)) { + moveTime.duration += 1; + } else if (team[2] == 13 && (solo || teamsCount === 3)) { + moveTime.duration += 2; + } + + //觉醒 + const awokenMoveTime = [ + {index:19,value:0.5}, //小手指 + {index:53,value:1}, //大手指 + ]; + moveTime.duration += awokenMoveTime.reduce((duration,aw)=> + duration + awokenCountInTeam(team, aw.index, solo, teamsCount) * aw.value + ,0); + //潜觉 + const latentMoveTime = [ + {index:4,value:0.05}, //小手指潜觉 + {index:31,value:0.12}, //大手指潜觉 + ]; + + moveTime.duration += latentMoveTime.reduce((duration,la)=> + duration + team[0].reduce((count,menber)=> + count + (menber.latent ? menber.latent.filter(l=>l==la.index).length : 0) + ,0) * la.value + ,0); + + } + + function leaderSkillMoveTime(ls) + { + let moveTime = {fixed:false,duration:0}; + const sk = ls.params; + switch (ls.type) + { + case 178: //固定操作时间 + moveTime.fixed = true; + moveTime.duration = sk[0]; + break; + case 15: case 185: + moveTime.duration += sk[0]/100; + break; + case 138: //调用其他队长技 + return sk.reduce((pmul,skid)=>{ + const subMoveTime = leaderSkillMoveTime(Skills[skid]); + if (subMoveTime.fixed) + { + pmul.fixed = true; + pmul.duration = subMoveTime.duration + }else + { + pmul.duration += subMoveTime.duration; + } + return pmul; + },moveTime); + default: + } + return moveTime; + } + return moveTime; } \ No newline at end of file diff --git a/script.js b/script.js index 4c6198ac..d7d55600 100644 --- a/script.js +++ b/script.js @@ -718,7 +718,7 @@ function initialize() { teamBadge.classList.remove(className_ChoseBadges); team[2] = parseInt(this.value, 10); const teamTotalInfoDom = teamBigBox.querySelector(".team-total-info"); //队伍能力值合计 - refreshTeamTotalHP(teamTotalInfoDom, team); + refreshTeamTotalHP(teamTotalInfoDom, team, teamIdx); creatNewUrl(); } else { teamBadge.classList.add(className_ChoseBadges); @@ -1322,7 +1322,7 @@ function initialize() { refreshAbility(teamAbilityDom, teamData, editBox.memberIdx[2]); //本人能力值 const teamTotalInfoDom = teamBigBox.querySelector(".team-total-info"); //队伍能力值合计 - if (teamTotalInfoDom) refreshTeamTotalHP(teamTotalInfoDom, teamData); + if (teamTotalInfoDom) refreshTeamTotalHP(teamTotalInfoDom, teamData, editBox.memberIdx[0]); const formationTotalInfoDom = formationBox.querySelector(".formation-total-info"); //所有队伍能力值合计 if (formationTotalInfoDom) refreshFormationTotalHP(formationTotalInfoDom, formation.teams); @@ -1355,7 +1355,7 @@ function initialize() { refreshAbility(teamAbilityDom, teamData, editBox.memberIdx[2]); //本人能力值 const teamTotalInfoDom = teamBigBox.querySelector(".team-total-info"); //队伍能力值合计 - if (teamTotalInfoDom) refreshTeamTotalHP(teamTotalInfoDom, teamData); + if (teamTotalInfoDom) refreshTeamTotalHP(teamTotalInfoDom, teamData, editBox.memberIdx[0]); const formationTotalInfoDom = formationBox.querySelector(".formation-total-info"); //所有队伍能力值合计 if (formationTotalInfoDom) refreshFormationTotalHP(formationTotalInfoDom, formation.teams); @@ -1382,7 +1382,7 @@ function initialize() { refreshAbility(teamAbilityDom, teamData, editBox.memberIdx[2]); //本人能力值 const teamTotalInfoDom = teamBigBox.querySelector(".team-total-info"); //队伍能力值合计 - if (teamTotalInfoDom) refreshTeamTotalHP(teamTotalInfoDom, teamData); + if (teamTotalInfoDom) refreshTeamTotalHP(teamTotalInfoDom, teamData, editBox.memberIdx[0]); const formationTotalInfoDom = formationBox.querySelector(".formation-total-info"); //所有队伍能力值合计 if (formationTotalInfoDom) refreshFormationTotalHP(formationTotalInfoDom, formation.teams); @@ -2077,7 +2077,7 @@ function refreshAll(formationData) { refreshAbility(teamAbilityDom, teamData, ti); //本人能力值 } const teamTotalInfoDom = teamBigBox.querySelector(".team-total-info"); //队伍能力值合计 - if (teamTotalInfoDom) refreshTeamTotalHP(teamTotalInfoDom, teamData); + if (teamTotalInfoDom) refreshTeamTotalHP(teamTotalInfoDom, teamData, teamNum); const teamAwokenDom = teamBigBox.querySelector(".team-awoken"); //队伍觉醒合计 if (teamAwokenDom) refreshTeamAwokenCount(teamAwokenDom, teamData); @@ -2188,17 +2188,19 @@ function refreshAbility(abilityDom, team, idx) { }); } //刷新队伍能力值合计 -function refreshTeamTotalHP(totalDom, team) { +function refreshTeamTotalHP(totalDom, team, teamIdx) { //计算总的生命值 if (!totalDom) return; const tHpDom = totalDom.querySelector(".tIf-total-hp"); const tRcvDom = totalDom.querySelector(".tIf-total-rcv"); + const tMoveDom = totalDom.querySelector(".tIf-total-move"); + + const teams = formation.teams; + + const leader1id = team[0][0].id; + const leader2id = teamsCount===2 ? (teamIdx === 1 ? teams[0][0][0].id : teams[1][0][0].id) : team[0][5].id; if (tHpDom) { - //因为目前仅用于1P、3P,所以直接固定写了 - const leader1id = team[0][0].id; - //const leader2 = teamsCount==2 ? Cards[team2[0][0].id] : Cards[team[0][5].id]; //这个写法无法获得队伍2的队长 - const leader2id = team[0][5].id; const teamHPArr = countTeamHp(team[0], leader1id, leader2id, solo); @@ -2235,6 +2237,15 @@ function refreshTeamTotalHP(totalDom, team) { ("(" + Math.round(Math.round(tRCV * (1 + 0.10 * teamRCVAwoken)) * badgeRCVScale).toString() + ")") : ""); } + if (tMoveDom) { + const moveTime = countMoveTime(team, leader1id, leader2id, teamIdx); + //tMoveDom.innerHTML = moveTime.fixed ? moveTime.duration : (moveTime.duration + badgeMoveTime); + tMoveDom.innerHTML = moveTime.duration; + if (moveTime.fixed) + tMoveDom.classList.add("fixed-move-time"); + else + tMoveDom.classList.remove("fixed-move-time"); + } } //刷新所有队伍能力值合计 function refreshFormationTotalHP(totalDom, teams) { diff --git a/solo.html b/solo.html index a6462b54..c7ab49b3 100644 --- a/solo.html +++ b/solo.html @@ -74,7 +74,7 @@ var formation = new Formation(teamsCount,6);
  • -
    +
    diff --git a/triple.html b/triple.html index 700dcf83..61adc022 100644 --- a/triple.html +++ b/triple.html @@ -89,7 +89,7 @@ var formation = new Formation(teamsCount,6);
  • -
    +
    @@ -429,7 +429,7 @@ var formation = new Formation(teamsCount,6);
  • -
    +
    @@ -769,7 +769,7 @@ var formation = new Formation(teamsCount,6);
  • -
    +