Skip to content

Commit

Permalink
Add Reposition action implementation, action item, and action macro (f…
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolaj-a authored Nov 9, 2023
1 parent da503a2 commit 1a2b1c4
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packs/action-macros/reposition-athletics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"_id": "gzTJWA5vJkZI9Gj5",
"actorIds": [],
"author": "j8qxwRz5RJ4kkzp9",
"command": "game.pf2e.actions.reposition({ event: event });",
"img": "icons/svg/dice-target.svg",
"name": "Reposition: Athletics",
"ownership": {
"default": 1
},
"scope": "global",
"type": "script"
}
48 changes: 48 additions & 0 deletions src/module/system/action-macros/athletics/reposition.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { ActorPF2e } from "@actor";
import { WeaponPF2e } from "@item";
import { ActionMacroHelpers, SkillActionOptions } from "../index.ts";
import { SingleCheckAction } from "@actor/actions/index.ts";

const PREFIX = "PF2E.Actions.Reposition";

function reposition(options: SkillActionOptions): void {
const slug = options?.skill ?? "athletics";
const modifiers = options?.modifiers;
const rollOptions = ["action:reposition"];
ActionMacroHelpers.simpleRollActionCheck<WeaponPF2e<ActorPF2e>>({
actors: options.actors,
actionGlyph: options.glyph ?? "A",
title: `${PREFIX}.Title`,
checkContext: (opts) => ActionMacroHelpers.defaultCheckContext(opts, { modifiers, rollOptions, slug }),
traits: ["attack"],
event: options.event,
callback: options.callback,
difficultyClass: options.difficultyClass ?? "fortitude",
extraNotes: (selector: string) => [
ActionMacroHelpers.note(selector, PREFIX, "criticalSuccess"),
ActionMacroHelpers.note(selector, PREFIX, "success"),
ActionMacroHelpers.note(selector, PREFIX, "criticalFailure"),
],
}).catch((error: Error) => {
ui.notifications.error(error.message);
throw error;
});
}

const action = new SingleCheckAction({
cost: 1,
description: `${PREFIX}.Description`,
difficultyClass: "fortitude",
name: `${PREFIX}.Title`,
notes: [
{ outcome: ["criticalSuccess"], text: `${PREFIX}.Notes.criticalSuccess` },
{ outcome: ["success"], text: `${PREFIX}.Notes.success` },
{ outcome: ["criticalFailure"], text: `${PREFIX}.Notes.criticalFailure` },
],
rollOptions: ["action:reposition"],
slug: "reposition",
statistic: "athletics",
traits: ["attack"],
});

export { reposition as legacy, action };
3 changes: 3 additions & 0 deletions src/module/system/action-macros/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { forceOpen } from "./athletics/force-open.ts";
import { grapple } from "./athletics/grapple.ts";
import { highJump } from "./athletics/high-jump.ts";
import { longJump } from "./athletics/long-jump.ts";
import * as reposition from "./athletics/reposition.ts";
import { shove } from "./athletics/shove.ts";
import { swim } from "./athletics/swim.ts";
import * as trip from "./athletics/trip.ts";
Expand Down Expand Up @@ -92,6 +93,7 @@ export const ActionMacros = {
grapple,
highJump,
longJump,
reposition: reposition.legacy,
shove,
swim,
trip: trip.legacy,
Expand Down Expand Up @@ -171,6 +173,7 @@ export const SystemActions: Action[] = [
pickALock.action,
ready,
release,
reposition.action,
seek.action,
senseDirection.action,
senseMotive.action,
Expand Down
9 changes: 9 additions & 0 deletions static/lang/action-en.json
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,15 @@
"NotPhysicalItem": "Specified item {item} is not a physical item."
}
},
"Reposition": {
"Description": "<p>You muscle a creature or object around. Attempt an Athletics check against the target's Fortitude DC.</p><p><strong>Critical Success</strong> You move the creature up to 10 feet. It must remain within your reach during this movement, and you can't move it into or through obstacles.<br><strong>Success</strong> You move the target up to 5 feet. It must remain within your reach during this movement, and you can't move it into or through obstacles.<br><strong>Critical Failure</strong> The target can move you up to 5 feet as though it successfully Repositioned you.</p>",
"Notes": {
"criticalFailure": "<strong>Critical Failure</strong> The target can move you up to 5 feet as though it successfully Repositioned you.",
"criticalSuccess": "<strong>Critical Success</strong> You move the creature up to 10 feet. It must remain within your reach during this movement, and you can't move it into or through obstacles.",
"success": "<strong>Success</strong> You move the target up to 5 feet. It must remain within your reach during this movement, and you can't move it into or through obstacles."
},
"Title": "Reposition"
},
"Request": {
"Notes": {
"criticalFailure": "<strong>Critical Failure</strong> Not only does the target refuse the request, but their attitude toward you decreases by one step due to the temerity of the request.",
Expand Down

0 comments on commit 1a2b1c4

Please sign in to comment.