From 30fb733b8932c4ae1df6d2a9d6c03a1b44d99f93 Mon Sep 17 00:00:00 2001 From: alakshana Date: Thu, 16 May 2024 22:58:09 -0400 Subject: [PATCH] 1.1.19 --- scripts/api.mjs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/api.mjs b/scripts/api.mjs index c8842e5..8c603c4 100644 --- a/scripts/api.mjs +++ b/scripts/api.mjs @@ -42,25 +42,33 @@ export class API { } // Target handling + + // Handle `game.user.targets` let owned; let toTarget; if (targets instanceof Set) { [owned, toTarget] = partitionTargets(Array.from(targets)); } + + // Handle a single Uuid else if (foundry.utils.getType(targets) === "string") { const t = await fromUuid(targets); - t.document.isOwner ? owned = t : toTarget = Array.from(t); + t.document.isOwner ? owned = Array.from(t) : toTarget = Array.from(t); } + + // Handle an array of Tokens else if (targets.at(0) instanceof Token) { [owned, toTarget] = partitionTargets(targets); } else { + + // Handle an array of Uuids owned = []; toTarget = []; for (const target of targets) { const t = await fromUuid(target); if (t.isOwned) owned.push(t); - else toTarget.push(t); + else toTarget.push(target); }; }