寻宝:roleStatus.heroes格式修改

This commit is contained in:
luying
2021-08-13 20:16:12 +08:00
parent 96042737d3
commit 899fc4aef6
4 changed files with 55 additions and 13 deletions
+10 -2
View File
@@ -15,6 +15,7 @@ import { checkActivityTask, checkTask } from './taskService';
import { getRandExpedition, gameData } from '../pubUtils/data';
import { ItemInter, RewardInter } from '../pubUtils/interface';
import { getTimeFunM } from '../pubUtils/timeUtil';
import { ComRoleStatusHero } from '../db/ComBattleTeam';
/**
* 获取当前镇念塔状态
@@ -461,10 +462,17 @@ export function getRandRobot(cnt = 1, withAttr = false) {
const warInfo = gameData.warJson.get(info.warId);
if (!warInfo || !warInfo.length) continue;
let heroes = [];
let heroes: ComRoleStatusHero[] = [];
for (let hero of warInfo) {
if (hero && hero.relation === 2 && hero.actorId) {
heroes.push(hero.actorId);
let dicHero = gameData.hero.get(hero.actorId);
heroes.push({
id: hero.actorId,
star: hero.star,
colorStar: 0,
lv: hero.lv,
quality: dicHero.quality
});
}
}
robots.push(heroes);
+4 -2
View File
@@ -230,7 +230,9 @@ function updateRobotKilled(bossHp: number, roleSt: RoleStatus) {
const dmgProgress = Math.floor(roleSt.totalDmg / (robotTotalHurt / roleSt.heroes.length));
if (dmgProgress > roleSt.killed.length && dmgProgress <= roleSt.heroes.length) {
const newKilledCnt = dmgProgress - roleSt.killed.length;
const aliveHeroes = difference(roleSt.heroes, roleSt.killed);
const aliveHeroes = roleSt.heroes.filter(hero => {
return roleSt.killed.indexOf(hero.id) == -1;
}).map(cur => cur.id);
const newKilledHeroes = getRandEelm(aliveHeroes, newKilledCnt);
roleSt.killed = roleSt.killed.concat(newKilledHeroes);
}
@@ -358,7 +360,7 @@ export function comBtlLvInvalid(lv: number, lvRange: number) {
const range = gameData.comBtlLvRange.get(lvRange);
if (!range) return true;
let { min, max } = range;
return lv >= min && lv <= max;
return lv < min || lv > max;
}
export async function dismissTeam(teamStatus: MemComBtlTeam, teamMap: Map<string, MemComBtlTeam>, roleId: string, teamDisTimer: Map<string, NodeJS.Timer>, channel) {