装备:洗练

This commit is contained in:
luying
2022-02-17 12:41:40 +08:00
parent 82b15e5792
commit 2bfc27356f
10 changed files with 1295 additions and 1992 deletions

View File

@@ -1,5 +1,5 @@
// 武将特技表
import { readFileAndParse, parseNumberList } from '../util'
import { readFileAndParse, decodeArrayListStr } from '../util'
import { FILENAME } from '../../consts'
export interface DicRandomEffectPool {
@@ -16,6 +16,10 @@ export interface DicRandomEffectPool {
readonly Min: number;
// 随机最大值
readonly Max: number;
// 分割
readonly gap: number;
// 分割
readonly rate: {min: number, max: number, weight: number}[];
}
@@ -26,8 +30,22 @@ export function loadRandomEffectPool() {
let arr = readFileAndParse(FILENAME.DIC_RANDOM_EFFECT_POOL);
arr.forEach(o => {
o.gainValueArr = parseNumberList(o.gainValue)
o.rate = parseRate(o.count)
dicRandomEffectPool.set(o.id, o);
});
arr = undefined;
}
function parseRate(str: string) {
let result: {min: number, max: number, weight: number}[] = [];
if(!str) return result;
let decodeArr = decodeArrayListStr(str);
for(let [min, max, weight] of decodeArr) {
if(isNaN(parseInt(min)) || isNaN(parseInt(max)) || isNaN(parseInt(weight))) {
throw new Error('data table format wrong');
}
result.push({min: parseInt(min), max: parseInt(max), weight: parseInt(weight) });
}
return result
}