战力:获取显示数据
This commit is contained in:
+4
-36
@@ -1,42 +1,14 @@
|
||||
import { ROLE_TERAPH, ROLE_SELECT, ABI_TYPE, HERO_CE_RATIO, BLOCK_TYPE } from './../consts';
|
||||
import { ROLE_TERAPH, ROLE_SELECT, ABI_TYPE, BLOCK_TYPE } from './../consts';
|
||||
import BaseModel from './BaseModel';
|
||||
import { index, getModelForClass, prop, DocumentType, Ref, mongoose } from '@typegoose/typegoose';
|
||||
import User from './User';
|
||||
import { shouldRefresh, reduceCe } from '../pubUtils/util';
|
||||
import { shouldRefresh } from '../pubUtils/util';
|
||||
import { nowSeconds, getTimeFunD } from '../pubUtils/timeUtil';
|
||||
import { Figure } from '../domain/dbGeneral';
|
||||
import * as dicParam from '../pubUtils/dicParam';
|
||||
import Hero from './Hero';
|
||||
import { SearchRoleParam } from '../domain/backEndField/search';
|
||||
|
||||
type CeAttrUpdate = Partial<CeAttrDataRole>;
|
||||
// role表属性格式
|
||||
export class CeAttrDataRole {
|
||||
@prop({ required: true })
|
||||
id: number = 0;
|
||||
@prop({ required: true })
|
||||
ratioUp: number = 0;
|
||||
@prop({ required: true })
|
||||
fixUp: number = 0;
|
||||
|
||||
constructor(id: number) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public updateAttr(update: { inc?: CeAttrUpdate, set?: CeAttrUpdate }) {
|
||||
if(update.inc) {
|
||||
let { fixUp, ratioUp } = update.inc;
|
||||
if(fixUp != undefined) this.fixUp += fixUp * HERO_CE_RATIO;
|
||||
if(ratioUp != undefined) this.ratioUp += ratioUp;
|
||||
}
|
||||
if(update.set) {
|
||||
let { fixUp, ratioUp } = update.set;
|
||||
if(fixUp != undefined) this.fixUp = fixUp * HERO_CE_RATIO;
|
||||
if(ratioUp != undefined) this.ratioUp = ratioUp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class TopHero {
|
||||
@prop({ required: true })
|
||||
hid: number; // 武将id
|
||||
@@ -185,16 +157,12 @@ export default class Role extends BaseModel {
|
||||
exp: number; // 经验值
|
||||
@prop({ required: true, default: 1 })
|
||||
lv: number; // 主公等级
|
||||
@prop({ required: true, default: 0, set: (val: number) => val, get: (val: number) => reduceCe(val) })
|
||||
@prop({ required: true, default: 0 })
|
||||
ce: number; // 总战力
|
||||
@prop({ required: true, type: CeAttrDataRole, default: [], _id: false })
|
||||
attr: CeAttrDataRole[]; // 总战力
|
||||
@prop({ required: true, default: 0, set: (val: number) => val, get: (val: number) => reduceCe(val) })
|
||||
@prop({ required: true, default: 0 })
|
||||
topLineupCe: number; // 最强x人战力
|
||||
@prop({ required: true, type: TopHero, default: [], _id: false })
|
||||
topLineup: Array<TopHero>; // 总战力
|
||||
@prop({ required: false, set: (val: boolean) => val, get: () => true })
|
||||
isReducedCe: boolean; // 如果战力没有缩过就会返回false,缩过了就会返回true
|
||||
|
||||
@prop({ required: true, default: 100 })
|
||||
gold: number; // 总金币
|
||||
|
||||
Reference in New Issue
Block a user