战力:修复战力错误

This commit is contained in:
luying
2021-12-28 19:31:48 +08:00
parent 1dee1a73b4
commit ff1f99ba42
2 changed files with 10 additions and 6 deletions
+3 -4
View File
@@ -71,7 +71,6 @@ export async function reCalAllHeroCe(type: number, roleId: string, update: RoleU
let pushHeros = new Array<{ hid: number, ce: number, incHeroCe: number }>();
let roleCe = 0; // 总战力加成
let allIncCe = 0;
for (let hero of heros) {
let { attr: heroAttrs, lv } = hero;
@@ -82,7 +81,6 @@ export async function reCalAllHeroCe(type: number, roleId: string, update: RoleU
if(heroCe != hero.ce) {
let incHeroCe = heroCe - hero.ce;
allIncCe += incHeroCe;
roleCe += heroCe;
pushHeros.push({ hid: hero.hid, ce: reduceCe(heroCe), incHeroCe: reduceCe(incHeroCe) });
await HeroModel.updateHeroInfo(roleId, hero.hid, { ce: heroCe });
await PvpDefenseModel.updateCe(roleId, hero.hid, incHeroCe); // 更新pvp防守阵战力
@@ -93,11 +91,12 @@ export async function reCalAllHeroCe(type: number, roleId: string, update: RoleU
if(allIncCe != 0) {
update.attr = roleAttrs;
update.ce = roleCe;
update.topLineup = topLineup;
update.topLineupCe = topLineupCe;
}
role = await RoleModel.updateRoleInfo(roleId, update);
console.log('************ roleAttr', update.attr)
role = await RoleModel.incRoleInfo(roleId, { ce: allIncCe },update);
let guild = await GuildModel.updateCe(roleId, allIncCe); // 公会更新战力