fix 寻宝:机器人重复问题,被踢人推送

This commit is contained in:
liangtongchuan
2020-12-30 12:11:49 +08:00
parent 0693c896c6
commit 666c79a84f
2 changed files with 13 additions and 9 deletions
+11 -8
View File
@@ -24,16 +24,19 @@ export function getRandBlueprtId(qualityArr: Array<number>, cnt = 1) {
export function getRandComBtlRobots(topFiveCe: number, lv: number, cnt: number) {
let robotHeroes = getRandRobot(cnt); // 随机几个阵容
let robotInfos = getRandEelm(COM_BATTLE_ROBOT_ID_NAME, cnt); // 随机几个阵容
// 创建并添加机器人
let robotStArr = [], robotIdArr = [];
for (let robot of robotHeroes) {
const robotCe = getRandValue(topFiveCe || 0, COM_BTL_CONST.ROBOT_CE_RATIO, 0);
const robotLv = getRandValue(lv, COM_BTL_CONST.ROBOT_CE_RATIO, 0);
const imgHid = robot[Math.floor(Math.random() * robot.length)];
const { robotRoleId, robotRoleName } = COM_BATTLE_ROBOT_ID_NAME[Math.floor(Math.random() * COM_BATTLE_ROBOT_ID_NAME.length)];
let robotStatus = new RoleStatus(robotRoleId, robotRoleName, false, false, imgHid, imgHid, robotCe, robotLv, robot, true);
robotStArr.push(robotStatus);
robotIdArr.push(robotRoleId);
if (robotHeroes && robotInfos && robotHeroes.length && robotInfos.length && robotInfos.length === robotHeroes.length) {
robotHeroes.forEach((robot, idx) => {
const robotCe = getRandValue(topFiveCe || 0, COM_BTL_CONST.ROBOT_CE_RATIO, 0);
const robotLv = getRandValue(lv, COM_BTL_CONST.ROBOT_CE_RATIO, 0);
const imgHid = robot[Math.floor(Math.random() * robot.length)];
const { robotRoleId, robotRoleName } = robotInfos[idx];
let robotStatus = new RoleStatus(robotRoleId, robotRoleName, false, false, imgHid, imgHid, robotCe, robotLv, robot, true);
robotStArr.push(robotStatus);
robotIdArr.push(robotRoleId);
});
}
return {
robotStArr, robotIdArr