✨ feat(副将): pvp相关副将设置
This commit is contained in:
@@ -156,10 +156,14 @@ export async function getVestigeUsedHeroes(roleId: string, curVestigeId: number)
|
||||
}
|
||||
|
||||
// 是否在其他遗迹中使用过这个武将
|
||||
export async function checkHeroIsUsedInOtherVestige(roleId: string, curVestigeId: number, heroes: { actorId: number }[]) {
|
||||
export async function checkHeroIsUsedInOtherVestige(roleId: string, curVestigeId: number, heroes: { actorId: number, subHid: number }[]) {
|
||||
let usedHeroes = await getVestigeUsedHeroes(roleId, curVestigeId);
|
||||
for(let { actorId } of heroes) {
|
||||
for(let { actorId, subHid } of heroes) {
|
||||
if(usedHeroes.indexOf(actorId) != -1) return true;
|
||||
// 查副将
|
||||
if(subHid) {
|
||||
if(usedHeroes.indexOf(subHid) != -1) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -251,7 +255,7 @@ export async function generateAttackInfo(roleId: string, league: GVGLeagueType,
|
||||
return info;
|
||||
}
|
||||
|
||||
export async function generateAttackHeroInfo(lineup: { actorId: number, dataId: number, order: number }[], dbHeroes: HeroType[]) {
|
||||
export async function generateAttackHeroInfo(lineup: { actorId: number, dataId: number, order: number, subHid: number }[], dbHeroes: HeroType[]) {
|
||||
let info = new OppPlayerInfo();
|
||||
info.setPlayerHeroes(dbHeroes, lineup);
|
||||
return info;
|
||||
@@ -265,7 +269,11 @@ export async function getOppDetailData(rec: GVGVestigeRecType) {
|
||||
const dicWar = gameData.war.get(dicLadderDifficultRatio.gkId);
|
||||
const dicWarJson = gameData.warJson.get(dicWar.dispatchJsonId);
|
||||
const defenseInfo = rec.defenseInfo.heroes||[];
|
||||
const hids = defenseInfo.map(cur => cur.hid);
|
||||
const hids: number[] = [];
|
||||
for(let { hid, subHid } of defenseInfo) {
|
||||
hids.push(hid);
|
||||
if(subHid) hids.push(subHid);
|
||||
}
|
||||
const heroes = await HeroModel.findByHidRange(hids, rec.defenseRoleId, 'hid lv quality star colorStar skins ce skinId');
|
||||
const artifactSeids = heroes.map(hero => hero.artifact);
|
||||
const artifacts = await ArtifactModel.findbySeqIds(rec.defenseRoleId, artifactSeids);
|
||||
@@ -299,7 +307,7 @@ export async function updateMyVestigeRank(isChange: boolean, atkData: GVGVestige
|
||||
if(isChange) {
|
||||
if(atkData && !atkData.hasDefense) { // 只有第一次挑战且自己没有主动保存过阵容的时候才会这么保存
|
||||
let heroes = rec.attackInfo.heroes||[];
|
||||
let lineup = heroes.map(hero => ({ actorId: hero.hid, dataId: hero.dataId, order: hero.order, ce: hero.ce }));
|
||||
let lineup = heroes.map(hero => ({ actorId: hero.hid, dataId: hero.dataId, order: hero.order, ce: hero.ce, subHid: hero.subHid }));
|
||||
update.lineup = lineup;
|
||||
update.hasDefense = true;
|
||||
needUpdate = true;
|
||||
|
||||
Reference in New Issue
Block a user