🐞 fix(稷下学宫): 修改恢复hp时过滤hp为0的情况
This commit is contained in:
@@ -783,7 +783,8 @@ export class RougeHandler {
|
|||||||
let updateCharas: RougelikeCharaPara[] = [];
|
let updateCharas: RougelikeCharaPara[] = [];
|
||||||
|
|
||||||
let hpRatio = await getRecoveryExtendHp(roleId, gameCode);
|
let hpRatio = await getRecoveryExtendHp(roleId, gameCode);
|
||||||
for (let { gameCode, charaCode, charaId, cards, hp, maxHp = 0, ap, shield, roundSkill, apSkill } of dbCharas) {
|
for (let { gameCode, charaCode, charaId, cards, hp = 0, maxHp = 0, ap, shield, roundSkill, apSkill } of dbCharas) {
|
||||||
|
if (hp == 0) continue;
|
||||||
let beforeHp = hp;
|
let beforeHp = hp;
|
||||||
hp = Math.floor(Math.min(hp + maxHp * ROUGELIKE.RECOVERY_RATIO / 100 + maxHp * hpRatio / 100, maxHp));
|
hp = Math.floor(Math.min(hp + maxHp * ROUGELIKE.RECOVERY_RATIO / 100 + maxHp * hpRatio / 100, maxHp));
|
||||||
updateCharas.push({ gameCode, charaCode, hp });
|
updateCharas.push({ gameCode, charaCode, hp });
|
||||||
|
|||||||
@@ -961,7 +961,9 @@ export async function updateMaxHp(roleId: string, gameCode: string, type: number
|
|||||||
if (tempMaxHp == val.maxHp && updateCharasMap && !updateCharasMap.has(val.charaCode)) continue;
|
if (tempMaxHp == val.maxHp && updateCharasMap && !updateCharasMap.has(val.charaCode)) continue;
|
||||||
let preMaxHp = val.maxHp;
|
let preMaxHp = val.maxHp;
|
||||||
val.maxHp = tempMaxHp;
|
val.maxHp = tempMaxHp;
|
||||||
val.hp = Math.min(val.hp + tempMaxHp - preMaxHp, tempMaxHp);
|
if (val.hp > 0) {
|
||||||
|
val.hp = Math.min(val.hp + tempMaxHp - preMaxHp, tempMaxHp);
|
||||||
|
}
|
||||||
result.push(val);
|
result.push(val);
|
||||||
}
|
}
|
||||||
await RougelikeCharaModel.bulkWriteUpdate(result);
|
await RougelikeCharaModel.bulkWriteUpdate(result);
|
||||||
|
|||||||
Reference in New Issue
Block a user