寻宝:修复boss血量串线;修复机器人重复
This commit is contained in:
@@ -549,7 +549,7 @@ export class ComBattleHandler {
|
|||||||
if (teamStatus && teamStatus.status === COM_TEAM_STATUS.FIGHTING) {
|
if (teamStatus && teamStatus.status === COM_TEAM_STATUS.FIGHTING) {
|
||||||
let channelService = thiz.app.get('channelService');
|
let channelService = thiz.app.get('channelService');
|
||||||
let channel = channelService.getChannel(teamCode, false);
|
let channel = channelService.getChannel(teamCode, false);
|
||||||
let team = await ComBattleTeamModel.syncTeamData({teamCode, status: COM_TEAM_STATUS.LOOSE, roleStatus: teamStatus.roleStatus, bossHpArr: teamStatus.bossHpArr});
|
let team = await ComBattleTeamModel.syncTeamData({teamCode, status: COM_TEAM_STATUS.LOOSE, roleStatus: teamStatus.roleStatus, bossHpArr: teamStatus.bossHpArr, bossCurHp: teamStatus.bossCurHp});
|
||||||
if (!team) return resResult(STATUS.COM_BATTLE_RESULT_ERR);
|
if (!team) return resResult(STATUS.COM_BATTLE_RESULT_ERR);
|
||||||
channel.pushMessage('onTeamComplete', {teamCode, result: false});
|
channel.pushMessage('onTeamComplete', {teamCode, result: false});
|
||||||
thiz.teamMap.delete(teamCode);
|
thiz.teamMap.delete(teamCode);
|
||||||
@@ -645,7 +645,7 @@ export class ComBattleHandler {
|
|||||||
st.fixReward = await getRealReward(teamStatus.blueprtId, st);
|
st.fixReward = await getRealReward(teamStatus.blueprtId, st);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
let team = await ComBattleTeamModel.syncTeamData({teamCode, status: battleSt, roleStatus: teamStatus.roleStatus, bossHpArr: teamStatus.bossHpArr});
|
let team = await ComBattleTeamModel.syncTeamData({teamCode, status: battleSt, roleStatus: teamStatus.roleStatus, bossHpArr: teamStatus.bossHpArr, bossCurHp: teamStatus.bossCurHp});
|
||||||
if (!team) return resResult(STATUS.COM_BATTLE_RESULT_ERR);
|
if (!team) return resResult(STATUS.COM_BATTLE_RESULT_ERR);
|
||||||
|
|
||||||
// 战斗胜利队长扣减藏宝图
|
// 战斗胜利队长扣减藏宝图
|
||||||
|
|||||||
@@ -24,17 +24,19 @@ export function getRandBlueprtId(qualityArr: Array<number>, cnt = 1) {
|
|||||||
|
|
||||||
export function getRandComBtlRobots(topFiveCe: number, lv: number, cnt: number) {
|
export function getRandComBtlRobots(topFiveCe: number, lv: number, cnt: number) {
|
||||||
let robotHeroes = getRandRobot(cnt); // 随机几个阵容
|
let robotHeroes = getRandRobot(cnt); // 随机几个阵容
|
||||||
|
let robots = getRandEelm(COM_BATTLE_ROBOT_ID_NAME, cnt);
|
||||||
// 创建并添加机器人
|
// 创建并添加机器人
|
||||||
let robotStArr = [], robotIdArr = [];
|
let robotStArr = [], robotIdArr = [];
|
||||||
for (let robot of robotHeroes) {
|
robotHeroes.forEach((robot, idx) => {
|
||||||
const robotCe = getRandValue(topFiveCe || 0, COM_BTL_CONST.ROBOT_CE_RATIO, 0);
|
const robotCe = getRandValue(topFiveCe || 0, COM_BTL_CONST.ROBOT_CE_RATIO, 0);
|
||||||
const robotLv = getRandValue(lv, COM_BTL_CONST.ROBOT_CE_RATIO, 0);
|
const robotLv = getRandValue(lv, COM_BTL_CONST.ROBOT_CE_RATIO, 0);
|
||||||
const imgHid = robot[Math.floor(Math.random() * robot.length)];
|
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)];
|
const { robotRoleId, robotRoleName } = robots[idx];
|
||||||
let robotStatus = new RoleStatus(robotRoleId, robotRoleName, false, false, imgHid, imgHid, robotCe, robotLv, robot, true);
|
let robotStatus = new RoleStatus(robotRoleId, robotRoleName, false, false, imgHid, imgHid, robotCe, robotLv, robot, true);
|
||||||
robotStArr.push(robotStatus);
|
robotStArr.push(robotStatus);
|
||||||
robotIdArr.push(robotRoleId);
|
robotIdArr.push(robotRoleId);
|
||||||
}
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
robotStArr, robotIdArr
|
robotStArr, robotIdArr
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ export default class ComBattleTeam extends BaseModel {
|
|||||||
return team;
|
return team;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async syncTeamData(teamData: {teamCode: string, status: number, roleStatus: Array<RoleStatus>, bossHpArr: Array<BossHp>}, lean = true) {
|
public static async syncTeamData(teamData: {teamCode: string, status: number, roleStatus: Array<RoleStatus>, bossHpArr: Array<BossHp>, bossCurHp: number}, lean = true) {
|
||||||
console.log('syncTeamData bossHpArr: ', teamData.bossHpArr);
|
console.log('syncTeamData bossHpArr: ', teamData.bossHpArr);
|
||||||
const team = await ComBattleTeamModel.findOneAndUpdate({ teamCode: teamData.teamCode }, {$set :{...teamData, roleCnt: teamData.roleStatus.length}}, {new: true}).lean(lean);
|
const team = await ComBattleTeamModel.findOneAndUpdate({ teamCode: teamData.teamCode }, {$set :{...teamData, roleCnt: teamData.roleStatus.length}}, {new: true}).lean(lean);
|
||||||
return team;
|
return team;
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ export function getBossHpByWarId(warId: number) {
|
|||||||
btlBossHpSum.set(warId, bossHpSum);
|
btlBossHpSum.set(warId, bossHpSum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { bossHpSum, bossHpArr };
|
return { bossHpSum, bossHpArr: JSON.parse(JSON.stringify(bossHpArr))};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getWarIdByBlueprtId(blueprtId: number) {
|
export function getWarIdByBlueprtId(blueprtId: number) {
|
||||||
|
|||||||
Reference in New Issue
Block a user