体力:修改体力逻辑

This commit is contained in:
luying
2021-06-22 20:33:45 +08:00
parent 43dd3eb400
commit 2baa41ab63
14 changed files with 184 additions and 41 deletions
@@ -123,7 +123,8 @@ export class ExpeditionBattleHandler {
return resResult(STATUS.BATTLE_MISS_INFO);
}
let apJson = await getAp(Date.now(), roleId);
let role = await RoleModel.findByRoleId(roleId, 'lv');
let apJson = await getAp(roleId, role.lv);
let { ap } = apJson;
if (ap < warInfo.cost) {
return resResult(STATUS.BATTLE_ACTION_POINT_LACK);
@@ -165,8 +166,7 @@ export class ExpeditionBattleHandler {
expeditionId,
battleId,
battleCode,
battleStatus: result.battleStatus,
apJson
battleStatus: result.battleStatus
});
}
@@ -202,8 +202,8 @@ export class ExpeditionBattleHandler {
return resResult(STATUS.BATTLE_INFO_VALIDATE_ERR);
}
const now = Date.now(); // 当前时间戳
let apJson = await setAp(now, roleId, sid, funcs, -1 * warInfo.cost); // 扣除体力
let role = await RoleModel.findByRoleId(roleId, 'lv');
let apJson = await setAp(roleId, role.lv, -1 * warInfo.cost, sid, funcs); // 扣除体力
if (!apJson) {
return resResult(STATUS.BATTLE_ACTION_POINT_LACK);
}
@@ -224,7 +224,7 @@ export class ExpeditionBattleHandler {
$set: { status: isSuccess ? 1 : 2, star }
}, true);
// 更新点数
let role = await RoleModel.increaseExpeditionPoint(roleId, isSuccess ? EXPEDITION_CONST.INCREASE_POINT : 0);
role = await RoleModel.increaseExpeditionPoint(roleId, isSuccess ? EXPEDITION_CONST.INCREASE_POINT : 0);
let { expeditionPoint = 0 } = role;
// 关卡奖励
@@ -243,7 +243,6 @@ export class ExpeditionBattleHandler {
battleCode, battleId,
battleStatus: expeditionWarRecord.battleStatus,
battleGoods: reward,
apJson,
expeditionPoint,
...actordata
});