Spell Methods
Core Methods
cast(unit)
Attempts to cast the spell on the specified unit.
local success = spell:cast(target) -- Returns boolean indicating success
castable(unit)
Checks if spell can be cast on the specified unit.
local canCast = spell:castable(target) -- Returns boolean
ready()
Checks if spell is ready to be cast (off cooldown and usable).
local isReady = spell:ready() -- Returns boolean
Cooldown Methods
getcd()
Gets remaining cooldown time in seconds.
local cooldown = spell:getcd() -- Returns number (seconds)
charges()
Gets current number of charges.
local currentCharges = spell:charges() -- Returns number
maxcharges()
Gets maximum number of charges.
local maxCharges = spell:maxcharges() -- Returns number
chargesleft()
Gets fractional charges remaining (includes partial charge regeneration).
local fractionalCharges = spell:chargesleft() -- Returns number
timetofull()
Gets time until all charges are regenerated.
local timeToFull = spell:timetofull() -- Returns number (seconds)
timetonextcharge()
Gets time until next charge is available.
local timeToNext = spell:timetonextcharge() -- Returns number (seconds)
Cast History Methods
waslastcast(timeWindow)
Checks if this spell was the last one cast within the specified time window.
local wasLast = spell:waslastcast(1.5) -- Returns boolean
wasSecondLastCast()
Checks if this spell was the second-to-last spell cast.
local wasSecondLast = spell:wasSecondLastCast() -- Returns boolean
timeSinceLastCast()
Gets time elapsed since this spell was last cast.
local timeSince = spell:timeSinceLastCast() -- Returns number (seconds)
AOE Methods
smartaoe(target, options)
Intelligently casts AOE spell considering multiple targets.
spell:smartaoe(target, {
offsetMin = 0, -- Minimum offset distance
offsetMax = 8, -- Maximum offset distance
distanceSteps = 24, -- Number of distance checks
circleSteps = 48, -- Number of circular positions to check
filter = function(unit, distance, position) -- Optional filter function
return true -- Return true to count this unit
end,
ignoreEnemies = false, -- Ignore enemy units
ignoreFriends = false -- Ignore friendly units
})
smartaoeposition(target, options)
Gets the optimal position for an AOE spell cast.
local position = spell:smartaoeposition(target, {
-- Same options as smartaoe()
})
-- Returns {x, y, z, hitCount} or nil
Angle Callback Methods
setanglecallback(angleCallback)
Sets a custom angle callback function or direct angle value for facing control.
-- Direct angle value (face north)
spell:setanglecallback(math.pi/2)
-- Function callback for dynamic angle calculation
spell:setanglecallback(function(spell, targetUnit)
return math.pi/4 -- Face northeast
end)
createangletoposition(x, y)
Helper function to create an angle callback that faces specific coordinates.
local angleCallback = spell:createangletoposition(100, 200)
spell:setanglecallback(angleCallback)
createangletounit(unit)
Helper function to create an angle callback that faces a specific unit.
-- Face current target
spell:setanglecallback(spell:createangletounit("target"))
-- Face specific unit
spell:setanglecallback(spell:createangletounit("focus"))
createanglewithoffset(offsetAngle)
Helper function to create an angle callback with a fixed offset from the target.
-- Face 45 degrees to the right of target
spell:setanglecallback(spell:createanglewithoffset(math.pi/4))
-- Face 90 degrees to the left of target
spell:setanglecallback(spell:createanglewithoffset(-math.pi/2))
Utility Methods
inrange(unit)
Checks if target is within spell range.
local inRange = spell:inrange(target) -- Returns boolean
rank()
Gets the current rank of a talent spell.
local rank = spell:rank() -- Returns number
overlayed()
Checks if the spell is currently overlayed (glowing).
local isOverlayed = spell:overlayed() -- Returns boolean
getcasttime()
Gets the cast time of the spell in seconds.
local castTime = spell:getcasttime() -- Returns number (seconds)
isknown()
Checks if the spell/talent is known by the player.
local isKnown = spell:isknown() -- Returns boolean
isusable()
Checks if spell is currently usable (has resources, etc).
local isusable, notEnoughResources = spell:isusable() -- Returns two booleans
Complete Example
-- Create a new spell object for Fireball
local fireball = Aurora.SpellHandler.NewSpell(133, {
})
-- Cast Fireball
fireball:cast(target)
-- Create an AOE spell like Blizzard
local blizzard = Aurora.SpellHandler.NewSpell(190356, {
isSkillshot = true,
radius = 8
})
-- Cast Blizzard optimally on groups of enemies
blizzard:smartaoe(target, {
offsetMax = 30,
filter = function(unit, distance, position)
return unit.enemy and not unit.dead
end
})