Created
August 3, 2020 23:03
-
-
Save teddy-dev/78b0444ff685447f8cc4e3d72933b1d7 to your computer and use it in GitHub Desktop.
FoundryVTT - Offer short or long rest to all player controlled tokens
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let type = 0; | |
let choice = new Dialog({ | |
title: 'Offer Rest', | |
content: '<p>Do you want to offer all players a short or long rest?</p>', | |
buttons: { | |
short: { | |
label: 'Short', | |
callback: () => { | |
type = 1; | |
} | |
}, | |
long: { | |
label: 'Long', | |
callback: () => { | |
type = 2; | |
} | |
} | |
}, | |
default: "short", | |
close: () => { | |
for (let token of canvas.tokens.controlled) { | |
if (token.inCombat === false && token.actor) { | |
if (type === 1) token.actor.shortRest(); | |
else if (type === 2) token.actor.longRest(); | |
} | |
} | |
} | |
}); | |
choice.render(true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment