体力:修改体力逻辑
This commit is contained in:
@@ -42,7 +42,8 @@ export class NormalBattleHandler {
|
||||
if (!warInfo) {
|
||||
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);
|
||||
@@ -104,7 +105,7 @@ export class NormalBattleHandler {
|
||||
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
battleId, battleCode, status, apJson, dailyNum, towerData, dungeonNum
|
||||
battleId, battleCode, status, dailyNum, towerData, dungeonNum
|
||||
});
|
||||
}
|
||||
|
||||
@@ -153,8 +154,8 @@ export class NormalBattleHandler {
|
||||
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);
|
||||
}
|
||||
@@ -263,7 +264,6 @@ export class NormalBattleHandler {
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
battleCode, battleId, status,
|
||||
battleGoods: reward,
|
||||
apJson,
|
||||
towerStatus, dailyNum, dungeonNum,
|
||||
...actordata
|
||||
});
|
||||
@@ -288,8 +288,8 @@ export class NormalBattleHandler {
|
||||
}
|
||||
|
||||
// 扣体力
|
||||
const now = Date.now(); // 当前时间戳
|
||||
let apJson = await setAp(now, roleId, sid, funcs, -1 * warInfo.cost * count); // 扣除体力
|
||||
let role = await RoleModel.findByRoleId(roleId, 'lv');
|
||||
let apJson = await setAp(roleId, role.lv, -1 * warInfo.cost * count, sid, funcs); // 扣除体力
|
||||
if (!apJson) {
|
||||
return resResult(STATUS.BATTLE_ACTION_POINT_LACK);
|
||||
}
|
||||
@@ -333,7 +333,6 @@ export class NormalBattleHandler {
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
battleId, count,
|
||||
battleGoods: result,
|
||||
apJson,
|
||||
dailyNum, dungeonNum,
|
||||
...actordata
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user