将血量修改为全部计算与无觉醒
This commit is contained in:
parent
6751a5a64c
commit
0567192ad4
|
@ -308,6 +308,13 @@ function calculateAbility(member, assist = null, solo = true, teamsCount = 1)
|
|||
[], //ATK
|
||||
[] //RCV
|
||||
];
|
||||
|
||||
/* //将来的语音觉醒
|
||||
|
||||
awokenScale.forEach(ab=>{
|
||||
ab.push({index:63,scale:1.1});
|
||||
});*/
|
||||
|
||||
if (!solo)
|
||||
{ //协力时计算协力觉醒
|
||||
awokenScale.forEach(ab=>{
|
||||
|
@ -322,7 +329,7 @@ function calculateAbility(member, assist = null, solo = true, teamsCount = 1)
|
|||
const memberCurves = [memberCard.hp, memberCard.atk, memberCard.rcv];
|
||||
const assistCurves = assistCard ? [assistCard.hp, assistCard.atk, assistCard.rcv] : null;
|
||||
|
||||
let abilitys = memberCurves.map((ab, idx)=>{
|
||||
const abilitys = memberCurves.map((ab, idx)=>{
|
||||
const n_base = Math.round(curve(ab, member.level, memberCard.maxLevel, memberCard.limitBreakIncr)); //等级基础三维
|
||||
const n_plus = member.plus[idx] * plusAdd[idx]; //加值增加量
|
||||
let n_assist_base = 0,n_assist_plus=0; //辅助的bonus
|
||||
|
@ -365,6 +372,7 @@ function calculateAbility(member, assist = null, solo = true, teamsCount = 1)
|
|||
0;
|
||||
//console.log("基础值:%d,加蛋值:%d,觉醒x%d增加:%d,潜觉增加:%d",n_base,n_plus,awokenCount,n_awoken,n_latent);
|
||||
let reValue = n_base + n_plus + n_awoken + n_latent + (n_assist_base + n_assist_plus) * bonusScale[idx];
|
||||
let reValueNoAwoken = Math.round(n_base + n_plus + (n_assist_base + n_assist_plus) * bonusScale[idx]);
|
||||
|
||||
//协力觉醒的倍率
|
||||
reValue = Math.round(awokenScale[idx].reduce(function(previous,aw){
|
||||
|
@ -380,7 +388,7 @@ function calculateAbility(member, assist = null, solo = true, teamsCount = 1)
|
|||
},reValue));
|
||||
|
||||
if (idx<2 && reValue<1) reValue = 1; //HP和ATK最低为1
|
||||
return reValue;
|
||||
return [reValue,reValueNoAwoken];
|
||||
});
|
||||
return abilitys;
|
||||
}
|
||||
|
@ -530,12 +538,13 @@ function isReincarnated(card)
|
|||
return card.is8Latent && !card.isUltEvo && (card.evoBaseId || card.evoRootId) != card.id && (card.awakenings.includes(49) ? isReincarnated(Cards[card.evoBaseId]) : true);
|
||||
}
|
||||
//计算队伍中有多少血量
|
||||
function countTeamHp(memberArr, leader1id, leader2id, solo)
|
||||
function countTeamHp(memberArr, leader1id, leader2id, solo, noAwoken=false)
|
||||
{
|
||||
const ls1 = Skills[Cards[leader1id].leaderSkillId];
|
||||
const ls2 = Skills[Cards[leader2id].leaderSkillId];
|
||||
const mHpArr = memberArr.map(m=>{
|
||||
let hp = m.ability ? m.ability[0] : 0;
|
||||
const ability = noAwoken ? m.abilityNoAwoken : m.ability;
|
||||
let hp = ability ? ability[0] : 0;
|
||||
if (!hp) return 0;
|
||||
const card = Cards[m.id];
|
||||
hp = hp1 = Math.round(hp * memberHpMul(card,ls2,memberArr,solo));//战友队长技
|
||||
|
|
71
script.js
71
script.js
|
@ -67,6 +67,7 @@ if (location.search.includes('&')) {
|
|||
var Member = function() {
|
||||
this.id = 0;
|
||||
this.ability = [0, 0, 0];
|
||||
this.abilityNoAwoken = [0, 0, 0];
|
||||
};
|
||||
Member.prototype.outObj = function() {
|
||||
const m = this;
|
||||
|
@ -150,7 +151,6 @@ MemberAssist.prototype.loadFromMember = function(m) {
|
|||
//正式队伍
|
||||
var MemberTeam = function() {
|
||||
this.latent = [];
|
||||
this.ability = [0, 0, 0];
|
||||
MemberAssist.call(this);
|
||||
//sawoken作为可选项目,默认不在内
|
||||
};
|
||||
|
@ -168,6 +168,7 @@ MemberTeam.prototype.loadFromMember = function(m) {
|
|||
if (m.latent != undefined && m.latent instanceof Array && m.latent.length >= 1) this.latent = JSON.parse(JSON.stringify(m.latent));
|
||||
if (m.sawoken != undefined) this.sawoken = m.sawoken;
|
||||
if (m.ability != undefined && m.ability instanceof Array && m.plus.length >= 3) this.ability = JSON.parse(JSON.stringify(m.ability));
|
||||
if (m.abilityNoAwoken != undefined && m.abilityNoAwoken instanceof Array && m.plus.length >= 3) this.abilityNoAwoken = JSON.parse(JSON.stringify(m.abilityNoAwoken));
|
||||
if (m.skilllevel != undefined) this.skilllevel = m.skilllevel;
|
||||
};
|
||||
|
||||
|
@ -1255,11 +1256,11 @@ function initialize() {
|
|||
awoken: awoken,
|
||||
latent: latent
|
||||
};
|
||||
const abilitys = calculateAbility(tempMon, null, solo, teamsCount) || [0, 0, 0];
|
||||
const abilitys = calculateAbility(tempMon, null, solo, teamsCount);
|
||||
|
||||
monEditHpValue.innerHTML = abilitys[0].toLocaleString();
|
||||
monEditAtkValue.innerHTML = abilitys[1].toLocaleString();
|
||||
monEditRcvValue.innerHTML = abilitys[2].toLocaleString();
|
||||
monEditHpValue.innerHTML = abilitys ? abilitys[0][0].toLocaleString() : 0;
|
||||
monEditAtkValue.innerHTML = abilitys ? abilitys[1][0].toLocaleString() : 0;
|
||||
monEditRcvValue.innerHTML = abilitys ? abilitys[2][0].toLocaleString() : 0;
|
||||
}
|
||||
editBox.reCalculateAbility = reCalculateAbility;
|
||||
|
||||
|
@ -2169,7 +2170,8 @@ function refreshAbility(abilityDom, team, idx) {
|
|||
const mainAbility = calculateAbility(memberData, assistData, solo, teamsCount);
|
||||
if (mainAbility && memberData.ability) {
|
||||
for (let ai = 0; ai < 3; ai++) {
|
||||
memberData.ability[ai] = mainAbility[ai];
|
||||
memberData.ability[ai] = mainAbility[ai][0];
|
||||
memberData.abilityNoAwoken[ai] = mainAbility[ai][1];
|
||||
}
|
||||
}
|
||||
if (!abilityDom) return; //如果没有dom,直接跳过
|
||||
|
@ -2203,8 +2205,11 @@ function refreshTeamTotalHP(totalDom, team, teamIdx) {
|
|||
if (tHpDom) {
|
||||
|
||||
const teamHPArr = countTeamHp(team[0], leader1id, leader2id, solo);
|
||||
const teamHPNoAwokenArr = countTeamHp(team[0], leader1id, leader2id, solo, true);
|
||||
|
||||
const tHP = teamHPArr.reduce((pv, v) => pv + v); //队伍计算的总HP
|
||||
const tHPNoAwoken = teamHPNoAwokenArr.reduce((pv, v) => pv + v); //队伍计算的总HP无觉醒
|
||||
|
||||
const teamHPAwoken = awokenCountInTeam(team, 46, solo, teamsCount); //全队大血包个数
|
||||
|
||||
let badgeHPScale = 1; //徽章倍率
|
||||
|
@ -2214,29 +2219,14 @@ function refreshTeamTotalHP(totalDom, team, teamIdx) {
|
|||
badgeHPScale = 1.15;
|
||||
}
|
||||
|
||||
tHpDom.innerHTML = Math.round(tHP).toString() +
|
||||
/*tHpDom.innerHTML = Math.round(tHP).toString() +
|
||||
(teamHPAwoken > 0 || badgeHPScale != 1 ?
|
||||
("(" + Math.round(Math.round(tHP * (1 + 0.05 * teamHPAwoken)) * badgeHPScale).toString() + ")") :
|
||||
"");
|
||||
"");*/
|
||||
tHpDom.innerHTML = Math.round(Math.round(tHP * (1 + 0.05 * teamHPAwoken)) * badgeHPScale) +
|
||||
` (${Math.round(tHPNoAwoken)})`;
|
||||
}
|
||||
if (tRcvDom) {
|
||||
const tRCV = team[0].reduce(function(value, mon) { //队伍计算的总回复
|
||||
return value += mon.ability ? mon.ability[2] : 0;
|
||||
}, 0);
|
||||
const teamRCVAwoken = awokenCountInTeam(team, 47, solo, teamsCount); //全队大回复个数
|
||||
|
||||
let badgeRCVScale = 1; //徽章倍率
|
||||
if (team[2] == 3 && (solo || teamsCount === 3)) {
|
||||
badgeRCVScale = 1.25;
|
||||
} else if (team[2] == 10 && (solo || teamsCount === 3)) {
|
||||
badgeRCVScale = 1.35;
|
||||
}
|
||||
|
||||
tRcvDom.innerHTML = tRCV.toString() +
|
||||
(teamRCVAwoken > 0 || badgeRCVScale != 1 ?
|
||||
("(" + 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);
|
||||
|
@ -2263,29 +2253,20 @@ function refreshFormationTotalHP(totalDom, teams) {
|
|||
|
||||
const teamTHP = teamHPArr.reduce((pv, v) => pv + v); //队伍计算的总HP
|
||||
const teamHPAwoken = awokenCountInTeam(team, 46, solo, teamsCount); //全队大血包个数
|
||||
return [teamTHP, teamHPAwoken];
|
||||
|
||||
return Math.round(teamTHP * (1 + 0.05 * teamHPAwoken));
|
||||
});
|
||||
const tHP = tHPArr.reduce(function(value, teamHP) {
|
||||
return [value[0] + teamHP[0], value[1] + Math.round(teamHP[0] * (1 + 0.05 * teamHP[1]))];
|
||||
}, [0, 0]);
|
||||
const tHPNoAwokenArr = teams.map(function(team) {
|
||||
const teamHPArr = countTeamHp(team[0], leader1id, leader2id, solo, true);
|
||||
|
||||
tHpDom.innerHTML = Math.round(tHP[0]).toString() +
|
||||
(tHP[0] != tHP[1] ? `(${tHP[1]})` : "");
|
||||
}
|
||||
if (tRcvDom) {
|
||||
const tRCVArr = teams.map(function(team) {
|
||||
const teamTRCV = team[0].reduce(function(value, mon) { //队伍计算的总回复
|
||||
return value += mon.ability ? mon.ability[2] : 0;
|
||||
}, 0);
|
||||
const teamRCVAwoken = awokenCountInTeam(team, 47, solo, teamsCount); //全队大回复个数
|
||||
return [teamTRCV, teamRCVAwoken];
|
||||
}, 0);
|
||||
const tRCV = tRCVArr.reduce(function(value, teamRCV) {
|
||||
return [value[0] + teamRCV[0], value[1] + Math.round(teamRCV[0] * (1 + 0.10 * teamRCV[1]))];
|
||||
}, [0, 0]);
|
||||
const teamTHP = teamHPArr.reduce((pv, v) => pv + v); //队伍计算的总HP
|
||||
return Math.round(teamTHP);
|
||||
});
|
||||
const tHP = tHPArr.reduce((pv, v) => pv + v);
|
||||
const tHPNoAwoken = tHPNoAwokenArr.reduce((pv, v) => pv + v);
|
||||
|
||||
tRcvDom.innerHTML = tRCV[0].toString() +
|
||||
(tRCV[0] != tRCV[1] ? `(${tRCV[1]})` : "");
|
||||
tHpDom.innerHTML = tHP.toString() +
|
||||
` (${tHPNoAwoken})`;
|
||||
}
|
||||
}
|
||||
//刷新单人技能CD
|
||||
|
|
Loading…
Reference in New Issue