Foundry VTT/P2FE
Jump to navigation
Jump to search
Macros
Raise Shield
game.pf2e.actions.raiseAShield({ actors: [token?.actor ?? actor ?? game.user.character].filter((actor) => actor) })
Scouting
const actors = game.user.getActiveTokens().flatMap((t) => t.actor ?? []); if (actors.length === 0) { return ui.notifications.error("PF2E.ErrorMessage.NoTokenSelected", { localize: true }); } const ITEM_UUID = "Compendium.pf2e.other-effects.Item.EMqGwUi3VMhCjTlF"; // Effect: Scouting const item = await fromUuid(ITEM_UUID); if (item?.type === "condition") { for (const actor of actors) { actor.toggleCondition(item.slug); } } else if (item?.type === "effect") { const source = item.toObject(); source.flags = mergeObject(source.flags ?? {}, { core: { sourceId: ITEM_UUID } }); for (const actor of actors) { const existing = actor.itemTypes.effect.find((e) => e.flags.core?.sourceId === ITEM_UUID); if (existing) { await existing.delete(); } else { await actor.createEmbeddedDocuments("Item", [source]); } } } else { ui.notifications.error(game.i18n.format("PF2E.ErrorMessage.ItemNotFoundByUUID", { uuid: ITEM_UUID })); }