代码微调

This commit is contained in:
枫谷剑仙 2023-09-04 17:04:36 +08:00
parent f0f1e23d6b
commit 907dda197b
2 changed files with 125 additions and 112 deletions

View File

@ -543,8 +543,7 @@ function awokenCountInFormation(formationTeams, awokenIndex, solo, teamsCount) {
}
//计算单个队伍中有多少个该觉醒
function awokenCountInTeam(team, awokenIndex, solo, teamsCount) {
const memberArray = team[0];
const assistArray = team[1];
const [memberArray, assistArray] = team;
const teamAwokenCount = memberArray.reduce(function(previous, mon, idx) {
if (mon.id <= 0) { //如果是delay和null
@ -774,16 +773,17 @@ function calculateAbility_max(id, solo, teamsCount, maxLevel = 110) {
};
const abilities = calculateAbility(tempMon, null, solo, teamsCount);
if (abilities) {
const [[hp,hpNA], [atk,atkNA], [rcv,rcvNA]] = abilities;
return {
noAwoken: {
hp: abilities[0][1],
atk: abilities[1][1],
rcv: abilities[2][1],
},
withAwoken: {
hp: abilities[0][0],
atk: abilities[1][0],
rcv: abilities[2][0],
hp: hp,
atk: atk,
rcv: rcv,
},
noAwoken: {
hp: hpNA,
atk: atkNA,
rcv: rcvNA,
},
};
} else {
@ -1098,15 +1098,16 @@ function countTeamHp(team, leader1id, leader2id, solo, noAwoken = false) {
const ls2 = Skills[(Cards[leader2id] || Cards[0])?.leaderSkillId];
const mHpArr = memberArr.map((member, idx) => {
const ability = noAwoken ? member.abilityNoAwoken : member.ability;
let hp = ability ? ability[0] : 0;
const hp = ability ? ability[0] : 0;
if (!hp) return 0;
let hp1 = hp = Math.round(hp * memberHpMul(member, assistArr[idx], ls2, memberArr, solo)); //战友队长技
let hp2 = hp = Math.round(hp * memberHpMul(member, assistArr[idx], ls1, memberArr, solo)); //我方队长技
const mulHP = hp * memberHpMul(member, assistArr[idx], ls2, memberArr, solo) //战友队长技
* memberHpMul(member, assistArr[idx], ls1, memberArr, solo);//我方队长技
//演示用代码
//console.log("%s 第1次倍率血量%s第2次倍率血量%s",Cards[m.id].otLangName["chs"],hp1,hp2);
return hp;
console.debug(hp, mulHP);
return Math.round(mulHP);
});
@ -1365,27 +1366,23 @@ function tIf_Effect(leader1id, leader2id, leader1id_original,leader2id_original)
const card1 = Cards[leader1id], card2 = Cards[leader2id];
{ //计算队伍是否为76
const searchTypeArray = [162, 186];
const ls1 = getCardLeaderSkills(henshinBase(leader1id_original), searchTypeArray)[0];
const ls2 = getCardLeaderSkills(henshinBase(leader2id_original), searchTypeArray)[0];
effect.board76 = Boolean(ls1 || ls2);
effect.board76 = Boolean(getCardLeaderSkills(henshinBase(leader1id_original), searchTypeArray).length) ||
Boolean(getCardLeaderSkills(henshinBase(leader2id_original), searchTypeArray).length);
}
{ //计算队伍是否为无天降
const searchTypeArray = [163, 177];
const ls1 = getCardLeaderSkills(card1, searchTypeArray)[0];
const ls2 = getCardLeaderSkills(card2, searchTypeArray)[0];
effect.noSkyfall = Boolean(ls1 || ls2);
effect.noSkyfall = Boolean(getCardLeaderSkills(henshinBase(leader1id_original), searchTypeArray).length) ||
Boolean(getCardLeaderSkills(henshinBase(leader2id_original), searchTypeArray).length);
}
{ //计算队伍是否为毒无效
const searchTypeArray = [197];
const ls1 = getCardLeaderSkills(card1, searchTypeArray)[0];
const ls2 = getCardLeaderSkills(card2, searchTypeArray)[0];
effect.poisonNoEffect = Boolean(ls1 || ls2);
effect.poisonNoEffect = Boolean(getCardLeaderSkills(henshinBase(leader1id_original), searchTypeArray).length) ||
Boolean(getCardLeaderSkills(henshinBase(leader2id_original), searchTypeArray).length);
}
{ //计算队伍是否有根性
const searchTypeArray = [14];
const ls1 = getCardLeaderSkills(card1, searchTypeArray)[0];
const ls2 = getCardLeaderSkills(card2, searchTypeArray)[0];
effect.resolve = Boolean(ls1 || ls2);
effect.resolve = Boolean(getCardLeaderSkills(henshinBase(leader1id_original), searchTypeArray).length) ||
Boolean(getCardLeaderSkills(henshinBase(leader2id_original), searchTypeArray).length);
}
{ //计算队伍的+C
effect.addCombo[0] = getSkillAddCombo(card1);
@ -1401,11 +1398,11 @@ function tIf_Effect(leader1id, leader2id, leader1id_original,leader2id_original)
//计算队伍SB
function countTeamSB(team, solo) {
let sbn = 0;
const badge = team[2];
const [members, assists, badge] = team;
for (let mi = 0; mi < team[0].length; mi++) {
const member = team[0][mi];
const assist = team[1][mi];
for (let mi = 0; mi < members.length; mi++) {
const member = members[mi];
const assist = assists[mi];
if (member.id < 0) continue;
const memberCard = henshinBase(member);
let enableAwoken = memberCard?.awakenings?.slice(0, member.awoken) || [];
@ -1431,9 +1428,10 @@ function countTeamSB(team, solo) {
}
//计算队伍操作时间
function countMoveTime(team, leader1id, leader2id, teamIdx) {
const [members, assists, badge] = team;
const searchTypeArray = [178, 15, 185];
const ls1 = getCardLeaderSkills(Cards[leader1id], searchTypeArray)[0];
const ls2 = getCardLeaderSkills(Cards[leader2id], searchTypeArray)[0];
const ls1 = getCardLeaderSkills(Cards[leader1id], searchTypeArray)?.[0];
const ls2 = getCardLeaderSkills(Cards[leader2id], searchTypeArray)?.[0];
const time1 = leaderSkillMoveTime(ls1);
const time2 = leaderSkillMoveTime(ls2);
@ -1473,9 +1471,10 @@ function countMoveTime(team, leader1id, leader2id, teamIdx) {
} else {
moveTime.duration.leader = time1.duration + time2.duration;
let _team = team.concat();
//1人、3人计算徽章
if (solo || teamsCount === 3) {
switch (team[2]) {
switch (badge) {
case 2: //小手指
moveTime.duration.badge = 1;
break;
@ -1490,14 +1489,15 @@ function countMoveTime(team, leader1id, leader2id, teamIdx) {
{
const teams = formation.teams;
const team2 = teamIdx === 1 ? teams[0] : teams[1]; //获取队伍2
const [members2, assists2, badge2, swapId2] = team2;
//复制队伍1这里参数里的 team 换成了一个新的数组
team = [
team[0].concat(),
team[1].concat()
_team = [
members.concat(),
assists.concat()
];
//把队伍2的队长和武器添加到复制的队伍1里面
team[0].push(team2[0][team2[3]]);
team[1].push(team2[1][team2[3]]);
_team[0].push(members2[swapId2]);
_team[1].push(assists2[swapId2]);
}
//觉醒
@ -1506,7 +1506,7 @@ function countMoveTime(team, leader1id, leader2id, teamIdx) {
{ index: 53, value: 1 }, //大手指
];
moveTime.duration.awoken += awokenMoveTime.reduce((duration, aw) =>
duration + awokenCountInTeam(team, aw.index, solo, teamsCount) * aw.value, 0);
duration + awokenCountInTeam(_team, aw.index, solo, teamsCount) * aw.value, 0);
//潜觉
const latentMoveTime = [
{ index: 4, value: 0.05 }, //小手指潜觉
@ -1514,7 +1514,7 @@ function countMoveTime(team, leader1id, leader2id, teamIdx) {
];
moveTime.duration.awoken += latentMoveTime.reduce((duration, la) =>
duration + team[0].reduce((count, member) =>
duration + _team[0].reduce((count, member) =>
count + (member?.latent?.filter(l => l == la.index)?.length ?? 0), 0) * la.value, 0);
}

155
script.js
View File

@ -5522,10 +5522,11 @@ function refreshAll(formationData) {
//刷新队伍觉醒效果计算
function refreshTeamAwokenEfeect(awokenEffectDom, team, ti) {
const [members, assists, badge, swapId] = team;
let targetIcon;
//解析两个队长技
let leader1 = team[0][team[3] || 0], //换队长或者默认队长
leader2 = team[0][5];
let leader1 = members[swapId || 0], //换队长或者默认队长
leader2 = members[5];
let parseLSkill1 = skillParser(leader1?.card?.leaderSkillId),
parseLSkill2 = skillParser(leader2?.card?.leaderSkillId);
//防绑
@ -5535,11 +5536,11 @@ function refreshTeamAwokenEfeect(awokenEffectDom, team, ti) {
//储存附加 52 即大防绑的队长技能
let lsAwoken = parseLSkill1.concat(parseLSkill2).filter(skill=>skill.kind == SkillKinds.ImpartAwakenings);
for (let mi=0; mi < team[0].length; mi++) {
const memberData = team[0][mi];
const assistData = team[1][mi];
for (let mi=0; mi < members.length; mi++) {
const memberData = members[mi];
const assistData = assists[mi];
let thisAwokenNum = 0;
if (team[2] === 8 && mi === 0) {
if (badge === 8 && mi === 0) {
thisAwokenNum = 2;
} else {
let effectiveAwokens = memberData.effectiveAwokens(assistData);
@ -5564,18 +5565,20 @@ function refreshTeamAwokenEfeect(awokenEffectDom, team, ti) {
awokenCountInTeam(team, equivalentAwoken.big, solo, teamsCount) * equivalentAwoken.times;
let count = thisAwokenNum * 1000; //普通觉醒每个加1000
//储存附加 52 即大防绑的队长技能
//自动回复的队长技能
let lsAwoken1 = parseLSkill1.filter(skill=>skill.kind == SkillKinds.AutoHeal),
lsAwoken2 = parseLSkill1.filter(skill=>skill.kind == SkillKinds.AutoHeal);
if (lsAwoken1.length) {
count += leader1.ability[2] * lsAwoken1[0].value.value;
const [,,rcv] = leader1.ability[2];
count += rcv * lsAwoken1[0].value.value;
}
if (lsAwoken2.length) {
count += leader2.ability[2] * lsAwoken2[0].value.value;
const [,,rcv] = leader2.ability[2];
count += rcv * lsAwoken2[0].value.value;
}
for (let mi=0; mi < team[0].length; mi++) {
const memberData = team[0][mi];
for (let mi=0; mi < members.length; mi++) {
const memberData = members[mi];
let latentCount = memberData?.latent?.filter(l=>l===5).length;
if (latentCount>0) { //自动回复潜觉不考虑任何297和觉醒
let memberCard = memberData.card;
@ -5592,7 +5595,7 @@ function refreshTeamAwokenEfeect(awokenEffectDom, team, ti) {
//颜色盾
if (targetIcon = awokenEffectDom.querySelector(".awoken-icon[data-awoken-icon=\"4\"]")) {
const orbs = Array.from(targetIcon.parentElement.querySelectorAll(".orb-list .orb"));
const teamLatents = team[0].flatMap(m=>m.latent); //因为盾是固定值,所以直接平面化所有的潜觉
const teamLatents = members.flatMap(m=>m.latent); //因为盾是固定值,所以直接平面化所有的潜觉
for (let oi=0; oi < orbs.length; oi++) {
let orb = orbs[oi];
const thisAwokenNum = awokenCountInTeam(team, 4+oi, solo, teamsCount);
@ -5622,7 +5625,7 @@ function refreshTeamAwokenEfeect(awokenEffectDom, team, ti) {
const targetValue = targetIcon.parentElement.querySelector(".prob");
const thisAwokenNum = awokenCountInTeam(team, 28, solo, teamsCount);
let prob = thisAwokenNum / 5;
if (team[2] == 9) prob += 0.5;
if (badge == 9) prob += 0.5;
targetValue.setAttribute(dataAttrName, Math.round(Math.min(prob,1)*100));
}
//暗
@ -5632,7 +5635,7 @@ function refreshTeamAwokenEfeect(awokenEffectDom, team, ti) {
const thisAwokenNum = awokenCountInTeam(team, equivalentAwoken.small, solo, teamsCount) +
awokenCountInTeam(team, equivalentAwoken.big, solo, teamsCount) * equivalentAwoken.times;
let prob = thisAwokenNum / 5;
if (team[2] == 12) prob += 0.5;
if (badge == 12) prob += 0.5;
targetValue.setAttribute(dataAttrName, Math.round(Math.min(prob,1)*100));
}
//废
@ -5642,7 +5645,7 @@ function refreshTeamAwokenEfeect(awokenEffectDom, team, ti) {
const thisAwokenNum = awokenCountInTeam(team, equivalentAwoken.small, solo, teamsCount) +
awokenCountInTeam(team, equivalentAwoken.big, solo, teamsCount) * equivalentAwoken.times;
let prob = thisAwokenNum / 5;
if (team[2] == 13) prob += 0.5;
if (badge == 13) prob += 0.5;
targetValue.setAttribute(dataAttrName, Math.round(Math.min(prob,1)*100));
}
//毒
@ -5652,7 +5655,7 @@ function refreshTeamAwokenEfeect(awokenEffectDom, team, ti) {
const thisAwokenNum = awokenCountInTeam(team, equivalentAwoken.small, solo, teamsCount) +
awokenCountInTeam(team, equivalentAwoken.big, solo, teamsCount) * equivalentAwoken.times;
let prob = thisAwokenNum / 5;
if (team[2] == 14) prob += 0.5;
if (badge == 14) prob += 0.5;
targetValue.setAttribute(dataAttrName, Math.round(Math.min(prob,1)*100));
}
//云
@ -5672,13 +5675,13 @@ function refreshTeamAwokenEfeect(awokenEffectDom, team, ti) {
//掉废
if (targetIcon = awokenEffectDom.querySelector(".latent-icon[data-latent-icon=\"14\"]")) {
const targetValue = targetIcon.parentElement.querySelector(".prob");
let prob = team[0].some(member=>member?.latent?.includes(14)) ? 1 : 0;
let prob = members.some(member=>member?.latent?.includes(14)) ? 1 : 0;
targetValue.setAttribute(dataAttrName, Math.round(Math.min(prob,1)*100));
}
//掉毒
if (targetIcon = awokenEffectDom.querySelector(".latent-icon[data-latent-icon=\"15\"]")) {
const targetValue = targetIcon.parentElement.querySelector(".prob");
let prob = team[0].some(member=>member?.latent?.includes(15)) ? 1 : 0;
let prob = members.some(member=>member?.latent?.includes(15)) ? 1 : 0;
targetValue.setAttribute(dataAttrName, Math.round(Math.min(prob,1)*100));
}
//心横解转转
@ -5686,9 +5689,9 @@ function refreshTeamAwokenEfeect(awokenEffectDom, team, ti) {
const targetValue = targetIcon.parentElement.querySelector(".count");
const equivalentAwoken = equivalent_awoken.find(eak => eak.small === 20);
let count = 0;
for (let mi=0; mi < team[0].length; mi++) {
const memberData = team[0][mi];
const assistData = team[1][mi];
for (let mi=0; mi < members.length; mi++) {
const memberData = members[mi];
const assistData = assists[mi];
if (memberData?.latent?.includes(40)) {
let effectiveAwokens = memberData.effectiveAwokens(assistData);
count += effectiveAwokens.filter(ak=>ak==equivalentAwoken.small).length + effectiveAwokens.filter(ak=>ak==equivalentAwoken.big).length * equivalentAwoken.times;
@ -5702,9 +5705,9 @@ function refreshTeamAwokenEfeect(awokenEffectDom, team, ti) {
if (targetIcon = awokenEffectDom.querySelector(".latent-icon[data-latent-icon=\"46\"]")) {
const targetValue = targetIcon.parentElement.querySelector(".count");
let count = 0;
for (let mi=0; mi < team[0].length; mi++) {
const memberData = team[0][mi];
const assistData = team[1][mi];
for (let mi=0; mi < members.length; mi++) {
const memberData = members[mi];
const assistData = assists[mi];
if (memberData?.latent?.includes(46)) {
let effectiveAwokens = memberData.effectiveAwokens(assistData);
count += effectiveAwokens.filter(ak=>ak==45).length;
@ -5719,9 +5722,9 @@ function refreshTeamAwokenEfeect(awokenEffectDom, team, ti) {
const orbs = Array.from(targetIcon.parentElement.querySelectorAll(".orb-list .orb"));
const equivalentAwoken = equivalent_awoken.find(eak => eak.small === 60);
let count = new Array(orbs.length).fill(0);
for (let mi=0; mi < team[0].length; mi++) {
const memberData = team[0][mi];
const assistData = team[1][mi];
for (let mi=0; mi < members.length; mi++) {
const memberData = members[mi];
const assistData = assists[mi];
let effectiveAwokens = memberData?.effectiveAwokens(assistData);
let thisAwokenNum = effectiveAwokens.filter(ak=>ak==equivalentAwoken.small).length + effectiveAwokens.filter(ak=>ak==equivalentAwoken.big).length * equivalentAwoken.times;
if (thisAwokenNum == 0) continue;
@ -5739,9 +5742,9 @@ function refreshTeamAwokenEfeect(awokenEffectDom, team, ti) {
const orbs = Array.from(targetIcon.parentElement.querySelectorAll(".orb-list .orb"));
const equivalentAwoken = equivalent_awoken.find(eak => eak.small === 60);
let count = new Array(orbs.length).fill(0);
for (let mi=0; mi < team[0].length; mi++) {
const memberData = team[0][mi];
//const assistData = team[1][mi]; //L解禁武器武器上的L无意义
for (let mi=0; mi < members.length; mi++) {
const memberData = members[mi];
//const assistData = assists[mi]; //L解禁武器武器上的L无意义
if (memberData?.latent?.includes(48)) {
let effectiveAwokens = memberData.effectiveAwokens();
let thisAwokenNum = effectiveAwokens.filter(ak=>ak==equivalentAwoken.small).length + effectiveAwokens.filter(ak=>ak==equivalentAwoken.big).length * equivalentAwoken.times;
@ -5763,9 +5766,9 @@ function refreshTeamAwokenEfeect(awokenEffectDom, team, ti) {
const orbs = Array.from(targetIcon.parentElement.querySelectorAll(".orb-list .orb"));
const equivalentAwoken = equivalent_awoken.find(eak => eak.small === 78);
let count = new Array(orbs.length).fill(0);
for (let mi=0; mi < team[0].length; mi++) {
const memberData = team[0][mi];
const assistData = team[1][mi];
for (let mi=0; mi < members.length; mi++) {
const memberData = members[mi];
const assistData = assists[mi];
let effectiveAwokens = memberData.effectiveAwokens(assistData);
let thisAwokenNum = effectiveAwokens.filter(ak=>ak==equivalentAwoken.small).length + effectiveAwokens.filter(ak=>ak==equivalentAwoken.big).length * equivalentAwoken.times;
if (thisAwokenNum == 0) continue;
@ -5783,14 +5786,14 @@ function refreshTeamAwokenEfeect(awokenEffectDom, team, ti) {
const orbs = Array.from(targetIcon.parentElement.querySelectorAll(".orb-list .orb"));
const equivalentAwoken = equivalent_awoken.find(eak => eak.small === 27);
let count = new Array(orbs.length).fill(0);
for (let mi=0; mi < team[0].length; mi++) {
const memberData = team[0][mi];
//const assistData = team[1][mi]; //L解禁武器武器上的L无意义
for (let mi=0; mi < members.length; mi++) {
const memberData = members[mi];
const assistData = assists[mi];
if (memberData?.latent?.includes(41)) {
let effectiveAwokens = memberData.effectiveAwokens();
let effectiveAwokens = memberData.effectiveAwokens(assistData);
let thisAwokenNum = effectiveAwokens.filter(ak=>ak==equivalentAwoken.small).length + effectiveAwokens.filter(ak=>ak==equivalentAwoken.big).length * equivalentAwoken.times;
if (thisAwokenNum == 0) continue;
const {attrs=[]} = memberData.getAttrsTypesWithWeapon() || {};
const {attrs=[]} = memberData.getAttrsTypesWithWeapon(assistData) || {};
attrs.distinct().forEach(attr=>{
count[attr] += thisAwokenNum;
});
@ -5808,9 +5811,9 @@ function refreshTeamAwokenEfeect(awokenEffectDom, team, ti) {
//目前没有大觉醒
//const equivalentAwoken = equivalent_awoken.find(eak => eak.small === 78);
let count = new Array(orbs.length).fill(0);
for (let mi=0; mi < team[0].length; mi++) {
const memberData = team[0][mi];
const assistData = team[1][mi];
for (let mi=0; mi < members.length; mi++) {
const memberData = members[mi];
const assistData = assists[mi];
let effectiveAwokens = memberData.effectiveAwokens(assistData);
//let thisAwokenNum = effectiveAwokens.filter(ak=>ak==equivalentAwoken.small).length + effectiveAwokens.filter(ak=>ak==equivalentAwoken.big).length * equivalentAwoken.times;
let thisAwokenNum = effectiveAwokens.filter(ak=>ak==62).length;
@ -5830,15 +5833,15 @@ function refreshTeamAwokenEfeect(awokenEffectDom, team, ti) {
//目前没有大觉醒
//const equivalentAwoken = equivalent_awoken.find(eak => eak.small === 27);
let count = new Array(orbs.length).fill(0);
for (let mi=0; mi < team[0].length; mi++) {
const memberData = team[0][mi];
//const assistData = team[1][mi]; //L解禁武器武器上的L无意义
for (let mi=0; mi < members.length; mi++) {
const memberData = members[mi];
const assistData = assists[mi];
if (memberData.latent.includes(39)) {
let effectiveAwokens = memberData.effectiveAwokens();
let effectiveAwokens = memberData.effectiveAwokens(assistData);
//let thisAwokenNum = effectiveAwokens.filter(ak=>ak==equivalentAwoken.small).length + effectiveAwokens.filter(ak=>ak==equivalentAwoken.big).length * equivalentAwoken.times;
let thisAwokenNum = effectiveAwokens.filter(ak=>ak==62).length;
if (thisAwokenNum == 0) continue;
const {attrs=[]} = memberData.getAttrsTypesWithWeapon() || {};
const {attrs=[]} = memberData.getAttrsTypesWithWeapon(assistData) || {};
attrs.distinct().forEach(attr=>{
count[attr] += thisAwokenNum;
});
@ -5856,9 +5859,9 @@ function refreshTeamAwokenEfeect(awokenEffectDom, team, ti) {
//目前没有大觉醒
//const equivalentAwoken = equivalent_awoken.find(eak => eak.small === 78);
let count = new Array(orbs.length).fill(0);
for (let mi=0; mi < team[0].length; mi++) {
const memberData = team[0][mi];
const assistData = team[1][mi];
for (let mi=0; mi < members.length; mi++) {
const memberData = members[mi];
const assistData = assists[mi];
let effectiveAwokens = memberData.effectiveAwokens(assistData);
//let thisAwokenNum = effectiveAwokens.filter(ak=>ak==equivalentAwoken.small).length + effectiveAwokens.filter(ak=>ak==equivalentAwoken.big).length * equivalentAwoken.times;
let thisAwokenNum = effectiveAwokens.filter(ak=>ak==126).length;
@ -6006,8 +6009,8 @@ function refreshMemberAwoken(memberAwokenDom, assistAwokenDom, team, idx) {
const memberData = team[0][idx];
const assistData = team[1][idx];
const memberCard = Cards[memberData.id] || Cards[0];
const assistCard = Cards[assistData.id] || Cards[0];
// const memberCard = Cards[memberData.id] || Cards[0];
// const assistCard = Cards[assistData.id] || Cards[0];
//队员觉醒
let memberAwokens = memberData.effectiveAwokens() || [];
//memberAwokens.sort();
@ -6120,14 +6123,19 @@ function refreshTeamTotalHP(totalDom, team, teamIdx) {
const tMoveDom = totalDom.querySelector(".tIf-total-move");
const tEffectDom = totalDom.querySelector(".tIf-effect");
const teams = formation.teams;
const [members, assists, badge, swapId] = team;
const leader1id = team[0][team[3] || 0].id;
const leader2id = teamsCount===2 ? (teamIdx === 1 ? teams[0][0][teams[0][3] || 0].id : teams[1][0][teams[1][3] || 0].id) : team[0][5].id;
const teams = formation.teams;
const [teamsA=[], teamsB=[], teamsC=[]] = teams;
const [teamsA_members, teamsA_assists, teamsA_badge] = teamsA;
const [teamsB_members, teamsB_assists, teamsB_badge] = teamsB;
const leader1id = members[swapId || 0].id;
const leader2id = teamsCount===2 ? (teamIdx === 1 ? teamsA_members[teamsA_badge || 0].id : teamsB_members[teamsB_badge || 0].id) : members[5].id;
//计算当前队伍2P时则是需要特殊处理
const team_2p = teamsCount===2 ? team[0].concat((teamIdx === 1 ? teams[0][0][0] : teams[1][0][0])) : team[0];
const assistTeam_2p = teamsCount===2 ? team[1].concat((teamIdx === 1 ? teams[0][1][0] : teams[1][1][0])) : team[1];
const team_2p = teamsCount===2 ? members.concat((teamIdx === 1 ? teamsA_members[0] : teamsB_members[0])) : members;
const assistTeam_2p = teamsCount===2 ? assists.concat((teamIdx === 1 ? teamsA_assists[0] : teamsB_assists[0])) : assists;
if (tHpDom) {
const reduceScales1 = getReduceScales(leader1id);
@ -6163,16 +6171,17 @@ function refreshTeamTotalHP(totalDom, team, teamIdx) {
const teamHPAwoken = awokenCountInTeam(team, 46, solo, teamsCount); //全队大血包个数
let badgeHPScale = 1; //徽章倍率
if (team[2] == 5 && (solo || teamsCount === 3)) {
if (badge === 5 && (solo || teamsCount === 3)) {
badgeHPScale = 1.05;
} else if (team[2] == 18 && (solo || teamsCount === 3)) {
} else if (badge === 18 && (solo || teamsCount === 3)) {
badgeHPScale = 1.15;
} else if (team[2] == 20 && (solo || teamsCount === 3)) {
} else if (badge === 20 && (solo || teamsCount === 3)) {
badgeHPScale = 1.10;
}
tHP = Math.round(Math.round(tHP * (1 + 0.05 * teamHPAwoken)) * badgeHPScale);
tHPNoAwoken = Math.round(Math.round(tHPNoAwoken) * badgeHPScale);
console.debug(teamHPArr, tHP, teamHPAwoken, badgeHPScale);
tHP = Math.round(tHP * (1 + 0.05 * teamHPAwoken) * badgeHPScale);
tHPNoAwoken = Math.round(tHPNoAwoken * badgeHPScale);
//记录到bar中方便打开详情时调用
hpBar.reduceAttrRangesWithShieldAwoken = reduceAttrRangesWithShieldAwoken; //有盾觉醒的
@ -6228,9 +6237,9 @@ function refreshTeamTotalHP(totalDom, team, teamIdx) {
if (tRarityDom)
{
const rarityDoms = tRarityDom.querySelector(".rarity");
const rarityCount = team[0].slice(0,5).reduce((pre,member)=>{
const rarityCount = members.slice(0,5).reduce((pre,member)=>{
if (member.id <= 0) return pre;
const card = Cards[member.id] || Cards[0];
const card = member.card;
return pre + (card?.rarity ?? 0);
},0);
rarityDoms.setAttribute(dataAttrName, rarityCount);
@ -6257,8 +6266,8 @@ function refreshTeamTotalHP(totalDom, team, teamIdx) {
if (tEffectDom) {
//76版队长技能不被换队长所影响
const leader1id_original = team[0][0].id;
const leader2id_original = teamsCount===2 ? (teamIdx === 1 ? teams[0][0][0].id : teams[1][0][0].id) : team[0][5].id;
const leader1id_original = members[0].id;
const leader2id_original = teamsCount===2 ? (teamIdx === 1 ? teamsA_members[0].id : teamsB_members[0].id) : members[5].id;
let effect = tIf_Effect(leader1id,leader2id, leader1id_original,leader2id_original);
refreshEffectDom(tEffectDom, effect);
}
@ -6295,10 +6304,14 @@ function refreshFormationTotalHP(totalDom, teams) {
const tHpDom = totalDom.querySelector(".tIf-total-hp");
const tSBDom = totalDom.querySelector(".tIf-total-skill-boost");
const tEffectDom = totalDom.querySelector(".tIf-effect");
const [teamsA=[], teamsB=[], teamsC=[]] = teams;
const [teamsA_members,,teamsA_badge] = teamsA;
const [teamsB_members,,teamsB_badge] = teamsB;
//因为目前仅用于2P所以直接在外面固定写了
const leader1id = teams[0][0][teams[0][3] || 0].id;
const leader2id = teams[1][0][teams[1][3] || 0].id;
const leader1id = teamsA_members[teamsA_badge || 0].id;
const leader2id = teamsB_members[teamsB_badge || 0].id;
if (tHpDom) {
@ -6363,8 +6376,8 @@ function refreshFormationTotalHP(totalDom, teams) {
}
if (tSBDom) {
const sbn1 = countTeamSB(teams[0], solo);
const sbn2 = countTeamSB(teams[1], solo);
const sbn1 = countTeamSB(teamsA, solo);
const sbn2 = countTeamSB(teamsB, solo);
const tSBDom_general = tSBDom.querySelector(".general");
setTextContentAndAttribute(tSBDom_general, sbn1 + sbn2);
@ -6372,8 +6385,8 @@ function refreshFormationTotalHP(totalDom, teams) {
if (tEffectDom) {
//76版队长技能不被换队长所影响
const leader1id_original = teams[0][0][0].id;
const leader2id_original = teams[1][0][0].id;
const leader1id_original = teamsA_members[0].id;
const leader2id_original = teamsB_members[0].id;
let effect = tIf_Effect(leader1id,leader2id, leader1id_original,leader2id_original);
refreshEffectDom(tEffectDom, effect);
}