武将:天赋

This commit is contained in:
陆莹
2022-03-22 21:25:48 +08:00
parent 5d0040b8a8
commit f53d53a7af
5 changed files with 120 additions and 20 deletions
+90 -1
View File
@@ -1,5 +1,7 @@
import { HeroType, HeroUpdate } from '../../db/Hero';
import { Connect, EPlace, HeroSkin, HeroType, HeroUpdate, Talent } from '../../db/Hero';
import { gameData } from '../../pubUtils/data';
import { reduceCe } from '../../pubUtils/util';
export interface CreateHeroParam extends HeroUpdate {
hid: number;
count: number;
@@ -17,4 +19,91 @@ export class HeroShowParam {
this.skinId = hero.skinId;
this.quality = hero.quality;
}
}
class HeroSKinParam {
id: number;
skinId: number; // fashions表的heroId字段
enable: boolean;
constructor(heroSkin: HeroSkin) {
this.id = heroSkin.id;
this.skinId = heroSkin.skinId;
this.enable = heroSkin.enable;
}
}
// 传给客户端的武将数据
export class HeroParam {
hid: number; // 武将 id
hName: string; // 武将名
seqId: number; // 武将表自增 id
exp: number; // 经验值
lv: number; // 武将等级
ce: number; // 武将战力
historyCe: number; // 武将历史最高战力
star: number; // 星级
starStage: number; // 星级六维阶段
colorStar: number; // 觉醒, 彩星
colorStarStage: number; // 觉醒六维阶段
quality: number; // 品质
scrollActive: boolean; // 是否在名将谱中激活
scrollId: number; // 名将谱id
scrollStar: number; // 名将谱中保存的星级
scrollColorStar: number; // 名将谱中保存的觉醒等级
scrollQuality: number; // 名将谱中保存的品质
job: number; // 职业
jobStage: number; // 职阶
skinId: number; // 当前皮肤idfashions表的heroId字段
favour: number; // 好感度
favourLv: number; // 好感等级
connections: Connect[]; // 羁绊
skins: HeroSKinParam[] = []; // 皮肤
ePlace: EPlace[]; // 武将装备引用数组
talent: Talent[];
usedTalentPoint: number;
totalTalentPoint: number;
constructor(hero: HeroType) {
this.hid = hero.hid;
this.hName = hero.hName;
this.exp = hero.exp;
this.lv = hero.lv;
if(hero.isReducedCe) {
this.ce = hero.ce;
this.historyCe = hero.historyCe;
} else {
this.ce = reduceCe(hero.ce);
this.historyCe = reduceCe(hero.historyCe);
}
this.star = hero.star;
this.starStage = hero.starStage;
this.colorStar = hero.colorStar;
this.colorStarStage = hero.colorStarStage;
this.quality = hero.quality;
this.scrollActive = hero.scrollActive;
this.scrollId = hero.scrollId;
this.scrollStar = hero.scrollStar;
this.scrollColorStar = hero.scrollColorStar;
this.scrollQuality = hero.scrollQuality;
this.job = hero.job;
this.totalTalentPoint = gameData.talentPointOfJob.get(hero.job)||0;
this.jobStage = hero.jobStage;
this.skinId = hero.skinId;
this.favour = hero.favour;
this.favourLv = hero.favourLv;
this.connections = hero.connections;
for(let skin of hero.skins) {
this.skins.push(new HeroSKinParam(skin));
if(skin.enable) {
this.talent = skin.talent;
this.usedTalentPoint = skin.usedTalentPoint;
}
}
this.ePlace = hero.ePlace;
}
}