Spell Objects are SYNQ's object-oriented system for working with abilities. Create them by providing a spell ID and optional traits that describe how the spell behaves.
synq.Spell(spellID, traits) -> Spell Object
local killCommand = synq.Spell(34026, {damage = "physical", targeted = true})
The spell object contains all attributes, methods, and functions for that spell. SYNQ automatically gathers spell information from WoW's API and uses traits to make intelligent casting decisions.
Traits tell SYNQ how each spell behaves - preventing casts into immunities, defining special casting rules, and handling edge cases automatically.
Common traits:
damage = "physical" or "magic" - Avoids damage immunitieseffect = "physical" or "magic" - Avoids effect immunitiestargeted = true - Requires a targetranged = true - Ranged spellheal = true - Healing spellignoreMoving = true - Can cast while movingignoreControl = true - Can cast while crowd controlledignoreChanneling = true - Cancels current channel to castignoreFacing = true - Doesn't require facing targetstun = true - Stun effectbleed = true - Bleed effectslow = true - Slow effectoverride = true - Spell may be replaced by another spell at runtime (talent, buff, or empower swap). Pairs with the spell.overridden attribute.alwaysFaceHack = true - Apply FaceHack automatically on every :Cast. Equivalent to passing { faceHack = true } each time. Aliases: autoFaceHack, faceHack.When a spell is flagged with override = true, SYNQ keeps tracking the original spell object even after the game swaps it for a replacement (e.g. Wake of Ashes → Hammer of Light). The spell.overridden attribute lets your callback branch based on which spell is actually live.
spell.overridden : true | nil
local wakeofashes = synq.Spell(255937, { override = true })
wakeofashes:Callback(function(spell)
-- Hammer of Light requires a target; Wake of Ashes does not.
if spell.overridden then return spell:Cast(target) end
return spell:Cast()
end)
The callback fires on the original spell object, so the same handler covers both forms — branch on spell.overridden only when the override changes targeting or behaviour.
Access the resource cost of a spell. Use spell.cost to check a specific power type, or spell.costs to auto-detect the power type and amount.
spell.cost.{powerType} - Cost for a specific power type
spell.cost.focus : number | 0
spell.cost.energy : number | 0
spell.cost.mana : number | 0
spell.cost.rage : number | 0
spell.costs - Auto-detects the power type and how much the spell costs
spell.costs : number | 0
-- Check specific power type cost
if player.focus >= killCommand.cost.focus then
killCommand()
end
-- Auto-detect cost (will return the cost regardless of power type)
if player.power >= cobraShot.costs then
cobraShot()
end
spell:Cast accepts an optional table as its second argument to tweak how the cast executes for that single call.
spell:Cast(unit, options)
Force the player to face the target for the cast, then restore the previous facing. Mouselook is preserved.
spell:Cast(unit, { faceHack = true }) -- face + restore
spell:Cast(unit, { faceHack = "oneWay" }) -- face only, no restore
spell:Cast(unit, { faceHack = "force" }) -- same as true
Apply an angular offset (in radians) on top of FaceHack. Useful for spells that need to fire slightly off-axis.
spell:Cast(unit, { faceHack = true, faceOffset = math.rad(20) })
To apply FaceHack on every cast of a spell without repeating the option, set the trait when constructing it:
local kick = synq.Spell(118, { alwaysFaceHack = true })
-- Aliases: autoFaceHack = true, faceHack = true
The same option is also accepted by item:Use — see Item Objects › Use. The underlying primitives (synq.FaceHack, synq.FaceSmooth, etc.) are documented in General Tools › Face Manipulation.
cobraShot = synq.Spell(193455, {damage = "physical", ranged = true, ignoreMoving = true})
feignDeath = synq.Spell(5384, {ignoreControl = true, ignoreChanneling = true})
exhilaration = synq.Spell(109304, {heal = true})
intimidation = synq.Spell(19577, {effect = "physical", stun = true})
Use synq.Populate to make spell objects available to your routine actor and file scope.
local Unlocker, synq, example = ...
local bm = example.hunter.bm
local Spell = synq.Spell
synq.Populate({
killCommand = Spell(34026, {damage = "physical", targeted = true}),
barbedShot = Spell(217200, {damage = "physical", ranged = true, targeted = true}),
cobraShot = Spell(193455, {damage = "physical", ranged = true, ignoreMoving = true}),
}, bm, getfenv(1))
After populating, call spells directly: killCommand() or barbedShot().
For a complete spellbook example with traits, callbacks, and rotation logic, see the Getting Started tutorial.
Next: Learn how to work with Item Objects for consumables, trinkets, and equipment.