Module action.Cast
Includes all casts API.
Functions
| API.CanCast (action, checks) | Checks if an action can be cast based on various conditions. |
| API.Cast (action, unit, checks) | Attempts to cast a given action on a specified unit, considering cast modes and checks. |
| API.CastTrinkets (excludes, condition) | Attempts to cast usable trinkets based on current settings and conditions. |
| API.CastEquipment (excludes, condition, checks) | Attempts to cast usable equipment (weapons) based on current settings and conditions. |
| API.CastHealItems () | Attempts to use healing items like Healthstone or Healing Potion based on player's current health and item readiness. |
| API.CastMitigation () | Attempts to cast available mitigation spells if the player needs active mitigation. |
| API.CastDispel () | Attempts to cast a dispel on the heal target if dispellable debuffs are present. |
| API.CastPurge () | Attempts to cast a purge on the current target if purgable buffs are present. |
| API.CastDesnare () | Attempts to cast a desnare spell on the player or heal target if they are snared. |
| API.CastAutoAttack () | Attempts to initiate auto-attack if not already auto-attacking. |
| API.StopCasting () | Attempts to stop the current spell cast or channel. |
| API.CastPool () | Casts the "Spell Pool" action. |
| API.CastOrPool (action, condition) | Attempts to cast an action; if the action cannot be cast or the condition is not met, it casts the Spell Pool. |
| API.CastQueue (...) | Attempts to cast the first spell in a given list of spells (queue), falling back to Spell Pool if it cannot be cast. |
Functions
- API.CanCast (action, checks)
-
Checks if an action can be cast based on various conditions.
Parameters:
- action table The action to check.
- checks table|nil Optional. A table of checks to perform. * `Moving` boolean: (default: `true`) If `true`, checks if the player is moving if the action has a cast time. * `Range` boolean: (default: `true`) If `true`, checks if the unit is within the action's range. * `Casting` boolean: (default: `true`) If `true`, checks if the player is currently casting or channeling, or if GCD is active. * `LoS` boolean: (default: `true`) If `true`, checks Line of Sight to the target. * `Facing` boolean: (default: `true`) If `true`, checks if the player is facing the target.
Returns:
-
boolean True if the action can be cast, false otherwise.
- API.Cast (action, unit, checks)
-
Attempts to cast a given action on a specified unit, considering cast modes and checks.
Parameters:
- action table The action to cast.
- unit table|nil Optional. The unit to cast the action on.
- checks table|nil Optional. A table of checks to perform. See `API.CanCast` for details.
Returns:
-
boolean True if the action was successfully cast or queued, false otherwise.
- API.CastTrinkets (excludes, condition)
-
Attempts to cast usable trinkets based on current settings and conditions.
Parameters:
- excludes table|nil Optional. A table of item IDs to exclude from consideration.
- condition function|nil Optional. A function that takes a unit as input and returns true if the trinket should be used on that unit.
Returns:
-
boolean True if a trinket was cast, false otherwise.
- API.CastEquipment (excludes, condition, checks)
-
Attempts to cast usable equipment (weapons) based on current settings and conditions.
Parameters:
- excludes table|nil Optional. A table of item IDs to exclude from consideration.
- condition function|nil Optional. A function that takes a unit (Target) as input and returns true if the equipment should be used.
- checks table|nil Optional. A table of checks to perform. See `API.CanCast` for details.
Returns:
-
boolean True if equipment was cast, false otherwise.
- API.CastHealItems ()
-
Attempts to use healing items like Healthstone or Healing Potion based on player's current health and item readiness.
Returns:
-
boolean True if a healing item was used, false otherwise.
- API.CastMitigation ()
-
Attempts to cast available mitigation spells if the player needs active mitigation.
Returns:
-
boolean True if a mitigation spell was cast, false otherwise.
- API.CastDispel ()
-
Attempts to cast a dispel on the heal target if dispellable debuffs are present.
Returns:
-
boolean True if a dispel spell was cast, false otherwise.
- API.CastPurge ()
-
Attempts to cast a purge on the current target if purgable buffs are present.
Returns:
-
boolean True if a purge spell was cast, false otherwise.
- API.CastDesnare ()
-
Attempts to cast a desnare spell on the player or heal target if they are snared.
Returns:
-
boolean True if a desnare spell was cast, false otherwise.
- API.CastAutoAttack ()
-
Attempts to initiate auto-attack if not already auto-attacking.
Returns:
-
boolean True if auto-attack was initiated, false otherwise.
- API.StopCasting ()
-
Attempts to stop the current spell cast or channel.
Returns:
-
boolean True if the stop casting action was performed, false otherwise.
- API.CastPool ()
-
Casts the "Spell Pool" action.
Returns:
-
boolean True if the Spell Pool action was cast, false otherwise.
- API.CastOrPool (action, condition)
-
Attempts to cast an action; if the action cannot be cast or the condition is not met, it casts the Spell Pool.
Parameters:
- action table The action to attempt to cast.
- condition boolean|nil Optional. A boolean condition that must be true for the action to be attempted. If false, immediately casts Spell Pool.
Returns:
-
boolean True if the action was cast or Spell Pool was cast, false otherwise.
- API.CastQueue (...)
-
Attempts to cast the first spell in a given list of spells (queue), falling back to Spell Pool if it cannot be cast.
Parameters:
- ... table A variable number of spells, treated as a queue. Only the first spell is considered.
Returns:
-
boolean True if the first spell in the queue was cast or Spell Pool was cast, false otherwise.