Module br.player.cast
These functions help in casting spells and retrieving information about casts.
Cast functions are stored in br.player.cast and can be utilized by `local cast = br.player.cast` in your profile. `spell` in the function represent the name in the actions list (Spec, Shared Class, Shared Global Lists) defined in System/List/Spells.lua
Functions
cast.spell (thisUnit, castType, minUnits, effectRng, predict, predictPad, enemies) | Cast a spell based on various parameters. |
cast.id (spellID, thisUnit, castType, minUnits, effectRng, predict, predictPad, enemies) | Cast a spell by its ID based on various parameters. |
cast.name (spellName, thisUnit, castType, minUnits, effectRng, predict, predictPad, enemies) | Cast a spell by its Name based on various parameters. |
cast.able.spell (thisUnit, castType, minUnits, effectRng, predict, predictPad, enemies) | Checks if a spell can be cast based on various parameters. |
cast.able.id (spellID, thisUnit, castType, minUnits, effectRng, predict, predictPad, enemies) | Checks if a spell can be cast by its ID based on various parameters. |
cast.able.name (spellName, thisUnit, castType, minUnits, effectRng, predict, predictPad, enemies) | Checks if a spell can be cast by its Name based on various parameters. |
cast.active.spell (thisUnit) | Checks if the spell is the one currently being cast. |
cast.auto.spell () | Checks if the spell is set to auto-repeat or if it's the current spell being cast. |
cast.cancel.spell () | Cancels the current spell being cast if it matches the specified spell. |
cast.cost.spell (altPower) | Gets the cost of the spell. |
cast.current.spell (thisUnit) | Gets the currently cast spell for the target (Alternate to br.player.cast.active.spell()). |
cast.current.id () | Gets the spell id of the current (or previously) cast spell by the API. |
cast.dispel.spell (thisUnit) | Checks if the spell is capable of dispelling the target. |
cast.empowered.spell () | Gets current empowered rank of the spell or 0 if not empowered. |
cast.form (formIndex) | Casts the form corresponding to the provided formIndex number. |
cast.inFlight.spell (thisUnit) | Checks if the spell is currently in flight to the target. |
cast.inFlightRemain.spell (thisUnit) | Gets time remaining on a spell in flight to the target. |
cast.last.spell (index) | Checks if the spell was the last one cast or not. |
cast.last.time.spell () | Gets the GetTime() value the last cast of this spell occurred. |
cast.noControl.spell () | Checks if the spell can free you of a "no control" effect. |
cast.opener (thisSpell, thisTracker, thisCount) | Casts special opener condition spell. |
cast.openerFail (thisSpell, thisTracker, thisCount) | Resets cast special opener condition if failed to cast. |
cast.pool.spell (specificAmt, multiplier) | Checks if specified power requirements are not met. |
cast.range.spell () | Gets the spell's range, if it has one. |
cast.regen.spell () | Gets the amount of power spell will generate when cast. |
cast.safe.spell (thisUnit, aoeType, minUnits, effectRng) | Checks if safe to cast specified aoe spell on unit given the aoe dimensions. |
cast.time.spell () | Gets the cast time of player's spell. |
cast.timeRemain (thisUnit) | Gets the cast time remaining on player's cast or supplied target. |
cast.timeSinceLast.spell () | Gets the time since the last cast of this spell occurred. |
cast.wait (condition) | Checks if the provided condition is true else it waits for 0.1sec. |
Functions
- cast.spell (thisUnit, castType, minUnits, effectRng, predict, predictPad, enemies)
-
Cast a spell based on various parameters.
The function name is dynamically generated based on the spell name.
For example, for a spell named "thisSpell", the function would be `cast.thisSpell()`.
Parameters:
- thisUnit string The target unit for the spell. Can be standard WoW units, dynamic units, or special parameters like "best", "playerGround", etc.
- castType string Defines the type of AoE or special cast conditions.
- minUnits number Minimum number of units needed to be hit by AoE spell.
- effectRng number The AoE's effect range.
- predict boolean If true, will attempt to predict enemy movements for ground location AoE spells.
- predictPad boolean Pads the prediction cast time. 'predict' must be true.
- enemies table A table of enemy units that the spell should be cast on.
Returns:
-
boolean
- cast.id (spellID, thisUnit, castType, minUnits, effectRng, predict, predictPad, enemies)
-
Cast a spell by its ID based on various parameters.
Parameters:
- spellID number The ID of the spell to cast.
- thisUnit string The target unit for the spell. Can be standard WoW units, dynamic units, or special parameters.
- castType string Defines the type of AoE or special cast conditions.
- minUnits number Minimum number of units needed to be hit by AoE spell.
- effectRng number The AoE's effect range.
- predict boolean If true, will attempt to predict enemy movements for ground location AoE spells.
- predictPad boolean Pads the prediction cast time. 'predict' must be true.
- enemies table A table of enemy units that the spell should be cast on.
Returns:
-
boolean
- cast.name (spellName, thisUnit, castType, minUnits, effectRng, predict, predictPad, enemies)
-
Cast a spell by its Name based on various parameters.
Parameters:
- spellName string The name of the spell to cast.
- thisUnit string The target unit for the spell. Can be standard WoW units, dynamic units, or special parameters.
- castType string Defines the type of AoE or special cast conditions.
- minUnits number Minimum number of units needed to be hit by AoE spell.
- effectRng number The AoE's effect range.
- predict boolean If true, will attempt to predict enemy movements for ground location AoE spells.
- predictPad boolean Pads the prediction cast time. 'predict' must be true.
- enemies table A table of enemy units that the spell should be cast on.
Returns:
-
boolean
- cast.able.spell (thisUnit, castType, minUnits, effectRng, predict, predictPad, enemies)
-
Checks if a spell can be cast based on various parameters.
The function name is dynamically generated based on the spell name.
Parameters:
- thisUnit string The target unit for the spell. Can be standard WoW units, dynamic units, or special parameters.
- castType string Defines the type of AoE or special cast conditions.
- minUnits number Minimum number of units needed to be hit by AoE spell.
- effectRng number The AoE's effect range.
- predict boolean If true, will attempt to predict enemy movements for ground location AoE spells.
- predictPad boolean Pads the prediction cast time. 'predict' must be true.
- enemies table A table of enemy units that the spell should be cast on.
Returns:
-
boolean
- cast.able.id (spellID, thisUnit, castType, minUnits, effectRng, predict, predictPad, enemies)
-
Checks if a spell can be cast by its ID based on various parameters.
Parameters:
- spellID number The ID of the spell to check.
- thisUnit string The target unit for the spell. Can be standard WoW units, dynamic units, or special parameters.
- castType string Defines the type of AoE or special cast conditions.
- minUnits number Minimum number of units needed to be hit by AoE spell.
- effectRng number The AoE's effect range.
- predict boolean If true, will attempt to predict enemy movements for ground location AoE spells.
- predictPad boolean Pads the prediction cast time. 'predict' must be true.
- enemies table A table of enemy units that the spell should be cast on.
Returns:
-
boolean
- cast.able.name (spellName, thisUnit, castType, minUnits, effectRng, predict, predictPad, enemies)
-
Checks if a spell can be cast by its Name based on various parameters.
Parameters:
- spellName string The Name of the spell to check.
- thisUnit string The target unit for the spell. Can be standard WoW units, dynamic units, or special parameters.
- castType string Defines the type of AoE or special cast conditions.
- minUnits number Minimum number of units needed to be hit by AoE spell.
- effectRng number The AoE's effect range.
- predict boolean If true, will attempt to predict enemy movements for ground location AoE spells.
- predictPad boolean Pads the prediction cast time. 'predict' must be true.
- enemies table A table of enemy units that the spell should be cast on.
Returns:
-
boolean
- cast.active.spell (thisUnit)
-
Checks if the spell is the one currently being cast.
Parameters:
- thisUnit string The unit to check if it's casting the spell. Can be standard WoW units or dynamic units.
Returns:
-
boolean
- cast.auto.spell ()
-
Checks if the spell is set to auto-repeat or if it's the current spell being cast.
Returns:
-
boolean
- cast.cancel.spell ()
-
Cancels the current spell being cast if it matches the specified spell.
Returns:
-
boolean
- cast.cost.spell (altPower)
-
Gets the cost of the spell.
Parameters:
- altPower boolean Set to "true" to return alternate power cost.
Returns:
-
number
- cast.current.spell (thisUnit)
-
Gets the currently cast spell for the target (Alternate to br.player.cast.active.spell()).
Parameters:
- thisUnit string Acceptable parameters: nil (defaults to "player"), standard WoW units, or dynamic units.
Returns:
-
boolean
- cast.current.id ()
-
Gets the spell id of the current (or previously) cast spell by the API.
Returns:
-
number
- cast.dispel.spell (thisUnit)
-
Checks if the spell is capable of dispelling the target.
Parameters:
- thisUnit string Acceptable parameters: nil (defaults to "target"), standard WoW units, or dynamic units.
Returns:
-
boolean
- cast.empowered.spell ()
-
Gets current empowered rank of the spell or 0 if not empowered.
Returns:
-
number
- cast.form (formIndex)
-
Casts the form corresponding to the provided formIndex number.
Parameters:
- formIndex number Index of the form to be casted. If not provided, defaults to 0.
- cast.inFlight.spell (thisUnit)
-
Checks if the spell is currently in flight to the target.
Parameters:
- thisUnit string Acceptable parameters: nil (defaults to "target"), standard WoW units, or dynamic units.
Returns:
-
boolean
- cast.inFlightRemain.spell (thisUnit)
-
Gets time remaining on a spell in flight to the target.
Parameters:
- thisUnit string The target unit to check for the spell in flight.
Returns:
-
number
- cast.last.spell (index)
-
Checks if the spell was the last one cast or not.
Parameters:
- index number Number of last cast spell up to 10 previous spells, default value is 1 if not provided.
Returns:
-
boolean
- cast.last.time.spell ()
-
Gets the GetTime() value the last cast of this spell occurred.
Returns:
-
number
- cast.noControl.spell ()
-
Checks if the spell can free you of a "no control" effect.
Returns:
-
boolean
- cast.opener (thisSpell, thisTracker, thisCount)
-
Casts special opener condition spell.
Parameters:
- thisSpell number The spell to be cast as the opener.
- thisTracker string The tracker for the opener.
- thisCount number The count for the opener.
Returns:
-
boolean
- cast.openerFail (thisSpell, thisTracker, thisCount)
-
Resets cast special opener condition if failed to cast.
Parameters:
- thisSpell number The spell that failed to cast.
- thisTracker string The tracker for the opener.
- thisCount number The count for the opener.
Returns:
-
boolean
- cast.pool.spell (specificAmt, multiplier)
-
Checks if specified power requirements are not met.
Parameters:
- specificAmt number Set to specified power amount. Defaults to 0 if not provided.
- multiplier number Set to specified power multiplier. Defaults to 1 if not provided.
Returns:
-
boolean
- cast.range.spell ()
-
Gets the spell's range, if it has one.
Returns:
-
number
- cast.regen.spell ()
-
Gets the amount of power spell will generate when cast.
Returns:
-
number
- cast.safe.spell (thisUnit, aoeType, minUnits, effectRng)
-
Checks if safe to cast specified aoe spell on unit given the aoe dimensions.
Parameters:
- thisUnit string The target unit to check for safety. Defaults to "target" if not provided.
- aoeType string The type of AoE to check for safety. Can be "rect", "cone", "ground", or "aoe".
- minUnits number Specify minimal number of units needed to be hit by AoE spell before it will use.
- effectRng number Specify the AoE's effect range to determine units hit by it.
Returns:
-
boolean
- cast.time.spell ()
-
Gets the cast time of player's spell. If the spell has no cast time, it returns the global cooldown.
Returns:
-
number
- cast.timeRemain (thisUnit)
-
Gets the cast time remaining on player's cast or supplied target.
Parameters:
- thisUnit string The unit to check cast time remaining. Defaults to "player" if not provided.
Returns:
-
number
- cast.timeSinceLast.spell ()
-
Gets the time since the last cast of this spell occurred.
Returns:
-
number
- cast.wait (condition)
-
Checks if the provided condition is true else it waits for 0.1sec.
Parameters:
- condition The condition to check.
Returns:
-
boolean