添加远征匹配玩家方法

This commit is contained in:
luying
2020-10-28 19:29:59 +08:00
parent 3377e0f99c
commit 222b9c6e12
11 changed files with 282 additions and 27 deletions

View File

@@ -77,6 +77,7 @@ export class ExpeditionBattleHandler {
// 计算我方战斗力(最高五人)
let myCe = await calculateSumCE(roleId, 1, { num: 5 });
console.log(myCe);
let enemyObj = {
enemyFrom: 0,
enemyId: '',
@@ -88,7 +89,7 @@ export class ExpeditionBattleHandler {
// 获取系数和步长
let {scale, range, lv} = await getCEScaleAndRange(roleId, curDicExpedition);
// 优先匹配其他玩家
let flag = await matchPlayers(scale, range, myCe, enemyObj);
let flag = await matchPlayers(roleId, scale, range, myCe, curDicExpedition.json, enemyObj);
// 当数量不够时使用机器人匹配
if(!flag) {
flag = await matchRobots(scale, myCe, curDicExpedition.ce, curDicExpedition.json, lv, enemyObj);

View File

@@ -3,7 +3,7 @@ import { BattleRecordModel } from '../../../db/BattleRecord';
import { BattleSweepRecordModel } from '../../../db/BattleSweepRecord';
import { getWarById, } from '../../../pubUtils/gamedata';
import { genCode } from '../../../pubUtils/util';
import { WAR_TYPE } from '../../../consts/consts';
import { WAR_TYPE, EVENT_STATUS } from '../../../consts/consts';
import { checkDaily, checkDailyAndIncrease } from '../../../services/dailyBattleService';
import { checkTowerWar, towerBattleEnd } from '../../../services/battleService';
import { WarReward } from '../../../services/warRewardService';
@@ -70,7 +70,8 @@ export class NormalBattleHandler {
towerData = Object.assign(towerData, checkResult.data);
} else if (warInfo.warType == WAR_TYPE.EVENT) {
// 记录事件状态
let checkResult = await checkEventBattle( roleId, session.get('eventStatus'), battleId, battleCode);
let eventStatus = session.get('eventStatus')||EVENT_STATUS.WAITING;
let checkResult = await checkEventBattle( roleId, eventStatus, battleId, battleCode);
if(checkResult.status == -1) {
return checkResult.resResult
}