寻宝:增加每个武将伤害的统计

This commit is contained in:
luying
2022-05-27 18:38:08 +08:00
parent 3737c888fd
commit 393e93224e
5 changed files with 28 additions and 8 deletions
+12 -2
View File
@@ -2,7 +2,6 @@ import BaseModel from './BaseModel';
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
import { EXTERIOR } from '../pubUtils/dicParam';
import { ItemReward } from '../domain/dbGeneral';
import { HeroType } from './Hero';
export class ComRoleStatusHero {
@prop({ required: true })
@@ -17,7 +16,9 @@ export class ComRoleStatusHero {
colorStar: number;
@prop({ required: true })
lv: number;
constructor(hero: HeroType) {
@prop({ required: true })
damage: number = 0;
constructor(hero: { hid: number, skinId: number, quality: number, star: number, colorStar: number, lv: number }) {
this.id = hero.hid;
this.skinId = hero.skinId;
this.quality = hero.quality;
@@ -25,6 +26,10 @@ export class ComRoleStatusHero {
this.colorStar = hero.colorStar;
this.lv = hero.lv;
}
addDamage(damage: number) {
this.damage += damage;
}
}
export class RoleStatus {
@@ -106,6 +111,11 @@ export class RoleStatus {
this.frdRatio += frdRatio;
}
}
addHeroDamage(hid: number, damage: number) {
let hero = this.heroes.find(cur => cur.id == hid);
if(hero) hero.addDamage(damage);
}
}
export class BossHp {
@@ -43,4 +43,8 @@ export class MemComBtlTeam extends ComBattleTeam {
this.blacklist = [];
this.sid = sid;
}
findMemberByRoleId(roleId: string) {
return this.roleStatus.find(cur => cur.roleId == roleId);
}
};