add lingering damage macro
This commit is contained in:
parent
b1d7a70185
commit
f170896d1a
32
macros/lingering-damage.js
Normal file
32
macros/lingering-damage.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
swadeMBHelpers.runOnTargetOrSelectedTokens(main)
|
||||||
|
|
||||||
|
async function main (tokens) {
|
||||||
|
const tokenList = tokens.map(t => t.name).join(', ')
|
||||||
|
const dialogOptions = {
|
||||||
|
title: 'Lingering Damage',
|
||||||
|
content: `Apply <em>Lingering Damage</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/acid/dissolve-arm-flesh.webp'
|
||||||
|
const effectName = 'Lingering Damage'
|
||||||
|
for (const token of tokens) {
|
||||||
|
const mutate = swadeMBHelpers.createMutationWithEffect(icon, effectName, 1, [])
|
||||||
|
mutate.embedded.ActiveEffect['Lingering Damage'].flags.swade.expiration =
|
||||||
|
CONFIG.SWADE.CONST.STATUS_EFFECT_EXPIRATION.StartOfTurnPrompt
|
||||||
|
const mutateOptions = swadeMBHelpers.defaultMutationOptions(effectName)
|
||||||
|
await warpgate.mutate(token.document, mutate, {}, mutateOptions)
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
@ -19,7 +19,7 @@ export class helpers {
|
|||||||
icon,
|
icon,
|
||||||
id: name,
|
id: name,
|
||||||
label: name,
|
label: name,
|
||||||
duration: { rounds: 5 },
|
duration: { rounds: durationRounds },
|
||||||
flags: {
|
flags: {
|
||||||
swade: {
|
swade: {
|
||||||
expiration: CONFIG.SWADE.CONST.STATUS_EFFECT_EXPIRATION.EndOfTurnPrompt,
|
expiration: CONFIG.SWADE.CONST.STATUS_EFFECT_EXPIRATION.EndOfTurnPrompt,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user