miao-plugin/models/dmg/AttrItem.js
2023-11-13 05:06:03 +08:00

26 lines
502 B
JavaScript

export default class AttrItem {
constructor (ds) {
this.base = ds.base * 1 || 0
this.plus = ds.plus * 1 || 0
this.pct = ds.pct * 1 || 0
this.inc = ds.inc * 1 || 0
}
static create (ds) {
return new AttrItem(ds)
/*
return {
base: ds.base * 1 || 0,
plus: ds.plus * 1 || 0,
pct: ds.pct * 1 || 0,
inc: ds.inc * 1 || 0
} */
}
toString () {
return (this.base || 0) + (this.plus || 0) + ((this.base || 0) * (this.pct || 0) / 100)
}
}