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',
|
default: 'cancel',
|
||||||
buttons: [
|
buttons: [
|
||||||
{ label: 'OK', value: 'ok' },
|
{ label: 'OK', value: 'ok' },
|
||||||
|
{ label: 'Mutate token lighting', value: 'mutate' },
|
||||||
{ label: 'Cancel', value: 'cancel' }
|
{ label: 'Cancel', value: 'cancel' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
const choice = await warpgate.buttonDialog(dialogOptions)
|
const choice = await warpgate.buttonDialog(dialogOptions)
|
||||||
|
|
||||||
if (choice === 'ok') {
|
if (choice === 'ok' || choice === 'mutate') {
|
||||||
await createEffect(tokens)
|
await createEffect(tokens, choice)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createEffect (tokens) {
|
async function createEffect (tokens, choice) {
|
||||||
const icon = 'icons/magic/light/explosion-star-blue-large.webp'
|
const icon = 'icons/magic/light/explosion-star-blue-large.webp'
|
||||||
const effectName = 'Glow'
|
const effectName = 'Glow'
|
||||||
for (const token of tokens) {
|
for (const token of tokens) {
|
||||||
const mutate = swadeMBHelpers.createMutationWithEffect(icon, effectName, 5, [])
|
const mutate = swadeMBHelpers.createMutationWithEffect(icon, effectName, 5, [])
|
||||||
const mutateOptions = swadeMBHelpers.defaultMutationOptions(effectName)
|
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)
|
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',
|
default: 'cancel',
|
||||||
buttons: [
|
buttons: [
|
||||||
{ label: 'OK', value: 'ok' },
|
{ label: 'OK', value: 'ok' },
|
||||||
|
{ label: 'Mutate token lighting', value: 'mutate' },
|
||||||
{ label: 'Cancel', value: 'cancel' }
|
{ label: 'Cancel', value: 'cancel' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
const choice = await warpgate.buttonDialog(dialogOptions)
|
const choice = await warpgate.buttonDialog(dialogOptions)
|
||||||
|
|
||||||
if (choice === 'ok') {
|
if (choice === 'ok' || choice === 'mutate') {
|
||||||
await createEffect(tokens)
|
await createEffect(tokens, choice)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createEffect (tokens) {
|
async function createEffect (tokens, choice) {
|
||||||
const icon = 'icons/magic/perception/silhouette-stealth-shadow.webp'
|
const icon = 'icons/magic/perception/silhouette-stealth-shadow.webp'
|
||||||
const effectName = 'Shroud'
|
const effectName = 'Shroud'
|
||||||
for (const token of tokens) {
|
for (const token of tokens) {
|
||||||
const mutate = swadeMBHelpers.createMutationWithEffect(icon, effectName, 5, [])
|
const mutate = swadeMBHelpers.createMutationWithEffect(icon, effectName, 5, [])
|
||||||
const mutateOptions = swadeMBHelpers.defaultMutationOptions(effectName)
|
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)
|
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