39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
swadeMBHelpers.runOnTargetOrSelectedTokens(main)
|
|
|
|
async function main (tokens) {
|
|
const tokenList = tokens.map(t => t.name).join(', ')
|
|
const dialogOptions = {
|
|
title: 'Hurry',
|
|
content: `Apply <em>Hurry</em> to ${tokenList}`,
|
|
default: 'cancel',
|
|
buttons: [
|
|
{ label: 'OK', value: 'ok' },
|
|
{ label: 'Cancel', value: 'cancel' }
|
|
]
|
|
}
|
|
|
|
const choice = await warpgate.buttonDialog(dialogOptions, 'column')
|
|
|
|
if (choice === 'ok') {
|
|
await createEffect(tokens, choice)
|
|
}
|
|
}
|
|
|
|
async function createEffect (tokens, choice) {
|
|
const icon = 'icons/skills/movement/feet-winged-boots-blue.webp'
|
|
const effectName = 'Hurry'
|
|
const changes = [
|
|
{
|
|
key: 'system.stats.speed.value',
|
|
mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD,
|
|
value: 2,
|
|
priority: 0
|
|
}
|
|
]
|
|
for (const token of tokens) {
|
|
const mutate = swadeMBHelpers.createMutationWithEffect(icon, effectName, 5, changes)
|
|
const mutateOptions = swadeMBHelpers.defaultMutationOptions(effectName)
|
|
await warpgate.mutate(token.document, mutate, {}, mutateOptions)
|
|
}
|
|
}
|