feat(战场): 保存战阵连携顺序

This commit is contained in:
luying
2023-08-01 17:20:21 +08:00
parent 07bce370aa
commit f0ab9b0aeb
14 changed files with 102 additions and 33 deletions

View File

@@ -10,6 +10,7 @@ import { EXTERIOR, LADDER } from "../../pubUtils/dicParam";
import { DicLadderDifficultRatio } from "../../pubUtils/dictionary/DicLadderDifficultRatio";
import { DicWarJson } from "../../pubUtils/dictionary/DicWarJson";
import { RoleRankInfo } from "../rank";
import { Combo } from "./pvp";
// ladderMatch表
export class LadderDefenseHero {
@@ -46,10 +47,13 @@ export class LadderDefense {
warId: number;
@prop({ required: true, type: LadderDefenseHero, _id: false })
heroes: LadderDefenseHero[];
@prop({ required: true, type: () => Combo, _id: false })
combo: Combo[];
constructor(heroes: LadderDefenseHero[], warId: number) {
constructor(heroes: LadderDefenseHero[], warId: number, combo: Combo[]) {
this.heroes = heroes;
this.warId = warId;
this.combo = combo;
}
}
@@ -208,6 +212,7 @@ export class LadderDefenseReturn {
warId: number;
defCe: number = 0;
heroes: LadderDefenseHeroReturn[] = [];
combo: Combo[] = [];
constructor(defense: LadderDefense) {
if(!defense) return;
@@ -216,6 +221,7 @@ export class LadderDefenseReturn {
this.defCe += defenseHero.ce;
this.heroes.push(new LadderDefenseHeroReturn(defenseHero));
}
this.combo = defense.combo;
}
}
@@ -429,6 +435,7 @@ export class LadderOppDetailReturn {
title: number = 1;
warId: number = 0;
heroes: LadderOppDetailHeroReturn[] = [];
combo: Combo[] = [];
defCe: number = 0;
constructor(ladderRec: LadderMatchRecType) {
@@ -448,6 +455,7 @@ export class LadderOppDetailReturn {
this.title = role.title;
if(ladderMatch.defense) {
this.warId = ladderMatch.defense.warId;
this.combo = ladderMatch.defense.combo||[];
let heroes = ladderMatch.defense.heroes||[];
for(let hero of heroes) {
let warJson = warJsons.find(cur => cur.dataId == hero.dataId);

View File

@@ -43,6 +43,13 @@ export class DefenseHero extends DefenseHeroInSaveData {
}
export class Combo {
@prop({ required: true })
groupId: number;
@prop({ required: true, type: Number })
levelList: number[];
}
// 防守阵容
export class Defense {
@prop({ required: true })
@@ -55,8 +62,10 @@ export class Defense {
score: number; // 防守阵容的总军功
@prop({ required: true })
pLv: number; // 防守阵容的等级
@prop({ required: true, type: () => Combo, _id: false })
combo: Combo[]; // 防守阵容的等级
constructor(heroes: DefenseHero[], scores: number[], warId: number, buff: number) {
constructor(heroes: DefenseHero[], scores: number[], warId: number, buff: number, combo: Combo[]) {
this.heroes = heroes;
this.score = scores.reduce((pre, cur) => pre + cur, 0);
let {pLv, score} = getPlvAndScore(scores);
@@ -64,6 +73,7 @@ export class Defense {
this.score = score;
this.warId = warId;
this.buff = buff;
this.combo = combo;
}
}
@@ -176,6 +186,7 @@ export class DefenseLineupReturn {
score: number;
pLv: number;
ce: number;
combo: Combo[];
constructor(defense: Defense, defenseCe: number) {
this.warId = defense.warId;
@@ -184,6 +195,7 @@ export class DefenseLineupReturn {
this.score = defense.score;
this.pLv = defense.pLv;
this.ce = defenseCe;
this.combo = defense.combo;
}
}

View File

@@ -10,6 +10,7 @@ import { DicGVGVestige } from "../../pubUtils/dictionary/DicGVGVestige";
import { DicWarJson } from "../../pubUtils/dictionary/DicWarJson";
import { GVGHeroInfo } from "../dbGeneral";
import { LineupHero } from "../roleField/hero";
import { Combo } from "../battleField/pvp";
export class OppPlayerHeroInfo {
@prop({ required: true })
@@ -100,6 +101,8 @@ export class OppPlayerInfo {
isSuccess: boolean = false; // 是否胜利
@prop({ required: true, default: [], type: OppPlayerHeroInfo, _id: false })
heroes: OppPlayerHeroInfo[] = []; // 武将
@prop({ required: true, default: [], type: () => Combo, _id: false })
combo: Combo[] = []; // 武将
@prop({ required: true })
isRobot: boolean = false; // 原排名
@@ -119,13 +122,14 @@ export class OppPlayerInfo {
this.leagueName = league.name;
}
setPlayerHeroes(heroes: HeroType[], lineup: {actorId: number, dataId: number, order: number, subHid: number}[]) {
setPlayerHeroes(heroes: HeroType[], lineup: {actorId: number, dataId: number, order: number, subHid: number}[], combo: Combo[]) {
for(let hero of heroes) {
let obj = new OppPlayerHeroInfo();
obj.setByDefenseHero(hero, lineup);
this.ce += hero.ce;
this.heroes.push(obj);
}
this.combo = combo;
}
initByRobot(dic: DicGVGVestige, heroes: OppPlayerHeroInfo[], isSuccess: boolean) {
@@ -228,6 +232,7 @@ export class OppDetailData{
status: number;
time: number;
heroes: OppDetailHeroData[] = [];
combo: Combo[] = [];
lineupCe: number = 0;
constructor(rec: GVGVestigeRecType, obj: {status: number, time: number}) {
@@ -240,7 +245,7 @@ export class OppDetailData{
this.time = obj.time;
}
setByPlayer(dicWarJson: DicWarJson[], defenseHeroes: OppPlayerHeroInfo[], heroes: HeroType[], artifacts: ArtifactModelType[]) {
setByPlayer(dicWarJson: DicWarJson[], defenseHeroes: OppPlayerHeroInfo[], heroes: HeroType[], artifacts: ArtifactModelType[], combo: Combo[]) {
for(let warJson of dicWarJson) {
let defenseHero = defenseHeroes.find(cur => cur.dataId == warJson.dataId);
if(!defenseHero) continue;
@@ -250,6 +255,7 @@ export class OppDetailData{
this.heroes.push(hero);
this.lineupCe += curHero.ce;
}
this.combo = combo;
}
setAttribute(hid: number, attribute: string) {
@@ -265,6 +271,7 @@ export interface SaveTeamParam {
frame: number;
spine: number;
lineup?: LineupHero[];
combo: Combo[];
}
export interface SaveTeamUpdateParam {
@@ -273,6 +280,7 @@ export interface SaveTeamUpdateParam {
frame: number;
spine: number;
lineup?: GVGHeroInfo[];
combo: Combo[];
lineupCe?: number;
cityId?: number;
areaId?: number;

View File

@@ -15,6 +15,7 @@ import { GVGCityType } from "../../db/GVGCity";
import { GVGTeamMem } from "../battleField/gvgBattle";
import { GVGTeamType } from "../../db/GVGTeam";
import { GVGRoleDataType } from "../../db/GVGRoleData";
import { Combo } from "../battleField/pvp";
class LeagueLeaderInfo {
name: string; // 盟主名
@@ -777,6 +778,7 @@ export class MyTeamSimpleInfo {
order: number; // 行动
subHid: number;
}[];
combo: Combo[];
hasConfirm: boolean;
constructor(team: GVGTeamType, configId: number) {
@@ -787,6 +789,7 @@ export class MyTeamSimpleInfo {
this.spine = team.spine;
this.lineup = team.lineup.map(({ actorId, dataId, outIndex, subActorId }) => ({ actorId, dataId, order: outIndex, subHid: subActorId }));
this.hasConfirm = team.confirmConfigId == configId;
this.combo = team.combo;
}
}