These are all of the functions available to both rotations and the theorycraft wiki formulas.
Buffs and Debuffs
In the functions, we don't distinguish between Buffs and Debuffs explicitly. For example: HasBuff will return true if the player has the named buff or it will return true if the current target has the named debuff. Not two buffs/debuffs can have the same code name, so you will never run into a situation where the player and target would have the same buff/debuff. Buff functions first look for buffs/debuffs applied by the current actor. Otherwise they will look for any unit with the specified buff.
BuffCountNumber
Get the current number of units that have the specified buff or debuff. This is especially useful when are switching targets, since the debuff might exist, but not on the current target.
BuffDurationSecNumber
Get the duration in seconds of a buff. This is the TOTAL duration, not the remaining or elapsed duration.
BuffMaxStack (spell)Number
Get the maximum stacks that a buff can have. Requires the code name of the spell or effect associated to the buff.
BuffRemainingSec (spell)Number
Get the number of seconds remaining on a buff before it will expire. Returns 0 if the buff is not currently active. Requires the code name of the spell or effect associated to the buff.
BuffStack (spell)Number
Get the current number of stacks of the specified buff. Requires the code name of the spell or effect associated to the buff.
BuffStat (stat, spell)Number
Get the amount of the specified stat that the specified buff is currently giving. Returns 0 if the buff is not active or the buff doesn't give that stat. Requires the name of the stat and the code name of the spell or effect associated to the buff. When there are multiple buffs affecting one stat, this function is useful to access the value of one particular buff's contribution.
HasBuff (spell)Boolean
True if the player/target currently has the specified buff/debuff. Requires the code name of the spell or effect associated to the buff.
HasItemProcBuffBoolean
True if the player currently has a buff from an item proc (trinket, legendary, etc.). Does not include on-use buffs from trinkets or items.
Damage/Heal Over Time (DoT/HoT) Effects
CanRefreshDot (spell)Boolean
True if the specified DoT can be applied or refreshed on the current target without clipping. 'Replace' type DoTs with less than 30% of the duration remaining will not clip if reapplied. False if there is no current target. This function encapsulates multiple conditions you would add to a DoT to refresh it optimally in a rotation. Most of the time, this is all you need to tell a rotation to "Keep this DoT up."
DotCount (spell)Number
Get the number of targets that currently have the specified DoT.
DotDurationSec (spell)Number
Get the duration in seconds of a DoT. This is the TOTAL duration, not the remaining or elapsed duration.
DotIntervalSec (spell)Number
Get the current tick interval of a DoT. This is the TOTAL tick interval, not the remaining or elapsed duration of the current tick. If used when the DoT is not currently ticking, may return 0 for special kinds of DoTs.
DotMaxStack (spell)Number
Get the maximum stacks that a DoT can have.
DotNextTicSec (spell)Number
Get the time in seconds until the next tick of a DoT will happen. Returns 0 if the DoT is not currently active on the current target.
DotRemainingSec (spell)Number
Get the number of seconds remaining on a DoT on the current target before it will expire. Returns 0 if the DoT is not currently active.
DotStack (spell)Number
Get the current number of stacks that the player's current target has of the specified DoT.
DotTickDamage (spell)Number
Get the damage that the next tick of the specified DoT will do. Any temporary buffs you gain between the current time and the next tick will not be considered. The simulator is not prescient.
HasDot (spell)Boolean
True if the player's current target has the specified DoT.
Artifacts
ArtifactRanksNumber
Total number of ranks purchased in the equipped artifact.
ArtifactRuleOfThree (artifactTrait)Number
Used to calculate the bonus in the scaling 3%/6%/10% abilities in the game. Returns the double value of the multiplier based on trait rank of the specified trait.
ArtifactTraitRank (artifactTrait)Number
Rank that the player has in the specified artifact trait (including any bonus ranks from relics).
Power and Alternate Power
AlternatePowerNumber
Get the player's current alternate power (chi, insanity, combo points, etc.).
AlternatePowerRegenNumber
Get the player's current alternate power regen per second (used mainly for insanity).
AlternatePowerSpentNumber
The amount of alternate power spent on the current spell, useful for e.g. effects that scale damage based on alternate power spent like rogue finishers.
MaxAlternatePowerNumber
Get the player's maximum alternate power (chi, shadow orbs, combo points, etc.). It is better to use this instead of hard-coding what you know the max is, in case a talent or future special item/set bonus modifies it.
MaxPowerNumber
Get the player's maximum power (rage, energy, mana, etc.). It is better to use this instead of hard-coding what you know the max is, in case a talent or future special item/set bonus modifies it.
PowerNumber
Get the player's current power (rage, energy, mana, etc.).
PowerRegenNumber
Get the player's current power regen per second (used mainly for energy or mana).
PowerSpentNumber
The amount of power spent on the current spell, useful for e.g. effects that scale damage based on power spent.
SpellBaseAlternatePowerCost (spell)Number
Returns the base alternate power cost of a spell. Effectively executes the power cost formula exactly as it appears on the wiki with no other modifiers applied from e.g. buffs. Requires the code name of the spell.
SpellBasePowerCost (spell)Number
Returns the base power cost of a spell. Effectively executes the power cost formula exactly as it appears on the wiki with no other modifiers applied from e.g. buffs. Requires the code name of the spell.
WillMaxPower (spell)Boolean
Returns True if you will reach Max Power (via Power regen) during the cast/channel time of the specified spell.
Spell Functions
CanUse (spell)Boolean
True if the specified spell can be used right now (checks cooldown, power cost, and any custom use condition on the spell). Custom use conditions are defined on the spell itself in the wiki, not in the rotation. A common example would be that you need a certain talent to use it.
ChainCountNumber
The number of times that a chain damage effect has chained. Only relevant within Damage, Crit Damage, Crit Chance, and Miss formulas for a damage effect.
ChargesRemaining (spell)Number
Get the current number of charges remaining for a spell that the player cast. 'Normal' spells have 1 charge. Spells with no cooldown always have 1 charge remaining.
CooldownSecRemaining (spell)Number
Get the seconds remaining on the cooldown of the specified spell before the player can cast it again.
GlobalCooldownSecNumber
Get the current duration of the global cooldown, accounts for temporary haste effects, etc.
InFlight (spell)Number
Returns the number of missiles currently in flight for the specified spell or damage effect.
IsCasting (spell)Number
True if the specified spell is being cast by the current actor, but hasn't completed its cast yet. See IsPlayerCasting and IsPetCasting for more clarification on casting check options.
IsChanneling (spell)Number
True if the specified spell is being channeled by the current actor, but hasn't completed yet. See IsPlayerChanneling and IsPetChanneling for more clarification on channeling check options.
IsPlayerCasting (spell)Number
True if the specified spell is being cast by the player, but hasn't completed its cast yet. Even if called from a pet action list, this will only check what the player is casting.
IsPlayerChanneling (spell)Number
True if the specified spell is being channeled by the player, but hasn't completed yet. Even if called from a pet action list, this will only check what the player is channeling.
LastSpellIdInt32
Get the game spell ID of the last spell used by the player, or 0 if no spell has been used yet. This function exists so that you can use the Save Value effect (which only saves numbers) to save what spell was cast.
MissileTravelTimeSec (spell)Number
Get the duration in seconds of the missile travel time of the specified spell. This is the TOTAL duration, not the remaining or elapsed duration.
SpellCastTimeSec (spell)Number
Get the duration in seconds of the cast time of the specified spell. This is the TOTAL duration, not the remaining or elapsed duration.
SpellChannelTimeSec (spell)Number
Get the duration in seconds of the channel time of the specified spell. This is the TOTAL duration, not the remaining or elapsed duration.
SpellCharges (spell)Number
Get the maximum number of charges that a spell can have when cast by the player. This is the MAX, not the remaining or current number of charges. 'Normal' spells or spells with no cooldown always return 1.
SpellCooldownSec (spell)Number
Get the duration in seconds of the cooldown of the specified spell. This is the TOTAL duration, not the remaining or elapsed duration. The current state of the simulation (buffs, etc.) is taken into account.
SpellDamage (spell)Number
Returns the amount of damage that the named damage spell or effect will do, essentially executes its damage formula and returns the base damage (non-crit). Useful for e.g. a spell where the damage is based on another spell's damage.
WasLastCast (spell)Boolean
True if the specified spell was the last spell used by the player that triggered a global cooldown, started a cast, or started a channel.
WasLastSpell (spell)Boolean
True if the specified spell was the last spell used by the player. Unlike WasLastCast, this includes spells that trigger no cooldown.
WillArriveInTime (spell)Boolean
Returns true if the specified spell will finish casting and the missile fired will arrive before the current target dies or despawns.
NPC and Boss Script Related Functions
These functions will give you information about the NPCs in the current simulation. The NPCs are defined in the loaded boss script. How long NPCs live is specified in the boss scripts - their health is not tracked explicitly. Doing more damage will not result in a shorter simulation or adds dying faster. You should edit the boss script you are simulating against to reflect how fast you think you can kill the different NPCs.
BossHealthPercentNumber
Get the main boss's health as a percent of its total health. The 'main boss' is defined by the loaded boss script.
BossSecRemainingNumber
Get seconds remaining until the main boss either dies or becomes untargetable. The 'main boss' is defined by the loaded boss script.
BossSecUntilDeathNumber
Get seconds remaining until the main boss will die and never come back, or 0 if the main boss is already dead and gone. The 'main boss' is defined by the loaded boss script.
CanAoE (targets, radius)Boolean
Returns true if the specified AoE situation is happening or will happen in the future: the specified number of targets will be grouped within the specified radius of each other. The intent is to have a function that can inform the rotation whether or not AoE exists in the current boss script.
CanExecuteTargetBoolean
Returns true if the current target is in execute range, as defined by ExecuteRange in the spec/class definition.
CurrentTargetString
Get the current hostile target's name.
FightDurationSecNumber
Get the total fight duration in seconds. This is the TOTAL duration, not the remaining or elapsed duration.
FightPercentRemainingNumber
Get fight time remaining as a percent of total fight time.
FightSecRemainingNumber
Get fight time remaining in seconds.
HaveTargetBoolean
True if the player has a current target and that target can be attacked (e.g. the current target is set and the NPC is not in an 'untargetable' interval of a boss script).
TargetCreatureClassTargetCreatureClass
Get the current target's creature class (warrior or mage), really only used in armor calculations.
TargetCreatureTypeTargetCreatureType
Get the current target's creature type (beast, demon, humanoid, etc.).
TargetHealthPercentNumber
Get the current target's health as a percent of its total health.
TargetLevelNumber
Get the current target's level.
TargetSecRemainingNumber
Get seconds remaining until the current target either dies or becomes untargetable, or 0 if already dead or untargetable. Use this function for checking things like if you can cast a spell and have the missile hit the npc before it is gone. This is not what you should use to check if you can execute a target.
TargetSecUntilDeathNumber
Get seconds remaining until the current target will die and never come back, or 0 if the target is already dead and gone. If you are checking if you will be able to hit this target with spell(s), you want to use TargetSecRemaining instead.
TargetsAvailableNumber
Get the number of valid targets available, even if they are currently out of range.
TargetsInRadius (spell)Number
Get the number of valid targets within the radius of the specified spell were it cast on the current target (including the current target).
TargetsInRange (spell)Number
Get the number of valid targets currently in attack range of the player.
SecondUntilAoE (targets, radius)Number
Number of seconds until the specified AoE situation will become available: the specified number of targets will be grouped within the specified radius of each other. Returns 0 if already in that situation, or 600 if it will never become available.
Items and Set Bonuses
Gear (slot)Item
Get the Item equipped in the specified slot, or null if no item is equipped in that slot.
HasItem (codeName)Boolean
Return true if the player has the specified item equipped in any slot. Parameter is the code name of the item (removes spaces and punctuation, words are camel-case, e.g. Donkey's Sword would be DonkeysSword).
HasSetBonus (tier, bonus)Boolean
True if the player has the specified set bonus. Specify the set bonus as Tier, Bonus. Tier 19 4 piece would be: 19, 4.
ItemScaleCoefficientNumber
Get a coefficient to scale things like proc values to the item level of the item equipped in the slot associated to the currently executing spell. This will only work in the definition of the item proc itself, on the item.
Pets
All the functions related to handling pets.
CurrentPetString
If the current actor is a pet, returns the name.
IsPetBoolean
Returns true if the current actor is a pet.
IsPetCasting (pet, spell)Number
True if the specified spell is being cast by the specified pet, but hasn't completed its cast yet. If more than one of that pet are currently active, returns true if any of them are casting the specified spell.
IsPetChanneling (pet, spell)Number
True if the specified spell is being channeled by the specified pet, but hasn't completed yet. If more than one of that pet are currently active, returns true if any of them are channeling the specified spell.
PetCount (pet)Number
Get the number of pets with this name that are currently active.
PetChargesRemaining (spell, pet)Number
Get the current number of charges remaining for a spell that the named pet cast. 'Normal' spells have 1 charge. Spells with no cooldown always have 1 charge remaining.
PetCooldownSecRemaining (spell, pet)Number
Get the seconds remaining on the cooldown of the specified spell before the named pet can cast it again.
PetPower (pet)Number
The named pet's current amount of power.
PetSpellCharges (spell, pet)Number
Get the maximum number of charges that a spell can have when cast by the specified pet. This is the MAX, not the remaining or current number of charges. 'Normal' spells or spells with no cooldown always return 1.
PetsWithBuff (pet, spell)Number
Get the number of currently active pets that have the specified buff. Requires the code name of the pet and the code name of the spell or effect associated to the buff.
Player Information
These functions are used mainly in the functions that calculate stats. They give information about the current player loaded into the simulator.
ClassClass
Get the player's class.
HasTalent (name)Boolean
True if the player has the specified talent.
IsAgilitySpecBoolean
True if agility is the player's primary stat, including agility tank specs.
IsDpsBoolean
True if the player is a damager.
IsDualWieldingBoolean
True if the player is dual-wielding. Returns false for feral and guardian druids even though they equip two weapons; they don't use dual-wield mechanics.
IsHealerBoolean
True if the player is a healer.
IsIntellectSpecBoolean
True if intellect is the player's primary stat.
IsStrengthSpecBoolean
True if strength is the player's primary stat.
IsTankBoolean
True if the player is a tank.
PlayerLevelNumber
Get the player's level.
RaceRace
Get the player's race.
SubSpecSubSpec
Get the player's sub-spec.
Math Functions
Abs (number)Number
Math absolute value function.
Ceiling (number)Number
Math ceiling function.
Floor (number)Number
Math floor function.
Min (number1, number2)Number
Return the minimum of two numbers.
Max (number1, number2)Number
Return the maximum of two numbers.
Pow (x, y)Number
Math power function. Raises x to the power of y.
Random (lowerInclusive, upperExclusive)Number
Get a random integer between the specified lower (inclusive) and upper (exclusive) bound.
RandomFloatNumber
Get a random floating point number between 0 and 1.
Round (number, decimals)Number
Round to the specified number of decimal places.
Sqrt (number)Number
Math square root function.
Other
These functions don't fall in any specific category, but serve various uses in the simulator and rotations.
IsOnGcdBoolean
True if the player is currently waiting on the global cooldown to finish. This won't be useful in a rotation because the simulator will not check the action list while you are on gcd. This function is to implement Demon Hunter's Demon Blades ability.
IsSwitchOn (switch)Boolean
True if the specified switch is currently ON (switches are created by special Switch rotation actions to help simplify rotation logic). They are essentially boolean variables that can be created and used in a rotation.
IsSwitchOff (switch)Boolean
True if the specified switch is currently OFF (switches are created by special Switch rotation actions to help simplify rotation logic). They are essentially boolean variables that can be created and used in a rotation.
IgnoredDamage (spell)Boolean
Get the total amount of damage that was ignored while a named Ignore Damage effect was active. Spell is the name of the Ignore Damage effect, not the spell cast.
DequeueSavedValueNumber
Get and remove the oldest saved value recorded by a named Save Value effect.
PeekSavedValueNumber
Get (but do not remove) the oldest saved value recorded by a named Save Value effect.
SavedValueLength (spell)Number
Get the number of entries in the saved value queue for the named Save Value effect (usually name is the same as the spell the effect is associated to).
SpellSlot (spell)Number
Returns the slot that the specified Spell or Effect is associated with, e.g. if the spell comes from an item or an enchant.
TimerSecRemaining (spell)Number
Get the seconds remaining on a timer. Returns 0 if the timer is not currently running. If the timer does not have a fixed duration, returns seconds until the next tick. A lot of class mechanics are implemented using Timers to trigger abilities. These timers can be used in rotations to check if one of these abilities is currently active. You will need to check the actual spells on the wiki to find the associated timer, although they will usually be named something like [SpellName]Timer.
TimerTickNumber (spell)Number
Get the current tick number for a timer. e.g. the first time it ticks this will be 1. Useful to do something different on each tick of a timer.
TotalDamage (target)Number
Gets the total damage dealt to the specified targets up to this point in the simulation.
Stat Functions
These are most often used in the formulas on the Theorycraft Wiki pages. Checking your current stats in a rotation is usually not going to be feasible in-game while you are trying to dodge fire.
ArmorReductionNumber
Formula that returns a multiplier to reduce physical damage based on a target's armor.
BaseManaNumber
Base mana by player level. This is the amount that a non-caster class like a Protection Paladin would have. Casters multiply this by 5.
BasePrimaryStatNumber
Gets the base amount of primary stats for the current player.
MasteryCoefficient (type)Number
The multipliers each spec gets on the Mastery stat tends to change a bit more often than other things, so we maintain a list that you can use for convenience. The type is a constant stored for each mastery multiplier. Some specs have more than one.
MasteryValue (type, isMultiplier)Number
Returns the Mastery for a given coefficient as either the percentage value or a multiplier.
RatingConversion (stat)Number
Some gear stats have a level-dependent conversion from rating to actual value.
SpellStatExtra (stat, spell)Number
Returns the spell-specific additive bonus to the specified stat. Rare to need this directly, but helps with a few edge cases.
SpellStatMultiplier (stat, spell)Number
Returns the spell-specific extra multiplier to the specified stat. Rare to need this directly, but helps with a few edge cases.
StatExtra (stat)Number
Get the 'extra' amount of a stat that a player has. This is the total amount of additive bonuses from all sources. Used primarily in stat calculators.
StatMultiplier (stat)Number
Get the total multiplier on a stat. This is the total amount of multiplicative bonuses from all sources. Used primarily in stat calculators.
StatRating (stat)Number
Get the amount of rating that a player has for a specific stat. This is the total amount of rating from all sources. Used primarily in stat calculators.
TotalAgilityNumber
Total Agility from all sources.
TotalArmorNumber
Total Armor from all sources.
TotalAttackPowerNumber
Total Attack Power from all sources.
TotalAttackSpeedNumber
Total Attack Speed from all sources.
TotalAvoidanceNumber
Total Avoidance from all sources.
TotalBlockNumber
Total Block from all sources.
TotalBlockAmountNumber
Total Block Amount from all sources.
TotalBonusArmorNumber
Total Bonus Armor from all sources.
TotalCritDamageMultiplierNumber
Total Crit Damage Multiplier from all sources.
TotalCriticalBlockNumber
Total Critical Block from all sources.
TotalCriticalStrikeNumber
Total CriticalStrike from all sources.
TotalDamageMultiplierNumber
Total Damage Multiplier from all sources.
TotalDodgeNumber
Total Dodge from all sources.
TotalHasteNumber
Total Haste from all sources.
TotalIgnoreArmorNumber
Total Ignore Armor from all sources.
TotalIntellectNumber
Total Intellect from all sources.
TotalLeechNumber
Total Leech from all sources.
TotalMainHandDamageNumber
Total Main Hand Damage from all sources.
TotalMasteryNumber
Total Mastery from all sources.
TotalMaxHealthNumber
Total Max Health from all sources.
TotalMovementSpeedNumber
Total Movement Speed from all sources.
TotalOffHandDamageNumber
Total Off Hand Damage from all sources.
TotalOffHandDamageMultiplierNumber
Total Off Hand Damage Multiplier from all sources.
TotalParryNumber
Total Parry from all sources.
TotalPetDamageMultiplierNumber
Total Pet Damage Multiplier from all sources.
TotalSpellPowerNumber
Total Spell Power from all sources.
TotalStaminaNumber
Total Stamina from all sources.
TotalStrengthNumber
Total Strength from all sources.
TotalVersatilityNumber
Total Versatility from all sources.