寻宝:有战力限制时机器人的战力算法

This commit is contained in:
liangtongchuan
2021-01-27 16:00:48 +08:00
parent b082900eb2
commit e70124e6fc
3 changed files with 15 additions and 8 deletions
+8 -3
View File
@@ -3,7 +3,7 @@ import { STATUS } from './../consts/statusCode';
import { COM_BATTLE_ROBOT_ID_NAME, COM_TEAM_STATUS, CURRENCY_BY_TYPE, CURRENCY_TYPE, FRIEND_DROP_TYPE, COM_BTL_CONST, FRIEND_DROP_MAX } from './../consts';
import { RoleStatus, ComBattleTeamModel } from './../db/ComBattleTeam';
import { getBluePrtByQuality, getComBtlSetByQuality, getRewardByBlueprtId, getWarById, getWarIdByBlueprtId, comBtlRangeInfo } from "../pubUtils/gamedata";
import { getRandEelm, getRandValue, resResult, ratioReward } from "../pubUtils/util";
import { getRandEelm, getRandValue, resResult, ratioReward, getRandValueByMinMax } from "../pubUtils/util";
import { getRandRobot } from "./battleService";
import { difference } from 'underscore';
import { Channel } from 'pinus';
@@ -24,14 +24,19 @@ export function getRandBlueprtId(qualityArr: Array<number>, cnt = 1) {
return res;
}
export function getRandComBtlRobots(topFiveCe: number, lv: number, cnt: number) {
export function getRandComBtlRobots(topFiveCe: number, ceLimit: number, lv: number, cnt: number) {
let robotHeroes = getRandRobot(cnt); // 随机几个阵容
let robotInfos = getRandEelm(COM_BATTLE_ROBOT_ID_NAME, cnt); // 随机几个阵容
// 创建并添加机器人
let robotStArr = [], robotIdArr = [];
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);
let robotCe = 0;
if (ceLimit) {
robotCe = getRandValueByMinMax(ceLimit * COM_BTL_CONST.ROBOT_CE_LIMIT_MIN, ceLimit * COM_BTL_CONST.ROBOT_CE_LIMIT_MAX, 0);
} else {
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];