Attribute(name, base, delta, formula, metadata)

Representation of an "Attribute" which is any value that has a base amount and depleted/restored safely. Where safely means without being destructive to the base value.

An attribute on its own cannot be raised above its base value. To raise attributes above their base temporarily see the Effect guide.

new Attribute(name, base, delta, formula, metadata)

Parameters:
Name Type Default Description
name string
base number
delta number 0
formula AttributeFormula null
metadata object {}
Properties:
Name Type Description
name string
base number
delta number

Current difference from the base

formula AttributeFormula
metadata object

any custom info for this attribute

Methods

lower(amount)

Lower current value

Parameters:
Name Type Description
amount number

raise(amount)

Raise current value

Parameters:
Name Type Description
amount number

setBase(amount)

Change the base value

Parameters:
Name Type Description
amount number

setDelta(amount)

Bypass raise/lower, directly setting the delta

Parameters:
Name Type Description
amount amount