战力:修复战力错误
This commit is contained in:
@@ -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 pushHeros = new Array<{ hid: number, ce: number, incHeroCe: number }>();
|
||||||
|
|
||||||
let roleCe = 0; // 总战力加成
|
|
||||||
let allIncCe = 0;
|
let allIncCe = 0;
|
||||||
for (let hero of heros) {
|
for (let hero of heros) {
|
||||||
let { attr: heroAttrs, lv } = hero;
|
let { attr: heroAttrs, lv } = hero;
|
||||||
@@ -82,7 +81,6 @@ export async function reCalAllHeroCe(type: number, roleId: string, update: RoleU
|
|||||||
if(heroCe != hero.ce) {
|
if(heroCe != hero.ce) {
|
||||||
let incHeroCe = heroCe - hero.ce;
|
let incHeroCe = heroCe - hero.ce;
|
||||||
allIncCe += incHeroCe;
|
allIncCe += incHeroCe;
|
||||||
roleCe += heroCe;
|
|
||||||
pushHeros.push({ hid: hero.hid, ce: reduceCe(heroCe), incHeroCe: reduceCe(incHeroCe) });
|
pushHeros.push({ hid: hero.hid, ce: reduceCe(heroCe), incHeroCe: reduceCe(incHeroCe) });
|
||||||
await HeroModel.updateHeroInfo(roleId, hero.hid, { ce: heroCe });
|
await HeroModel.updateHeroInfo(roleId, hero.hid, { ce: heroCe });
|
||||||
await PvpDefenseModel.updateCe(roleId, hero.hid, incHeroCe); // 更新pvp防守阵战力
|
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) {
|
if(allIncCe != 0) {
|
||||||
update.attr = roleAttrs;
|
update.attr = roleAttrs;
|
||||||
update.ce = roleCe;
|
|
||||||
update.topLineup = topLineup;
|
update.topLineup = topLineup;
|
||||||
update.topLineupCe = topLineupCe;
|
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); // 公会更新战力
|
let guild = await GuildModel.updateCe(roleId, allIncCe); // 公会更新战力
|
||||||
|
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ import { pick } from "underscore";
|
|||||||
import { HeroShowParam } from '../domain/roleField/hero';
|
import { HeroShowParam } from '../domain/roleField/hero';
|
||||||
import { saveCeChangeLog } from "./logUtil";
|
import { saveCeChangeLog } from "./logUtil";
|
||||||
import { ActivityInRemote } from "../domain/activityField/activityField";
|
import { ActivityInRemote } from "../domain/activityField/activityField";
|
||||||
|
import { AttributeCal } from "../domain/roleField/attribute";
|
||||||
|
|
||||||
// 储存在内存中的初始数据
|
// 储存在内存中的初始数据
|
||||||
export function getInitRoleInfo() {
|
export function getInitRoleInfo() {
|
||||||
@@ -288,7 +289,11 @@ export class CreateHeroes extends UpdateHeroes {
|
|||||||
this.updateDbCe(true, heroInfo);
|
this.updateDbCe(true, heroInfo);
|
||||||
// 皮肤使用初始加载进内存的数据
|
// 皮肤使用初始加载进内存的数据
|
||||||
let skins = await this.getSkinsOfThisHero(hid, { ...skinInfo, _id: new SkinModel()._id }, false);
|
let skins = await this.getSkinsOfThisHero(hid, { ...skinInfo, _id: new SkinModel()._id }, false);
|
||||||
initHeroInfos.push({ ...heroInfo, skins, _id: new HeroModel()._id });
|
let newAttr = new AttributeCal();
|
||||||
|
newAttr.setLv(heroInfo.lv);
|
||||||
|
newAttr.setByDbData(role.attr, heroInfo.attr);
|
||||||
|
let heroCe = newAttr.calCe(); // 计算最终战力
|
||||||
|
initHeroInfos.push({ ...heroInfo, skins, _id: new HeroModel()._id, ce: heroCe });
|
||||||
this.heroNum ++;
|
this.heroNum ++;
|
||||||
}
|
}
|
||||||
// 武将使用初始加载数据插入
|
// 武将使用初始加载数据插入
|
||||||
|
|||||||
Reference in New Issue
Block a user