mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 21:27:47 +00:00
支持自定义评分规则、支持动态选用、更新相关文档
This commit is contained in:
parent
06ec5152a0
commit
504d2792a8
11 changed files with 217 additions and 114 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { baseValueData, scoreData } from '../../lib/score.js';
|
||||
import { idToName } from '../../lib/convert/property.js';
|
||||
import { baseValueData } from '../../lib/score.js';
|
||||
import { getMapData } from '../../utils/file.js';
|
||||
var rarity;
|
||||
(function (rarity) {
|
||||
|
|
@ -10,13 +10,13 @@ var rarity;
|
|||
const mainStats = getMapData('EquipMainStats');
|
||||
const subStats = Object.keys(baseValueData).map(Number);
|
||||
export default class Score {
|
||||
scoreData;
|
||||
equip;
|
||||
weight;
|
||||
partition;
|
||||
userMainStat;
|
||||
constructor(charID, equip) {
|
||||
this.scoreData = scoreData[charID];
|
||||
constructor(equip, weight) {
|
||||
this.equip = equip;
|
||||
this.weight = weight;
|
||||
this.partition = this.equip.equipment_type;
|
||||
this.userMainStat = this.equip.main_properties[0].property_id;
|
||||
}
|
||||
|
|
@ -37,13 +37,13 @@ export default class Score {
|
|||
}
|
||||
get_max_count() {
|
||||
const subMaxStats = subStats
|
||||
.filter(p => p !== this.userMainStat && this.scoreData[p])
|
||||
.sort((a, b) => this.scoreData[b] - this.scoreData[a]).slice(0, 4);
|
||||
.filter(p => p !== this.userMainStat && this.weight[p])
|
||||
.sort((a, b) => this.weight[b] - this.weight[a]).slice(0, 4);
|
||||
if (!subMaxStats.length)
|
||||
return 0;
|
||||
logger.debug(`[${this.partition}号位]理论副词条:` + subMaxStats.map(idToName).reduce((a, p, i) => a + `${p}*${this.scoreData[subMaxStats[i]].toFixed(2)} `, ''));
|
||||
let count = this.scoreData[subMaxStats[0]] * 6;
|
||||
subMaxStats.slice(1).forEach(p => count += this.scoreData[p] || 0);
|
||||
logger.debug(`[${this.partition}号位]理论副词条:` + subMaxStats.map(idToName).reduce((a, p, i) => a + `${p}*${this.weight[subMaxStats[i]].toFixed(2)} `, ''));
|
||||
let count = this.weight[subMaxStats[0]] * 6;
|
||||
subMaxStats.slice(1).forEach(p => count += this.weight[p] || 0);
|
||||
logger.debug(`[${this.partition}号位]理论词条数:${logger.blue(count)}`);
|
||||
return count;
|
||||
}
|
||||
|
|
@ -51,7 +51,7 @@ export default class Score {
|
|||
let count = 0;
|
||||
for (const prop of this.equip.properties) {
|
||||
const propID = prop.property_id;
|
||||
const weight = this.scoreData[propID];
|
||||
const weight = this.weight[propID];
|
||||
if (weight) {
|
||||
logger.debug(`[${this.partition}号位]实际副词条:${idToName(propID)} ${logger.green(prop.count + 1)}*${weight}`);
|
||||
count += weight * (prop.count + 1);
|
||||
|
|
@ -75,17 +75,17 @@ export default class Score {
|
|||
return score;
|
||||
}
|
||||
const mainMaxStat = mainStats[this.partition]
|
||||
.filter(p => this.scoreData[p])
|
||||
.sort((a, b) => this.scoreData[b] - this.scoreData[a])[0];
|
||||
const mainScore = (mainMaxStat ? 12 * (this.scoreData[this.userMainStat] || 0) / this.scoreData[mainMaxStat] : 12) * this.get_level_multiplier();
|
||||
.filter(p => this.weight[p])
|
||||
.sort((a, b) => this.weight[b] - this.weight[a])[0];
|
||||
const mainScore = (mainMaxStat ? 12 * (this.weight[this.userMainStat] || 0) / this.weight[mainMaxStat] : 12) * this.get_level_multiplier();
|
||||
const subScore = actual_count / max_count * 43;
|
||||
const score = (mainScore + subScore) * rarity_multiplier;
|
||||
logger.debug(`[${this.partition}号位] ${logger.magenta(`(${mainScore} + ${subScore}) * ${rarity_multiplier} = ${score}`)}`);
|
||||
return score;
|
||||
}
|
||||
static main(charID, equip) {
|
||||
static main(equip, weight) {
|
||||
try {
|
||||
return new Score(charID, equip).get_score();
|
||||
return new Score(equip, weight).get_score();
|
||||
}
|
||||
catch (err) {
|
||||
logger.error('角色驱动盘评分计算错误:', err);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue