mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-09-30 23:25:57 -04:00
c114ab9eb7
* add interface for stats, d2 is an implementation * fix incorrect comment, remove ennecessary int * simplified description functions, remove duplicates * moved default stringer functions * fixed incorrect stat combine method * change `Create` to `New` in method names
28 lines
571 B
Go
28 lines
571 B
Go
package d2stats
|
|
|
|
// StatValueType is a value type for a stat value
|
|
type StatValueType int
|
|
|
|
// Stat value types
|
|
const (
|
|
StatValueInt StatValueType = iota
|
|
StatValueFloat
|
|
)
|
|
|
|
// StatValue is something that can have both integer and float
|
|
// number components, as well as a means of retrieving a string for
|
|
// its values.
|
|
type StatValue interface {
|
|
Type() StatValueType
|
|
Clone() StatValue
|
|
|
|
SetInt(int) StatValue
|
|
SetFloat(float64) StatValue
|
|
SetStringer(func(StatValue) string) StatValue
|
|
|
|
Int() int
|
|
Float() float64
|
|
String() string
|
|
Stringer() func(StatValue) string
|
|
}
|