pvp:修复全局战力未计入pvp的问题
This commit is contained in:
@@ -305,7 +305,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
|
|||||||
let hero = await HeroModel.updateHeroInfo(roleId, hid, { ...heroUpdate, ce });
|
let hero = await HeroModel.updateHeroInfo(roleId, hid, { ...heroUpdate, ce });
|
||||||
calCe.setResultHero(hero);
|
calCe.setResultHero(hero);
|
||||||
heroes.push(hero);
|
heroes.push(hero);
|
||||||
await PvpDefenseModel.updateCe(roleId, hid, inc); // 更新pvp防守阵战力
|
await PvpDefenseModel.updateCe(roleId, hid, ce); // 更新pvp防守阵战力
|
||||||
pushHeros.push({ hid, ce, incHeroCe: inc });
|
pushHeros.push({ hid, ce, incHeroCe: inc });
|
||||||
changeHids.push(hid);
|
changeHids.push(hid);
|
||||||
} else {
|
} else {
|
||||||
@@ -316,6 +316,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
|
|||||||
for(let [hid, { ce, inc }] of heroCe) {
|
for(let [hid, { ce, inc }] of heroCe) {
|
||||||
if(changeHids.indexOf(hid) == -1) {
|
if(changeHids.indexOf(hid) == -1) {
|
||||||
let hero = await HeroModel.updateHeroInfo(roleId, hid, { ce });
|
let hero = await HeroModel.updateHeroInfo(roleId, hid, { ce });
|
||||||
|
await PvpDefenseModel.updateCe(roleId, hid, ce); // 更新pvp防守阵战力
|
||||||
pushHeros.push({ hid, ce: hero.ce, incHeroCe: inc });
|
pushHeros.push({ hid, ce: hero.ce, incHeroCe: inc });
|
||||||
changeHids.push(hid);
|
changeHids.push(hid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,8 +109,8 @@ export default class PvpDefense extends BaseModel {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async updateCe(roleId: string, hid: number, incCe: number, lean = true) {
|
public static async updateCe(roleId: string, hid: number, ce: number, lean = true) {
|
||||||
const rec: PvpDefenseType = await PvpDefenseModel.findOneAndUpdate({ roleId, 'lineupCe.hid': hid }, { $inc: { 'lineupCe.$.ce': incCe } }).lean(lean);
|
const rec: PvpDefenseType = await PvpDefenseModel.findOneAndUpdate({ roleId, 'lineupCe.hid': hid }, { $set: { 'lineupCe.$.ce': ce } }).lean(lean);
|
||||||
return rec
|
return rec
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user