1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-09-30 23:25:57 -04:00
OpenDiablo2/d2core/d2stats/stat_value.go
lord c114ab9eb7
add interfaces for stats, added diablo 2 implementation (#614)
* 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
2020-07-23 19:03:58 -04:00

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
}