fix: 计算

This commit is contained in:
bietiaop 2024-07-28 23:56:23 +08:00
parent 2c02be9e68
commit cc9a0a1271
2 changed files with 4 additions and 3 deletions

View file

@ -29,7 +29,7 @@ export const getEquipPropertyBaseScore = (charID, propertyID) => {
/** /**
* 获取装备属性分数 * 获取装备属性分数
* @param {string} charID 角色id * @param {string} charID 角色id
* @param {string} propertyID 属性id * @param {number} propertyID 属性id
* @param {string} value 属性值 * @param {string} value 属性值
* @returns {number} * @returns {number}
*/ */
@ -38,6 +38,7 @@ export const getEquipPropertyScore = (charID, propertyID, value) => {
value = value.replace('%', ''); value = value.replace('%', '');
} }
value = Number(value); value = Number(value);
propertyID = String(propertyID);
const baseScore = getEquipPropertyBaseScore(charID, propertyID); const baseScore = getEquipPropertyBaseScore(charID, propertyID);
let finalScore = baseScore * value; let finalScore = baseScore * value;
switch (propertyID) { switch (propertyID) {

View file

@ -400,14 +400,14 @@ export class ZZZAvatarInfo {
return damagelist; return damagelist;
} }
/** @type {number|boolean} */ /** @type {string|boolean} */
get equip_score() { get equip_score() {
if (hasScoreData(this.id)) { if (hasScoreData(this.id)) {
let score = 0; let score = 0;
for (const equip of this.equip) { for (const equip of this.equip) {
score += equip.score; score += equip.score;
} }
return score; return score.toFixed(2);
} }
return false; return false;
} }