add shroud macro
This commit is contained in:
parent
38a60f8671
commit
bf79a662a2
75
macros/shroud.js
Normal file
75
macros/shroud.js
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
swadeMBHelpers.runOnTargetOrSelectedTokens(main)
|
||||||
|
|
||||||
|
async function main (tokens) {
|
||||||
|
const tokenList = tokens.map(t => t.name).join(', ')
|
||||||
|
const dialogOptions = {
|
||||||
|
title: 'Shroud',
|
||||||
|
content: `Apply <em>Shroud</em> to ${tokenList}`,
|
||||||
|
default: 'cancel',
|
||||||
|
buttons: [
|
||||||
|
{ label: 'OK', value: 'ok' },
|
||||||
|
{ label: 'Cancel', value: 'cancel' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
const choice = await warpgate.buttonDialog(dialogOptions)
|
||||||
|
|
||||||
|
if (choice === 'ok') {
|
||||||
|
await createEffect(tokens)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createEffect (tokens) {
|
||||||
|
const icon = 'icons/magic/perception/silhouette-stealth-shadow.webp'
|
||||||
|
const effectName = 'Shroud'
|
||||||
|
for (const token of tokens) {
|
||||||
|
const effectData = {
|
||||||
|
icon,
|
||||||
|
id: effectName,
|
||||||
|
label: effectName,
|
||||||
|
duration: { rounds: 5 },
|
||||||
|
flags: {
|
||||||
|
swade: {
|
||||||
|
expiration: CONFIG.SWADE.CONST.STATUS_EFFECT_EXPIRATION.EndOfTurnPrompt,
|
||||||
|
loseTurnOnHold: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// const roiling = CONFIG.Canvas.lightAnimations.roiling
|
||||||
|
const mutate = {
|
||||||
|
token: {
|
||||||
|
light: {
|
||||||
|
alpha: 0.5,
|
||||||
|
angle: 360,
|
||||||
|
attenuation: 0.1,
|
||||||
|
animation: {
|
||||||
|
intensity: 5,
|
||||||
|
reverse: false,
|
||||||
|
speed: 5,
|
||||||
|
type: 'roiling'
|
||||||
|
},
|
||||||
|
bright: 0,
|
||||||
|
color: null,
|
||||||
|
coloration: 0,
|
||||||
|
contrast: 0,
|
||||||
|
dim: 0.1,
|
||||||
|
luminosity: -0.15,
|
||||||
|
saturation: 0,
|
||||||
|
shadows: 0.25
|
||||||
|
}
|
||||||
|
},
|
||||||
|
embedded: {
|
||||||
|
ActiveEffect: {
|
||||||
|
Shroud: effectData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const mutateOptions = {
|
||||||
|
comparisonKeys: { ActiveEffect: 'label' },
|
||||||
|
name: effectName,
|
||||||
|
permanent: false,
|
||||||
|
description: 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