From 07a9c74145cae69001e5a4a1dccf350c4551088d Mon Sep 17 00:00:00 2001 From: luying Date: Mon, 8 Mar 2021 16:53:02 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9C=E5=BE=81=EF=BC=9Afix=20=E8=BF=9C?= =?UTF-8?q?=E5=BE=81=E6=9C=BA=E5=99=A8=E4=BA=BA=E6=88=98=E5=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game-server/app/services/expeditionService.ts | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/game-server/app/services/expeditionService.ts b/game-server/app/services/expeditionService.ts index 37d3db932..cff12f2fa 100644 --- a/game-server/app/services/expeditionService.ts +++ b/game-server/app/services/expeditionService.ts @@ -12,6 +12,14 @@ import { HeroType } from '../db/Hero'; import { gameData } from '../pubUtils/data'; import { getPlayerAttribute, getRobotAttribute } from './pvpService'; +/** + * 根据存下的战力获取当前远征关卡的对手 + * @param roleId 我的id + * @param myCe 存在expeditionRecord内的战力(缩过) + * @param expeditionCode 远征批次id + * @param expeditionId 该关卡id + * @param battleStatus 该关卡的挑战状态 + */ export async function findOrCreateEnemies(roleId: string, myCe: number, expeditionCode: string, expeditionId: number, battleStatus: number) { let expeditionWarRecord = await ExpeditionWarRecordModel.getRecordByCodeAndId(expeditionCode, expeditionId); @@ -62,7 +70,15 @@ export async function findOrCreateEnemies(roleId: string, myCe: number, expediti return expeditionWarRecord; } -// 匹配玩家 +/** + * 远征关卡匹配玩家 + * @param roleId 我的id + * @param scale 己方战力和对方战力比 + * @param range 浮动范围 + * @param myCe 己方战力(已缩小) + * @param warJsonIndex 模板出兵表id + * @param enemyObj 返回的敌军数据 + */ export async function matchPlayers(roleId: string, scale: number, range: number, myCe: number, warJsonIndex:any, enemyObj: {enemyFrom: number, enemyId: string, enemies: Array, ce: number }) { let {json: dicWarJson } = getWarJsons(warJsonIndex); @@ -113,7 +129,15 @@ export async function matchPlayers(roleId: string, scale: number, range: number, } } -// 匹配机器人 +/** + * 匹配远征机器人 + * @param scale 己方战力和出兵表配置战力比 + * @param myCe 己方战力(已缩小) + * @param robotCe 机器人战力(10000,相当于已缩小战力) + * @param warJsonIndex 模板出兵表id + * @param lv 我的主公等级 + * @param enemyObj 返回的敌军数据 + */ export async function matchRobots(scale: number, myCe: number, robotCe: number, warJsonIndex: number, lv: number, enemyObj: {enemyFrom: number, enemyId: string, enemies: Array, ce: number }) { let dicWarJson = gameData.warJson.get(warJsonIndex); if(dicWarJson) { @@ -121,13 +145,12 @@ export async function matchRobots(scale: number, myCe: number, robotCe: number, enemyObj.enemyId = warJsonIndex + ''; let allCe = 0; - let ratio = myCe / HERO_CE_RATIO / HERO_CE_RATIO / robotCe * scale; // 玩家战力/机器人初始战力*系数 for(let json of dicWarJson) { if(json.relation == 2) { const { attribute } = json; let newAttribute = getRobotAttribute(attribute, myCe, robotCe, scale); - let ce = newAttribute.calCelAndReduce(); + let ce = newAttribute.calCe(); enemyObj.enemies.push({...json, attribute: newAttribute, lv}); allCe += ce; }