Documentation ¶
Index ¶
- Variables
- func NewSchoolFloatArray() [SchoolLen]float64
- type Bonuses
- type PseudoStats
- type SchoolIndex
- type Stat
- type StatDependency
- type StatDependencyManager
- func (sdm *StatDependencyManager) AddStatDependency(src Stat, dst Stat, amount float64)
- func (sdm *StatDependencyManager) ApplyStatDependencies(s Stats) Stats
- func (sdm *StatDependencyManager) DisableDynamicStatDep(dep *StatDependency) bool
- func (sdm *StatDependencyManager) EnableDynamicStatDep(dep *StatDependency) bool
- func (sdm *StatDependencyManager) FinalizeStatDeps()
- func (sdm *StatDependencyManager) IsFinalized() bool
- func (sdm *StatDependencyManager) MultiplyStat(s Stat, amount float64)
- func (sdm *StatDependencyManager) NewDynamicMultiplyStat(s Stat, amount float64) *StatDependency
- func (sdm *StatDependencyManager) NewDynamicStatDependency(src Stat, dst Stat, amount float64) *StatDependency
- func (sdm *StatDependencyManager) ResetStatDeps()
- func (sdm *StatDependencyManager) SortAndApplyStatDependencies(s Stats) Stats
- type Stats
- func (stats Stats) Add(other Stats) Stats
- func (stats *Stats) AddInplace(other *Stats)
- func (stats Stats) DotProduct(other Stats) Stats
- func (stats Stats) Equals(other Stats) bool
- func (stats Stats) EqualsWithTolerance(other Stats, tolerance float64) bool
- func (stats Stats) FlatString() string
- func (stats Stats) Floor() Stats
- func (stats Stats) GetHighestStatType(statTypeOptions []Stat) Stat
- func (stats Stats) Invert() Stats
- func (stats Stats) Multiply(multiplier float64) Stats
- func (stats Stats) String() string
- func (stats Stats) Subtract(other Stats) Stats
- func (stats Stats) ToProtoArray() []float64
- type UnitStat
- func (s UnitStat) AddToStatsProto(p *proto.UnitStats, value float64)
- func (s UnitStat) EqualsPseudoStat(other proto.PseudoStat) bool
- func (s UnitStat) EqualsStat(other Stat) bool
- func (s UnitStat) IsPseudoStat() bool
- func (s UnitStat) IsStat() bool
- func (s UnitStat) PseudoStatIdx() int
- func (s UnitStat) StatIdx() int
Constants ¶
This section is empty.
Variables ¶
var ProtoStatsLen = len(proto.Stat_name)
var PseudoStatsLen = len(proto.PseudoStat_name)
var UnitStatsLen = ProtoStatsLen + PseudoStatsLen
Functions ¶
func NewSchoolFloatArray ¶
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 SpiritRegenRateCombat float64 // percentage of spirit regen allowed during combat // 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). DotDamageMultiplierAdditive float64 // All periodic damage // Important when unit is attacker or target BlockDamageReduction 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, represented as // probabilities (between 0 and 1). BaseDodgeChance float64 BaseParryChance float64 ReducedCritTakenChance float64 // Reduces chance to be crit. BonusRangedAttackPowerTaken float64 // Hunters mark BonusSpellCritPercentTaken float64 // Imp Shadow Bolt / Imp Scorch / Winter's Chill debuff 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 MovementSpeedMultiplier float64 // Multiplier for movement speed, default to 1. Player base movement 7 yards/s. All effects affecting movements are multipliers. }
func NewPseudoStats ¶
func NewPseudoStats() PseudoStats
type SchoolIndex ¶
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 HitRating CritRating HasteRating ExpertiseRating DodgeRating ParryRating MasteryRating AttackPower RangedAttackPower SpellPower SpellPenetration ResilienceRating ArcaneResistance FireResistance FrostResistance NatureResistance ShadowResistance Armor BonusArmor Health Mana MP5 // The remaining stats below are stored as PseudoStats rather than as // Stats in UnitStats proto messages, since they are not required in the // database files. However, it is valuable to keep these as proper Stats // in the back-end, since they are used in various stat dependencies. // The units for all 5 of these are percentages (between 0 and 100). PhysicalHitPercent SpellHitPercent PhysicalCritPercent SpellCritPercent BlockPercent SimStatsLen )
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: it is okay for SimStatsLen to exceed ProtoStatsLen, but the shared indices between the two must match 1:1 .
func ProtoArrayToStatsList ¶
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 [SimStatsLen]float64
func FromProtoArray ¶ added in v0.0.62
func FromUnitStatsProto ¶ added in v0.0.62
Runs FromProtoArray() on the stats array embedded in the UnitStats message, but additionally imports any PseudoStats that we want to model as proper Stats in the back-end. This allows us to include only essential basic properties in database stats arrays, while still letting the back-end Stat enum include derived properties when it is computationally convenient to do so (such as for automatically applying stat dependencies). Make sure to update this function if you add any back-end Stat entries that are modeled as PseudoStats in the front-end.
func (*Stats) AddInplace ¶
Adds another to Stats to this, in-place. For performance, only.
func (Stats) DotProduct ¶
Multiplies two Stats together by multiplying the values of corresponding stats, like a dot product operation.
func (Stats) EqualsWithTolerance ¶
func (Stats) FlatString ¶
Like String() but without the newlines.
func (Stats) Floor ¶ added in v0.0.23
Rounds all stat values down to the nearest integer, returning the new Stats. Used for random suffix stats currently.
func (Stats) GetHighestStatType ¶ added in v0.0.62
Given an array of Stat types, return the Stat whose value is largest within this Stats array.
func (Stats) ToProtoArray ¶ added in v0.0.62
type UnitStat ¶
type UnitStat int
func UnitStatFromIdx ¶
func UnitStatFromPseudoStat ¶
func UnitStatFromPseudoStat(s proto.PseudoStat) UnitStat
func UnitStatFromStat ¶
func (UnitStat) AddToStatsProto ¶
func (UnitStat) EqualsPseudoStat ¶
func (s UnitStat) EqualsPseudoStat(other proto.PseudoStat) bool