Skip to content

Draw Steel Helpers

TheGenieOfTheCode edited this page Nov 17, 2026 · 4 revisions

Draw Steel Helpers

Helpers that know how the Draw Steel system stores things: squads, Stamina, sizes, abilities and power rolls.

Squads and Stamina

Function Returns
getSquadGroup(actor) The squad combat group the actor's combatant belongs to in the current combat, or null.
snapStamina(actor) A snapshot to undo damage with: { prevValue, prevTemp, squadGroup, prevSquadHP, squadCombatantIds, squadTokenIds }. Take it before applying damage.
undoDamage(actor, snapshot) Puts the actor's Stamina, temporary Stamina and its squad's Stamina pool back as the snapshot recorded them. The updates carry the dsblUndo: true option, so an update hook can tell an undo from healing.
damageBatch(fn) Runs fn and returns its result, marking that damage is being applied in a batch while it runs. Death Tracker waits for a batch to finish before deciding who dies, so wrap several damage applications that belong together.

Size, movement and forced movement

Function Returns
sizeRank(size) A number that orders sizes from smallest to largest: 1T is 0, 1S 1, 1M 2, 1L 3, 2 is 4, 3 is 5, and so on. Takes a Draw Steel size { value, letter }.
canForcedMoveTarget(attacker, target, might = null) Whether attacker can force move target: its Might is at least 2 and at least the target's size, or it's at least as large. Pass might to use a different score.
hasFly(actor) Whether the actor has a fly speed.
canCurrentlyFly(actor) Whether it can fly right now: it has a fly speed, isn't prone or restrained, and its speed is above 0.

Abilities

Function Returns
getItemDsid(item) The item's Draw Steel id, the stable name that doesn't change between copies of the same ability, or null.
getItemRange(item, distance = null) The ability's reach in squares, read from its distance. For melee or ranged abilities it's the ranged number when the ability is set to ranged; lines, cubes and walls add their size to how far away they can be placed.
isSelfAndSelf(ability, view = null) Whether the ability both targets and ranges as self.
rangeEnforced() Whether range limits apply for this user: the enforceAbilityRange config is on, and the user isn't a Director with gmBypassRangeEnforcement on.
MULTI_GRAB_LIMITS How many creatures the monster abilities that can grab more than one can hold, by Draw Steel id.

Power rolls

Function Returns
tierOf(total) The tier a power roll total reaches: 11 or lower is tier 1, 12 to 16 tier 2, 17 or higher tier 3.
parsePowerRollState(element) Reads the ability roll in a rendered chat message: { originalTotal, originalNet, baseFormula, baseTooltip, isCritical }, where originalNet is 1 for a bane and -1 for an edge, and the formula has that bonus taken back out. null when the message has no ability roll.

Summons and companions

CTLib marks every token an ability's summon places with the ability that summoned it, whether the summon came from the ability's Summon button or a portfolio summon. Summons the system imports from a compendium also carry the system's own summonSource flag, which these read too.

Function Returns
summonSourceOf(tokenOrActor) The uuid of the ability (or actor) that summoned it, or null.
isSummoned(tokenOrActor) Whether it was summoned.
summonerOf(tokenOrActor) The actor that summoned it, or null.
summonsOf(actor, { abilityUuid }) The tokens on the scene actor summoned, or only those one ability summoned.
masterOf(companion) A companion's hero, or null.
companionsOf(hero) The tokens on the scene of the hero's companions.

Finding actors and monsters

Function Returns
getActingActor(predicate = null) The actor the user is most likely acting as: a controlled token they own first, then their assigned character, then (for players) any token they own on the scene. With predicate, the first of those it accepts.
monsterFilter Predicate builders for filtering actors, listed below.
const { monsterFilter: filter } = ctlib;

const goblinMinions = game.actors.filter((a) => filter.keyword('goblin')(a) && filter.isMinion(a));
const onScene = canvas.tokens.placeables.filter(filter.onActor(filter.sameLevel(leader)));
Predicate Accepts an actor that
keyword(kw) Has the monster keyword.
organization(o) Has that organization, such as 'minion' or 'leader'.
level(n) Is that level.
type(t) Is that actor type.
isMinion Is a minion. Use it as it is, without calling it.
sameLevel(source) Shares the level of source, an actor or token.
sameOrganization(source) Shares its organization.
sameKeywords(source) Has exactly the same keywords.
onActor(fn) Wraps an actor predicate so it takes tokens.

Action tracker

actions records which of its main action, maneuver, move and triggered action each combatant has spent this round, and shows them as pips on the combat tracker. It does nothing until a module turns it on with actions.enable(moduleId). From then on, using an ability on a creature's turn spends that kind of action, a minion squad spends its main action together, deleting the ability's chat message gives it back, a creature's turn start frees its main action, maneuver and move, and a new round frees its triggered action. Owners can click a pip to switch it. A chat message with the granted flag under CTLib's scope spends nothing.

Function What it does
actions.enable(moduleId) Turns the tracker on.
actions.get(target) The state for a token, actor or combatant: { main, maneuver, move, triggered, mainFree, minion, onTurn }, or null when it isn't in a combat. main is null while free, else what it was spent as.
actions.spend(target, kind, { source, force }) Spends 'main', 'maneuver', 'move' or 'triggered', using the main action when the maneuver or move is already spent. Returns the slot spent, or null. source names the spender for refund; force marks it spent even when nothing is left.
actions.refund(target, { source, slot }) Frees what source spent, or one slot. Returns the freed slots.

Related Pages

Clone this wiki locally