fix target finding helper
This commit is contained in:
+5
-3
@@ -2,9 +2,11 @@ export class helpers {
|
||||
static runOnTargetOrSelectedTokens (runFunc) {
|
||||
let tokens = []
|
||||
const targets = Array.from(game.user.targets)
|
||||
if (targets.length > 0) tokens = targets
|
||||
if (canvas.tokens.controlled.length > 0) tokens = canvas.tokens.controlled
|
||||
|
||||
if (targets.length > 0) {
|
||||
tokens = targets
|
||||
} else if (canvas.tokens.controlled.length > 0) {
|
||||
tokens = canvas.tokens.controlled
|
||||
}
|
||||
if (tokens.length > 0) {
|
||||
runFunc(tokens)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user