diff --git a/game-server/app/servers/battle/handler/expeditionBattleHandler.ts b/game-server/app/servers/battle/handler/expeditionBattleHandler.ts index 0309150c1..e6df61406 100644 --- a/game-server/app/servers/battle/handler/expeditionBattleHandler.ts +++ b/game-server/app/servers/battle/handler/expeditionBattleHandler.ts @@ -1,5 +1,5 @@ import { Application, BackendSession } from 'pinus'; -import { getGamedata, getWarById } from '../../../pubUtils/gamedata'; +import { getGamedata, getWarById, hasExpeditionById } from '../../../pubUtils/gamedata'; import { BattleRecordModel } from '../../../db/BattleRecord'; import { ExpeditionRecordModel } from '../../../db/ExpeditionRecord'; import { ExpeditionWarRecordModel } from '../../../db/ExpeditionWarRecord'; @@ -125,8 +125,11 @@ export class ExpeditionBattleHandler { } let { battleId, enemyFrom, enemies, battleStatus, ce: curCe } = curExpeditionWarRecord; let nextCe = 0; // 下一关战力 - let nextExpeditionWarRecord = await findOrCreateEnemies(roleId, myCe, expeditionCode, expeditionId + 1, EXPEDITION_WAR_RECORD_STATUS.HIDE); - if(nextExpeditionWarRecord) nextCe = nextExpeditionWarRecord.ce; + + if(hasExpeditionById(expeditionId + 1)) { + let nextExpeditionWarRecord = await findOrCreateEnemies(roleId, myCe, expeditionCode, expeditionId + 1, EXPEDITION_WAR_RECORD_STATUS.HIDE); + if(nextExpeditionWarRecord) nextCe = nextExpeditionWarRecord.ce; + } return resResult(STATUS.SUCCESS, { expeditionCode, expeditionId, battleId, diff --git a/game-server/app/services/expeditionService.ts b/game-server/app/services/expeditionService.ts index 82bdafd9d..d59b7f54c 100644 --- a/game-server/app/services/expeditionService.ts +++ b/game-server/app/services/expeditionService.ts @@ -8,7 +8,6 @@ import { decodeStr, resResult, setLocalHours, shouldRefresh } from '../pubUtils/ import { WAR_JSON_ATTRIBUTE_TYPE, EXPEDITION_CONST } from '../consts/consts'; import Actor from '../pubUtils/actor'; import { ExpeditionWarRecordModel } from '../db/ExpeditionWarRecord'; -import { stat } from 'fs'; export async function findOrCreateEnemies(roleId: string, myCe: number, expeditionCode: string, expeditionId: number, battleStatus: number) { @@ -46,7 +45,6 @@ export async function findOrCreateEnemies(roleId: string, myCe: number, expediti let {enemiesCurHpAp, enemies} = expeditionWarRecord; for(let enemy of enemies) { let cur = {"hp": 0, "ap": 0}; - console.log(enemiesCurHpAp) let getHp = enemiesCurHpAp && enemiesCurHpAp.find(cur => cur.dataId == enemy.dataId); if(getHp) { cur.hp = getHp.hp; diff --git a/shared/pubUtils/gamedata.ts b/shared/pubUtils/gamedata.ts index e9908c161..c27a01cef 100644 --- a/shared/pubUtils/gamedata.ts +++ b/shared/pubUtils/gamedata.ts @@ -299,4 +299,8 @@ export function getOlySeidByType(type: number) { export function getExpeditionById(id: number) { return expeditionInfo.get(id); +} + +export function hasExpeditionById(id: number) { + return expeditionInfo.has(id); } \ No newline at end of file