swadeMBHelpers.runOnTargetOrSelectedTokens(main) async function main (tokens) { const tokenList = tokens.map(t => t.name).join(', ') const dialogOptions = { title: 'Hurry/Hinder', content: `Apply Hurry or Hinder 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) } }