重构更改面板评分规则

This commit is contained in:
UCPr 2025-03-26 01:52:07 +08:00
parent d594caaeb1
commit b46537ea3d
15 changed files with 474 additions and 445 deletions

View file

@ -2,15 +2,17 @@ import { getMapData } from '../utils/file.js';
import { charNameToID } from './convert/char.js';
import { nameToId } from './convert/property.js';
const baseValueData = getMapData('EquipBaseValue');
/** @type {{ [propID: string]: number }} */
export const baseValueData = getMapData('EquipBaseValue');
const equipScore = getMapData('EquipScore');
const scoreData = {};
/** @type {{ [charID: string]: { [propID: string]: number } }} */
export const scoreData = {};
for (const charName in equipScore) {
// 兼容原ID格式
if (+charName) {
scoreData[charName] = equipScore[charName];
continue;
}
};
const charID = charNameToID(charName);
if (!charID)
continue;
@ -21,6 +23,12 @@ for (const charName in equipScore) {
continue;
scoreData[charID][propID] = equipScore[charName][propName];
};
/** 小生命、小攻击、小防御映射为大生命、大攻击、大防御的1/3 */
for (const [small, big] of [[11103, 11102], [12103, 12102], [13103, 13102]]) {
if (!scoreData[charID][small] && scoreData[charID][big]) {
scoreData[charID][small] = scoreData[charID][big] / 3;
};
};
};
/**
@ -35,79 +43,6 @@ export const hasScoreData = charID => {
);
};
/**
* 获取装备属性基准分数
* @param {string} charID 角色id
* @param {string} propertyID 属性id
* @returns {number}
*/
export const getEquipPropertyBaseScore = (charID, propertyID) => {
const score = scoreData[charID][propertyID] || 0;
return score;
};
/**
* 获取装备属性分数
* @param {string} charID 角色id
* @param {number} propertyID 属性id
* @param {string} value 属性值
* @returns {number}
*/
export const getEquipPropertyScore = (charID, propertyID, value) => {
if (value.includes('%')) {
value = value.replace('%', '');
}
value = Number(value);
propertyID = String(propertyID);
const baseScore = getEquipPropertyBaseScore(charID, propertyID);
let finalScore = baseScore * value;
switch (propertyID) {
// 小生命
case '11103':
finalScore = value * 0.043 * baseScore * 1;
break;
// 大生命
case '11102':
finalScore = value * 1.6 * baseScore * 1;
break;
// 小攻击
case '12103':
finalScore = value * 0.25 * baseScore * 1;
break;
// 大攻击
case '12102':
finalScore = value * 1.6 * baseScore * 1;
break;
// 小防御
case '13103':
finalScore = value * 0.32 * baseScore * 1;
break;
// 大防御
case '13102':
finalScore = value * 1 * baseScore * 1;
break;
// 暴击
case '20103':
finalScore = value * 2 * baseScore * 1;
break;
// 暴击伤害
case '21103':
finalScore = value * 1 * baseScore * 1;
break;
// 穿透值
case '23203':
finalScore = value * 0.53 * baseScore * 1;
break;
// 异常精通
case '31403':
finalScore = value * 0.5 * baseScore * 1;
break;
default:
break;
}
return finalScore;
};
/**
* 获取词条强化次数
* @param {string} propertyID 属性id