mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-28 18:19:15 +00:00
9b90010daa
* 目前可正确获取圣遗物名称了,`#圣遗物列表`如有错误重新获角色信息后即正常 * 雷神、莫娜的元素伤害字段数据错误fix * 由于服务逻辑与之前数据不一致,部分角色的属性及伤害计算可能会不准确,如有发现请反馈给喵喵
95 lines
2.0 KiB
JavaScript
95 lines
2.0 KiB
JavaScript
import {attrMark, maxMark, attrMap, usefulAttr} from "../../resources/meta/reliquaries/reliquaries-mark.js";
|
|
import lodash from "lodash";
|
|
|
|
//let meta = Data.readJSON("../../resources/meta/reliquaries", "data.json");
|
|
|
|
|
|
let Reliquaries = {
|
|
getUseful(char) {
|
|
let attrKey = usefulAttr[char] || "";
|
|
attrKey = attrKey.split(",");
|
|
let attrTitles = [], retMap = {};
|
|
lodash.forEach(attrKey, (key) => {
|
|
let attr = attrMap[key];
|
|
if (attr) {
|
|
attrTitles.push(attr.title);
|
|
lodash.forEach(attr.attr.split(","), (k) => {
|
|
retMap[k] = attrMark[k];
|
|
})
|
|
}
|
|
})
|
|
return {
|
|
titles: attrTitles,
|
|
mark: retMap
|
|
}
|
|
},
|
|
|
|
getMaxMark(char, banTitle = "") {
|
|
let markMap = Reliquaries.getUseful(char).mark;
|
|
|
|
let markList = [];
|
|
|
|
lodash.forEach(markMap, (m, title) => {
|
|
if (title !== banTitle) {
|
|
markList.push(maxMark[title]);
|
|
}
|
|
});
|
|
|
|
markList = markList.sort((a, b) => b - a);
|
|
let retMaxMark = markList[0];
|
|
lodash.forEach(markList, (mark, idx) => {
|
|
if (idx > 0 && idx < 4) {
|
|
retMaxMark += mark / 6;
|
|
}
|
|
});
|
|
|
|
return retMaxMark;
|
|
|
|
},
|
|
|
|
getMark(char = "", data = []) {
|
|
let total = 0;
|
|
let markMap = Reliquaries.getUseful(char).mark;
|
|
lodash.forEach(data, (ret) => {
|
|
ret = ret || [];
|
|
let title = ret[0], val = ret[1];
|
|
if (title && val) {
|
|
if (markMap[title]) {
|
|
total += markMap[title] * val;
|
|
}
|
|
}
|
|
})
|
|
return total;
|
|
},
|
|
|
|
getMarkScore(mark, maxMark) {
|
|
let pct = mark / maxMark;
|
|
let scoreMap = [
|
|
["D", 0.15],
|
|
["C", 0.25],
|
|
["B", 0.35],
|
|
["A", 0.45],
|
|
["S", 0.55],
|
|
["SS", 0.65],
|
|
["SSS", 0.75],
|
|
["ACE", 0.85],
|
|
["ACE²", 1]
|
|
];
|
|
|
|
for (let idx = 0; idx < scoreMap.length; idx++) {
|
|
if (pct < scoreMap[idx][1]) {
|
|
return scoreMap[idx][0];
|
|
}
|
|
}
|
|
},
|
|
|
|
getSet(name) {
|
|
for (let idx in meta) {
|
|
if (meta[idx].name === name) {
|
|
return meta[idx];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
export default Reliquaries; |