From aa415237926419b8c0392879687ce9e856fcd83e Mon Sep 17 00:00:00 2001 From: liangtongchuan Date: Mon, 25 Jan 2021 17:48:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BB=E5=AE=9D=EF=BC=9A=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E6=89=A3=E5=87=8F=E8=97=8F=E5=AE=9D=E5=9B=BE=E6=97=B6=E9=98=9F?= =?UTF-8?q?=E9=95=BF=20sid=20=E7=9A=84=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game-server/app/servers/battle/handler/comBattleHandler.ts | 4 ++-- game-server/app/services/comBattleService.ts | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/game-server/app/servers/battle/handler/comBattleHandler.ts b/game-server/app/servers/battle/handler/comBattleHandler.ts index cd627b904..340e8a965 100644 --- a/game-server/app/servers/battle/handler/comBattleHandler.ts +++ b/game-server/app/servers/battle/handler/comBattleHandler.ts @@ -521,7 +521,7 @@ export class ComBattleHandler { }, COM_BTL_CONST.BTL_TIME_LMT); teamStatus.roleStatus.forEach((st, idx) => { if (st.isRobot === true) { - updateRobotHurtByTime(teamStatus, st, COM_BTL_CONST.ROBOT_BASE_TIME_INTERVAL + idx, channel, this.robotHurtTimer, this.teamMap, sid); + updateRobotHurtByTime(teamStatus, st, COM_BTL_CONST.ROBOT_BASE_TIME_INTERVAL + idx, channel, this.robotHurtTimer, this.teamMap); } }); return resResult(STATUS.SUCCESS); @@ -586,7 +586,7 @@ export class ComBattleHandler { let channel = channelService.getChannel(teamCode, false); const roleStatus = teamStatus.roleStatus.map(st => {return {roleId: st.roleId, totalDmg: st.totalDmg, killed: st.killed}}); channel.pushMessage('onTeammateAct', resResult(STATUS.SUCCESS, { teamCode, bossCurHp: teamStatus.bossCurHp, bossHpArr: teamStatus.bossHpArr, roleStatus, actRoleId: roleId, actBossHurts })); - const result = await handleComBtlProgress(teamStatus, sid, this.robotHurtTimer, this.teamMap, channel); + const result = await handleComBtlProgress(teamStatus, this.robotHurtTimer, this.teamMap, channel); if (result && result.code !== 0) return result; return resResult(STATUS.SUCCESS); } diff --git a/game-server/app/services/comBattleService.ts b/game-server/app/services/comBattleService.ts index accf6bfad..e31ba3e06 100644 --- a/game-server/app/services/comBattleService.ts +++ b/game-server/app/services/comBattleService.ts @@ -216,7 +216,7 @@ function updateRobotKilled(bossHp: number, roleSt: RoleStatus) { } } -export async function handleComBtlProgress(teamStatus, sid: string, robotHurtTimer: Map, teamMap: Map, channel: Channel) { +export async function handleComBtlProgress(teamStatus, robotHurtTimer: Map, teamMap: Map, channel: Channel) { const { teamCode } = teamStatus; // 判断战斗是否结束 let battleSt = checkComBattleResult(teamStatus); @@ -236,6 +236,7 @@ export async function handleComBtlProgress(teamStatus, sid: string, robotHurtTim // 战斗胜利队长扣减藏宝图 if (result && teamStatus.capId != 'robot') { + const { sid } = channel.getMember(teamStatus.capId); let res = await decreaseItems(teamStatus.capId, sid, [{id: teamStatus.blueprtId, count: 1}]); if (res === true) return resResult(STATUS.COM_BATTLE_BLUEPRT_NOT_ENOUGH); } @@ -284,13 +285,13 @@ export function updateRobotHurt(teamStatus, roleSt: RoleStatus, channel: Channel * @param {Channel} channel * @param {Map} robotHurtTimer */ -export function updateRobotHurtByTime(teamStatus, roleSt: RoleStatus, interval: number, channel: Channel, robotHurtTimer: Map, teamMap: Map, sid: string) { +export function updateRobotHurtByTime(teamStatus, roleSt: RoleStatus, interval: number, channel: Channel, robotHurtTimer: Map, teamMap: Map) { const timerKey = `${teamStatus.teamCode}_${roleSt.roleId}`; const robotTimer = setInterval(() => { const robotTotalHurt = teamStatus.bossHp * COM_BTL_CONST.ROBOT_HURT_RATIO; if (roleSt.totalDmg < robotTotalHurt && teamStatus.bossCurHp > 0 && teamMap.has(teamStatus.teamCode)) { updateRobotHurt(teamStatus, roleSt, channel); - handleComBtlProgress(teamStatus, sid, robotHurtTimer, teamMap, channel); + handleComBtlProgress(teamStatus, robotHurtTimer, teamMap, channel); } else { clearInterval(robotTimer); }