Documentation
¶
Index ¶
- Constants
- type StatInfo
- type Statistics
- func (s *Statistics) AddMod(statName string, value int)
- func (s *Statistics) Get(name string) *StatInfo
- func (s *Statistics) GetBase(statName string) int
- func (s *Statistics) GetStatInfoNames() []string
- func (s *Statistics) GetTraining(statName string) int
- func (s *Statistics) GetValue(statName string) int
- func (s *Statistics) GetValueAdj(statName string) int
- func (s *Statistics) SetBase(statName string, value int)
- func (s *Statistics) SetMod(statName string, value int)
- func (s *Statistics) SetTraining(statName string, value int)
Constants ¶
View Source
const ( BaseModFactor = 0.3333333334 // How much of a scaling to aply to levels before multiplying by racial stat NaturalGainsModFactor = 0.5 // Free stats gained per level modded by this. )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StatInfo ¶
type StatInfo struct {
Training int `yaml:"training,omitempty"` // How much it's been trained with Training Points spending
Value int `yaml:"-"` // Final calculated value
ValueAdj int `yaml:"-"` // Final calculated value (Adjusted)
Racial int `yaml:"-"` // Value provided by racial benefits
Base int `yaml:"base,omitempty"` // Base stat value
Mods int `yaml:"-"` // How much it's modded by equipment, spells, etc.
}
When saving to a file, we don't need to write all the properties that we calculate. Just keep track of "Training" because that's not calculated.
func (*StatInfo) GainsForLevel ¶
func (*StatInfo) Recalculate ¶
type Statistics ¶
type Statistics struct {
Strength StatInfo `yaml:"strength,omitempty"` // Muscular strength (damage?)
Speed StatInfo `yaml:"speed,omitempty"` // Speed and agility (dodging)
Smarts StatInfo `yaml:"smarts,omitempty"` // Intelligence and wisdom (magic power, memory, deduction, etc)
Vitality StatInfo `yaml:"vitality,omitempty"` // Health and stamina (health capacity)
Mysticism StatInfo `yaml:"mysticism,omitempty"` // Magic and mana (magic capacity)
Perception StatInfo `yaml:"perception,omitempty"` // How well you notice things
}
func (*Statistics) AddMod ¶
func (s *Statistics) AddMod(statName string, value int)
func (*Statistics) Get ¶
func (s *Statistics) Get(name string) *StatInfo
Get returns a pointer to the StatInfo for the given name.
func (*Statistics) GetBase ¶
func (s *Statistics) GetBase(statName string) int
func (*Statistics) GetStatInfoNames ¶
func (s *Statistics) GetStatInfoNames() []string
GetStatInfoNames returns a list of all stat names in the order they are defined. TODO: This should be a representation of the stats in the game, not hardcoded.
func (*Statistics) GetTraining ¶
func (s *Statistics) GetTraining(statName string) int
func (*Statistics) GetValue ¶
func (s *Statistics) GetValue(statName string) int
Helper methods for common stat operations
func (*Statistics) GetValueAdj ¶
func (s *Statistics) GetValueAdj(statName string) int
func (*Statistics) SetBase ¶
func (s *Statistics) SetBase(statName string, value int)
func (*Statistics) SetMod ¶
func (s *Statistics) SetMod(statName string, value int)
func (*Statistics) SetTraining ¶
func (s *Statistics) SetTraining(statName string, value int)
Click to show internal directories.
Click to hide internal directories.