初步完成手指计算

This commit is contained in:
枫谷剑仙 2020-09-23 03:12:40 +08:00
parent da6f688a88
commit 0dad9225de
10 changed files with 168 additions and 15 deletions

View File

@ -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): ";
}

View File

@ -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(チーム覚醒):";
}

View File

@ -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(팀 각성)";
}

View File

@ -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(隊伍覺醒)";
}

View File

@ -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(队伍觉醒和徽章)";
}

View File

@ -57,6 +57,7 @@ var formation = new Formation(teamsCount,5);
<div class="formation-total-info"><div class="tIf-total-hp"></div></div>
<ul class="teams">
<li class="team-bigbox team-1 show-team-name-right">
<div class="team-total-info"><div class="tIf-total-move"></div></div>
<div class="team-box-name">
<div class="team-box">
<ul class="team-assist">
@ -429,6 +430,7 @@ var formation = new Formation(teamsCount,5);
</ul>
</div>
</div>
<div class="team-total-info"><div class="tIf-total-move"></div></div>
</li>
</ul>
<div class="formation-awoken">

View File

@ -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;
}

View File

@ -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) {

View File

@ -74,7 +74,7 @@ var formation = new Formation(teamsCount,6);
<li><input type="radio" name="team-1-badge" class="badge-radio" value="15" id="team-1-badge-15"><label class="badge" data-badge-icon="15" for="team-1-badge-15"></label></li>
<li><input type="radio" name="team-1-badge" class="badge-radio" value="16" id="team-1-badge-16"><label class="badge" data-badge-icon="16" for="team-1-badge-16"></label></li>
<li><input type="radio" name="team-1-badge" class="badge-radio" value="17" id="team-1-badge-17"><label class="badge" data-badge-icon="17" for="team-1-badge-17"></label></li>
<div class="team-total-info"><div class="tIf-total-hp"></div><div class="tIf-total-rcv"></div></div>
<div class="team-total-info"><div class="tIf-total-hp"></div><div class="tIf-total-move"></div></div>
</ul>
<div class="team-box-name">
<div class="team-box">

View File

@ -89,7 +89,7 @@ var formation = new Formation(teamsCount,6);
<li><input type="radio" name="team-1-badge" class="badge-radio" value="15" id="team-1-badge-15"><label class="badge" data-badge-icon="15" for="team-1-badge-15"></label></li>
<li><input type="radio" name="team-1-badge" class="badge-radio" value="16" id="team-1-badge-16"><label class="badge" data-badge-icon="16" for="team-1-badge-16"></label></li>
<li><input type="radio" name="team-1-badge" class="badge-radio" value="17" id="team-1-badge-17"><label class="badge" data-badge-icon="17" for="team-1-badge-17"></label></li>
<div class="team-total-info"><div class="tIf-total-hp"></div><div class="tIf-total-rcv"></div></div>
<div class="team-total-info"><div class="tIf-total-hp"></div><div class="tIf-total-move"></div></div>
</ul>
<div class="team-box-name">
<div class="team-box">
@ -429,7 +429,7 @@ var formation = new Formation(teamsCount,6);
<li><input type="radio" name="team-2-badge" class="badge-radio" value="15" id="team-2-badge-15"><label class="badge" data-badge-icon="15" for="team-2-badge-15"></label></li>
<li><input type="radio" name="team-2-badge" class="badge-radio" value="16" id="team-2-badge-16"><label class="badge" data-badge-icon="16" for="team-2-badge-16"></label></li>
<li><input type="radio" name="team-2-badge" class="badge-radio" value="17" id="team-2-badge-17"><label class="badge" data-badge-icon="17" for="team-2-badge-17"></label></li>
<div class="team-total-info"><div class="tIf-total-hp"></div><div class="tIf-total-rcv"></div></div>
<div class="team-total-info"><div class="tIf-total-hp"></div><div class="tIf-total-move"></div></div>
</ul>
<div class="team-box-name">
<div class="team-box">
@ -769,7 +769,7 @@ var formation = new Formation(teamsCount,6);
<li><input type="radio" name="team-3-badge" class="badge-radio" value="15" id="team-3-badge-15"><label class="badge" data-badge-icon="15" for="team-3-badge-15"></label></li>
<li><input type="radio" name="team-3-badge" class="badge-radio" value="16" id="team-3-badge-16"><label class="badge" data-badge-icon="16" for="team-3-badge-16"></label></li>
<li><input type="radio" name="team-3-badge" class="badge-radio" value="17" id="team-3-badge-17"><label class="badge" data-badge-icon="17" for="team-3-badge-17"></label></li>
<div class="team-total-info"><div class="tIf-total-hp"></div><div class="tIf-total-rcv"></div></div>
<div class="team-total-info"><div class="tIf-total-hp"></div><div class="tIf-total-move"></div></div>
</ul>
<div class="team-box-name">
<div class="team-box">