寻宝:匹配的队伍也要超时判负;action 返回本次伤害;测试用例修改
This commit is contained in:
@@ -256,9 +256,7 @@ export class ComBattleHandler {
|
|||||||
}
|
}
|
||||||
// 机器人队伍 3 秒直接开战
|
// 机器人队伍 3 秒直接开战
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
await ComBattleTeamModel.updateStatusByCode(teamCode, COM_TEAM_STATUS.FIGHTING);
|
thiz.startBattle({teamCode}, session);
|
||||||
comTeam.status = COM_TEAM_STATUS.FIGHTING;
|
|
||||||
channelService.pushMessageByUids('onComBtlStart', resResult(STATUS.SUCCESS, {teamCode, roleStatus: comTeam.roleStatus}), [{uid: roleId, sid}]);
|
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}, COM_BTL_CONST.ASSIST_TIME);
|
}, COM_BTL_CONST.ASSIST_TIME);
|
||||||
return resResult(STATUS.SUCCESS);
|
return resResult(STATUS.SUCCESS);
|
||||||
@@ -565,15 +563,18 @@ export class ComBattleHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 重置总血量,计算真实伤害
|
// 重置总血量,计算真实伤害
|
||||||
|
let actBossHurts = [];
|
||||||
let totalHurtHp = 0;
|
let totalHurtHp = 0;
|
||||||
teamStatus.bossHpArr.forEach(boss => {
|
teamStatus.bossHpArr.forEach(boss => {
|
||||||
for (let bh of bossHurts) {
|
for (let bh of bossHurts) {
|
||||||
if (boss.dataId === bh.dataId && bh.hurtHp < 0) {
|
if (boss.dataId === bh.dataId && bh.hurtHp < 0) {
|
||||||
let deltaHp = Math.abs(bh.hurtHp);
|
let deltaHp = Math.abs(bh.hurtHp);
|
||||||
if (boss.curHp >= deltaHp) {
|
if (boss.curHp >= deltaHp) {
|
||||||
|
actBossHurts.push({dataId: boss.dataId, hurtHp: deltaHp});
|
||||||
totalHurtHp += deltaHp;
|
totalHurtHp += deltaHp;
|
||||||
boss.curHp -= deltaHp;
|
boss.curHp -= deltaHp;
|
||||||
} else if (boss.curHp > 0) {
|
} else if (boss.curHp > 0) {
|
||||||
|
actBossHurts.push({dataId: boss.dataId, hurtHp: boss.curHp});
|
||||||
totalHurtHp += boss.curHp;
|
totalHurtHp += boss.curHp;
|
||||||
boss.curHp = 0;
|
boss.curHp = 0;
|
||||||
}
|
}
|
||||||
@@ -619,7 +620,7 @@ export class ComBattleHandler {
|
|||||||
let channelService = this.app.get('channelService');
|
let channelService = this.app.get('channelService');
|
||||||
let channel = channelService.getChannel(teamCode, false);
|
let channel = channelService.getChannel(teamCode, false);
|
||||||
const roleStatus = teamStatus.roleStatus.map(st => {return {roleId: st.roleId, totalDmg: st.totalDmg, killed: st.killed}});
|
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}));
|
channel.pushMessage('onTeammateAct', resResult(STATUS.SUCCESS, { teamCode, bossCurHp: teamStatus.bossCurHp, bossHpArr: teamStatus.bossHpArr, roleStatus, actRoleId: roleId, actBossHurts }));
|
||||||
// 判断战斗是否结束
|
// 判断战斗是否结束
|
||||||
let battleSt = checkComBattleResult(teamStatus);
|
let battleSt = checkComBattleResult(teamStatus);
|
||||||
teamStatus.status = battleSt;
|
teamStatus.status = battleSt;
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ describe('test zyz login', function() {
|
|||||||
port: port
|
port: port
|
||||||
}, (data) => {
|
}, (data) => {
|
||||||
// 连接成功执行函数
|
// 连接成功执行函数
|
||||||
console.log('gate连接成功', data);
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -53,7 +52,6 @@ describe('test zyz login', function() {
|
|||||||
expect(1).equal(1);
|
expect(1).equal(1);
|
||||||
pinusClient.request('connector.entryHandler.enter', {token:'mgn0njiajb6kapid3eekvt7tssxelig9zi2oq2bzkxr4zzi9w9', serverId: 1} , (ret) => {
|
pinusClient.request('connector.entryHandler.enter', {token:'mgn0njiajb6kapid3eekvt7tssxelig9zi2oq2bzkxr4zzi9w9', serverId: 1} , (ret) => {
|
||||||
// 消息回调
|
// 消息回调
|
||||||
console.log('connector返回', JSON.stringify(ret));
|
|
||||||
expect(ret).to.be.an('object');
|
expect(ret).to.be.an('object');
|
||||||
expect(ret.code).equal(0);
|
expect(ret.code).equal(0);
|
||||||
done();
|
done();
|
||||||
|
|||||||
@@ -13,8 +13,10 @@ describe('寻宝创建队伍', function() {
|
|||||||
var pinusClient;
|
var pinusClient;
|
||||||
var roleInfo;
|
var roleInfo;
|
||||||
|
|
||||||
const loginParm = {token:'mgn0njiajb6kapid3eekvt7tssxelig9zi2oq2bzkxr4zzi9w9', serverId: 1};
|
const loginParms = {token:'mgn0njiajb6kapid3eekvt7tssxelig9zi2oq2bzkxr4zzi9w9', serverId: 1};
|
||||||
const createTeamParm = {blueprtId: 33001, pub: true, ceLimit: 0};
|
const createTeamParms = {blueprtId: 33001, pub: true, ceLimit: 0};
|
||||||
|
const searchTeamParms = {qualityArr: [1, 2, 3, 4, 5]};
|
||||||
|
|
||||||
beforeEach(function(done) {
|
beforeEach(function(done) {
|
||||||
pinusClient = new PinusWSClient();
|
pinusClient = new PinusWSClient();
|
||||||
pinusClient.on(PinusWSClientEvent.EVENT_IO_ERROR, (event) => {
|
pinusClient.on(PinusWSClientEvent.EVENT_IO_ERROR, (event) => {
|
||||||
@@ -42,11 +44,11 @@ describe('寻宝创建队伍', function() {
|
|||||||
port: port
|
port: port
|
||||||
}, (data) => {
|
}, (data) => {
|
||||||
// 连接成功执行函数
|
// 连接成功执行函数
|
||||||
console.log('gate连接成功', data);
|
// console.log('gate连接成功', data);
|
||||||
// done();
|
// done();
|
||||||
pinusClient.request('connector.entryHandler.enter', loginParm, (ret) => {
|
pinusClient.request('connector.entryHandler.enter', loginParms, (ret) => {
|
||||||
// 消息回调
|
// 消息回调
|
||||||
console.log('connector返回', JSON.stringify(ret));
|
// console.log('connector返回', JSON.stringify(ret));
|
||||||
roleInfo = ret.role;
|
roleInfo = ret.role;
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@@ -58,8 +60,8 @@ describe('寻宝创建队伍', function() {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('直接返回队伍', function(done) {
|
it('创建队伍并解散', function(done) {
|
||||||
pinusClient.request('battle.comBattleHandler.createTeam', createTeamParm, (res) => {
|
pinusClient.request('battle.comBattleHandler.createTeam', createTeamParms, (res) => {
|
||||||
expect(res).to.be.an('object');
|
expect(res).to.be.an('object');
|
||||||
expect(res.code).equal(0);
|
expect(res.code).equal(0);
|
||||||
expect(res.data).to.be.an('object');
|
expect(res.data).to.be.an('object');
|
||||||
@@ -68,10 +70,24 @@ describe('寻宝创建队伍', function() {
|
|||||||
res.data.roleStatus.forEach(roleSt => {
|
res.data.roleStatus.forEach(roleSt => {
|
||||||
expect(roleSt).to.have.all.keys('roleId', 'roleName', 'isCap', 'isFrd', 'headHid', 'sHid', 'topFiveCe', 'lv', 'isRobot', 'heroes', 'killed', 'totalDmg');
|
expect(roleSt).to.have.all.keys('roleId', 'roleName', 'isCap', 'isFrd', 'headHid', 'sHid', 'topFiveCe', 'lv', 'isRobot', 'heroes', 'killed', 'totalDmg');
|
||||||
});
|
});
|
||||||
done();
|
pinusClient.request('battle.comBattleHandler.dismiss', {teamCode: res.data.teamCode}, (dismissRes) => {
|
||||||
|
expect(dismissRes).to.be.an('object');
|
||||||
|
expect(dismissRes.code).equal(0);
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// it('加入队伍,机器人的话直接开战', function(done) {
|
||||||
|
// this.timeout(65 * 1000);
|
||||||
|
// pinusClient.request('battle.comBattleHandler.searchTeam', searchTeamParms, (res) => {
|
||||||
|
// expect(res).to.be.an('object');
|
||||||
|
// expect(res.code).equal(0);
|
||||||
|
// expect(res.data).to.be.an('object');
|
||||||
|
// expect(res.data.teamCode).to.be.a('string');
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
it('获取寻宝记录', function(done) {
|
it('获取寻宝记录', function(done) {
|
||||||
pinusClient.request('battle.comBattleHandler.getTeamRec', {}, (res) => {
|
pinusClient.request('battle.comBattleHandler.getTeamRec', {}, (res) => {
|
||||||
expect(res).to.be.an('object');
|
expect(res).to.be.an('object');
|
||||||
|
|||||||
Reference in New Issue
Block a user