From 40670fc17296ea676220ddb6f7848adc14efe053 Mon Sep 17 00:00:00 2001 From: bietiaop <1527109126@qq.com> Date: Mon, 29 Jul 2024 12:44:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AF=84=E7=BA=A7=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E7=9A=84=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/equip.js | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/model/equip.js b/model/equip.js index 256fdb9..57aec35 100644 --- a/model/equip.js +++ b/model/equip.js @@ -225,20 +225,22 @@ export class Equip { * @returns {number} */ get_score(charID) { - this.score = this.properties.reduce( - (acc, item) => acc + item.get_score(charID), - 0 - ); - const additional = this.main_properties.reduce( - (acc, item) => acc + item.get_score(charID), - 0 - ); - if (this.equipment_type === 4) { - this.score += 4.8 * additional; - } else if (this.equipment_type === 5) { - this.score += 9.6 * additional; - } else if (this.equipment_type === 6) { - this.score += 4.8 * additional; + if (hasScoreData(charID)) { + this.score = this.properties.reduce( + (acc, item) => acc + item.get_score(charID), + 0 + ); + const additional = this.main_properties.reduce( + (acc, item) => acc + item.get_score(charID), + 0 + ); + if (this.equipment_type === 4) { + this.score += 4.8 * additional; + } else if (this.equipment_type === 5) { + this.score += 9.6 * additional; + } else if (this.equipment_type === 6) { + this.score += 4.8 * additional; + } } return this.score; }