Module power
These functions help in retrieving information about player power.
Power functions are the profile API table `power` (br.api.profile.power); profiles use it by name. powerType is the name of the power passed from the builder which cycles all the collected power from the power list powerIndex is the powerID passed from the builder which cycles all the collected power from the power list
Functions
| power. (cost[, keep=0]) | True when the player can pay cost and still have keep left, counting what earlier casts are
promised and the game hasn't charged yet (a bolt queued behind the current cast, Maul waiting on a
swing): power. |
| power. () | Gets the amount of specified power until max is reached |
| power. () | Gets the amount with its fraction: Death Knight runes counting the next rune's recharge,
soul shards with fragments (Destruction); other powers as power. |
| power. () | Gets the maximum aount of the specified power |
| power. () | Gets the current amount of specified power as a percentage |
| power. () | Gets the current rate of regeneration for the specified power, per second (in combat) |
| power. ([amount]) | Gets the time in seconds until the specified power is maxed (999 if it doesn't regenerate) |
| power. ([thisUnit="target"]) | Gets the current amount of the specified power. |
| power.runes.blood () | Death Knight: ready Blood runes |
| power.runes.bloodPercent () | Death Knight: Blood runes ready, as a percent of all Blood runes |
| power.runes.cdPercent (index) | Death Knight: how far a rune is through its cooldown, as a percent |
| power.runes.typeCount (rtype) | Death Knight: ready runes of a type |
| power.runes.death () | Death Knight: ready Death runes |
| power.runes.deathPercent () | Death Knight: Death runes ready, as a percent |
| power.runes.frost () | Death Knight: ready Frost runes |
| power.runes.frostPercent () | Death Knight: Frost runes ready, as a percent |
| power.runes.info () | Death Knight: every rune's type, whether it is ready and its cooldown |
| power.runes.typePercent (rtype) | Death Knight: runes of a type ready, as a percent (power.runes.percent() is all runes') |
| power.runes.recharge (index) | Death Knight: seconds until a rune is ready |
| power.runes.timeTill (n) | Death Knight: seconds until n runes are ready |
| power.runes.unholy () | Death Knight: ready Unholy runes |
| power.runes.unholyPercent () | Death Knight: Unholy runes ready, as a percent |
Tables
| powerList | Reference for powerIndex and powerType variables. |
Functions
- power. (cost[, keep=0])
-
True when the player can pay cost and still have keep left, counting what earlier casts are
promised and the game hasn't charged yet (a bolt queued behind the current cast, Maul waiting on a
swing): power.
() alone doesn't know those Parameters:
- cost
number
What the spell costs (cast.cost.
()) - keep number How much to keep back (a heal's cost, the mana to shift back into a form) (default 0)
Returns:
-
boolean
Usage:
if power.mana.affordable(cast.cost.lightningBolt(), cast.cost.healingWave()) then
- cost
number
What the spell costs (cast.cost.
- power. ()
-
Gets the amount of specified power until max is reached
Returns:
-
number
- power. ()
-
Gets the amount with its fraction: Death Knight runes counting the next rune's recharge,
soul shards with fragments (Destruction); other powers as power.
() Returns:
-
number
- power. ()
-
Gets the maximum aount of the specified power
Returns:
-
number
- power. ()
-
Gets the current amount of specified power as a percentage
Returns:
-
number
- power. ()
-
Gets the current rate of regeneration for the specified power, per second (in combat)
Returns:
-
number
- power. ([amount])
-
Gets the time in seconds until the specified power is maxed (999 if it doesn't regenerate)
Parameters:
- amount number Time until this amount instead of the maximum (Death Knight runes: how many runes, default 6) (optional)
Returns:
-
number
- power. ([thisUnit="target"])
-
Gets the current amount of the specified power. Combo points: yours on thisUnit (default "target");
where they're stored on the unit (Classic-era clients), BR's pick is read on itself, not your target
Parameters:
- thisUnit Combo points only: the unit they were built on (units.dyn5) (default "target")
Returns:
-
number
Usage:
local comboPoints = power.comboPoints(units.dyn5)
- power.runes.blood ()
-
Death Knight: ready Blood runes
Returns:
-
number
- power.runes.bloodPercent ()
-
Death Knight: Blood runes ready, as a percent of all Blood runes
Returns:
-
number
- power.runes.cdPercent (index)
-
Death Knight: how far a rune is through its cooldown, as a percent
Parameters:
- index number The rune (1-6)
Returns:
-
number
- power.runes.typeCount (rtype)
-
Death Knight: ready runes of a type
Parameters:
- rtype string "blood", "frost", "unholy" or "death"
Returns:
-
number
- power.runes.death ()
-
Death Knight: ready Death runes
Returns:
-
number
- power.runes.deathPercent ()
-
Death Knight: Death runes ready, as a percent
Returns:
-
number
- power.runes.frost ()
-
Death Knight: ready Frost runes
Returns:
-
number
- power.runes.frostPercent ()
-
Death Knight: Frost runes ready, as a percent
Returns:
-
number
- power.runes.info ()
-
Death Knight: every rune's type, whether it is ready and its cooldown
Returns:
- power.runes.typePercent (rtype)
-
Death Knight: runes of a type ready, as a percent (power.runes.percent() is all runes')
Parameters:
- rtype string "blood", "frost", "unholy" or "death"
Returns:
-
number
- power.runes.recharge (index)
-
Death Knight: seconds until a rune is ready
Parameters:
- index number The rune (1-6)
Returns:
-
number
- power.runes.timeTill (n)
-
Death Knight: seconds until n runes are ready
Parameters:
- n number How many runes
Returns:
-
number
- power.runes.unholy ()
-
Death Knight: ready Unholy runes
Returns:
-
number
- power.runes.unholyPercent ()
-
Death Knight: Unholy runes ready, as a percent
Returns:
-
number