spelldata

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package spelldata is the game files' spell rows as the sim reads them: one Spell per spell ID, with its effects and power costs, and accessors that turn the game files' units into core's.

Values are stored in the units the game files state them in - a percentage is the integer 16, rage is on a 0-1000 bar, times are milliseconds - and the conversion happens in the accessors, so a row always matches what the DBC says.

Every accessor answers on the zero value, so Nil and NilEffect are safe to chain: an unknown spell reads as zeroes rather than crashing the registration that asked for it.

sim/core must never import this package: tools/database imports core, and a cycle there would stop the generator that writes this package's data.

Index

Examples

Constants

View Source
const ReasonPPMHearsNoWeaponHits = "a procs-per-minute rate hears no weapon hits in this mask"
View Source
const ReasonStatesNoRate = "states no rate"

The reason given for a proc whose rows state no rate, which the generator also gives where the rows' rate is a sentinel its tooltip contradicts.

Variables

View Source
var Nil = &Spell{}

What an unknown spell and an out-of-range effect answer with: every accessor reads zero off them, so a caller can chain through a spell the store does not carry. Both are shared by every caller that lands on them, so neither may be written through.

View Source
var NilEffect = &Effect{}

The haste pseudo stats each attack or cast speed aura adds its percent to: a raise of the caster's speeds, or a slow of an enemy's where the percent is negative. Unlike ranged hit and crit, ranged haste is not a total including melee: the sim applies melee, ranged and cast speed each on its own.

Functions

func AppliesAura

func AppliesAura(t dbcenums.SpellEffectType) bool

The effect types that put an aura on someone: the plain application and the area auras, which carry the same aura and misc values.

func AreaTypeOfGroup

func AreaTypeOfGroup(group int32) proto.AreaType

func ArmorNoModsStats

func ArmorNoModsStats(mask int32) []stats.Stat

The stats an A_MOD_ARMOR_NO_MODS mask names: ArmorNoMods for school 1 alone, nothing for any other mask. The item generator reads the aura's armor by the same rule.

func AttachChargeSpender

func AttachChargeSpender(character *core.Character, buff *core.Aura, s *Spell, name string, opts ...ProcOpt) core.ProcTrigger

Attaches to a charged buff the listener that spends its charges, as the buff's row states it, and returns that listener. A cast spends one charge however many targets it hits. The spells that spend one are the ones the row's proc effect names; a row whose proc effect names none states them on its spell modifiers instead, and the charge goes to the spells the buff modifies. An option that sets the trigger to CallbackOnCastComplete spends the charge as the cast completes, once its hits have rolled, so no spell landing after it takes the charge. A condition an option sets narrows the spells that spend it, and a hit it turns away marks no channel. A charge gained while a channel the class flags name is running is still kept for that channel's end.

A channel is one cast for a buff whose row names its spells by class flags: the charge stays up for every tick and every target, and is spent when the channel ends. A channel the buff's class flags name spends it once the channel has started, even when its cast lands nothing itself, and so does one already running when the charge comes. A listener on the cast counts a channeled cast as the channel only while the channel runs, so one that starts none spends the charge like any other cast. A tick that is a proc the row cannot proc from is not heard, so a channel of such ticks the class flags do not name leaves the charge up. Wand Shoot is no such channel: each shot spends a charge like any hit, and so do other hits while wanding. A buff whose row names no spells keeps nothing for a channel: the first hit it hears spends the charge as it lands, a channel's missile included (EV-0162). TODO: For a buff that names its spells, a tick that lands after its channel ends, a missile still in flight, misses the charge. For one that names none, a missile in flight when a crit spends the charge keeps the crit it rolled with the buff up.

func AuraConfig

func AuraConfig(s *Spell, opts ...AuraOpt) core.Aura

What the game files state about a spell's aura. The caller adds the callbacks and anything the game files do not carry to the returned value before registering it.

A row that states no duration resolves to one of 0, which core refuses to activate: such an aura needs Permanent() or a duration of the caller's.

Example

The aura's duration and stack count are the row's. Lightning Shield states charges rather than cumulative stacks, and the sim keeps both in one field.

aura := AuraConfig(MustFind(324))
fmt.Println(aura.Label, aura.Duration, aura.MaxStacks)
Output:
Lightning Shield 10m0s 3

func CarriesProcClassMask

func CarriesProcClassMask(aura dbcenums.EffectAuraType) bool

Whether an effect of this aura kind is the proc whose class mask narrows the listener: a trigger, a copied trigger or a dummy the server scripts. The ProcClassMask override writes onto the same effects.

func Cast

func Cast(s *Spell) core.CastConfig

The cast time and global cooldown the row states and whether haste shortens them, without the cooldowns: for a caller that runs the spell on cooldowns of its own.

func DamageDoneStats

func DamageDoneStats(mask int32) []stats.Stat

The stats a flat damage mask names: the sim keeps one stat for physical damage and one for magic, plus a stat per magic school, so a mask of every school is the first two together, a mask of every magic school is the second alone, and any other mask names a stat for each school it states: the Spellstones' 36 is fire and shadow damage. The item generator reads the aura's stats by the same rule.

func DamageShieldHits

func DamageShieldHits(s *Spell) core.ProcMask

The physical hits a row's damage shield answers: the ones its proc flags name, or every one where it states none. Retricutioner's 435901 names the melee swings and abilities taken, so a ranged shot is not reflected; Immolation 21142 and the other passive shields state no flags. The flags say which hits reach the shield and nothing about a roll: a shield answers each of them.

func DamageShieldLockout

func DamageShieldLockout(s *Spell) time.Duration

The time a row's damage shield waits between two reflections: its internal cooldown, or the cooldown the row states where it has none. Retricutioner's 435901 states 5 s, so a second melee hit inside them is not reflected; the passive shields state none and answer every hit.

func DotConfig

func DotConfig(s *Spell, e *Effect, opts ...AuraOpt) core.DotConfig

What the game files state about a periodic effect of a spell, as the dot core registers. The ticks are the row's duration over the effect's period. The default OnTick deals one roll of the effect at the caster's level (its Average where it states no spread), on the stats and multipliers in force at the tick; a caller replaces OnTick for a heal or a value the game files do not state. OnSnapshot is nil.

The tick rolls no hit (TickOutcome): a dot's hit is rolled once, by the cast or proc that applies it, so a caller whose application rolls none rolls it there.

The aura's duration is the row's, which core recomputes from the ticks on every application.

A ranked row's dot joins the rank group of its name with the row's rank, so a caster keeps one rank of it on a unit, and its aura carries the ranked name unless an option labels it. A lower rank's periodic stays off while a higher rank is up; the row's CastRequirement decides whether the cast itself is refused.

func EffectsOn

func EffectsOn(s *Spell, target AuraTarget) []int32

The positions, counted from 1 the way Effects counts, of the row's aura effects that land on the target.

func EnchantAuraUnsupported

func EnchantAuraUnsupported(trigger *Spell) []string

The same for an enchant's equip aura, whose procs-per-minute rate rolls on weapon hits only: the sim never procs one from a spell or a heal.

func IsBookRank

func IsBookRank(id int32) bool

func ItemAuraParsedOn

func ItemAuraParsedOn(s *Spell, target AuraTarget) []int32

The positions of the row's aura effects on the target that an item's aura shape parses: the ones EffectsOn names, less the auras it leaves out and, on the wearer, the damage shields it attaches beside the parse.

func ItemAuraUnsupported

func ItemAuraUnsupported(s *Spell, equipped bool) []string

What an item's aura shape leaves out of a row, one reason per effect: an effect that is not an aura, one landing on a unit the shape does not reach, and one the parser skips on the unit it lands on; and a row restricted to an area group that names no area type. Empty means every effect of the row is attached or left out on purpose: a movement speed change is dropped, and a damage shield on the wearer is attached by hand. An equipped row is parsed the way ParseStatic parses it, onto the wearer and its pets; any other is an aura applied for the row's duration.

The parser answers by parsing: each target's effects are parsed onto a character of its own that nothing else reads, so the generator and the sim make the same decision.

func ItemProcUnsupportedWithRate

func ItemProcUnsupportedWithRate(trigger *Spell, isWeaponProc bool, itemPPM float64, lockedFamily int32) []string

What a proc the game files hang on an item, an enchant or a set bonus does not model, as one reason per shape. An empty answer means the rows state enough to build the listener the game files describe.

The one decision, for the generator that writes the registrations and for the sim that resolves them: both read this row, so a proc the generator emits is one the sim can build, and a proc it comments out is one nothing would have heard correctly.

A class's own spell states a class mask to narrow its listener to spells the caster really casts; an item is worn by every class, so a class mask on its trigger is the filter of the one class it was written for and names nothing the sim can reproduce. An item proc therefore has no character to weigh the mask against.

