underscore读取,排行榜保护

This commit is contained in:
mamengke01
2021-01-12 14:13:30 +08:00
parent 58f3e94fc0
commit 22f2eed34e
16 changed files with 53 additions and 51 deletions
+5 -5
View File
@@ -16,9 +16,9 @@ import { DicRandomEffectPool } from './dictionary/DicRandomEffectPool';
import { getGoodById } from './gamedata';
import { SchoolModel } from '../db/School';
import { getTeraphAttr, HEROTARIN } from '../consts/constModules/abilityConst'
// import { PvpDefenseModel } from '../db/PvpDefense';
import { PvpDefenseModel } from '../db/PvpDefense';
const HERO_CE_RATIO = 100;
const _ = require('underscore');
import { findIndex } from 'underscore';
//战力计算TODO
export function calPlayerCe(globalCeAttr: CeAttrRole, hero: HeroType, type: number, args: Array<number> = []) {
let heroCe = 0;
@@ -108,7 +108,7 @@ export async function calPlayerCeAndSave(roleId: string, heros: Array<HeroType>,
incPlayerCe += incHeroCe;
await calculateTopFive(role, hero.hid, hero.ce, hero._id); // 计算更新最强五人战力
await HeroModel.updateHeroInfo(roleId, hero.hid, hero);
//await PvpDefenseModel.updateCe(roleId, hero.hid, hero.ce); // 更新pvp防守阵最强五人战力
await PvpDefenseModel.updateCe(roleId, hero.hid, hero.ce); // 更新pvp防守阵战力
pushHeros.push({
hid: hero.hid,
ce: reduceCe(hero.ce),
@@ -294,13 +294,13 @@ export function calHeroJobStageUpIncAttr(hero: HeroType, args: Array<number>, ad
let lastJob = gameData.job.get(args[0]) || { seid: [] };
let currentJob = gameData.job.get(hero.job);
for (let seid of currentJob.seid) {
let index = _.findIndex(lastJob.seid, seid);
let index = findIndex(lastJob.seid, seid);
if (index < 0) {
addSeidList.push(seid, 0);
}
}
for (let seid of lastJob.seid) {
let index = _.findIndex(currentJob.seid, seid);
let index = findIndex(currentJob.seid, seid);
if (index < 0) {
removeSeidList.push(seid, 0);
}