✨ feat(副将): pvp相关副将设置

This commit is contained in:
luying
2023-07-18 20:28:35 +08:00
parent a726681d25
commit c6455de8e4
17 changed files with 157 additions and 44 deletions
+23 -6
View File
@@ -25,14 +25,17 @@ export class LadderDefenseHero {
hero: Ref<Hero>;
@prop({ required: true })
ce: number;
@prop({ required: false })
subHid: number;
constructor(param: { actorId: number, ai: number, dataId: number, order: number }, heroId: string, ce: number) {
constructor(param: { actorId: number, ai: number, dataId: number, order: number, subHid?: number }, heroId: string, ce: number) {
this.actorId = param.actorId;
this.ai = param.ai;
this.dataId = param.dataId;
this.order = param.order;
this.hero = heroId;
this.ce = ce;
this.subHid = param.subHid||0;
}
}
@@ -80,6 +83,10 @@ export class LadderOppPlayerHeroInfo {
colorStar: number; // 彩星
@prop({ required: true })
lv: number; // 等级
@prop({ required: true })
subHid: number; // 副将
@prop({ required: true })
subActorId: number; // 副将(纯武将)
@prop({ required: true, type: HeroArtifact, _id: false })
artifact: HeroArtifact[] = []; // 等级
@@ -112,6 +119,11 @@ export class LadderOppPlayerHeroInfo {
setArtifact(artifact: ArtifactModelType) {
if(artifact) this.artifact.push({ artifactId: artifact.artifactId, lv: artifact.lv });
}
setSubHero(hero: HeroType) {
this.subHid = hero?.skinId||0;
this.subActorId = hero?.hid||0;
}
}
// ladderMatchRec
@@ -180,12 +192,14 @@ export class LadderDefenseHeroReturn {
ai: number; // ai逻辑,1-进攻型 2-防守型
dataId: number;
order: number;
subHid: number;
constructor(defenseHero: LadderDefenseHero) {
this.actorId = defenseHero.actorId;
this.ai = defenseHero.ai;
this.dataId = defenseHero.dataId;
this.order = defenseHero.order;
this.subHid = defenseHero.subHid||0;
}
}
@@ -362,7 +376,7 @@ export class LadderOppDetailHeroReturn {
subActorId: number = 0;
artifacts: HeroArtifact[] = [];
constructor(warJson: DicWarJson, defensHero: LadderDefenseHero, artifacts: ArtifactModelType[]) {
constructor(warJson: DicWarJson, defensHero: LadderDefenseHero, artifacts: ArtifactModelType[], subHero: HeroType) {
this.dataId = warJson.dataId;
this.relation = warJson.relation;
this.dirction = warJson.dirction;
@@ -390,12 +404,14 @@ export class LadderOppDetailHeroReturn {
let skin = hero.skins.find(cur => cur.enable);
if(skin) this.talent = skin.talent;
this.job = hero.job;
this.subHid = hero.subHid;
this.subActorId = hero.subActorId;
let artifact = artifacts.find(cur => cur.seqId == hero.artifact);
if(artifact) this.artifacts.push({ artifactId: artifact.artifactId, lv: artifact.lv });
}
}
if(subHero) {
this.subHid = subHero?.skinId||0;
this.subActorId = subHero?.hid||0;
}
}
setAttribute(attribute: string) {
@@ -426,7 +442,7 @@ export class LadderOppDetailReturn {
}
}
setByPlayer(ladderMatch: LadderMatchType, warJsons: DicWarJson[], artifacts: ArtifactModelType[]) {
setByPlayer(ladderMatch: LadderMatchType, warJsons: DicWarJson[], artifacts: ArtifactModelType[], subHeroes: HeroType[]) {
this.isRobot = false;
let role = <RoleType>ladderMatch.role;
this.title = role.title;
@@ -436,7 +452,8 @@ export class LadderOppDetailReturn {
for(let hero of heroes) {
let warJson = warJsons.find(cur => cur.dataId == hero.dataId);
if(warJson) {
let obj = new LadderOppDetailHeroReturn(warJson, hero, artifacts);
let subHero = subHeroes.find(sub => sub.hid == hero.subHid);
let obj = new LadderOppDetailHeroReturn(warJson, hero, artifacts, subHero);
this.heroes.push(obj);
this.defCe += hero.ce;
}