🐞 fix(远征&巅峰): 获取对手装备上的天晶

This commit is contained in:
luying
2023-07-07 15:59:34 +08:00
parent 8d21c5ecbf
commit 02625de882
3 changed files with 11 additions and 19 deletions

View File

@@ -159,7 +159,6 @@ export async function matchPlayers(roleId: string, scale: number, range: number,
let { star, lv, ce, skins, colorStar, quality, job, subHid = 0, subActorId = 0, ePlace = [] } = h;
let artifact = h.artifact? artifacts.find(cur => cur.seqId == h.artifact): null;
let skin = skins?.find(cur => cur.enable);
let curJewels = jewels.filter(jewel => jewel.hid == h.hid);
let dicHero = gameData.hero.get(hero.hid);
let attr = attrByHid.get(hero.hid);
@@ -182,8 +181,7 @@ export async function matchPlayers(roleId: string, scale: number, range: number,
artifact: artifact? [{ artifactId: artifact.artifactId, lv: artifact.lv }]: [],
subHid,
subActorId,
ePlace,
jewels: curJewels
ePlace: ePlace.map(cur => ({ ...cur, jewel: jewels.find(ccur => cur.jewel == ccur.seqId) })),
};
enemyObj.enemies.push({...json, ...heroInfo});

View File

@@ -235,16 +235,11 @@ async function generPlayerOppHis(pvpdefense: PvpDefenseType, roleId: string, pos
let attrByHid = await getHeroesAttributes(role.roleId);
let hids = defenseHeroes.map(cur => cur.actorId);
console.log('#### hids', hids);
let artifacts = await ArtifactModel.findbyHids(role.roleId, hids);
let jewels = await JewelModel.findbyRoleAndHids(role.roleId, hids);
console.log('#### jewels', jewels.length);
for (let dbHero of dbHeroes) {
let artifact = dbHero.artifact? artifacts.find(cur => cur.seqId == dbHero.artifact): null;
let curJewels = jewels.filter(jewel => jewel.hid == dbHero.hid);
console.log('#### curJewels', dbHero.hid, curJewels.length)
let h = defenseHeroes.find(cur => cur.actorId == dbHero.hid); // 阵容里是否有这个武将
let hs = heroScores.find(cur => cur.hid == dbHero.hid); // 这个武将是否有这个得分
if (!!h) {
@@ -253,7 +248,7 @@ async function generPlayerOppHis(pvpdefense: PvpDefenseType, roleId: string, pos
let warJson = mapWarJson.find(cur => cur.dataId == h.dataId);
if (warJson && warJson.relation == 2) {
let heroInfo = new PvpHeroInfo();
heroInfo.setHeroInfo(dbHero, artifact, curJewels);
heroInfo.setHeroInfo(dbHero, artifact, dbHero.ePlace.map(cur => ({ ...cur, jewel: jewels.find(ccur => cur.jewel == ccur.seqId) })));
// heroInfo.setOutIndex(h.order);
let attr = attrByHid.get(h.actorId);
if(!attr) continue;
@@ -269,7 +264,7 @@ async function generPlayerOppHis(pvpdefense: PvpDefenseType, roleId: string, pos
}
} else {
let heroInfo = new PvpOtherHeroes(hs ? hs.score : 0);
heroInfo.setHeroInfo(dbHero, artifact, curJewels);
heroInfo.setHeroInfo(dbHero, artifact);
otherHeroes.push(heroInfo);
}
}

View File

@@ -4,7 +4,6 @@ import Hero, { HeroType } from '../db/Hero';
import { nowSeconds } from '../pubUtils/timeUtil';
import { DicHero } from '../pubUtils/dictionary/DicHero';
import { ArtifactModelType } from '../db/Artifact';
import { JewelType } from '../db/Jewel';
class Talent {
@@ -16,6 +15,10 @@ class Talent {
class HeroArtifact {
@prop({ required: true })
id: number;
@prop({ required: true })
artifactId: number;
@@ -75,8 +78,8 @@ class EPlace {
starStage: number = 0;
@prop({ required: true, type: Stone, _id: false })
stones: Stone[];
@prop({ required: false })
jewel: number = 0;
@prop({ required: false, _id: false })
jewel: Jewel = null;
}
// 从玩家数据中覆盖warjson的部分字段
@@ -119,10 +122,8 @@ export class PvpHeroInfo {
@prop({ required: false, type: EPlace, _id: false })
ePlace: EPlace[]; // 战力
@prop({ required: false, type: Jewel, _id: false })
jewels: Jewel[]; // 天晶
setHeroInfo(hero: HeroType, artifact: ArtifactModelType, jewels: JewelType[]) {
setHeroInfo(hero: HeroType, artifact: ArtifactModelType, ePlace: EPlace[] = []) {
this.actorId = hero.hid;
this.skinId = hero.skinId;
this.actorName = hero.hName;
@@ -136,8 +137,7 @@ export class PvpHeroInfo {
this.subHid = hero.subHid;
this.subActorId = hero.subActorId;
if(artifact) this.artifact.push(artifact);
this.ePlace = hero.ePlace;
this.jewels = jewels;
this.ePlace = ePlace;
}
setRobotInfo(dicHero: DicHero, lv?: number) {
@@ -262,7 +262,6 @@ export class PvpEnemies extends Enemies {
this.subActorId = heroInfo.subActorId;
this.artifact = heroInfo.artifact||[];
this.ePlace = heroInfo.ePlace||[];
this.jewels = heroInfo.jewels||[];
if(score != undefined) this.score = score;
}
}