体力:修改体力逻辑
This commit is contained in:
@@ -549,8 +549,8 @@ export class ComBattleHandler {
|
||||
let warInfo = getWarByBlueprtId(blueprtId);
|
||||
if (!warInfo) return resResult(STATUS.BATTLE_MISS_INFO);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
@@ -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