体力:添加购买体力功能

This commit is contained in:
luying
2021-06-28 15:40:01 +08:00
parent 29eb2e239c
commit 621bf3d82a
7 changed files with 158 additions and 23 deletions

View File

@@ -0,0 +1,22 @@
import { readFileAndParse, parseGoodStr } from '../util'
import { FILENAME } from '../../consts'
import { RewardInter } from '../interface';
export interface DicApBuy {
// 购买次数
readonly times: number;
// 消耗
readonly cost: RewardInter[];
}
export const dicApMaxBuyTimes = { max: 0 };
export const dicApBuy = new Map<number, RewardInter[]>();
export function loadApBuy() {
let arr = readFileAndParse(FILENAME.DIC_AP_BUY_COST);
arr.forEach(o => {
o.cost = parseGoodStr(o.cost);
dicApBuy.set(o.times, o.cost);
if(o.times > dicApMaxBuyTimes.max) dicApMaxBuyTimes.max = o.times;
});
arr = undefined;
}