Skip to content

Damage Types and Resource Tokens

TheGenieOfTheCode edited this page Oct 29, 2026 · 2 revisions

Damage Types and Resource Tokens

Two sets of small pictures the family shares, so a fire hit or a spent Recovery looks the same in every module: an icon and colour for each damage type, and a drawn token for each resource.

Damage types

DAMAGE_TYPES holds an entry for each of Draw Steel's damage types, plus three of CTLib's own: untyped for damage with no type, healing for Stamina regained, and temporary for Temporary Stamina.

Key Icon
acid fa-solid fa-flask-vial
cold fa-solid fa-snowflake
corruption fa-brands fa-galactic-republic
fire fa-solid fa-fire
holy fa-solid fa-sun
lightning fa-solid fa-bolt
poison fa-solid fa-skull-crossbones
psychic fa-solid fa-brain
sonic fa-solid fa-volume-high
untyped fa-solid fa-burst
healing fa-solid fa-heart-pulse
temporary fa-solid fa-shield-halved

Each entry is { icon, dark, light }: the icon classes, and its colour for each theme as a hex string (null for untyped, which takes the text colour). The icons and dark colours match Draw Steel: Target Damage; the light colours are the same hues, darkened to read on a light background.

Colours by class

Rather than reading the hex values, give an element the class ctlib-dmg-<type>. CTLib's stylesheet colours it and switches the colour with Foundry's theme, so the same markup is right in both.

<span class="ctlib-dmg-fire">5 fire</span>

Functions

Function Returns
damageTypeIconHTML(type, { className = '' }) An <i> with the type's icon, colour classes and a rich tooltip naming the type. An empty or missing type gives the untyped icon; a type CTLib doesn't know gives ''.
damageTypeLabel(type) The type's name in the user's language: the system's own label when it has one, CTLib's for untyped, healing and temporary. An empty type reads as untyped.

Resource tokens

Drawn coins, one for each of a creature's resources, lit from above, each with its own colour, rim and emblem. They're drawn on a canvas when first asked for and kept, so there are no image files to ship.

RESOURCE_TOKENS lists the keys:

Key For
malice The Director's Malice.
heroic A hero's Heroic Resource.
surges Surges.
heroTokens Hero Tokens.
recovery Recoveries.
stamina Stamina.
temporary Temporary Stamina.
Function What it does
resourceTokenHTML(key, { tooltip = '', className = '' }) An <img> of the token, sized to sit in a line of text. It carries ctlib-res-token and ctlib-res-<key>, plus className. Returns '' for an unknown key.
resourceTokenURI(key, size = 64) The token as a PNG data URI, size pixels square, for an src or a CSS background. Returns null for an unknown key.
drawResourceToken(ctx, key, x, y, r) Draws the token onto your own 2D canvas context, centred on x, y with radius r.
line.insertAdjacentHTML('beforeend', resourceTokenHTML('surges', { tooltip: 'Surges' }));

The Malice token has horns above its rim, so resourceTokenURI draws it a little smaller and lower in its square to keep them inside.

Related Pages

Clone this wiki locally