fix 修复远征当前血量和最大血量无法匹配bug

This commit is contained in:
luying
2020-11-19 10:37:39 +08:00
parent f07109d11c
commit 225d55f98f
6 changed files with 55 additions and 31 deletions
+2 -1
View File
@@ -193,6 +193,7 @@ export async function calcuHangUpReward(roleId: string, speedUp = false, speedUp
}
async function checkCond(roleId: string, heroes, type: number, param: number, cnt: number) {
let heroCnt = 0;
switch (type) {
@@ -217,7 +218,7 @@ async function checkCond(roleId: string, heroes, type: number, param: number, cn
for(let seqId of heroes) {
let {hid} = await HeroModel.findBySeqIdAndRole(seqId, roleId);
const hInfo = getHeroInfoById(hid);
if (getJobInfoById(hInfo.jobid) === param) {
if (getJobInfoById(hInfo.jobid).job_class === param) {
heroCnt++;
}
}
@@ -41,6 +41,23 @@ export async function findOrCreateEnemies(roleId: string, myCe: number, expediti
}
}
}
// 处理当前血量
let {enemiesCurHpAp, enemies} = expeditionWarRecord;
for(let enemy of enemies) {
let cur = {"hp": 0, "ap": 0};
console.log(enemiesCurHpAp)
let getHp = enemiesCurHpAp && enemiesCurHpAp.find(cur => cur.dataId == enemy.dataId);
if(getHp) {
cur.hp = getHp.hp;
cur.ap = getHp.ap;
} else {
cur.hp = enemy.attribute.hp;
cur.ap = 0;
}
enemy["cur"] = cur;
}
return expeditionWarRecord;
}
+7 -6
View File
@@ -45,9 +45,9 @@ export class WarReward {
let last = str.substr(str.length-1, 1);
if(last == '&') str = str.substr(0, str.length - 1);
if(str.length) {
this.fixReward += '|' + reward;
this.fixReward = str + '|' + reward;
} else {
this.fixReward += reward;
this.fixReward = str + reward;
}
}
@@ -56,9 +56,9 @@ export class WarReward {
let last = str.substr(str.length-1, 1);
if(last == '&') str = str.substr(0, str.length - 1);
if(str.length) {
this.conditionReward += reward;
this.conditionReward = str + '|' + reward;
} else {
this.conditionReward += '|' + reward;
this.conditionReward = str + reward;
}
}
@@ -67,9 +67,9 @@ export class WarReward {
let last = str.substr(str.length-1, 1);
if(last == '&') str = str.substr(0, str.length - 1);
if(str.length) {
this.randomReward += reward;
this.randomReward = str + '|' + reward;
} else {
this.randomReward += '|' + reward;
this.randomReward = str + reward;
}
}
@@ -127,6 +127,7 @@ export class WarReward {
// let warType = this.warInfo.warType;
if(this.isSuccess) { // 成功了才给固定奖励
console.log(this.fixReward)
if(this.fixReward) this.handleFixReward(num, this.fixReward);
if(this.conditionReward) this.handleConditionReward(num, this.conditionReward);
if(this.randomReward) await this.handleRandomReward(num, this.randomReward);