d2stats

package
v0.0.0-...-7f92c57 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2021 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

Package d2stats provides item/skill/character stats functionality

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stat

type Stat interface {
	Name() string
	Clone() Stat
	Copy(Stat) Stat
	Combine(Stat) (combined Stat, err error)
	String() string
	Values() []StatValue
	SetValues(...StatValue)
	Priority() int
}

Stat a generic interface for a stat. It is something which can be combined with other stats, holds one or more values, and handles the way that it is printed as a string

type StatList

type StatList interface {
	Index(idx int) Stat
	Stats() []Stat
	SetStats([]Stat) StatList
	Clone() StatList
	ReduceStats() StatList
	RemoveStatAtIndex(idx int) Stat
	AppendStatList(other StatList) StatList
	Pop() Stat
	Push(Stat) StatList
}

StatList is useful for reducing stats. They provide a context for stats to alter other stats or infer values during stat assignment/calculation

type StatNumberType

type StatNumberType int

StatNumberType is a value type for a stat value

const (
	StatValueInt StatNumberType = iota
	StatValueFloat
)

Stat value types

type StatValue

type StatValue interface {
	NumberType() StatNumberType
	CombineType() ValueCombineType

	Clone() StatValue

	SetInt(int) StatValue
	SetFloat(float64) StatValue
	SetStringer(func(StatValue) string) StatValue

	Int() int
	Float() float64
	String() string
	Stringer() func(StatValue) string
}

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 ValueCombineType

type ValueCombineType int

ValueCombineType is a rule for combining stat values

const (
	// StatValueCombineSum means that the values are simply summed
	StatValueCombineSum ValueCombineType = iota

	// StatValueCombineStatic means that values can be combined only if they
	// have the same number value, and that the combination does not alter
	// the number value. This is typically for things like static skill level
	// monster/skill index for on proc stats where it doesnt make sense to sum
	// the values
	// example 1:
	//	if
	//		Stat_A := `25% chance to cast level 2 Frozen Orb on attack`
	//		Stat_B := `25% chance to cast level 3 Frozen Orb on attack`
	// then
	// 		Stat_A can NOT be combined with Stat_B
	//		even though the skills are the same, the levels are different
	//
	// example 2:
	//	if
	//		Stat_A := `25% chance to cast level 20 Frost Nova on attack`
	//		Stat_B := `25% chance to cast level 20 Frost Nova on attack`
	// then
	// 		the skills and skill levels are the same, so it can be combined
	//		(Stat_A + Stat_B) == `50% chance to cast level 20 Frost Nova on attack`
	StatValueCombineStatic
)

Directories

Path Synopsis
Package diablo2stats is the Diablo 2 stats implementation
Package diablo2stats is the Diablo 2 stats implementation

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL