✨ feat(宝物): 添加宝物系统
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { mongoose, prop, Ref } from "@typegoose/typegoose";
|
||||
import { LADDER_STATUS } from "../../consts";
|
||||
import { ArtifactModelType } from "../../db/Artifact";
|
||||
import Hero, { HeroType, Talent } from '../../db/Hero';
|
||||
import { LadderMatchType } from "../../db/LadderMatch";
|
||||
import { LadderMatchRecType } from "../../db/LadderMatchRec";
|
||||
@@ -56,6 +57,15 @@ export class LadderOppPlayerInDB {
|
||||
rank: number;
|
||||
}
|
||||
|
||||
|
||||
class HeroArtifact {
|
||||
@prop({ required: true })
|
||||
artifactId: number;
|
||||
|
||||
@prop({ required: true })
|
||||
lv: number;
|
||||
}
|
||||
|
||||
// ladderMatchRec
|
||||
export class LadderOppPlayerHeroInfo {
|
||||
@prop({ required: true })
|
||||
@@ -70,6 +80,8 @@ export class LadderOppPlayerHeroInfo {
|
||||
colorStar: number; // 彩星
|
||||
@prop({ required: true })
|
||||
lv: number; // 等级
|
||||
@prop({ required: true, type: HeroArtifact, _id: false })
|
||||
artifact: HeroArtifact[] = []; // 等级
|
||||
|
||||
setByWarJson(warJson: DicWarJson) {
|
||||
this.hid = warJson.actorId;
|
||||
@@ -96,6 +108,10 @@ export class LadderOppPlayerHeroInfo {
|
||||
this.colorStar = hero.colorStar;
|
||||
this.lv = hero.lv;
|
||||
}
|
||||
|
||||
setArtifact(artifact: ArtifactModelType) {
|
||||
if(artifact) this.artifact.push({ artifactId: artifact.artifactId, lv: artifact.lv });
|
||||
}
|
||||
}
|
||||
|
||||
// ladderMatchRec
|
||||
@@ -343,8 +359,9 @@ export class LadderOppDetailHeroReturn {
|
||||
spine: string = ''; // 动画
|
||||
talent: Talent[] = [];
|
||||
subHid: number = 0; // 副将
|
||||
artifact: HeroArtifact[] = [];
|
||||
|
||||
constructor(warJson: DicWarJson, defensHero: LadderDefenseHero) {
|
||||
constructor(warJson: DicWarJson, defensHero: LadderDefenseHero, artifacts: ArtifactModelType[]) {
|
||||
this.dataId = warJson.dataId;
|
||||
this.relation = warJson.relation;
|
||||
this.dirction = warJson.dirction;
|
||||
@@ -373,6 +390,8 @@ export class LadderOppDetailHeroReturn {
|
||||
if(skin) this.talent = skin.talent;
|
||||
this.job = hero.job;
|
||||
this.subHid = hero.subHid;
|
||||
let artifact = artifacts.find(cur => cur.seqId == hero.artifact);
|
||||
if(artifact) this.artifact.push({ artifactId: artifact.artifactId, lv: artifact.lv });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -405,7 +424,7 @@ export class LadderOppDetailReturn {
|
||||
}
|
||||
}
|
||||
|
||||
setByPlayer(ladderMatch: LadderMatchType, warJsons: DicWarJson[]) {
|
||||
setByPlayer(ladderMatch: LadderMatchType, warJsons: DicWarJson[], artifacts: ArtifactModelType[]) {
|
||||
this.isRobot = false;
|
||||
let role = <RoleType>ladderMatch.role;
|
||||
this.title = role.title;
|
||||
@@ -415,7 +434,7 @@ 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);
|
||||
let obj = new LadderOppDetailHeroReturn(warJson, hero, artifacts);
|
||||
this.heroes.push(obj);
|
||||
this.defCe += hero.ce;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { DicWarJson } from '../pubUtils/dictionary/DicWarJson';
|
||||
import Hero, { HeroType } from '../db/Hero';
|
||||
import { nowSeconds } from '../pubUtils/timeUtil';
|
||||
import { DicHero } from '../pubUtils/dictionary/DicHero';
|
||||
import { ArtifactModelType } from '../db/Artifact';
|
||||
|
||||
|
||||
class Talent {
|
||||
@@ -11,6 +12,16 @@ class Talent {
|
||||
@prop({ required: true })
|
||||
level: number; // 激活等级
|
||||
}
|
||||
|
||||
|
||||
class HeroArtifact {
|
||||
@prop({ required: true })
|
||||
artifactId: number;
|
||||
|
||||
@prop({ required: true })
|
||||
lv: number;
|
||||
}
|
||||
|
||||
// 从玩家数据中覆盖warjson的部分字段
|
||||
export class PvpHeroInfo {
|
||||
@prop({ required: true })
|
||||
@@ -44,8 +55,10 @@ export class PvpHeroInfo {
|
||||
|
||||
@prop({ required: true, _id: false })
|
||||
attribute?: string; // 属性
|
||||
@prop({ required: true, _id: false, type: HeroArtifact })
|
||||
artifact?: HeroArtifact[] = []; // 宝物
|
||||
|
||||
setHeroInfo(hero: HeroType) {
|
||||
setHeroInfo(hero: HeroType, artifact: ArtifactModelType) {
|
||||
this.actorId = hero.hid;
|
||||
this.skinId = hero.skinId;
|
||||
this.actorName = hero.hName;
|
||||
@@ -57,6 +70,7 @@ export class PvpHeroInfo {
|
||||
let skin = hero.skins?.find(cur => cur.enable);
|
||||
if(skin) this.talent = skin.talent;
|
||||
this.subHid = hero.subHid;
|
||||
if(artifact) this.artifact.push({ artifactId: artifact.artifactId, lv: artifact.lv })
|
||||
}
|
||||
|
||||
setRobotInfo(dicHero: DicHero, lv: number) {
|
||||
@@ -150,6 +164,9 @@ export class PvpEnemies extends Enemies {
|
||||
talent: Talent[];
|
||||
@prop({ required: true })
|
||||
subHid: number;
|
||||
@prop({ required: true, type: () => HeroArtifact, _id: false })
|
||||
artifact: HeroArtifact[] = []; // 宝物
|
||||
|
||||
|
||||
// score: 这个武将的军功
|
||||
constructor(warjson: DicWarJson, heroInfo: PvpHeroInfo, score: number, ce: number) {
|
||||
@@ -162,6 +179,7 @@ export class PvpEnemies extends Enemies {
|
||||
this.talent = heroInfo.talent;
|
||||
this.job = heroInfo.job;
|
||||
this.subHid = heroInfo.subHid;
|
||||
this.artifact = heroInfo.artifact||[];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import * as friendUtil from '../../pubUtils/friendUtil'
|
||||
import { FRIEND_RELATION_TYPE } from "../../consts";
|
||||
import { Connect, EPlace, HeroType, Stone, Talent } from "../../db/Hero";
|
||||
import { JewelType, RandSe } from "../../db/Jewel";
|
||||
import { ArtifactModelType } from "../../db/Artifact";
|
||||
|
||||
export class FriendParams {
|
||||
roleId: string;
|
||||
@@ -201,6 +202,7 @@ export class HeroDetailParam {
|
||||
school: number;
|
||||
};
|
||||
subHid: number = 0;
|
||||
artifacts: {artifactId: number, lv: number }[] = []
|
||||
|
||||
constructor(hero: HeroType) {
|
||||
this.roleId = hero.roleId;
|
||||
@@ -239,4 +241,8 @@ export class HeroDetailParam {
|
||||
setRole(title: number, scroll: number, teraph: number, school: number) {
|
||||
this.role = { title, scroll, teraph, school };
|
||||
}
|
||||
|
||||
setArtifact(artifact: ArtifactModelType) {
|
||||
this.artifacts.push({ artifactId: artifact.artifactId, lv: artifact.lv });
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
|
||||
import { ArtifactModelType } from '../../db/Artifact';
|
||||
import { Connect, EPlace, HeroSkin, HeroType, HeroUpdate, Talent } from '../../db/Hero';
|
||||
import { JewelSe, JewelType, RandSe } from '../../db/Jewel';
|
||||
import { gameData } from '../../pubUtils/data';
|
||||
@@ -60,6 +61,7 @@ export class HeroParam {
|
||||
skins: HeroSKinParam[] = []; // 皮肤
|
||||
ePlace: EPlace[]; // 武将装备引用数组
|
||||
|
||||
artifact: number = 0;
|
||||
talent: Talent[] = [];
|
||||
usedTalentPoint: number = 0;
|
||||
totalTalentPoint: number = 0;
|
||||
@@ -93,6 +95,7 @@ export class HeroParam {
|
||||
}
|
||||
}
|
||||
this.ePlace = hero.ePlace;
|
||||
this.artifact = hero.artifact;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,3 +127,27 @@ export class JewelParam {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class ArtifactParam {
|
||||
seqId: number; // 唯一id
|
||||
artifactId: number; // 宝物id
|
||||
id: number; // 物品id
|
||||
lv: number; // 强化等级
|
||||
hid: number; // 装备的武将
|
||||
count: number;
|
||||
inc: number; // 增减数量,固定1
|
||||
reason: number; // 来源id
|
||||
|
||||
constructor(artifact: ArtifactModelType, isPush?: boolean, reason?: number) {
|
||||
this.seqId = artifact.seqId;
|
||||
this.artifactId = artifact.artifactId;
|
||||
this.id = artifact.id;
|
||||
this.lv = artifact.lv;
|
||||
this.hid = artifact.hid;
|
||||
if(isPush) {
|
||||
this.count = 1;
|
||||
this.inc = 1;
|
||||
this.reason = reason;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { ArtifactModelType } from "../../db/Artifact";
|
||||
import { Connect, EPlace, HeroType } from "../../db/Hero";
|
||||
import { JewelType } from "../../db/Jewel";
|
||||
import { HeroScore } from "../battleField/pvp";
|
||||
@@ -56,6 +57,8 @@ export class TaskParamInter {
|
||||
jewels?: JewelType[]; // 天晶石
|
||||
skinId?: number; // 皮肤id
|
||||
|
||||
artifacts?: ArtifactModelType[]; // 宝物
|
||||
|
||||
skipTower?: boolean;
|
||||
debugInfo?: {condition: number};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user