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 effectAccess 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
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.