任务:按条件开启任务

This commit is contained in:
luying
2021-04-19 13:17:18 +08:00
parent 260744e7d2
commit dd6c3355c3
32 changed files with 296 additions and 195 deletions
@@ -30,7 +30,7 @@ export async function getAp(now: number, roleId: string) {
}
}
export async function setAp(now: number, roleId: string, sid: string, changeAp: number) {
export async function setAp(now: number, roleId: string, sid: string, funcs: number[], changeAp: number) {
let ApResult = await getAp(now, roleId);
let { ap, maxAp, refTime, apRemainTime, isOver } = ApResult; // 更新ap
ap += changeAp;
@@ -44,7 +44,7 @@ export async function setAp(now: number, roleId: string, sid: string, changeAp:
if(isOver && ap < maxAp) apRemainTime = Math.floor(ACTION_POIN.PER / 1000); // 特殊处理
if(changeAp < 0) {
await checkTask(roleId, sid, TASK_TYPE.BATTLE_COST_AP, -1 * changeAp, true, {});
await checkTask(roleId, sid, funcs, TASK_TYPE.BATTLE_COST_AP, -1 * changeAp, true, {});
}
return {ap, maxAp, refTime, apRemainTime}
}