stats

package
v0.9.9 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

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.
	NoCap    bool `yaml:"-"`                  // When true, skip the stat cap compression in Recalculate
}

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 (si *StatInfo) GainsForLevel(level int) int

GainsForLevel returns the racial stat value at the given level, using the configured progression formula:

racial = floor(base * BaseModFactor * (level-1)^BaseModExponent)
       + floor(NaturalGainsModFactor * level^NaturalGainsExponent)

func (*StatInfo) Recalculate

func (si *StatInfo) Recalculate(level int)

func (*StatInfo) SetMod

func (si *StatInfo) SetMod(mod ...int)

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
}

Jump to

Keyboard shortcuts

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