装备:洗练
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user