武将:修复重生战力返回

This commit is contained in:
luying
2022-03-03 20:09:10 +08:00
parent 62caa8f832
commit bca996cda4
3 changed files with 385 additions and 381 deletions

View File

@@ -71,6 +71,7 @@ export async function reCalAllHeroCe(type: number, roleId: string, update: RoleU
let pushHeros = new Array<{ hid: number, ce: number, incHeroCe: number }>();
let allIncCe = 0;
let resultHeroes = [];
for (let hero of heros) {
let { attr: heroAttrs, lv } = hero;
let newAttr = new AttributeCal();
@@ -81,8 +82,11 @@ export async function reCalAllHeroCe(type: number, roleId: string, update: RoleU
let incHeroCe = heroCe - hero.ce;
allIncCe += incHeroCe;
pushHeros.push({ hid: hero.hid, ce: reduceCe(heroCe), incHeroCe: reduceCe(incHeroCe) });
await HeroModel.updateHeroInfo(roleId, hero.hid, { ce: heroCe });
let resultHero = await HeroModel.updateHeroInfo(roleId, hero.hid, { ce: heroCe });
resultHeroes.push(resultHero);
await PvpDefenseModel.updateCe(roleId, hero.hid, reduceCe(incHeroCe)); // 更新pvp防守阵战力
} else {
resultHeroes.push(hero);
}
}
@@ -100,7 +104,7 @@ export async function reCalAllHeroCe(type: number, roleId: string, update: RoleU
let guild = await GuildModel.updateCe(roleId, allIncCe); // 公会更新战力
saveCeChangeLog(role, allIncCe, role.ce, type, args);
return { role, pushHeros, ce: role.ce, topLineupCe: role.topLineupCe, guild, serverId: role.serverId, heros }
return { role, pushHeros, ce: role.ce, topLineupCe: role.topLineupCe, guild, serverId: role.serverId, heros: resultHeroes }
}