体力:修改体力逻辑
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
|
||||
import { HeroModel } from '../db/Hero';
|
||||
import Role, { RoleModel, RoleType } from '../db/Role'
|
||||
import { getLvByExp, getExpByLv, gameData } from '../pubUtils/data';
|
||||
import { getLvByExp, getExpByLv, gameData, getDicApByLv } from '../pubUtils/data';
|
||||
import { updateUserInfo } from './redisService';
|
||||
import { switchOnFunc } from './funcSwitchService';
|
||||
import { FUNC_OPT_TYPE, TASK_TYPE, WAR_TYPE } from '../consts';
|
||||
@@ -11,9 +11,12 @@ import { Rank } from './rankService';
|
||||
import { checkActivityTask, checkTask } from './taskService';
|
||||
import { accomplishTask } from '../pubUtils/taskUtil';
|
||||
import { RScriptRecordModel } from '../db/RScriptRecord';
|
||||
import { setAp } from './actionPointService';
|
||||
|
||||
export async function roleLevelup(roleId: string, kingExp: number, session: BackendSession) {
|
||||
const serverId = session.get('serverId');
|
||||
const sid = session.get('sid');
|
||||
const funcs = session.get('funcs');
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
let { lv = 1, exp = 0 } = role;
|
||||
let canGetExp = lv < gameData.maxPlayerLv.max; // 当主公超过最大级后,挑战结算不再获得经验值
|
||||
@@ -57,7 +60,12 @@ export async function roleLevelup(roleId: string, kingExp: number, session: Back
|
||||
getExp: getExp > 0 ? getExp : 0, // 获得的经验
|
||||
mostExp: cur
|
||||
});
|
||||
if(i != lv) { // 升级加体力
|
||||
let dicAp = getDicApByLv(i);
|
||||
await setAp(roleId, i, dicAp.restoreAp, sid, funcs);
|
||||
}
|
||||
}
|
||||
|
||||
return { actordata, lv: newLv, exp: newExp, kingExp: newExp - exp };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user