From e319d4a37fc87988e1cce2fe8b990b152e59648d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=AB=E8=B0=B7=E5=89=91=E4=BB=99?= Date: Sun, 25 Apr 2021 17:54:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=BC=80=E7=A9=BA=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=E5=87=BA=E9=94=99=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/script.js b/script.js index ebd7fe71..48bc6083 100644 --- a/script.js +++ b/script.js @@ -287,7 +287,8 @@ Formation.prototype.loadObj = function(f) { t[1].forEach(function(m, mi) { m.loadObj(null); }); - if (t[2] != undefined) t.splice(2); + t[2] = 0; + t[3] = 0; }); return; } @@ -3304,8 +3305,8 @@ function refreshTeamTotalHP(totalDom, team, teamIdx) { const teams = formation.teams; - const leader1id = team[0][team[3]].id; - const leader2id = teamsCount===2 ? (teamIdx === 1 ? teams[0][0][teams[0][3]].id : teams[1][0][teams[1][3]].id) : team[0][5].id; + 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; if (tHpDom) { const reduceScales1 = getReduceScales(leader1id); @@ -3445,8 +3446,8 @@ function refreshFormationTotalHP(totalDom, teams) { const tEffectDom = totalDom.querySelector(".tIf-effect"); //因为目前仅用于2P,所以直接在外面固定写了 - const leader1id = teams[0][0][teams[0][3]].id; - const leader2id = teams[1][0][teams[1][3]].id; + const leader1id = teams[0][0][teams[0][3] || 0].id; + const leader2id = teams[1][0][teams[1][3] || 0].id; if (tHpDom) {