48 lines
1.6 KiB
TypeScript
48 lines
1.6 KiB
TypeScript
/**
|
||
* 圣物效果配置表
|
||
*/
|
||
|
||
import { decodeArrayListStr, readFileAndParse } from '../util'
|
||
import { ABI_TYPE, FILENAME, ROUGE_EFFECT_TYPE } from '../../consts'
|
||
|
||
export interface DicRougeEffect {
|
||
readonly id: number;
|
||
readonly effectId: number;
|
||
readonly effectType: number; // 效果的类型,具体什么type写个文档
|
||
readonly effectParam: number[]; // 效果的具体参数,不同的type对这个param的解释不同需要分别定义,用&连接
|
||
}
|
||
|
||
|
||
export const dicRougeEffect = new Map<number, DicRougeEffect>();
|
||
export function loadRougeEffect() {
|
||
dicRougeEffect.clear();
|
||
|
||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_EFFECT);
|
||
|
||
arr.forEach(o => {
|
||
o.effectParam = parseEffectParam(o.effectType, o.effectParam);
|
||
// console.log('effectParam', o.effectParam)
|
||
// if (!dicRougeEffect.has(o.effectType)) {
|
||
// dicRougeEffect.set(o.effectType, []);
|
||
// }
|
||
// dicRougeEffect.get(o.effectType).push(o);
|
||
dicRougeEffect.set(o.effectId, o);
|
||
});
|
||
arr = undefined;
|
||
}
|
||
|
||
function parseEffectParam(effectType: number, str: string) {
|
||
let arr = decodeArrayListStr(str);
|
||
switch(effectType) {
|
||
case ROUGE_EFFECT_TYPE.HOLY_CHARA_MAIN_ATTR_UP:
|
||
case ROUGE_EFFECT_TYPE.HOLY_CHARA_MAIN_ATTR_UP:
|
||
case ROUGE_EFFECT_TYPE.HOLY_CHARA_MAIN_ATTR_UP:
|
||
case ROUGE_EFFECT_TYPE.HOLY_CHARA_MAIN_ATTR_UP:
|
||
{
|
||
arr = arr.filter(cur => cur[0] == ABI_TYPE.ABI_HP.toString());
|
||
break;
|
||
}
|
||
}
|
||
return arr.length > 0? arr[0].map(cur => parseFloat(cur)): [];
|
||
}
|