miao-plugin/models/dmg/AttrItem.js

26 lines
502 B
JavaScript
Raw Normal View History

2023-11-12 21:06:03 +00:00
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)
}
}