From f2a62f23342a1a9b1c514429468ef9f2b5be01c1 Mon Sep 17 00:00:00 2001 From: liangtongchuan Date: Thu, 3 Dec 2020 16:18:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BB=E5=AE=9D=EF=BC=9A=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=98=B5=E4=BA=A1=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/servers/battle/handler/comBattleHandler.ts | 10 +++++++--- game-server/app/services/comBattleService.ts | 2 +- shared/db/ComBattleTeam.ts | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/game-server/app/servers/battle/handler/comBattleHandler.ts b/game-server/app/servers/battle/handler/comBattleHandler.ts index 9f89efd12..949b1daf8 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-12-02 23:23:16 + * @Last Modified time: 2020-12-03 16:17:18 */ 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, COM_BATTLE_CAP_START_TIME, COM_BATTLE_ASSIST_REWARD_RATIO } from './../../../consts/consts'; @@ -525,7 +525,11 @@ export class ComBattleHandler { let teamStatus = this.teamMap.get(teamCode); if (!teamStatus || !teamStatus.roleIds || teamStatus.roleIds.indexOf(roleId) === -1) return resResult(STATUS.COM_BATTLE_TEAM_INVALID); if (teamStatus.status !== COM_TEAM_STATUS.FIGHTING) return resResult(STATUS.COM_BATTLE_NOT_START); - + for (let st of teamStatus.roleStatus) { + if (!st.heroes || st.heroes.length === 0) { + return resResult(STATUS.COM_BATTLE_HEROES_ERR); + } + } // 重置总血量,计算真实伤害 let totalHurtHp = 0; teamStatus.bossHpArr.forEach(boss => { @@ -547,7 +551,7 @@ export class ComBattleHandler { if (roleSt.roleId === roleId) { if (killed && killed.length) { killed.forEach(killedHid => { - if (roleSt.killed.indexOf(killedHid) === -1) { + if (roleSt.killed.indexOf(killedHid) === -1 && roleSt.heroes.indexOf(killedHid) !== -1) { roleSt.killed.push(killedHid); } }); diff --git a/game-server/app/services/comBattleService.ts b/game-server/app/services/comBattleService.ts index eb6b64df2..dd9d60f7f 100644 --- a/game-server/app/services/comBattleService.ts +++ b/game-server/app/services/comBattleService.ts @@ -49,7 +49,7 @@ export function checkComBattleResult(teamStatus) { // 看看是否还有活人 teamStatus.roleStatus.forEach(st => { // 设置了阵容,且阵容人数和阵亡人数一样,说明玩家战败 - if (!st.isRobot && st.heroes && st.heroes.length > 0 && st.killed.length < st.heroes.length) { + if (!st.isRobot && st.heroes && ((st.heroes.length > 0 && st.killed.length < st.heroes.length) || st.heroes.length === 0)) { allPlayerKilled = false } }); diff --git a/shared/db/ComBattleTeam.ts b/shared/db/ComBattleTeam.ts index d2b1bc096..d6d5766cf 100644 --- a/shared/db/ComBattleTeam.ts +++ b/shared/db/ComBattleTeam.ts @@ -20,7 +20,7 @@ export class RoleStatus { @prop({ required: false, type: Number, default: [] }) heroes: Array; // 阵亡武将 - @prop({ required: false, default: [] }) + @prop({ required: false, type: Number, default: [] }) killed: Array; // 是否情谊助阵 @prop({ required: false, default: false })