添加主角等级升级逻辑

This commit is contained in:
luying
2020-10-20 20:18:15 +08:00
parent 3332d16cc6
commit 7b65c1856b
6 changed files with 71 additions and 24 deletions
@@ -5,7 +5,7 @@ import { getWarById, } from '../../../pubUtils/gamedata';
import { genCode } from '../../../pubUtils/util';
import { WAR_TYPE, EVENT_START_BATTLE } from '../../../consts/consts';
import { checkDaily, checkDailyAndIncrease } from '../../../services/dailyBattleService';
import { checkTowerWar, towerBattleEnd } from '../../../services/battleService';
import { checkTowerWar, towerBattleEnd, roleLevelup } from '../../../services/battleService';
import { WarReward } from '../../../services/warRewardService';
import { getAp, setAp } from '../../../services/actionPointService';
import { setBattleStatus, startEvent } from '../../../services/eventSercive';
@@ -181,6 +181,8 @@ export class NormalBattleHandler {
}, true);
let { status } = updateResult;
let actordata = await roleLevelup(roleId, warInfo.kingExp)// 主公升级经验
let curHeroes = [];
for(let hid of heroes) {
let hero = await HeroModel.findByHidAndRole(hid, roleId);
@@ -201,28 +203,8 @@ export class NormalBattleHandler {
goods: reward, towerBonus, towerReward,
apJson,
dailyNum,
kingExp: warInfo.kingExp,
heroes: curHeroes,
actordata: [
{
lv : 20,
exp : 700,
getExp : 1300,
mostExp : 2000
},
{
lv : 21,
exp : 0,
getExp : 3000,
mostExp : 3000
},
{
lv : 22,
exp : 0,
getExp : 700,
mostExp : 4000,
}
]
...actordata
});
}
@@ -266,6 +248,8 @@ export class NormalBattleHandler {
let warReward = new WarReward(roleId, roleName, battleId, true);
let result = await warReward.saveReward(count);
let actordata = await roleLevelup(roleId, warInfo.kingExp * count)// 主公升级经验
// 扫荡记录
await BattleSweepRecordModel.saveBattleSweepRecordById(roleId, battleId, {
$set: {
@@ -280,7 +264,8 @@ export class NormalBattleHandler {
battleId, count,
goods: result,
apJson,
dailyNum
dailyNum,
...actordata
});
}