This commit is contained in:
mamengke01
2020-12-25 14:15:03 +08:00
parent 0c5cb1daac
commit 04fa4e79cf
14 changed files with 304 additions and 27 deletions

View File

@@ -30,7 +30,8 @@ import { dicStrengthenCost } from './dictionary/DicStrengthenCost';
import { dicRefine } from './dictionary/DicRefine';
import { dicHeroEquip } from './dictionary/DicHeroEquip';
import { dicSuit } from './dictionary/DicSuit';
import { dicTitle } from './dictionary/DicTitle'
import { dicTitle } from './dictionary/DicTitle';
import { dicTeraph } from './dictionary/DicTeraph';
export const gameData = {
blurprtCompose: dicBlueprtCompose,
blueprtPossibility: dicBlueprtPossibility,
@@ -72,7 +73,8 @@ export const gameData = {
jewels: dicJewel,
dicHeroEquip: dicHeroEquip,
suit: dicSuit,
title: dicTitle
title: dicTitle,
teraphs: dicTeraph
};
// 在此提供一些原先在gamedata中提供的方法以便更方便获取gameData数据
@@ -204,3 +206,8 @@ export function getTitle(titleLv: number) {
const titleInfo = gameData.title.get(titleLv);
return titleInfo;
}
export function getTeraph(id: number, grade: number) {
const teraphInfo = gameData.teraphs.get(id +'_'+ grade);
return teraphInfo;
}

View File

@@ -0,0 +1,90 @@
// 物品表
import { decodeArrayListStr, readJsonFile, parseGoodStr } from '../util'
import { FILENAME} from '../../consts'
const _ = require('lodash');
export interface SpecialMaterial {
readonly ids: number[];
readonly count: number;
}
export interface DicTeraph {
// 等级
readonly id: number;
readonly index: number;
readonly grade: number;
readonly hpMax: number;
readonly atkMax: number;
readonly defMax: number;
readonly mdefMax: number;
readonly agiMax: number;
readonly lukMax: number;
readonly hp;
readonly atk;
readonly def;
readonly mdef;
readonly agi;
readonly luk;
readonly criRate;
readonly criEffect;
readonly upMaterial:Array<{id: number, number: number}>;
readonly assiAttrValue: Map<number, number>;
readonly upGradeMaterial:Array<{id: number, number: number}>;
}
const str = readJsonFile(FILENAME.DIC_TERAPH);
let arr = JSON.parse(str);
type KeysEnum<T> = { [P in keyof Required<T>]: true };
const DicTeraphKeys: KeysEnum<DicTeraph> = {
id: true,
index: true,
grade: true,
hpMax: true,
atkMax: true,
defMax: true,
mdefMax: true,
agiMax: true,
lukMax: true,
hp: true,
atk: true,
def: true,
mdef: true,
agi: true,
luk: true,
criRate: true,
criEffect: true,
upMaterial: true,
assiAttrValue: true,
upGradeMaterial: true,
}
export const dicTeraph = new Map<string, DicTeraph>();
arr.forEach(o => {
o.assiAttrValue = parseAttr(o.assiAttrValue);
o.upGradeMaterial = parseGoodStr(o.upGradeMaterial);
o.upMaterial = parseGoodStr(o.upMaterial);
o.hp = o.hpUp;
o.atk = o.atkUp;
o.def = o.defUp;
o.mdef = o.mdefUp;
o.agi = o.agiUp;
o.luk = o.lukUp;
dicTeraph.set(o.index + '_' + o.grade, _.pick(o, Object.keys(DicTeraphKeys)));
});
arr = undefined;
function parseAttr(str: string) {
let result = new Array<{id: number, number: number}>();
if(!str) return result;
let decodeArr = decodeArrayListStr(str);
for(let [id, number] of decodeArr) {
if(isNaN(parseInt(id)) || isNaN(parseInt(number))) {
throw new Error('data table format wrong');
}
result.push({id: parseInt(id), number: parseInt(number)});
}
return result
}

View File

@@ -52,7 +52,7 @@ export function calPlayerCe(globalCeAttr: CeAttr, hero: HeroType, type: number,
} else if (type == HERO_SYSTEM_TYPE.JEWEL_OFF) {//宝石卸下
reIncAttr = calHeroCeWhenJewelOff(hero, args);
} else {
reIncAttr = hero.ceAttr;
return incCe;
}
addSeidEffect(reIncAttr, hero.ceAttr, addSeidList, removeSeidList); // 处理加值