itemPPM is the procs-per-minute rate a weapon's item effect states, which answers a trigger whose row states none; 0 where the item states no rate.

lockedFamily is the class family of a relic, an idol, libram or totem one class alone wields: a class mask under that family is the relic's own lock on its spells, which the listener reads the way a class spell's is read, so it is no reason to refuse as long as it names a spell of the family. Idol of Longevity's 28847 names Healing Touch under the druid family. 0 on any other item.

func MobTypes

func MobTypes(mask int32) []proto.MobType

The mob types a creature type mask names, as the versus auras' misc value and TargetCreatureType state it: 4 is Demon, 32 Undead.

func PeriodicDamageTick

func PeriodicDamageTick(e *Effect, outcome func(*core.Dot) core.OutcomeApplier) core.OnTick

func ProcTrigger

func ProcTrigger(character *core.Character, s *Spell, handler core.ProcHandler, opts ...ProcOpt) core.ProcTrigger

What the game files state about a proc, as the fields core registers a listener through: what it hears (ProcTypeMask through the decoder, with the row's tooltip hint), how often it fires, its internal cooldown and the attribute-driven gates. The caller adds what the row does not carry - the name and action the sim keys the effect by, the buff the handler applies - to the returned value before handing it to MakeProcTriggerAura. The row's own class flags go on the trigger too, so a SPELLMOD_CHANCE_OF_SUCCESS that names the row reaches its roll, and the character's mods are the ones counted wherever the trigger sits.

The trigger's internal cooldown is the proc category's recovery alone. On a proc trigger row, RecoveryTime is a cooldown on casting the aura, which an item or enchant never casts: the shield spikes state 5 s there and proc on every block in game (EV-0047, EV-0148). A damage shield is no proc trigger and keeps its RecoveryTime as the wait between two reflections (DamageShieldLockout).

ProcCharges is not a property of the trigger: it is how many times the buff acts before it drops, which AuraConfig reads as the aura's MaxStacks.

The character is needed for the procs-per-minute managers, which are bound to the weapon carrying them, so a trigger is built where the sim has a character rather than at package init.

func RangedBitsOnly

func RangedBitsOnly(mask int32) bool

Whether a combat rating mask holds ranged bits and no other.

func RatingStats

func RatingStats(mask int32) []stats.Stat

The ratings a combat rating mask names, read bit by bit, so a mask naming several ratings gives each of them. One rating feeds melee, ranged and spells alike, so its melee and spell bits name the same stat. The ranged bits are not read: beside the melee or spell bit of the same rating they add nothing, and a mask of them alone is a ranged row, which ScopedRatingStats reads.

func RequiredHand

func RequiredHand(s *Spell) core.ProcMask

The hand ATTR_EX_3_REQ_MAIN_HAND and ATTR_EX_3_REQ_OFF_HAND name, as a melee proc mask.

func Scaled

func Scaled(amount float64, mod *Effect) float64

An improving talent's modifier on an amount, truncated the way the game resolves one: a percentage of it, or a flat addition. An untaken talent is NilEffect, which adds nothing.

func ScopedRatingStats

func ScopedRatingStats(mask int32) []stats.Stat

The ratings a scoped A_MOD_RATING mask names, its ranged bits read as the rating they belong to. The aura parse turns the hit and crit among them into mods, and the item fold turns the hit, crit and haste of a mask of ranged bits alone into the ranged percents.

func SetBonusUnsupported

func SetBonusUnsupported(s *Spell) []string

What a set bonus aura leaves out of a row, one reason per effect: an effect that is not an aura or lands on anyone but the wearer, and one the parser skips; and a row restricted to an area group, which the set bonus does not check. Empty means the row parses whole onto the set bonus aura, as shared.ParsedSetBonus parses it. That parse puts every aura effect on the wearer, so an effect meant for a pet is refused here.

func SpellConfig

func SpellConfig(unit *core.Unit, s *Spell, opts ...SpellOpt) core.SpellConfig

What the game files state about a spell, as the fields core registers it through. The caller adds the proc mask, ApplyEffects and anything the game files do not carry to the returned value before handing it to RegisterSpell: the resolver fills the row's own fields and nothing else.

The unit is needed for the cooldown timers, so a config is built where the sim has a character, not at package init. MaxTargets has no SpellConfig field; a caller that needs the row's cap reads s.MaxTargets itself.

Example

What the row fills in a spell config, before the caller adds the effects and the flags the game files do not state.

config := SpellConfig(&core.Unit{}, MustFind(116), Magic(core.ProcMaskSpellDamage))

fmt.Println(config.ActionID.SpellID, config.Rank, config.ManaCost.FlatCost)
fmt.Println(config.Cast.DefaultCast.CastTime, config.Cast.DefaultCast.GCD)
fmt.Printf("%.3f\n", config.BonusCoefficient)
Output:
116 1 25
1.5s 1.5s
0.407

func TargetsAnEnemy

func TargetsAnEnemy(target dbcenums.ImplicitTarget) bool

Whether the implicit target names an enemy unit, or a point or area chosen on one.

func VersusBonus

func VersusBonus(aura dbcenums.EffectAuraType, amount float64) stats.Stats

Each stat a versus aura grants, at the amount; none when the aura is no versus aura.

func VersusStats

func VersusStats(aura dbcenums.EffectAuraType) []stats.Stat

The stats a versus aura grants; none when the aura is no versus aura.

func WeaponBindable

func WeaponBindable(aura dbcenums.EffectAuraType) bool

Whether the aura is a hit, crit, rating, damage done, spell hit or threat aura, the ones WeaponScope can bind to a weapon.

func WeaponDamageSchools

func WeaponDamageSchools(s *Spell, e *Effect) core.SpellSchool

The schools a melee weapon's while-equipped damage done row gives as a school multiplier: its Physical, or every school of its mask when its aura reaches beyond its weapon. The other schools take the percent on their melee-defense spells.

func WeaponSkillOfLine

func WeaponSkillOfLine(line int32) (proto.WeaponSkill, bool)

The weapon skill an A_MOD_SKILL effect on the skill line raises; false for a line that is no weapon skill.

Types

type Applied

type Applied struct {
	Effect *Effect
	Kind   string
	Value  float64
}

One attachment the parse made, or one part of an attachment that has parts, for a log or a test: the effect it came from, the sim kind it became and the value it carries in the sim's own units. A time value is stated in milliseconds, and a multiplier as the factor itself.

type AuraOpt

type AuraOpt func(*core.Aura)

An addition to the resolved aura for what the game files do not state: the label the sim keys the aura by and the callbacks it acts through.

func Label

func Label(label string) AuraOpt

Two auras of the same spell on one unit need labels of their own.

func Permanent

func Permanent() AuraOpt

An aura that is up for the whole iteration, whatever duration the row states.

func RankLabel

func RankLabel(s *Spell, owner *core.Unit) AuraOpt

Ranks of one spell registered side by side need an aura each: ranks that share the spell's name share one aura on the unit, and a cast of one rank then runs every rank's callbacks. The owner's label keeps two casters' debuffs on one target apart.

type AuraTarget

type AuraTarget uint8

The unit an item's aura effect lands on.

const (
	AuraOnWearer AuraTarget = iota + 1
	AuraOnPet
	AuraOnEnemy
)

type Effect

type Effect struct {
	ID, SpellID int32

	// SpellEffect.EffectIndex, the game files' own numbering. EffectN indexes by position instead.
	Index uint8

	Type dbcenums.SpellEffectType
	Aura dbcenums.EffectAuraType

	// EffectBasePointsF as the game files state it, which is a percentage as an integer and rage on a
	// 0-1000 bar. Average() adds the per-level scaling on top.
	BasePoints float64

	// EffectRealPointsPerLevel: what the effect gains for each level between the spell's BaseLevel and
	// the caster's.
	PPL float64

	// The owning spell's SpellLevels, copied onto the effect at generation: Average() prices the
	// per-level gain off them, and reading them here rather than looking the owner up in the store
	// keeps the answer the same for an effect whose spell the store does not carry.
	BaseLevel, MaxLevel int16

	// EffectVariance, the full width of the roll: a spell-school hit or a heal lands within
	// Variance/2 of its whole amount, power included (DirectVariance); any other effect rolls
	// |BasePoints| * Variance/2 either side of the base points, a physical hit rounded to a whole
	// number, plus the per-level gain (Min, Max). Zero on an effect that does not roll.
	Variance float64

	// EffectBonusCoefficient and BonusCoefficientFromAP: the share of spell power and attack power the
	// effect adds.
	SPCoef float64
	APCoef float64

	// EffectPvpMultiplier.
	PvpMult float32

	// EffectAmplitude and EffectAuraPeriod, the tick interval in ms.
	Amplitude float32
	PeriodMs  int32

	// SpellRadius through EffectRadiusIndex_0 or _1, whichever has the larger maximum.
	RadiusMin, RadiusMax float32

	// EffectMiscValue_0/_1. What they mean is the aura's business: a stat for A_MOD_STAT, a stat
	// mask in the second for A_MOD_TOTAL_STAT_PERCENTAGE (TotalStatPercentStats reads it), a school
	// mask for A_MOD_DAMAGE_DONE, a modifier op for A_ADD_PCT_MODIFIER.
	Misc, Misc2 int32

	// EffectSpellClassMask_0..3 with the owning spell's family: the spells this effect modifies.
	ClassFlags core.ClassFlags

	// EffectTriggerSpell: the spell this effect fires. Trigger() resolves it.
	TriggerID int32

	// EffectChainTargets and EffectChainAmplitude: how far a chain jumps and what each jump keeps.
	ChainTargets int16
	ChainAmp     float32

	// EffectMechanic.
	Mechanic dbcenums.Mechanic

	// EffectPointsPerResource: what the amount gains per point of the resource spent.
	PointsPerResource float32

	// ImplicitTarget_0/_1.
	Target [2]dbcenums.ImplicitTarget

	// EffectAttributes.
	Attributes int32
}

One SpellEffect row.

func ItemAuraDamageShields

func ItemAuraDamageShields(s *Spell) []*Effect

The damage shields the row puts on the wearer, which an item's aura shape attaches to the wearer's aura rather than parsing.

func (*Effect) APCoeff

func (e *Effect) APCoeff() float64

func (*Effect) ArmorNoMods

func (e *Effect) ArmorNoMods() bool

Whether the effect states armor alone with A_MOD_ARMOR_NO_MODS.

func (*Effect) AuraTarget

func (e *Effect) AuraTarget() AuraTarget

Where the effect's aura lands, or 0 for an implicit target an item's aura does not reach. Any enemy target is the enemy the item answers or is used on.

func (*Effect) Average

func (e *Effect) Average() float64

Average, Min, Max, Mean and Roll read the sim's character level; the At forms take one.

func (*Effect) AverageAt

func (e *Effect) AverageAt(level int32) float64

The amount at a caster level: the base points plus the per-level gain over the spell's BaseLevel, stopping at the level the spell stops scaling at. Both levels are the owning spell's, stamped onto the effect at generation, so an effect answers the same amount however the caller reached it.

The base keeps the game files' own EffectBasePointsF, which is fractional on about one effect in 55, and the per-level gain is added on top of the fraction.

A damage or heal amount keeps the fraction: in game the amount dealt rounds up with a chance equal to the fraction of the whole amount, power and multipliers included, so it averages the exact value (EV-0095). Every other amount, a stat, a resource, an absorb or a threat, is the whole number the tooltip shows, the floor.

float32 is load-bearing: EffectRealPointsPerLevel is a float32 widened into the DB (3.79999995231628), and multiplying in float64 moves the result off the tooltip on six rows.

func (*Effect) BaseValue

func (e *Effect) BaseValue() float64

The game files' own number, before any unit the aura gives it.

func (*Effect) ChangesAttackSpeed

func (e *Effect) ChangesAttackSpeed() bool

Whether the effect's speed aura changes the time between melee attacks.

func (*Effect) ChangesCastSpeed

func (e *Effect) ChangesCastSpeed() bool

Whether the effect's speed aura changes cast times.

func (*Effect) Coeff

func (e *Effect) Coeff() float64

func (*Effect) DirectAmount

func (e *Effect) DirectAmount(sim *core.Simulation) float64

The amount to hand CalcDamage or CalcHealing for one cast: the average where core rolls the whole amount (DirectVariance), one roll of the base points otherwise.

func (*Effect) DirectVariance

func (e *Effect) DirectVariance() float64

What core.SpellConfig.DirectVariance takes: the Variance of a spell-school hit or of a heal of any school, which roll their whole amount once power is added; 0 for every other effect.

func (*Effect) FlatStats

func (e *Effect) FlatStats() []stats.Stat

The stats a flat stat or resistance aura adds its amount to, as the parser attaches them: A_MOD_STAT by the game files' stat index, A_MOD_RESISTANCE by its school mask, where armor is school 1. Nil for any other effect.

func (*Effect) HitsACone

func (e *Effect) HitsACone() bool

Whether either of the effect's implicit targets picks the enemies in a cone in front of the caster.

func (*Effect) HitsAnArea

func (e *Effect) HitsAnArea() bool

Whether either of the effect's implicit targets picks the enemies in an area. The area is often the second: Shard of the Fallen Star states TARGET_DEST_TARGET_ENEMY, then TARGET_UNIT_DEST_AREA_ENEMY.

func (*Effect) HitsAnEnemy

func (e *Effect) HitsAnEnemy() bool

Whether either of the effect's implicit targets is an enemy.

func (*Effect) HitsAroundTheCaster

func (e *Effect) HitsAroundTheCaster() bool

Whether the effect picks the enemies in an area centred on the caster: Goblin Sapper Charge's 13241 states TARGET_SRC_CASTER, then TARGET_UNIT_SRC_AREA_ENEMY.

func (*Effect) Max

func (e *Effect) Max() float64

func (*Effect) MaxAt

func (e *Effect) MaxAt(level int32) float64

func (*Effect) Mean

func (e *Effect) Mean() float64

func (*Effect) MeanAt

func (e *Effect) MeanAt(level int32) float64

What a cast averages before power: the average for an effect that does not roll and for a spell-school hit or a heal, whose roll core centres on it; elsewhere the middle of the roll, which can sit half a point off Average.

func (*Effect) Min

func (e *Effect) Min() float64

func (*Effect) MinAt

func (e *Effect) MinAt(level int32) float64

The low end of the roll. EffectVariance spreads the base points, whose ends are rounded to whole numbers, a half to the even one; the per-level gain is added to both, and each end is rounded outward. An effect that does not roll answers the floored amount at both ends. For a spell-school hit or a heal these are the ends the game files state, which core spreads over the whole amount instead (DirectVariance).

func (*Effect) ParsedAura

func (e *Effect) ParsedAura() bool

Whether ParseEffects attaches something for the effect's aura. The skill row reads only Defense, Feral Combat and the weapon skills, so a profession skill is not one. Another row can still refuse one effect by its misc value, which only a parse against a unit finds out.

func (*Effect) Percent

func (e *Effect) Percent() float64

The game files state a percentage as an integer: Improved Righteous Fury reads 16, not 0.16.

func (*Effect) Period

func (e *Effect) Period() time.Duration

EffectAuraPeriod: how long one tick of the aura lasts.

func (*Effect) Roll

func (e *Effect) Roll(sim *core.Simulation) float64

func (*Effect) RollAt

func (e *Effect) RollAt(sim *core.Simulation, level int32) float64

The amount for one cast: rolled where the game files state a spread, the average where they do not. A physical hit spreads its base points by half the Variance and rounds to a whole number; the per-level gain is added after the rounding.

func (*Effect) StatesADamageAmount

func (e *Effect) StatesADamageAmount() bool

Whether the effect deals an amount of damage it states itself, rather than one off a weapon: E_SCHOOL_DAMAGE or E_HEALTH_LEECH.

func (*Effect) Tenths

func (e *Effect) Tenths() float64

The game files state rage on a 0-1000 bar: a -30 cost modifier is 3 rage, Charge's energize of 150 is 15.

func (*Effect) TimeValue

func (e *Effect) TimeValue() time.Duration

The value read as a time, which is the unit a duration or delay modifier states it in.

func (*Effect) TotalStatPercentStats

func (e *Effect) TotalStatPercentStats() []stats.Stat

The stats an A_MOD_TOTAL_STAT_PERCENTAGE effect multiplies. A mask in the second misc value, where there is one, names them, and the first then does not: Heart of the Wild 17003 states 0 and 8, Intellect, and Vitality 29140 states 2 and 5, Strength and Stamina.

func (*Effect) Trigger

func (e *Effect) Trigger() *Spell

The spell this effect fires, or Nil where it fires nothing.

type Ladder

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

A spell's ranks in rank order, whether the game files state them as one spell per rank or as one spell with a curve. Rank 0 is untaken, so the readers below answer 0 there instead of panicking.

Example

A ladder is the ranks of one family in rank order. Rank 0 is untaken and answers Nil, so no "if rank > 0" guard is needed.

frostbolt := Ranked(116, 205, 837)
fmt.Println(frostbolt.Len(), frostbolt.Rank(1).Rank, frostbolt.Highest().Rank)
fmt.Println(frostbolt.Rank(0) == Nil)
Output:
3 Rank 1 Rank 3
true

func Ranked

func Ranked(ids ...int32) Ladder

A ladder of one spell per rank, lowest first. Every id has to be in the store: a rank named by typo has to fail loudly rather than register nothing.

func Talent

func Talent(spellID int32, maxRanks int32) Ladder

A ladder of a trait-tree talent, which is one spell whose per-rank numbers live in a curve. Each rank is a copy of the spell with the curve's value on the effects the curve covers; an effect the curve has no row for keeps the spell's own base value.

func (Ladder) ByID

func (l Ladder) ByID(id int32) *Spell

The rank with this spell id. Panics on an id the ladder does not carry, the way MustFind does on a spell the store does not carry.

func (Ladder) Contains

func (l Ladder) Contains(spell *core.Spell) bool

Whether the spell was registered from one of the ladder's ranks.

func (Ladder) Each

func (l Ladder) Each(fn func(rank int32, s *Spell))

func (Ladder) Effect

func (l Ladder) Effect(aura dbcenums.EffectAuraType, misc int32) LadderEffect

The effect with this aura and misc value, which panics when the rank has two of them.

func (Ladder) EffectAt

func (l Ladder) EffectAt(index int32) LadderEffect

The effect at a position, counted from 1, for the ranks that carry more than one.

func (Ladder) FractionAt

func (l Ladder) FractionAt(rank int32) float64

The game files state a percentage as an integer: 16, not 0.16.

func (Ladder) Highest

func (l Ladder) Highest() *Spell

func (Ladder) Len

func (l Ladder) Len() int32

func (Ladder) MultiplierAt

func (l Ladder) MultiplierAt(rank int32) float64

The sign comes from the data: Improved Righteous Fury states -2/-4/-6, so rank 3 gives 0.94.

func (Ladder) Rank

func (l Ladder) Rank(n int32) *Spell

The spell at a rank. Rank 0 is untaken and answers Nil, as does a rank the ladder does not have.

func (Ladder) TenthsAt

func (l Ladder) TenthsAt(rank int32) float64

The game files state rage on a 0-1000 bar.

func (Ladder) ValueAt

func (l Ladder) ValueAt(rank int32) float64

The rank's only effect, in the game files' units. Rank 0 is untaken and answers 0.

type LadderEffect

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

One named effect across the ladder's ranks.

func (LadderEffect) FractionAt

func (e LadderEffect) FractionAt(rank int32) float64

func (LadderEffect) MultiplierAt

func (e LadderEffect) MultiplierAt(rank int32) float64

func (LadderEffect) TenthsAt

func (e LadderEffect) TenthsAt(rank int32) float64

func (LadderEffect) ValueAt

func (e LadderEffect) ValueAt(rank int32) float64

type ParseOpt

type ParseOpt func(*parseOptions)

How a parse is narrowed: which effects it reads, what gates them and whether their values follow the aura's stacks.

func AllManaRegen

func AllManaRegen() ParseOpt

The row's mana regen percent (A_MOD_POWER_REGEN_PERCENT on mana) is Innervate's multiplier on the unit's mana regen, where the parse otherwise reads it as a Spirit regen multiplier.

func BuffAuras

func BuffAuras() ParseOpt

The rows only a raid buff reads, on top of the table: see buffAuraTable.

func Conditional

func Conditional(fn func() bool) ParseOpt

A condition every attachment is gated on, beyond the aura being up: it is read when the aura is gained and whenever the caller calls Refresh, and nothing is active while it answers false.

func Count

func Count(n float64) ParseOpt

The amounts are counted n times over, for one aura that stands for several sources of it. A multiplier cannot be counted, so those rows are skipped the way a stacking row skips them.

func Effects

func Effects(idx ...int32) ParseOpt

Only these effects, counted from 1 by position the way EffectN counts.

func Exclusive

func Exclusive(category string, singleAura bool) ParseOpt

The parse bids under an exclusive category, where only the strongest member applies: a multiplier priced by how far it is from 1, a stat by its size, and a stacking row once per stack. With singleAura everything it attaches bids as a whole, priced at the first attachment, and deactivates the others outright. Without, each stat and pseudo-stat bids alone under category + its key + "Add" or "Mul", so a stronger member holds only the effects of its own kind and the aura keeps the rest.

func ExclusivePerStat

func ExclusivePerStat(category string) ParseOpt

Every stat and pseudo-stat the parse attaches bids alone, under the category name core's own exclusive stat buffs build: category + the stat or PseudoStats field + "Add" or "Mul". An elixir and a scroll of the same stat compete that way. The stacks are not followed.

func FromCaster

func FromCaster(caster *core.Unit, index, total int) ParseOpt

The unit that put the aura on the unit it sits on, for the rows that reach only that caster's attacks on it: Shadow Weaving's shadow damage, Hemorrhage's Rupture, Winter's Chill's crit. Those rows share one slot, index out of total, in the caster's attack table against the aura's unit: every damage row multiplies into its DamageDoneByCasterExtraMultiplier handler and every crit row adds into its CritChanceByCasterBonus handler, each enabled while any of its rows is up. The class numbers its slots the way it numbers its AttachDDBC calls, one per parse. Without a caster those rows are skipped.

func FullComboPoints

func FullComboPoints() ParseOpt

The finisher at full combo points: an effect the game files state per combo point spent is worth five of them. A parse without it skips an effect whose amount is its per-point value alone.

func IgnoreStacks

func IgnoreStacks() ParseOpt

The values do not follow the aura's stacks, which is what a row that states charges rather than cumulative stacks means.

func Level

func Level(n int32) ParseOpt

The amounts are priced at this level rather than the caster's. A raid's buff or debuff is cast by a player of the sim's own level whatever unit it lands on, and a debuff on a level 63 boss has no character to read that level from.

func OnHand

func OnHand(hand core.ProcMask) ParseOpt

The row sits on the weapon in this hand, so a hit, crit or rating aura bound to a matching weapon reaches that hand's attacks alone and holds while that hand holds one. An aura this hand cannot carry is skipped.

func Overwrites added in v1.0.4

func Overwrites(category string) ParseOpt

Each stat and pseudo-stat the parse attaches also bids under category's per-stat category, as ExclusivePerStat names it, with no effect of its own: a weaker bid there adds nothing while the aura is up, and the aura's stats count by its other bids alone. Arcane Intellect overwrites the elixirs' Intellect that way.

func RaidBuffOptions

func RaidBuffOptions(skip []dbcenums.EffectAuraType, fullComboPoints, allManaRegen bool) []ParseOpt

The options every raid buff and debuff is parsed with: priced at core.CharacterLevel, with the buff table's rows, less the auras skip names, and a finisher at full combo points where fullComboPoints says so, and a mana regen percent read as Innervate's multiplier on the mana regen where allManaRegen says so.

func ScaledBy

func ScaledBy(mod *Effect) ParseOpt

An improving talent's modifier on the amount, truncated the way the game resolves one: a percentage of it for A_ADD_PCT_MODIFIER, a flat addition otherwise. It prices the first effect the table attaches, in the game files' units before the row converts them. An untaken talent is NilEffect, which changes nothing.

func ScaledByRanks

func ScaledByRanks(ranks, divisor int32) ParseOpt

The talent's ranks out of divisor, for a talent whose tooltip prices the buff as a fraction of the spell's own amount. Every amount the parse attaches is scaled, in the game files' units, and rounded to the nearest whole amount the way the tooltip shows it. Rank 0 changes nothing: the full amount.

func SchoolResistances

func SchoolResistances() ParseOpt

Every flat school resistance the parse attaches bids alone under its school's category, whatever else the parse does with the rest, so that only the strongest source of each school applies. Armor is not a school.

func ShowAsSchoolHit

func ShowAsSchoolHit(schools core.SpellSchool) ParseOpt

The character sheet shows the row's SPELLMOD_RESIST_MISS_CHANCE hit in these schools' hit, from the talents stage on. The row names its spells by class flags, which carry no school, so the caller states the schools its tooltip names, for a talent that reaches the class's main spells of them: Shadow Focus takes core.SpellSchoolShadow. The spells the mod reaches stay the ones the class flags name.

func SkipAuras

func SkipAuras(auras ...dbcenums.EffectAuraType) ParseOpt

No effect of these auras is read, wherever the row states it.

func SkipEffects

func SkipEffects(idx ...int32) ParseOpt

type Parsed

type Parsed struct {
	Applied []Applied
	Skipped []SkippedEffect
	// contains filtered or unexported fields
}

What one parse did. Skipped holds the aura effects the table does not know, which are the ones a port still has to wire by hand.

func DryRun

func DryRun(s *Spell, opts ...ParseOpt) *Parsed

What ParseEffects would attach and skip for the row, with nothing registered anywhere: the answer a generator reads before it writes the call. The aura sits on a unit with no character, so the rows that act through a character are skipped. The amounts are priced at core.CharacterLevel unless Level says otherwise.

func ParseEffects

func ParseEffects(character *core.Character, aura *core.Aura, s *Spell, opts ...ParseOpt) *Parsed

Everything the row's aura effects say, attached to an aura: the mods, stat buffs and pseudo-stat multipliers follow the aura's gain and expiry, and their values follow its stacks where the row states cumulative ones.

The effects act on the aura's own unit, and the character is that unit's, for the few rows whose helper lives on a character rather than on a unit. An aura on a unit with no character of its own - a debuff on an enemy - takes a nil character and has those rows skipped and reported.

An aura that is already up when it is parsed is caught up the way core's Attach helpers catch one up, except for the rows that need a Simulation to act: the haste and energy regen multipliers stay off until the aura is applied again. What a category holds waits for the aura's next application too.

func ParseStatic

func ParseStatic(character *core.Character, s *Spell, opts ...ParseOpt) *Parsed

Everything the row's aura effects say, applied to the character now: a talent or a passive, which the game files state as an aura the unit is never without.

func (*Parsed) Refresh

func (p *Parsed) Refresh(sim *core.Simulation)

Reads the condition again and turns the attachments on or off accordingly, for a caller whose condition changed under a parse that is already in place.

func (*Parsed) SkippedNotes

func (p *Parsed) SkippedNotes(s *Spell) []string

What a buff built from row s leaves out, one note per aura effect the parse skipped. An empty answer means every aura effect the row states is attached. A generator reads the notes off DryRun, so a buff it writes is one the sim builds the same way.

func (*Parsed) Stats

func (p *Parsed) Stats() []stats.Stat

The stats the attachments add to or multiply, in effect order.

type Power

type Power struct {
	// SpellPower.PowerType. Rage is on a 0-1000 bar, so PowerCost divides it; the rest are stated in
	// whole points.
	Type dbcenums.PowerType

	// ManaCost and ManaCostPerLevel, in the bar's own units.
	Cost, CostPerLevel int32

	// PowerCostPct: the share of the caster's base the cast takes instead of a flat amount.
	CostPct float32

	// ManaPerSecond, for a channel that drains while it runs.
	PerSecond int32
}

One SpellPower row: what the spell costs and out of which bar.

type ProcChanceSource

type ProcChanceSource uint8

Where the proc's chance is stated, since the ProcChance column alone cannot tell a roll from a condition.

const (
	// ProcChance is the roll: the tooltip renders it as "$h%".
	ProcChanceColumn ProcChanceSource = iota

	// The value of effect ProcChanceEffect is the roll: the tooltip renders it as "$mN%".
	ProcChanceEffectN

	// The column reads 100 or 101 and the tooltip's trigger clause states no chance at all, so the
	// aura fires whenever its condition is met.
	ProcChanceAlways

	// The game files state no chance anywhere, or state 100 or 101 beside a trigger clause saying the
	// effect only sometimes happens, so the rate has to come from an override into RPPM.
	ProcChancePPM
)

type ProcOpt

type ProcOpt func(*core.Character, *core.ProcTrigger)

An addition to the resolved trigger for what the game files do not state, which on a proc is the rate: a row that states none needs one of PPM, ChanceFrom or Chance.

func Chance

func Chance(chance float64) ProcOpt

A rate the caller states outright, which replaces whatever the row said, manager included.

func ChanceFrom

func ChanceFrom(e *Effect) ProcOpt

The chance an effect states, for a $mN the generator could not resolve into ProcChanceEffect.

func ItemProcChance

func ItemProcChance(s *Spell) ProcOpt

The column's chance on an item or enchant proc ItemProcRollsTheColumn picks it for. A rate option that replaces the chance has to come after this one.

func PPM

func PPM(ppm float64) ProcOpt

A hand-supplied rate, for a proc whose real rate lives outside the spell data. It reads the trigger's own proc mask, so an option that narrows the mask has to be given before this one.

func WeaponProc

func WeaponProc() ProcOpt

A weapon proc's listener, which no row states: the game casts a "Chance on hit" effect and a combat enchant off every eligible weapon hit, so the trigger hears them all and the weapon it sits on decides which ones count. A hit that lands is enough, so a special that deals no damage, such as Sunder Armor, rolls it too. The outcome stays what the row's tooltip hint read, and the aura-side proc-ness attribute goes: a weapon proc ignores proc-ness by its own rule. A rate option that reads the mask has to come after this one.

func WeaponSpeedPPM

func WeaponSpeedPPM(ppm float64) ProcOpt

A hand-supplied rate on the main hand's speed as Seal of the Crusader leaves it, through core.NewWeaponSpeedPPMManager. Like PPM, it reads the trigger's proc mask.

type RatingPercent

type RatingPercent struct {
	Stat    stats.Stat
	Percent float64
}

func ScopedRatingPercents

func ScopedRatingPercents(mask int32, v float64) []RatingPercent

The ratings ScopedRatingStats reads, each with the percent v points of it are worth. A rating with no percent of its own is worth 0.

type Reagent

type Reagent struct {
	Item  int32
	Count int16
}

One filled slot of the SpellReagents row: an item the cast consumes, and how many.

type SkippedEffect

type SkippedEffect struct {
	*Effect
	Position int
	Reason   string
}

An aura effect the parse left out, and its position on the row, counted from 1 the way EffectN counts. Reason says why, where the row that refused the effect states one.

type Spell

type Spell struct {
	ID   int32
	Name string

	// Spell.NameSubtext_lang: "Rank 4" on a ranked spell, empty on everything else.
	Rank string

	// SpellMisc.SchoolMask, which core.SpellSchool states in the same bits.
	School core.SpellSchool

	// SpellMisc.Speed: how fast the missile flies, in yards per second, or its flight time in seconds
	// where the row states Fixed Travel Time (FixedTravelTime). Zero, with no MinDuration, hits on cast.
	Speed float32

	// SpellMisc.MinDuration: the shortest the missile flies, in seconds, however close the target.
	MinDuration float32

	// SpellMisc.Attributes_0..16, read through HasAttr and the named accessors in attributes.go.
	Attr [17]uint32

	// SpellLevels: the level the rank is taught at, the level its per-level scaling counts from, and
	// the level that scaling stops at. A spell with no SpellLevels row carries SpellLevel and BaseLevel
	// 60 and MaxLevel 0, which is what the generator writes for "no level scaling", and NoSpellLevels.
	SpellLevel, BaseLevel, MaxLevel int16
	NoSpellLevels                   bool

	// SpellCastTimes.Base through SpellMisc.CastingTimeIndex.
	CastTimeMs int32

	// SpellDuration.Duration through SpellMisc.DurationIndex. -1 is the game files' permanent aura and
	// is kept as it is; Duration() turns it into core.NeverExpires.
	DurationMs int32

	// SpellRange.RangeMin_0 / RangeMax_0. A nonzero minimum is the dead zone on a charge.
	MinRange, MaxRange float32

	// SpellCooldowns.RecoveryTime, CategoryRecoveryTime and StartRecoveryTime. The category cooldown
	// is the shared one Fire Blast and Cone of Cold run off.
	CooldownMs, CategoryCooldownMs, GCDMs int32

	// SpellCategories.Category, StartRecoveryCategory and ChargeCategory.
	Category, StartRecoveryCategory, ChargeCategory int16

	// SpellCategories.DefenseType, DispelType, Mechanic and PreventionType. The game files count
	// defense types none, magic, melee, ranged, which is the order core.DefenseType is declared in.
	DefenseType    core.DefenseType
	DispelType     uint8
	Mechanic       dbcenums.Mechanic
	PreventionType uint8

	// SpellAuraOptions.CumulativeAura: how high the aura stacks. Zero is one application.
	MaxStack int16

	// SpellAuraOptions.ProcChance as the game files state it, which is not always a roll: 100 and 101
	// both read as "fires on its own condition". It is the chance only where ProcChanceSource is
	// ProcChanceColumn; under any other source the column means nothing and the source says where
	// the rate is.
	ProcChance uint8

	// SpellAuraOptions.ProcCharges: how many times the aura acts before it drops. Zero is unlimited.
	ProcCharges int16

	// SpellAuraOptions.ProcTypeMask_0/_1, decoded by the dbcenums.PROC_FLAG_ names.
	ProcFlags [2]uint32

	// SpellAuraOptions.ProcCategoryRecovery: the internal cooldown between two procs, in ms.
	ICDMs int32

	// Procs per minute. The game files carry none - SpellProcsPerMinuteID is 0 on every row - so
	// this is zero unless an override fills it.
	RPPM float32

	// The threat an ability adds beyond its damage, where the tooltip states threat without a
	// number: "causes a high amount of threat". The amounts the game files do state are an E_THREAT
	// effect, so this is zero unless an override fills it.
	FlatThreat float32

	// An area bonus from an override: AreaGroup ids (any counts), amount and duration factors.
	AreaBonusGroups                        []int32
	AreaMultiplier, AreaDurationMultiplier float32

	// A factor against some targets from an override, read through VersusBonus: the effect whose base
	// points are the factor, or a factor of the override's own, and the targets as proto.MobType and
	// proto.CreatureFamily numbers.
	VersusEffectIndex              uint8
	VersusMultiplier               float32
	VersusMobTypes, VersusFamilies []int32

	// SpellClassOptions.SpellClassSet and SpellClassMask_0..3: the set of spells a talent effect
	// naming this family reaches.
	ClassFlags core.ClassFlags

	// SpellInterrupts.InterruptFlags, read through PushedBack.
	InterruptFlags uint32

	// SpellInterrupts.AuraInterruptFlags_0/_1 and ChannelInterruptFlags_0/_1.
	AuraInterrupt, ChannelInterrupt [2]uint32

	// SpellShapeshift.ShapeshiftMask_0 | ShapeshiftMask_1 << 32: the forms the spell is usable in.
	StanceMask uint64

	// SpellShapeshift.ShapeshiftExclude_0 | ShapeshiftExclude_1 << 32: the forms the spell is barred from.
	StanceExclude uint64

	// SpellAuraRestrictions.CasterAuraSpell: the spell id whose aura the caster must carry to cast this one.
	CasterAura int32

	// SpellAuraRestrictions.ExcludeCasterAuraSpell: the spell id whose aura bars the caster from casting this one.
	ExcludeCasterAura int32

	// SpellTargetRestrictions.MaxTargets for an area effect. Zero is unlimited.
	MaxTargets int16

	// SpellTargetRestrictions.TargetCreatureType: the creature types the spell can hit, as a mask of
	// 1 << (CreatureType - 1), so 4 is demons and 256 mechanicals. Zero is any.
	TargetCreatureType int32

	// SpellCastingRequirements.RequiredAreasID. Zero is anywhere.
	RequiredAreas int32

	// SpellEquippedItems: the item class, subclass mask and inventory-type mask the spell requires,
	// which is how a weapon-specific proc states the weapons it fires from.
	EquipClass                  int8
	EquipSubclass, EquipInvType int32

	// SpellLabel.LabelID: the labels a label-keyed modifier aura addresses this spell through.
	Labels []int16

	// The spell IDs the tooltip references ($12966n, $26364s1), in the order they appear. Refs()
	// resolves them.
	RefIDs []int32

	// How the tooltip words the proc, baked in at generation: it is what says whether ProcChance is a
	// roll at all.
	ProcChanceSource ProcChanceSource

	// The effect whose value is the roll, when ProcChanceSource is ProcChanceEffectN, as the
	// position EffectN counts by.
	ProcChanceEffect int8

	// What the tooltip states about the trigger that the proc mask cannot, baked in at generation.
	ProcHint core.ProcHint

	// Whether one roll of the damage is divided evenly among the targets hit, baked in at generation.
	// No column states it; the tooltip reads "split between", "divided up evenly" or "$s1 total ...
	// damage".
	SplitsDamage bool

	Effects  []Effect
	Powers   []Power
	Reagents []Reagent
}

One spell row. Every field is the game files' column, in the game files' units.

func All

func All() []*Spell

Every row in id order. The rows are shared, not copied, so callers must not write through them.

func ByName

func ByName(name string) []*Spell

Every row with this exact name, by linear scan over the whole store. For tests and debugging - a sim should name the spell by id.

func EquipAuraRow

func EquipAuraRow(s *Spell) *Spell

The row an equip spell keeps on its targets: the spell itself, or the one its only effect casts on a period short enough to keep it up. Beastmaster's Boots' 27206 casts 27205, a 4 s aura on the pet, every 3 s.

func Find

func Find(id int32) *Spell

The row for an id, or Nil when the store does not carry it. Nil reads as zeroes rather than crashing, so a caller can ask about a spell this build does not have. The row is the store's own, not a copy: callers must not write through it.

Example

A row the store does not carry reads as zeroes rather than crashing the registration that asked for it.

frostbolt := Find(116)
fmt.Println(frostbolt.Name, frostbolt.Rank)
fmt.Println(Find(0) == Nil, Find(0).CastTime())
Output:
Frostbolt Rank 1
true 0s

func MustFind

func MustFind(id int32) *Spell

For a spell a caller depends on: a missing row is a generator problem, not a runtime condition. The row is the store's own, not a copy.

func (*Spell) AbsorbEffect

func (s *Spell) AbsorbEffect() *Effect

The A_SCHOOL_ABSORB aura the spell applies, or NilEffect where it applies none. Its Misc is the mask of the schools it absorbs, in core.SpellSchool's bits.

func (*Spell) AlwaysHits

func (s *Spell) AlwaysHits() bool

Whether the game files flag the spell Always Hit, which picks an outcome with no miss roll.

func (*Spell) AppliesAnAuraToAnEnemy

func (s *Spell) AppliesAnAuraToAnEnemy() bool

Whether any aura the row applies lands on an enemy. Such a row is never a buff on the wearer.

func (*Spell) AppliesBleed

func (s *Spell) AppliesBleed() bool

Whether the spell's periodic damage is a bleed: the mechanic sits on the spell, or on the effect alone where the spell also hits directly.

func (*Spell) AreaBonus

func (s *Spell) AreaBonus(encounter *core.Encounter) (amount, duration float64)

The amount and duration factors in this encounter; 1 and 1 outside the bonus's areas.

func (*Spell) AreaType

func (s *Spell) AreaType() proto.AreaType

func (*Spell) AuraReachesBeyondItsWeapon

func (s *Spell) AuraReachesBeyondItsWeapon() bool

Whether the aura reaches every spell and attack of its schools while the required weapon is equipped, beyond the attacks made with that weapon.

func (*Spell) CanProcFromProcs

func (s *Spell) CanProcFromProcs() bool

func (*Spell) CannotCrit

func (s *Spell) CannotCrit() bool

Whether the game files bar the spell from critting, which picks the no-crit hit table.

func (*Spell) CastRequirement

func (s *Spell) CastRequirement() core.CastRequirement

The forms, caster auras, weapon or shield, out-of-combat state and target creature types the row requires. A shield is the only armor a castable spell asks for. The creature types limit the cast only on a spell cast on an enemy unit: Bestial Wrath's Beast is the pet it lands on, and Holy Wrath's Undead and Demon are the enemies its area hits.

A ranked row whose only effect that does something is the periodic is refused while a higher rank of its dot is up: Shadow Word: Pain, Renew, Corruption, Rend, and Rip and Rupture, whose dummy effects do nothing by themselves. A row with any other effect casts, and only its periodic stays off.

func (*Spell) CastTime

func (s *Spell) CastTime() time.Duration

The client marks 51 instants - the hunter's shots and stings among them - with a negative cast time, which is no cast at all.

func (*Spell) CastableInCasterForm

func (s *Spell) CastableInCasterForm() bool

func (*Spell) CasterDamageEffect

func (s *Spell) CasterDamageEffect() *Effect

The damage the spell deals to its own caster: Goblin Sapper Charge 13241 rolls 600 on the enemies around the caster in its first effect and 500 on the caster in its second. DamageEffect answers the first damaging effect only.

func (*Spell) CategoryCooldown

func (s *Spell) CategoryCooldown() time.Duration

func (*Spell) CategoryCooldownEffect

func (s *Spell) CategoryCooldownEffect() *Effect

func (*Spell) ClassSpellsOnly

func (s *Spell) ClassSpellsOnly() bool

func (*Spell) Cooldown

func (s *Spell) Cooldown() time.Duration

SpellCooldowns.RecoveryTime. A spell gated by its category instead - Fire Blast and Cone of Cold share one - states that in CategoryCooldown.

func (*Spell) Cost

func (s *Spell) Cost() float64

The cost of the bar the spell spends - the first SpellPower row - in the units PowerCost converts to. 0 for a spell with no SpellPower row.

func (*Spell) DamageEffect

func (s *Spell) DamageEffect() *Effect

The effect carrying the spell's direct damage, whether it states an amount or a weapon multiplier. It sits on any of the weapon effects as readily as on school damage: a weapon effect states a multiplier or a flat bonus rather than an amount. An E_HEALTH_LEECH deals its amount as damage too.

func (*Spell) DamagesAnEnemy

func (s *Spell) DamagesAnEnemy() bool

Whether the spell deals damage to an enemy: a damage effect or a periodic damage effect that hits one.

func (*Spell) DebuffEffects

func (s *Spell) DebuffEffects() []int32

The positions of the slows and stat changes the spell puts on the enemy it lands on, in order.

func (*Spell) DebuffsTheTarget

func (s *Spell) DebuffsTheTarget() bool

Whether the row puts a debuff the sim models on the enemy it lands on.

func (*Spell) DefenseTypeCore

func (s *Spell) DefenseTypeCore() core.DefenseType

func (*Spell) Drivers

func (s *Spell) Drivers() []*Spell

The spells whose effects fire this one, from the trigger index.

func (*Spell) Duration

func (s *Spell) Duration() time.Duration

The game files state a permanent aura as -1, which is core.NeverExpires here.

func (*Spell) Effect

func (s *Spell) Effect(aura dbcenums.EffectAuraType, misc int32) *Effect

The one effect with this aura and misc value. Panics when none matches, and when two do: reading the first of several silently is the bug this shape exists to prevent, and EffectN is the way past it.

func (*Spell) EffectAtIndex

func (s *Spell) EffectAtIndex(i uint8) *Effect

The effect at the game files' EffectIndex i, or NilEffect when the row carries none there.

func (*Spell) EffectN

func (s *Spell) EffectN(i int) *Effect

The i-th effect the row carries, counted from 1 by position rather than by the game files' EffectIndex, which has gaps. Out of range answers NilEffect.

Example

Effects are counted from 1 by position, not by the game files' EffectIndex, and the values come in the units the game files state them in.

frostbolt := MustFind(116)
damage := frostbolt.EffectN(2)

fmt.Println(damage.Index)
fmt.Printf("%.0f %.0f %.3f\n", damage.BaseValue(), damage.AverageAt(60), damage.Coeff())
fmt.Println(frostbolt.EffectN(3) == NilEffect)
Output:
1
19 21 0.407
true

func (*Spell) EnergizeEffect

func (s *Spell) EnergizeEffect() *Effect

func (*Spell) ExpectedMagicTickOutcome

func (s *Spell) ExpectedMagicTickOutcome(spell *core.Spell) core.OutcomeApplier

What a tick of a magic damage over time is expected to deal: the crit share counts where the row states Periodic Can Crit, as the tick rolls it.

func (*Spell) ExtraAttacksEffect

func (s *Spell) ExtraAttacksEffect() *Effect

The effect granting the caster extra attacks, whose BasePoints is how many.

func (*Spell) FindEffect

func (s *Spell) FindEffect(typ dbcenums.SpellEffectType, aura dbcenums.EffectAuraType, misc int32) *Effect

The first effect matching all three, or NilEffect. Zero matches anything it is given as: an aura of 0 on a direct effect is what the game files state there.

func (*Spell) FiredSpell

func (s *Spell) FiredSpell() *Spell

The spell a proc row fires: what its A_PROC_TRIGGER_SPELL triggers, or, on a dummy proc the server scripts, the one spell its tooltip names where that spell restores a resource. Idol of Longevity's 28847 names 28848, the mana it refunds; most dummy procs name the spell they listen for instead, which fires nothing. Nil where the row fires nothing the store carries.

func (*Spell) FirstAura

func (s *Spell) FirstAura(auras ...dbcenums.EffectAuraType) *Effect

func (*Spell) FixedTravelTime

func (s *Spell) FixedTravelTime() bool

Whether the game files flag the spell Fixed Travel Time, which makes its Speed the missile's flight time in seconds rather than yards per second.

func (*Spell) GCD

func (s *Spell) GCD() time.Duration

func (*Spell) GeneratesNoThreat

func (s *Spell) GeneratesNoThreat() bool

func (*Spell) HasAttr

func (s *Spell) HasAttr(word int, bit uint32) bool

Whether the spell sets bit in Attributes[word]. A word outside the game files' 17 reads as unset.

func (*Spell) HealEffect

func (s *Spell) HealEffect() *Effect

func (*Spell) ICD

func (s *Spell) ICD() time.Duration

SpellAuraOptions.ProcCategoryRecovery: the internal cooldown between two procs.

func (*Spell) IsAProc

func (s *Spell) IsAProc() bool

Whether the spell's hits count as a proc, which is what a listener that cannot proc from procs skips. The game files state the negative, so this answers it as the sim's SpellFlagProc reads.

func (*Spell) IsBinary

func (s *Spell) IsBinary() bool

Whether the spell resists all or nothing: a magic row on the magic hit table that deals damage and, beside the damage, applies an aura other than a dummy to an enemy, interrupts, or carries a dummy, script, energize or area trigger effect on any target. Its hit roll resists it in full at the target's average resist, and a hit or tick that lands takes no partial resist (EV-0142).

func (*Spell) IsBleed

func (s *Spell) IsBleed() bool

func (*Spell) IsChanneled

func (s *Spell) IsChanneled() bool

func (*Spell) IsPassive

func (s *Spell) IsPassive() bool

func (*Spell) IsStun

func (s *Spell) IsStun() bool

func (*Spell) IsWeaponProcAura

func (s *Spell) IsWeaponProcAura() bool

Whether the spell's aura hears hits the way a weapon proc does, which means skipping the hits of a spell flagged Suppress Weapon Procs. The flag sits on the listener; SuppressesWeaponProcs above sits on the spell whose hits are skipped.

func (*Spell) ItemProcRollsTheColumn

func (s *Spell) ItemProcRollsTheColumn() bool

Whether an item or enchant proc rolls the ProcChance column rather than the chance its tooltip states on an effect: the column holds a real roll, 1 to 99, that the effect's contradicts. Uther's Light 8397 states 2% on effect 1 and 4 in the column. A class spell keeps the effect's, which is where a talent's ranks state theirs.

func (*Spell) KeepsCombatTimers

func (s *Spell) KeepsCombatTimers() bool

Whether completing a cast of the spell leaves the melee swing timer running instead of starting a fresh swing.

func (*Spell) MissRefund

func (s *Spell) MissRefund() float64

The share of the cost a miss refunds, for RageCostOptions.Refund: 80% where the game files flag Discount Power On Miss, nothing otherwise.

func (*Spell) MissileMinDuration

func (s *Spell) MissileMinDuration() time.Duration

SpellMisc.MinDuration, to the millisecond: the game files state it in seconds as a float.

func (*Spell) NoActiveDefense

func (s *Spell) NoActiveDefense() bool

Whether the game files flag the spell No Active Defense, which keeps dodge, parry and block out of its hit roll.

func (*Spell) NotShapeshifted

func (s *Spell) NotShapeshifted() bool

func (*Spell) OnlyOnPlayers

func (s *Spell) OnlyOnPlayers() bool

Whether only a player can carry the spell's aura, which leaves a pet without it.

func (*Spell) OverriddenBy

func (s *Spell) OverriddenBy(overrider *Spell) *Spell

The spell an A_OVERRIDE_ACTIONBAR_SPELLS effect of overrider puts on the action bar in place of this one. It panics when overrider does not replace this spell.

func (*Spell) PeriodicCanCrit

func (s *Spell) PeriodicCanCrit() bool

func (*Spell) PeriodicDamageEffect

func (s *Spell) PeriodicDamageEffect() *Effect

The A_PERIODIC_DAMAGE aura the spell applies, or NilEffect where it applies none.

func (*Spell) PeriodicEffect

func (s *Spell) PeriodicEffect() *Effect

The effect that ticks: an aura application whose aura carries a per-tick value, which is damage, healing, mana or a spell fired each tick.

func (*Spell) PersistsThroughDeath

func (s *Spell) PersistsThroughDeath() bool

func (*Spell) Power

func (s *Spell) Power(t dbcenums.PowerType) *Power

The cost out of this bar, or a zero Power where the spell does not use it. Both the row's own and the shared zero one are the store's, so a caller must not write through what it gets back.

func (*Spell) PowerCost

func (s *Spell) PowerCost(t dbcenums.PowerType) float64

The cost in the units the sim spends: rage off the game files' 0-1000 bar, everything else as stated.

Example

A cost is answered in the units the sim spends, and the school mask is core's own.

frostbolt := MustFind(116)
fmt.Println(frostbolt.PowerCost(0), frostbolt.SpellSchool() == core.SpellSchoolFrost, frostbolt.CastTime())
Output:
25 true 1.5s

func (*Spell) ProcDamageEffect

func (s *Spell) ProcDamageEffect() *Effect

The effect a proc deals its damage through: the row's damage effect, or the A_PROC_TRIGGER_DAMAGE aura of a proc that deals its amount off its own trigger, with no spell below it: the shield spikes' 20 to 30.

func (*Spell) ProcEnergizeEffect

func (s *Spell) ProcEnergizeEffect() *Effect

The effect a resource gain lands through: E_ENERGIZE, an amount into the bar its misc value names (Burst of Energy 24532 reads 60 energy), or an A_PERIODIC_ENERGIZE aura that restores the amount every period (Earthen Sigil 24884 reads 40 mana every 1 s).

func (*Spell) ProcHealEffect

func (s *Spell) ProcHealEffect() *Effect

The effect a proc's heal lands through: E_HEAL_PCT, a percentage of the target's maximum health (Recovery 1248759 reads 5), E_HEAL, an amount the effect rolls, or an A_PERIODIC_HEAL aura that heals the amount it rolls every period (Julie's Blessing 8348 reads 13 every 2 s).

func (*Spell) PushedBack

func (s *Spell) PushedBack() bool

Whether damage taken while casting the spell pushes its cast back.

func (*Spell) RankNumber

func (s *Spell) RankNumber() int32

Spell.NameSubtext_lang's "Rank N" as a number; 0 for a spell the game files show no rank on, whose subtext is "Passive" or empty.

func (*Spell) RankedLabel

func (s *Spell) RankedLabel(owner *core.Unit) string

The ranked name with the caster's label, "Holy Fire Rank 8 - Priest (#1)".

func (*Spell) RankedName

func (s *Spell) RankedName() string

The name with its "Rank N" subtext, "Holy Fire Rank 8"; a spell the game files show no rank on keeps its name.

func (*Spell) ReagentCount

func (s *Spell) ReagentCount(item int32) int32

How many of the item each cast consumes; 0 when it is not one of the spell's reagents.

func (*Spell) Refs

func (s *Spell) Refs() []*Spell

The spells the tooltip names, in the order it names them. An id the store does not carry is left out rather than answered as Nil.

func (*Spell) RefundsOnMiss

func (s *Spell) RefundsOnMiss() bool

func (*Spell) ShapeshiftForm

func (s *Spell) ShapeshiftForm() dbcenums.ShapeshiftForm

The form an A_MOD_SHAPESHIFT effect puts the caster in, or none.

func (*Spell) SlowEffects

func (s *Spell) SlowEffects() []int32

The positions, counted from 1 the way EffectN counts, of the effects that slow the enemy the spell lands on: a speed aura of a negative value on an enemy target that changes its attack or cast speed, as Frostguard's Chilled 16927 states. A row that stacks answers none, since an exclusive slow cannot follow stacks.

func (*Spell) SpeedEffects

func (s *Spell) SpeedEffects() []*Effect

The auras that raise a speed of the spell's caster: 23733 (Blinding Light) states 33% cast speed and 25% melee haste.

func (*Spell) SpeedPseudoStats

func (s *Spell) SpeedPseudoStats() []float64

The haste percents the spell's speed effects add, indexed by proto.PseudoStat.

func (*Spell) SpellSchool

func (s *Spell) SpellSchool() core.SpellSchool

func (*Spell) StatedChance

func (s *Spell) StatedChance() float64

The roll the row states, by the source that says where it is stated. The ProcChance column is the roll only under ProcChanceColumn; under the others it means nothing, which is why reading it directly is the bug ProcChanceSource exists to prevent. 0 where the row states no roll, which under ProcChancePPM is a rate the caller supplies through PPM().

func (*Spell) SummonEffect added in v1.0.6

func (s *Spell) SummonEffect() *Effect

The E_SUMMON effect, whose Misc is the creature it puts up and BasePoints how many, or NilEffect where the spell summons none.

func (*Spell) SuppressesCasterProcs

func (s *Spell) SuppressesCasterProcs() bool

func (*Spell) SuppressesTargetProcs

func (s *Spell) SuppressesTargetProcs() bool

func (*Spell) SuppressesWeaponProcs

func (s *Spell) SuppressesWeaponProcs() bool

func (*Spell) TickOutcome

func (s *Spell) TickOutcome(dot *core.Dot) core.OutcomeApplier

A tick of a damage over time. The hit is rolled once, when the dot is applied, so the tick rolls none: a crit only where the row states Periodic Can Crit, on the crit of the dot spell's defense type, and the partial resist its school takes unless the spell is binary.

func (*Spell) TicksIgnoreArmor added in v1.0.8

func (s *Spell) TicksIgnoreArmor() bool

Whether the spell's periodic physical damage ignores armor, which wins over TicksMeetATenthOfArmor; with neither, it meets the target's armor whole (EV-0194).

func (*Spell) TicksMeetATenthOfArmor added in v1.0.8

func (s *Spell) TicksMeetATenthOfArmor() bool

func (*Spell) Triggered

func (s *Spell) Triggered() []*Spell

Every spell this one's effects fire, deduped, in effect order, and then the ones a server-side handler casts off it.

func (*Spell) VersusBonus

func (s *Spell) VersusBonus() (core.VersusBonus, bool)

The factor the row deals or restores against its targets, and false where it has none.

func (*Spell) VersusFactorEffect

func (s *Spell) VersusFactorEffect() *Effect

The effect whose base points are the row's factor against its targets, or NilEffect where the row states none or the factor is the override's own.

func (*Spell) WeaponStrike

func (s *Spell) WeaponStrike(sim *core.Simulation, spell *core.Spell, weaponDamage, extra float64) float64

A weapon strike's damage: its flat weapon-damage roll, the weapon damage and extra, all scaled by the spell's weapon percent, or taken whole where it states none. In game the percent scales the flat part too: Holy Strike rank 1's 12 ± 1.5 at 25% shows as 2 to 4 (EV-0101).

func (*Spell) WhileSeated

func (s *Spell) WhileSeated() bool

Whether the spell's aura lasts only while the unit sits: the eating and drinking of food and water, whose health and mana come in out of combat.

type SpellOpt

type SpellOpt func(*core.SpellConfig, *Spell)

An addition to the resolved config for what the game files do not state: the proc mask, the metrics the sim keeps and the flags a row cannot justify.

func Flags

func Flags(flags core.SpellFlag) SpellOpt

Flags the game files do not state, such as the sim's own metrics and rotation flags.

func Magic

func Magic(mask core.ProcMask) SpellOpt

The same for a spell that scales with spell power, whose share of it and whose roll the row states on the effect that deals the damage, or heals where the spell has no damaging effect.

func Melee

func Melee(mask core.ProcMask) SpellOpt

The proc mask, the melee metrics bucket and the multipliers an ability needs, for a physical spell.

func Proc

func Proc() SpellOpt

A spell another spell or an aura casts: it is out of the rotation Melee and Magic put it in, it does not feed on-cast effects, and it has no cast, cost, cooldown, cast requirement or flat threat of its own even when it shares the row of the ability that casts it, the way the warrior's Blood Craze heal and Whirlwind's off-hand strike are registered. Its damage and healing are still measured, its casts are not: the metrics aggregator counts no cast for a passive spell, so a sub-spell whose casts the sim reports - the warrior's Deep Wounds and Retaliation's counterattack - sets the flags itself instead.

func RemoveFlags

func RemoveFlags(flags core.SpellFlag) SpellOpt

RemoveFlags clears specific flags from the configuration that should not be present.

Ex: ArcaneMissilesTickSpell is NotAProc so you cant use Proc() SpellOpt, so it ends up being castable through APL

Usage: spelldata.RemoveFlags(core.SpellFlagAPL)

func Tag

func Tag(tag int32) SpellOpt

Splits one spell id into several actions, for a spell the sim registers more than once.

type WeaponRule

type WeaponRule uint8

How the parse binds an aura WeaponBindable names to the weapon its row requires in SpellEquippedItems.

const (
	// The effect gives its stat: the row names no weapon, names a shield, the aura reaches another unit,
	// or the effect is not an aura WeaponBindable names.
	WeaponRuleNone WeaponRule = iota
	// A mod on the attacks made with a matching weapon.
	WeaponRulePerWeapon
	// The stat on every spell and attack while a matching weapon is in a weapon slot.
	WeaponRuleWhileEquipped
	// A rating mask of ranged bits alone, on a row that names no weapon: the percent the rating is
	// worth, on ranged-defense attacks. A magic-defense spell on the ranged proc mask, such as Thunder
	// Clap, rolls on the spell tables and takes none of it.
	WeaponRuleRangedRatings
)

func WeaponScope

func WeaponScope(s *Spell, e *Effect) (WeaponRule, core.SpellModConfig)

The rule the parse applies to an effect whose aura WeaponBindable names, and the scope a mod under it takes: the proc mask and the Equip fields, with no class flags, so the mod reaches auto attacks whatever family the spell belongs to. The scope is zero under WeaponRuleNone.

A_MOD_HIT_CHANCE and A_MOD_WEAPON_CRIT_PERCENT are per weapon. A_MOD_CRIT_PCT and A_MOD_DAMAGE_PERCENT_DONE are per weapon where their weapons are ranged weapons alone, named by subclass only, and hold while equipped otherwise. A_MOD_RATING is per weapon where the row names one, and on ranged attacks where its mask holds ranged bits alone. A_MOD_SPELL_HIT_CHANCE and A_MOD_THREAT reach no attack in particular, so they hold while equipped wherever the row names a weapon: Precision 13705's spell hit and Two-Handed Weapon Specialization 20111's threat go with the weapon the same way their melee hit and damage do.

Jump to

Keyboard shortcuts

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