寻宝:修改阵亡判断

This commit is contained in:
liangtongchuan
2020-12-03 16:18:37 +08:00
parent 64e6a58ee9
commit f2a62f2334
3 changed files with 9 additions and 5 deletions

View File

@@ -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);
}
});

View File

@@ -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
}
});

View File

@@ -20,7 +20,7 @@ export class RoleStatus {
@prop({ required: false, type: Number, default: [] })
heroes: Array<number>;
// 阵亡武将
@prop({ required: false, default: [] })
@prop({ required: false, type: Number, default: [] })
killed: Array<number>;
// 是否情谊助阵
@prop({ required: false, default: false })