templates

WildMagicAPI. templates

Methods

# (async, static) handler(actor, surgeData, targetRoll, surgeRoll) → {Promise}

Core roll <= target handler. Has no side effects and can be used to build upon. Checks for surge given the roll and targets, produces chat message data, retrieves the table configured in Helpers, and produces the update data for recharging Tides if enabled in the Helpers options.

Parameters:
Name Type Description
actor Actor5e

actor for the surge

surgeData Object
Properties
Name Type Description
spellLevel number

Spell level triggering this surge check

targetRoll string | Roll

Either a die expression or a Roll object (evaluated or not) representing the target number that the surge roll will be compared against.

surgeRoll string | Roll

Either a die expression or a Roll object (evaluated or not) representing the surge check.

Returns:

surge results, table selection, resulting chat data for this surge.

Type
Promise

# (static) preCheck(actor, updates) → {Object|boolean}

Core "was slot used?" pre check for surging. Checks if the actor update is a reduction in spell slot counts. Each preCheck function will return data for its paired handler to consume in order to execute the needed rolls to determine if a surge actually occurs.

Parameters:
Name Type Description
actor Actor5e

The actor at its current state, before any updates have been applied

updates Object

The incoming updates that may trigger a surge check. In this case, the reduction of any spell slot count will trigger a surge check.

See:
  • WildMagic.templates.handler
Returns:

a non-false return indicates that this update triggers a surge check. Additionally, the data returned will be used by the surge handler in order to execute the needed checks. {spellLevel: number} is returned by this handler and is intended for use with the default handler.

Type
Object | boolean