Last active
December 20, 2024 05:00
-
-
Save 7H3LaughingMan/0d8c84b963ef92340c999b8a70d8d431 to your computer and use it in GitHub Desktop.
Dirty Trick Macro
This file contains hidden or 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
| const actor = canvas.tokens.controlled[0]?.actor; | |
| const targetActor = game.user.targets.first()?.actor; | |
| if (!actor || !targetActor || game.user.targets.size !== 1) { | |
| return ui.notifications.warn("Please select one actor and one target"); | |
| } | |
| if (!actor.isOfType("character")) { | |
| return ui.notifications.warn("Controlled actor must be a player-character"); | |
| } | |
| const dirtyTrickFeat = actor.itemTypes.feat.find( | |
| (item) => item.slug === "dirty-trick" | |
| ); | |
| if (!dirtyTrickFeat) { | |
| return ui.notifications.warn( | |
| `${actor?.name || "Selected actor"} does not have the Dirty Trick feat!` | |
| ); | |
| } | |
| const label = await renderTemplate( | |
| "systems/pf2e/templates/chat/action/header.hbs", | |
| { glyph: "A", subtitle: "PF2E.ActionsCheck.thievery", title: "Dirty Trick" } | |
| ); | |
| await actor.skills.thievery.roll({ | |
| action: "dirty-trick", | |
| target: targetActor, | |
| dc: { slug: "reflex" }, | |
| label, | |
| extraRollNotes: [ | |
| { | |
| title: "Critical Success", | |
| text: "The target is @UUID[Compendium.pf2e.conditionitems.Item.i3OJZU2nk64Df3xm]{Clumsy 1} until they use an @UUID[Compendium.pf2e.actionspf2e.Item.pvQ5rY2zrtPI614F]{Interact} action to end the impediment.", | |
| outcome: ["criticalSuccess"], | |
| }, | |
| { | |
| title: "Success", | |
| text: "The target is @UUID[Compendium.pf2e.conditionitems.Item.i3OJZU2nk64Df3xm]{Clumsy 1} until they use an @UUID[Compendium.pf2e.actionspf2e.Item.pvQ5rY2zrtPI614F]{Interact} action to end the impediment, but the condition ends automatically after 1 round.", | |
| outcome: ["success"], | |
| }, | |
| { | |
| title: "Critical Failure", | |
| text: "You fall @UUID[Compendium.pf2e.conditionitems.Item.j91X7x0XSomq8d60]{Prone} as your attempt backfires.", | |
| outcome: ["criticalFailure"], | |
| }, | |
| ], | |
| extraRollOptions: ["action:dirty-trick"], | |
| item: dirtyTrickFeat, | |
| traits: dirtyTrickFeat.system.traits.value, | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment