军团表逻辑

This commit is contained in:
mamengke01
2021-01-22 21:28:35 +08:00
parent b5d84c03e4
commit 3e6ec77d56
30 changed files with 4838 additions and 1387 deletions

View File

@@ -330,4 +330,8 @@ export function getStructureConsume(structureId: number, level: number) {
export function hasStructureConsume(structureId: number, level: number) {
return gameData.structureConsume.get(structureId).has(level);
}
export function getBossByLv(lv: number) {
return gameData.bossBase.get(lv);
}

View File

@@ -52,17 +52,20 @@ export interface DicBossBase {
// boss等级
readonly bossLevel: number;
// 关卡id
readonly warId: number;
readonly wars: Array<{warId:number, bossHp:number}>;
// 掉落的拍卖行奖励
readonly reward: RewardInter[];
readonly consume: number;
}
const DicBossKeys: KeysEnum<DicBossBase> = {
id: true,
level: true,
bossLevel: true,
warId: true,
reward: true
wars: true,
reward: true,
consume: true
};
// 练兵场
@@ -181,6 +184,13 @@ let arrBoss = JSON.parse(strBoss);
arrBoss.forEach(o => {
setStructureConsume(o);
o.reward = parseGoodStr(o.reward);
o.wars = o.warIdHP.split('|').map((warStrs)=> {
if (!warStrs) {
return;
}
let warArr = warStrs.split('&');
return { warId: parseInt(warArr[0]), bossHp: parseInt(warArr[1])}
});
dicBossBase.set(o.level, _.pick(o, Object.keys(DicBossKeys)));
});
arrBoss = undefined;

View File

@@ -4,7 +4,6 @@ import { HeroModel, HeroType } from '../db/Hero';
import fs = require('fs');
import path = require('path');
import { DicRandomEffectPool } from './dictionary/DicRandomEffectPool';
import { HERO_CE_RATIO, ABI_STAGE } from '../consts';
import { findIndex } from 'underscore';
@@ -167,9 +166,6 @@ export async function calculateSumCE(roleId: string, type: number, param: { num?
return sum;
}
export function getRandomByLen(arr: Array<number>): number
export function getRandomByLen(arr: Array<string>): string
export function getRandomByLen(arr: Array<DicRandomEffectPool>): DicRandomEffectPool
export function getRandomByLen(arr: Array<any>): any {
let len = arr.length;
return arr[Math.floor(Math.random() * len)]