fix glow/shroud macros with optional mutation for lighting
This commit is contained in:
parent
58e2b033ae
commit
30b489e397
@ -8,44 +8,51 @@ async function main (tokens) {
|
||||
default: 'cancel',
|
||||
buttons: [
|
||||
{ label: 'OK', value: 'ok' },
|
||||
{ label: 'Mutate token lighting', value: 'mutate' },
|
||||
{ label: 'Cancel', value: 'cancel' }
|
||||
]
|
||||
}
|
||||
|
||||
const choice = await warpgate.buttonDialog(dialogOptions)
|
||||
|
||||
if (choice === 'ok') {
|
||||
await createEffect(tokens)
|
||||
if (choice === 'ok' || choice === 'mutate') {
|
||||
await createEffect(tokens, choice)
|
||||
}
|
||||
}
|
||||
|
||||
async function createEffect (tokens) {
|
||||
async function createEffect (tokens, choice) {
|
||||
const icon = 'icons/magic/light/explosion-star-blue-large.webp'
|
||||
const effectName = 'Glow'
|
||||
for (const token of tokens) {
|
||||
const mutate = swadeMBHelpers.createMutationWithEffect(icon, effectName, 5, [])
|
||||
const mutateOptions = swadeMBHelpers.defaultMutationOptions(effectName)
|
||||
mutate.token = {
|
||||
light: {
|
||||
alpha: 0.5,
|
||||
angle: 360,
|
||||
attenuation: 0.5,
|
||||
animation: {
|
||||
intensity: 5,
|
||||
reverse: false,
|
||||
speed: 5,
|
||||
type: 'starlight'
|
||||
},
|
||||
bright: 0,
|
||||
color: '#0f3fff',
|
||||
coloration: 1,
|
||||
contrast: 0,
|
||||
dim: 0.5,
|
||||
luminosity: 0.5,
|
||||
saturation: 0,
|
||||
shadows: 0
|
||||
}
|
||||
}
|
||||
await warpgate.mutate(token.document, mutate, {}, mutateOptions)
|
||||
if (choice === 'mutate') {
|
||||
const mutate2 = {
|
||||
token: {
|
||||
light: {
|
||||
alpha: 0.5,
|
||||
angle: 360,
|
||||
attenuation: 0.5,
|
||||
animation: {
|
||||
intensity: 5,
|
||||
reverse: false,
|
||||
speed: 5,
|
||||
type: 'starlight'
|
||||
},
|
||||
bright: 0,
|
||||
color: '#0f3fff',
|
||||
coloration: 1,
|
||||
contrast: 0,
|
||||
dim: 0.5,
|
||||
luminosity: 0.5,
|
||||
saturation: 0,
|
||||
shadows: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
mutateOptions.permanent = false
|
||||
await warpgate.mutate(token.document, mutate2, {}, mutateOptions)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,44 +8,51 @@ async function main (tokens) {
|
||||
default: 'cancel',
|
||||
buttons: [
|
||||
{ label: 'OK', value: 'ok' },
|
||||
{ label: 'Mutate token lighting', value: 'mutate' },
|
||||
{ label: 'Cancel', value: 'cancel' }
|
||||
]
|
||||
}
|
||||
|
||||
const choice = await warpgate.buttonDialog(dialogOptions)
|
||||
|
||||
if (choice === 'ok') {
|
||||
await createEffect(tokens)
|
||||
if (choice === 'ok' || choice === 'mutate') {
|
||||
await createEffect(tokens, choice)
|
||||
}
|
||||
}
|
||||
|
||||
async function createEffect (tokens) {
|
||||
async function createEffect (tokens, choice) {
|
||||
const icon = 'icons/magic/perception/silhouette-stealth-shadow.webp'
|
||||
const effectName = 'Shroud'
|
||||
for (const token of tokens) {
|
||||
const mutate = swadeMBHelpers.createMutationWithEffect(icon, effectName, 5, [])
|
||||
const mutateOptions = swadeMBHelpers.defaultMutationOptions(effectName)
|
||||
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
|
||||
}
|
||||
}
|
||||
await warpgate.mutate(token.document, mutate, {}, mutateOptions)
|
||||
if (choice === 'mutate') {
|
||||
const mutate2 = {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
mutateOptions.permanent = false
|
||||
await warpgate.mutate(token.document, mutate2, {}, mutateOptions)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user