stats

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PseudoStats

type PseudoStats struct {
	NoCost         bool    // If set, spells cost no mana/energy/rage.
	CostMultiplier float64 // Multiplies spell cost.
	CostReduction  float64 // Reduces spell cost.

	CastSpeedMultiplier   float64
	MeleeSpeedMultiplier  float64
	RangedSpeedMultiplier float64

	FiveSecondRuleRefreshTime time.Duration // last time a spell was cast
	SpiritRegenRateCasting    float64       // percentage of spirit regen allowed during casting

	// Both of these are currently only used for innervate.
	ForceFullSpiritRegen  bool    // If set, automatically uses full spirit regen regardless of FSR refresh time.
	SpiritRegenMultiplier float64 // Multiplier on spirit portion of mana regen.

	// If true, allows block/parry.
	InFrontOfTarget bool

	// "Apply Aura: Mod Damage Done (Physical)", applies to abilities with EffectSpellCoefficient > 0.
	//  This includes almost all "(Normalized) Weapon Damage", but also some "School Damage (Physical)" abilities.
	BonusDamage float64 // Comes from '+X Weapon Damage' effects

	BonusRangedHitRating  float64 // Hit rating for ranged only.
	BonusMeleeCritRating  float64 // Crit rating for melee only (not ranged).
	BonusRangedCritRating float64 // Crit rating for ranged only.
	BonusFireCritRating   float64 // Crit rating for fire spells only (Combustion).
	BonusMHCritRating     float64 // Talents, e.g. Rogue Dagger specialization
	BonusOHCritRating     float64 // Talents, e.g. Rogue Dagger specialization

	DisableDWMissPenalty bool    // Used by Heroic Strike and Cleave
	IncreasedMissChance  float64 // Insect Swarm and Scorpid Sting
	DodgeReduction       float64 // Used by Warrior talent 'Weapon Mastery' and SWP boss auras.

	MobTypeAttackPower float64 // Bonus AP against mobs of the current type.
	MobTypeSpellPower  float64 // Bonus SP against mobs of the current type.

	// For Human and Orc weapon racials
	BonusMHExpertiseRating float64
	BonusOHExpertiseRating float64

	ThreatMultiplier          float64 // Modulates the threat generated. Affected by things like salv.
	HolySpellThreatMultiplier float64 // Righteous Fury

	DamageDealtMultiplier       float64 // All damage
	RangedDamageDealtMultiplier float64

	PhysicalDamageDealtMultiplier float64
	ArcaneDamageDealtMultiplier   float64
	FireDamageDealtMultiplier     float64
	FrostDamageDealtMultiplier    float64
	HolyDamageDealtMultiplier     float64
	NatureDamageDealtMultiplier   float64
	ShadowDamageDealtMultiplier   float64

	// Modifiers for spells with the SpellFlagAgentReserved1 flag set.
	BonusCritRatingAgentReserved1       float64
	AgentReserved1DamageDealtMultiplier float64

	CanBlock bool
	CanParry bool
	CanCrush bool

	ParryHaste bool

	ReducedCritTakenChance float64 // Reduces chance to be crit.

	BonusMeleeAttackPower  float64 // Imp Hunters mark, EW
	BonusRangedAttackPower float64 // Hunters mark, EW
	BonusCritRating        float64 // Imp Judgement of the Crusader
	BonusFrostCritRating   float64 // Winter's Chill
	BonusMeleeHitRating    float64 // Imp FF

	BonusDamageTaken         float64 // Blessing of Sanctuary
	BonusPhysicalDamageTaken float64 // Hemo, Gift of Arthas, etc
	BonusHolyDamageTaken     float64 // Judgement of the Crusader

	DamageTakenMultiplier float64 // All damage

	PhysicalDamageTakenMultiplier float64
	ArcaneDamageTakenMultiplier   float64
	FireDamageTakenMultiplier     float64
	FrostDamageTakenMultiplier    float64
	HolyDamageTakenMultiplier     float64
	NatureDamageTakenMultiplier   float64
	ShadowDamageTakenMultiplier   float64

	PeriodicPhysicalDamageTakenMultiplier float64
}

