stats

package
v0.1.80 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PseudoStatsLen = len(proto.PseudoStat_name)
View Source
var UnitStatsLen = int(Len) + PseudoStatsLen

Functions

func NewSchoolFloatArray added in v0.1.1

func NewSchoolFloatArray() [SchoolLen]float64

Types

type Bonuses

type Bonuses struct {
	Multiplier float64          // multiplier added to all stat gains from this stat.
	Deps       map[Stat]float64 // multiplier added to Stat when this stat is changed.
}

Bonuses for a single stat

type PseudoStats

type PseudoStats struct {
	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

	BonusMHDps     float64
	BonusOHDps     float64
	BonusRangedDps float64

	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.

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

	DamageDealtMultiplier       float64            // All damage
	SchoolDamageDealtMultiplier [SchoolLen]float64 // For specific spell schools (arcane, fire, shadow, etc).

	// Treat melee haste as a pseudostat so that shamans, death knights, paladins, and druids can get the correct scaling
	MeleeHasteRatingPerHastePercent float64

	// Important when unit is attacker or target
	BlockValueMultiplier float64

	// Only used for NPCs, governs variance in enemy auto-attack damage
	DamageSpread float64

	CanBlock bool
	CanParry bool
	Stunned  bool // prevents blocks, dodges, and parries

	ParryHaste bool

	// Avoidance % not affected by Diminishing Returns
	BaseDodge float64
	BaseParry float64

	ReducedCritTakenChance float64 // Reduces chance to be crit.

	BonusRangedAttackPowerTaken float64 // Hunters mark
	BonusSpellCritRatingTaken   float64 // Imp Shadow Bolt / Imp Scorch / Winter's Chill debuff
	BonusCritRatingTaken        float64 // Totem of Wrath / Master Poisoner / Heart of the Crusader
	BonusMeleeHitRatingTaken    float64 // Formerly Imp FF and SW Radiance;
	BonusSpellHitRatingTaken    float64 // Imp FF

	BonusPhysicalDamageTaken float64 // Hemo, Gift of Arthas, etc
	BonusHealingTaken        float64 // Talisman of Troll Divinity

	DamageTakenMultiplier       float64            // All damage
	SchoolDamageTakenMultiplier [SchoolLen]float64 // For specific spell schools (arcane, fire, shadow, etc.)

	DiseaseDamageTakenMultiplier          float64
	PeriodicPhysicalDamageTakenMultiplier float64

	ArmorMultiplier float64 // Major/minor/special multiplicative armor modifiers

	ReducedPhysicalHitTakenChance float64
	ReducedArcaneHitTakenChance   float64
	ReducedFireHitTakenChance     float64
	ReducedFrostHitTakenChance    float64
	ReducedNatureHitTakenChance   float64
	ReducedShadowHitTakenChance   float64

	HealingTakenMultiplier float64
}

func NewPseudoStats

func NewPseudoStats() PseudoStats

type SchoolIndex added in v0.1.1

type SchoolIndex byte
const (
	SchoolIndexNone     SchoolIndex = 0
	SchoolIndexPhysical SchoolIndex = iota
	SchoolIndexArcane
	SchoolIndexFire
	SchoolIndexFrost
	SchoolIndexHoly
	SchoolIndexNature
	SchoolIndexShadow

	SchoolLen
)

type Stat

type Stat byte
const (
	Strength Stat = iota
	Agility
	Stamina
	Intellect
	Spirit
	SpellPower
	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
	BonusArmor
	RunicPower
	BloodRune
	FrostRune
	UnholyRune
	DeathRune

	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 {
	// contains filtered or unexported fields
}

func (StatDependency) String

func (sd StatDependency) String() string

type StatDependencyManager

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

Manages dependencies between stats.

Some examples: Increases your AP by 30% of your Int Increases agility by X% Reduces armor by 50%

func NewStatDependencyManager

func NewStatDependencyManager() StatDependencyManager

func (*StatDependencyManager) AddStatDependency

func (sdm *StatDependencyManager) AddStatDependency(src Stat, dst Stat, amount float64)

func (*StatDependencyManager) ApplyStatDependencies

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

func (*StatDependencyManager) DisableDynamicStatDep

func (sdm *StatDependencyManager) DisableDynamicStatDep(dep *StatDependency) bool

Returns whether the state changed.

func (*StatDependencyManager) EnableDynamicStatDep

func (sdm *StatDependencyManager) EnableDynamicStatDep(dep *StatDependency) bool

Returns whether the state changed.

func (*StatDependencyManager) FinalizeStatDeps

func (sdm *StatDependencyManager) FinalizeStatDeps()

func (*StatDependencyManager) IsFinalized

func (sdm *StatDependencyManager) IsFinalized() bool

func (*StatDependencyManager) MultiplyStat

func (sdm *StatDependencyManager) MultiplyStat(s Stat, amount float64)

func (*StatDependencyManager) NewDynamicMultiplyStat

func (sdm *StatDependencyManager) NewDynamicMultiplyStat(s Stat, amount float64) *StatDependency

func (*StatDependencyManager) NewDynamicStatDependency

func (sdm *StatDependencyManager) NewDynamicStatDependency(src Stat, dst Stat, amount float64) *StatDependency

func (*StatDependencyManager) ResetStatDeps

func (sdm *StatDependencyManager) ResetStatDeps()

func (*StatDependencyManager) SortAndApplyStatDependencies

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

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) AddInplace added in v0.1.48

func (stats *Stats) AddInplace(other *Stats)

Adds another to Stats to this, in-place. For performance, only.

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) Invert added in v0.1.52

func (stats Stats) Invert() Stats

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

type UnitStat added in v0.1.8

type UnitStat int

func UnitStatFromIdx added in v0.1.8

func UnitStatFromIdx(s int) UnitStat

func UnitStatFromPseudoStat added in v0.1.8

func UnitStatFromPseudoStat(s proto.PseudoStat) UnitStat

func UnitStatFromStat added in v0.1.8

func UnitStatFromStat(s Stat) UnitStat

func (UnitStat) AddToStatsProto added in v0.1.8

func (s UnitStat) AddToStatsProto(p *proto.UnitStats, value float64)

func (UnitStat) EqualsPseudoStat added in v0.1.8

func (s UnitStat) EqualsPseudoStat(other proto.PseudoStat) bool

func (UnitStat) EqualsStat added in v0.1.8

func (s UnitStat) EqualsStat(other Stat) bool

func (UnitStat) IsPseudoStat added in v0.1.8

func (s UnitStat) IsPseudoStat() bool

func (UnitStat) IsStat added in v0.1.8

func (s UnitStat) IsStat() bool

func (UnitStat) PseudoStatIdx added in v0.1.8

func (s UnitStat) PseudoStatIdx() int

func (UnitStat) StatIdx added in v0.1.8

func (s UnitStat) StatIdx() int

Jump to

Keyboard shortcuts

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