Skip to content

Commit

Permalink
Merge pull request #78 from etiquettestartshere/1.1.19
Browse files Browse the repository at this point in the history
1.1.19
  • Loading branch information
etiquettestartshere authored May 17, 2024
2 parents ded8da7 + 30fb733 commit df5e423
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scripts/api.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
}

Expand Down

0 comments on commit df5e423

Please sign in to comment.