diff --git a/game-server/app.ts b/game-server/app.ts index 7d08ad754..b73a06e45 100644 --- a/game-server/app.ts +++ b/game-server/app.ts @@ -45,7 +45,7 @@ if(process.env.NODE_ENV == 'local') { } // 创建 mongodb 连接 -mongoose.connect(mongoAddr, { useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true }, (err) => { +mongoose.connect(mongoAddr, { useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true, useFindAndModify: true }, (err) => { if (err) { console.log('mongodb connect err', err); } else { diff --git a/game-server/app/servers/battle/handler/comBattleHandler.ts b/game-server/app/servers/battle/handler/comBattleHandler.ts index 7b7f34061..fd47a3b51 100644 --- a/game-server/app/servers/battle/handler/comBattleHandler.ts +++ b/game-server/app/servers/battle/handler/comBattleHandler.ts @@ -2,7 +2,7 @@ * @Author: 梁桐川 * @Date: 2020-11-30 15:05:48 * @Last Modified by: 梁桐川 - * @Last Modified time: 2020-11-30 23:45:32 + * @Last Modified time: 2020-12-01 11:17:04 */ import { COM_BATTLE_ASSIST_TIME, COM_BATTLE_ROBOT_ROUND_LMT, COM_BATTLE_ROBOT_HURT_RATIO, COM_BATTLE_ROBOT_HURT_CH_RATIO, COM_TEAM_STATUS } from './../../../consts/consts'; import { IT_TYPE, GOLD_COST_RATIO, CURRENCY_BY_TYPE, CURRENCY_TYPE, COM_BATTLE_CAP_TIME, COM_BATTLE_TIME_LMT } from './../../../consts/consts'; @@ -91,7 +91,7 @@ export class ComBattleHandler { if (!goodData || goodData.itid !== IT_TYPE.BLUEPRT) return resResult(STATUS.COM_BATTLE_BLUEPRT_INVALID); // 检查藏宝图是否足够 - let { lv, headHid = 19, topFiveCe, sHid = 19 } = await RoleModel.findByRoleId(roleId); + let { lv, headHid = 19, topFiveCe = 100, sHid = 19 } = await RoleModel.findByRoleId(roleId); if (lv < COM_TEAM_ENABLE_LV) return resResult(STATUS.COM_BATTLE_LV_NOT_ENOUGH); let blueprt = await ItemModel.findbyRoleAndGidAndCount(roleId, blueprtId, 1); diff --git a/game-server/app/services/comBattleService.ts b/game-server/app/services/comBattleService.ts index 37dbed758..f31c07f89 100644 --- a/game-server/app/services/comBattleService.ts +++ b/game-server/app/services/comBattleService.ts @@ -25,7 +25,7 @@ export function getRandComBtlRobots(topFiveCe: number, lv: number, cnt: number) // 创建并添加机器人 let robotStArr = [], robotIdArr = []; for (let robot of robotHeroes) { - const robotCe = getRandValue(topFiveCe, COM_BATTLE_ROBOT_CE_RATIO, 0); + const robotCe = getRandValue(topFiveCe || 0, COM_BATTLE_ROBOT_CE_RATIO, 0); const robotLv = getRandValue(lv, COM_BATTLE_ROBOT_CE_RATIO, 0); const imgHid = robot[Math.floor(Math.random() * robot.length)]; const { robotRoleId, robotRoleName } = COM_BATTLE_ROBOT_ID_NAME[Math.floor(Math.random() * COM_BATTLE_ROBOT_ID_NAME.length)];