寻宝:修正扣减藏宝图时队长 sid 的获取
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ function updateRobotKilled(bossHp: number, roleSt: RoleStatus) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function handleComBtlProgress(teamStatus, sid: string, robotHurtTimer: Map<string, NodeJS.Timer>, teamMap: Map<string, any>, channel: Channel) {
|
||||
export async function handleComBtlProgress(teamStatus, robotHurtTimer: Map<string, NodeJS.Timer>, teamMap: Map<string, any>, 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<string, NodeJS.Timer>} robotHurtTimer
|
||||
*/
|
||||
export function updateRobotHurtByTime(teamStatus, roleSt: RoleStatus, interval: number, channel: Channel, robotHurtTimer: Map<string, NodeJS.Timer>, teamMap: Map<string, any>, sid: string) {
|
||||
export function updateRobotHurtByTime(teamStatus, roleSt: RoleStatus, interval: number, channel: Channel, robotHurtTimer: Map<string, NodeJS.Timer>, teamMap: Map<string, any>) {
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user