寻宝:有战力限制时机器人的战力算法
This commit is contained in:
@@ -169,7 +169,7 @@ export class ComBattleHandler {
|
||||
setTimeout(async () => {
|
||||
let team = thiz.teamMap.get(teamCode);
|
||||
if (team && team.roleIds && team.status === COM_TEAM_STATUS.DEFAULT && team.roleIds.length < 3) {
|
||||
let { robotStArr, robotIdArr } = getRandComBtlRobots(topFiveCe, lv, 3 - team.roleIds.length);
|
||||
let { robotStArr, robotIdArr } = getRandComBtlRobots(topFiveCe, team.ceLimit, lv, 3 - team.roleIds.length);
|
||||
team.roleIds = team.roleIds.concat(robotIdArr);
|
||||
team.roleStatus = team.roleStatus.concat(robotStArr);
|
||||
for (let st of robotStArr) {
|
||||
@@ -244,7 +244,7 @@ export class ComBattleHandler {
|
||||
roleStatus.push(roleInfo);
|
||||
roleIds.push(roleId);
|
||||
// 创建并添加机器人
|
||||
let { robotStArr, robotIdArr } = getRandComBtlRobots(topFiveCe, lv, 2);
|
||||
let { robotStArr, robotIdArr } = getRandComBtlRobots(topFiveCe, comTeam.ceLimit, lv, 2);
|
||||
roleStatus = roleStatus.concat(robotStArr);
|
||||
roleIds = roleIds.concat(robotIdArr);
|
||||
comTeam.roleStatus = roleStatus;
|
||||
@@ -462,7 +462,7 @@ export class ComBattleHandler {
|
||||
}
|
||||
if (!roleSt) return;
|
||||
let { topFiveCe, lv } = roleSt;
|
||||
let { robotStArr, robotIdArr } = getRandComBtlRobots(topFiveCe, lv, 3 - team.roleIds.length);
|
||||
let { robotStArr, robotIdArr } = getRandComBtlRobots(topFiveCe, team.ceLimit, lv, 3 - team.roleIds.length);
|
||||
team.roleIds = team.roleIds.concat(robotIdArr);
|
||||
team.roleStatus = team.roleStatus.concat(robotStArr);
|
||||
for (let st of robotStArr) {
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -135,9 +135,11 @@ export const COM_BTL_CONST = {
|
||||
BTL_TIME_LMT: 10 * 60 * 1000, // 每局时长限制
|
||||
ROBOT_HURT_RAND_RATE: 0.05, // 每个机器人消耗 boss 血量百分比浮动范围
|
||||
FRDCNT_DROP: 10, // 每场情谊点掉落
|
||||
ROBOT_CE_RATIO: 0.2, // 机器人战力上下浮动百分比
|
||||
ROBOT_CE_RATIO: 0.2, // 没有战力限制的情况下机器人战力上下浮动百分比
|
||||
ROBOT_CE_LIMIT_MIN: 1.05, // 有战力限制的情况下机器人战力最小倍数
|
||||
ROBOT_CE_LIMIT_MAX: 1.15, // 有战力限制的情况下机器人战力最大倍数
|
||||
ASSIST_TIME: 60 * 1000, // 助战匹配机器人的等待时长
|
||||
CAP_TIME: 60 * 1000, // 队长匹配机器人的等待时长
|
||||
CAP_TIME: 40 * 1000, // 队长匹配机器人的等待时长
|
||||
CAP_START_TIME: 60 * 1000, // 人齐后队长开始时长倒计时
|
||||
ROBOT_RND_LMT: 10, // 机器人输出伤害的回合数
|
||||
ROBOT_ACT_LMT: 10, // 机器人输出伤害的次数
|
||||
|
||||
Reference in New Issue
Block a user