add hurry-hinder macro
This commit is contained in:
parent
f170896d1a
commit
f689b0fc48
44
macros/hurry-hinder.js
Normal file
44
macros/hurry-hinder.js
Normal file
@ -0,0 +1,44 @@
|
||||
swadeMBHelpers.runOnTargetOrSelectedTokens(main)
|
||||
|
||||
async function main (tokens) {
|
||||
const tokenList = tokens.map(t => t.name).join(', ')
|
||||
const dialogOptions = {
|
||||
title: 'Hurry/Hinder',
|
||||
content: `Apply <em>Hurry or Hinder</em> to ${tokenList}`,
|
||||
default: 'cancel',
|
||||
buttons: [
|
||||
{ label: 'Hurry', value: 'hurry' },
|
||||
{ label: 'Hinder', value: 'hinder' },
|
||||
{ label: 'Cancel', value: 'cancel' }
|
||||
]
|
||||
}
|
||||
|
||||
const choice = await warpgate.buttonDialog(dialogOptions, 'column')
|
||||
|
||||
if (choice && choice !== 'cancel') {
|
||||
await createEffect(tokens, choice)
|
||||
}
|
||||
}
|
||||
|
||||
async function createEffect (tokens, choice) {
|
||||
let icon = 'icons/skills/movement/feet-winged-boots-blue.webp'
|
||||
let effectName = 'Hurry'
|
||||
const changes = [
|
||||
{
|
||||
key: 'system.stats.speed.value',
|
||||
mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD,
|
||||
value: 2,
|
||||
priority: 0
|
||||
}
|
||||
]
|
||||
if (choice === 'hinder') {
|
||||
changes.value = '-2'
|
||||
effectName = 'Hinder'
|
||||
icon = 'icons/magic/movement/abstract-ribbons-red-orange.webp'
|
||||
}
|
||||
for (const token of tokens) {
|
||||
const mutate = swadeMBHelpers.createMutationWithEffect(icon, effectName, 5, [])
|
||||
const mutateOptions = swadeMBHelpers.defaultMutationOptions(effectName)
|
||||
await warpgate.mutate(token.document, mutate, {}, mutateOptions)
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user