Spell Objects are SYNQ's object-oriented system for working with abilities. Each spell object provides a powerful, customized set of tools for casting, tracking, and managing that specific spell throughout your routine.
Create spell objects by providing a spell ID and optional traits that describe how the spell behaves. Once created, all methods and attributes for that spell object follow the traits you've defined.
synq.Spell(spellID, traits) -> Spell Object
local killCommand = synq.Spell(34026, {damage = "physical", targeted = true})
Now killCommand contains all attributes, methods, and functions of a spell object. You can use it to check cooldowns, cast the spell, set up callbacks, and gather information about Kill Command.
SYNQ automatically gathers spell information from WoW's API and presents it as attributes. By telling it damage = "physical", the spell object knows to avoid casting into physical damage immunities automatically.
Spell traits tell SYNQ how each spell behaves. Many traits exist to prevent casting into immunities, while others define special casting rules (like casting while moving or while crowd controlled).
By default, :Cast won't attempt to cast while you're crowd controlled. Some abilities can be cast during CC, like Feign Death:
-- Feign Death can be cast while in CC, and we want it to cancel any channeling spells
-- ignoreControl allows casting while crowd controlled
-- ignoreChanneling allows it to cancel current channel to cast
feignDeath = synq.Spell(5384, {ignoreControl = true, ignoreChanneling = true})
Some spells can be cast while moving, like Cobra Shot or Steady Shot:
cobraShot = synq.Spell(193455, {damage = "physical", ranged = true, ignoreMoving = true})
The ignoreMoving trait tells SYNQ this spell can be cast while moving, so it won't wait for you to stop before attempting to cast.
Spell objects handle complex casting logic automatically. Even a simple example like Kill Command benefits—the :Cast method automatically checks:
All of this happens automatically when you call killCommand:Cast(target), so you can focus on rotation logic instead of casting conditions.
Spell objects allow you to modularize code related to the spell into neat little packages within itself. This provides:
:Cast perfectly timed as an immunity to it will fallCastEdgeUse synq.Populate to make spell objects available to your routine actor and the current file's scope. This lets you reference spells directly by name without creating local variables or storing them in tables.
local Unlocker, synq, example = ...
local bm = example.hunter.bm
local spells = {
exhilaration = synq.Spell(109304, {heal = true}),
intimidation = synq.Spell(19577, {effect = "physical", stun = true}),
killCommand = synq.Spell(34026, {damage = "physical", targeted = true}),
}
synq.Populate(spells, bm, getfenv(1))
After populating, you can call killCommand() or exhilaration() directly in your actor without needing local references. This keeps your code clean and organized.
Here's a comprehensive Beast Mastery Hunter spellbook showing how to organize spells with proper traits:
local Unlocker, synq, example = ...
local bm = example.hunter.bm
local Spell = synq.Spell
synq.Populate({
-- SYNQ objects (always available)
target = synq.target,
focus = synq.focus,
player = synq.player,
healer = synq.healer,
pet = synq.pet,
enemyHealer = synq.enemyHealer,
-- Core rotation abilities
killCommand = Spell(34026, { damage = "physical", targeted = true }),
barbedShot = Spell(217200, { damage = "physical", ranged = true, targeted = true }),
cobraShot = Spell(193455, { damage = "physical", ranged = true, targeted = true }),
serpentSting = Spell(271788, { damage = "physical", ranged = true, targeted = true, bleed = true }),
-- Cooldowns
bestialWrath = Spell(19574, { damage = "physical" }),
aspectOfTheWild = Spell(193530, { damage = "physical" }),
bloodshed = Spell(321530, { damage = "physical", targeted = true }),
-- Utility
disengage = Spell(781, { ignoreFacing = true }),
harpoon = Spell(190925, { damage = "physical", targeted = true }),
feignDeath = Spell(5384),
exhilaration = Spell(109304, { heal = true }),
mendPet = Spell(136, { heal = true }),
-- Crowd control
intimidation = Spell(19577, { effect = "physical", stun = true }),
concussiveShot = Spell(5116, { effect = "physical", ranged = true, targeted = true, slow = true }),
}, bm, getfenv(1))
This example shows how to organize a complete spellbook with proper traits. Each trait helps SYNQ make intelligent casting decisions—avoiding immunities, checking range, and handling special cases automatically.
Next: Learn how to work with Item Objects for consumables, trinkets, and equipment.