1.0 release #30
@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
- Confusion effect macro
|
||||
- Entangle effect macro
|
||||
- Blind effect macro
|
||||
|
||||
### Changed
|
||||
|
||||
|
||||
45
macros/blind.js
Normal file
45
macros/blind.js
Normal file
@ -0,0 +1,45 @@
|
||||
swadeMBHelpers.runOnTargetOrSelectedTokens(main)
|
||||
|
||||
async function main (tokens) {
|
||||
const tokenList = tokens.map(t => t.name).join(', ')
|
||||
const menuOptions = {
|
||||
title: 'Blind',
|
||||
defaultButton: 'Cancel',
|
||||
options: {}
|
||||
}
|
||||
|
||||
const menuData = {
|
||||
inputs: [
|
||||
{ type: 'header', label: 'Blind' },
|
||||
{ type: 'info', label: `Apply Blind to ${tokenList}` },
|
||||
{ type: 'checkbox', label: 'Strong', options: false }
|
||||
],
|
||||
buttons: [
|
||||
{ label: 'Apply', value: 'apply' },
|
||||
{ label: 'Raise', value: 'raise' },
|
||||
{ label: 'Cancel', value: 'cancel' }
|
||||
]
|
||||
}
|
||||
|
||||
const { buttons, inputs } = await warpgate.menu(menuData, menuOptions)
|
||||
if (buttons && buttons !== 'cancel') {
|
||||
const options = {
|
||||
raise: (buttons === 'raise'),
|
||||
strong: (!!inputs[2])
|
||||
}
|
||||
await createEffect(tokens, options)
|
||||
}
|
||||
}
|
||||
|
||||
async function createEffect (tokens, options) {
|
||||
const effectDetails = (options.raise ? '-4' : '-2')
|
||||
const effectEnd = (options.strong ? 'Vigor -2' : 'Vigor')
|
||||
const effectName = `Blind (${effectDetails}) ${effectEnd} ends`
|
||||
const baseEffect = CONFIG.statusEffects.find(se => se.label === 'EFFECT.StatusBlind')
|
||||
for (const token of tokens) {
|
||||
const mutate = swadeMBHelpers.createMutationWithEffect(baseEffect.icon, effectName, 1, [])
|
||||
mutate.embedded.ActiveEffect[effectName].flags.core = { statusId: baseEffect.id }
|
||||
const mutateOptions = swadeMBHelpers.defaultMutationOptions('Blind')
|
||||
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