1.0 release #30

Merged
mike merged 7 commits from develop into main 2023-03-07 06:20:43 +00:00
4 changed files with 102 additions and 13 deletions
Showing only changes of commit 37f76c2521 - Show all commits

View File

@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Confusion effect macro - Confusion effect macro
- Entangle effect macro - Entangle effect macro
- Blind effect macro - Blind effect macro
- Invisiblity macro
- Intangibility macro
### Changed ### Changed

41
macros/intangibility.js Normal file
View File

@ -0,0 +1,41 @@
swadeMBHelpers.runOnTargetOrSelectedTokens(main)
async function main (tokens) {
const tokenList = tokens.map(t => t.name).join(', ')
const menuOptions = {
title: 'Intangibility',
defaultButton: 'Cancel',
options: {}
}
const menuData = {
inputs: [
{ type: 'header', label: 'Intangibility' },
{ type: 'info', label: `Apply Intangibility to ${tokenList}` },
{ type: 'checkbox', label: 'Duration', options: false }
],
buttons: [
{ label: 'Apply', value: 'apply' },
{ label: 'Cancel', value: 'cancel' }
]
}
const { buttons, inputs } = await warpgate.menu(menuData, menuOptions)
if (buttons && buttons !== 'cancel') {
const options = {
duration: (!!inputs[2])
}
await createEffect(tokens, options)
}
}
async function createEffect (tokens, options) {
const effectName = 'Intangibility'
const duration = (options.duration ? 5 * 6 * 60 : 5)
const icon = 'icons/magic/control/debuff-energy-hold-levitate-blue-yellow.webp'
for (const token of tokens) {
const mutate = swadeMBHelpers.createMutationWithEffect(icon, effectName, duration, [])
const mutateOptions = swadeMBHelpers.defaultMutationOptions('Intangibility')
await warpgate.mutate(token.document, mutate, {}, mutateOptions)
}
}

44
macros/invisibility.js Normal file
View File

@ -0,0 +1,44 @@
swadeMBHelpers.runOnTargetOrSelectedTokens(main)
async function main (tokens) {
const tokenList = tokens.map(t => t.name).join(', ')
const menuOptions = {
title: 'Invisibility',
defaultButton: 'Cancel',
options: {}
}
const menuData = {
inputs: [
{ type: 'header', label: 'Invisibility' },
{ type: 'info', label: `Apply Invisibility to ${tokenList}` },
{ type: 'checkbox', label: 'Duration', 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'),
duration: (!!inputs[2])
}
await createEffect(tokens, options)
}
}
async function createEffect (tokens, options) {
const effectName = `${options.raise ? 'major' : 'minor'} Invisibility`
const baseEffect = CONFIG.statusEffects.find(se => se.label === 'EFFECT.StatusInvisible')
const duration = (options.duration ? 5 * 6 * 60 : 5)
for (const token of tokens) {
const mutate = swadeMBHelpers.createMutationWithEffect(baseEffect.icon, effectName, duration, [])
mutate.embedded.ActiveEffect[effectName].flags.core = { statusId: baseEffect.id }
const mutateOptions = swadeMBHelpers.defaultMutationOptions('Invisibility')
await warpgate.mutate(token.document, mutate, {}, mutateOptions)
}
}

File diff suppressed because one or more lines are too long