func NewPseudoStats

func NewPseudoStats() PseudoStats

type Stat

type Stat byte
const (
	Strength Stat = iota
	Agility
	Stamina
	Intellect
	Spirit
	SpellPower
	HealingPower
	ArcaneSpellPower
	FireSpellPower
	FrostSpellPower
	HolySpellPower
	NatureSpellPower
	ShadowSpellPower
	MP5
	SpellHit
	SpellCrit
	SpellHaste
	SpellPenetration
	AttackPower
	MeleeHit
	MeleeCrit
	MeleeHaste
	ArmorPenetration
	Expertise
	Mana
	Energy
	Rage
	Armor
	RangedAttackPower
	Defense
	Block
	BlockValue
	Dodge
	Parry
	Resilience
	Health
	ArcaneResistance
	FireResistance
	FrostResistance
	NatureResistance
	ShadowResistance
	FeralAttackPower

	Len
)

Use internal representation instead of proto.Stat so we can add functions and use 'byte' as the data type.

This needs to stay synced with proto.Stat.

func ProtoArrayToStatsList

func ProtoArrayToStatsList(protoStats []proto.Stat) []Stat

func (Stat) StatName

func (s Stat) StatName() string

type StatDependency

type StatDependency struct {
	// The stat which will be used to control the amount of increase.
	SourceStat Stat

	// The stat which will be modified, depending on the value of SourceStat.
	ModifiedStat Stat

	// Applies the stat modification.
	Modifier StatModifier
}

Represents a dependency between two stats, whereby the value of one stat modifies the value of the other.

For example, many casters have a talent to increase their spell power by a percentage of their intellect.

type StatDependencyManager

type StatDependencyManager struct {
	// contains filtered or unexported fields
}

func (*StatDependencyManager) AddStatDependency

func (sdm *StatDependencyManager) AddStatDependency(dep StatDependency)

func (*StatDependencyManager) ApplyStatDependencies

func (sdm *StatDependencyManager) ApplyStatDependencies(stats Stats) Stats

Applies all stat dependencies and returns the new Stats.

func (*StatDependencyManager) Finalize

func (sdm *StatDependencyManager) Finalize()

func (*StatDependencyManager) Sort

func (sdm *StatDependencyManager) Sort()

Populates sortedDeps. Panics if there are any dependency cycles. TODO: Figure out if we need to separate additive / multiplicative dependencies.

func (*StatDependencyManager) SortAndApplyStatDependencies

func (sdm *StatDependencyManager) SortAndApplyStatDependencies(stats Stats) Stats

type StatModifier

type StatModifier func(sourceValue float64, modValue float64) float64

Given the current values for source and mod stats, should return the new value for the mod stat.

type Stats

type Stats [Len]float64

func FromFloatArray

func FromFloatArray(values []float64) Stats

func (Stats) Add

func (stats Stats) Add(other Stats) Stats

Adds two Stats together, returning the new Stats.

func (Stats) DotProduct

func (stats Stats) DotProduct(other Stats) Stats

Multiplies two Stats together by multiplying the values of corresponding stats, like a dot product operation.

func (Stats) Equals

func (stats Stats) Equals(other Stats) bool

func (Stats) EqualsWithTolerance

func (stats Stats) EqualsWithTolerance(other Stats, tolerance float64) bool

func (Stats) FlatString

func (stats Stats) FlatString() string

Like String() but without the newlines.

func (Stats) Multiply

func (stats Stats) Multiply(multiplier float64) Stats

func (Stats) String

func (stats Stats) String() string

func (Stats) Subtract

func (stats Stats) Subtract(other Stats) Stats

Subtracts another Stats from this one, returning the new Stats.

func (Stats) ToFloatArray

func (stats Stats) ToFloatArray() []float64

Jump to

Keyboard shortcuts

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