Published on

Swashbuckling in Foundry

Author

We moved our long-running Spinach Inquisition campaign to FoundryVTT last night. It's great at automating Pathfinder 2e, but there are a few gaps. We ran into one: our battle-dancin' swashbuckler needed to make performance checks using the acrobatics skill, and there wasn't an obvious way to do that. So I figured out how to hack a solution in!

The battledancer's main way to gain Panache, a key buff for the class, is to dance at people. Successful Perform - Dance checks against a target's will DC grants panache, and it's spammable in the sense that anybody who can see them1 has to save against it. A single success by the dancer is all they need.

Change the Skill for the Roll

The first complication here: our party member, Herpes Harry the Hamburglin' Hobgoblin, has the Acrobatic Performer feat. His character's highest stat is dexterity, so his Acrobatics is higher than Performance, and this lets him use his higher Acrobatics skill for dancing.

The PF2e system for Foundry does not account for this feat in the automations. That's not an impossible problem -- for the first session, he made boring Acrobatics checks. That's perfectly servicable -- but when you roll Perform - Dance, there's a bunch of extra data it can include in chat. Like the Panache buff, so it's right there and ready to be dragged to Harry's character to apply it.

I thought fixing this would be hard, but it ended up being incredibly straightforward after digging around in the pf2e source code for a few minutes.

Make a macro:

game.pf2e.actions.perform({
		event: event,
		variant: 'dance',
		skill: 'acrobatics',
});

The perform() method lets you pass in the skill you want to roll. It defaults to performance, but changing it was as simple as passing that skill argument. It still figures out the other bonuses and includes the text/buffs/etc that we wanted in chat.

Make it Spammable

The next challenge was dealing with multiple targets. This proved way harder.

Somebody on Reddit had posted a macro a year ago to do this. I played around with it a bit and ultimately gave up on it.

I wanted to use the game.pf2e.actions.perform() method so the card would have all the necessary data instead of the (removed?) actor.system.skills.prf.roll(), but this proved challenging: perform() wants to roll against a single target and figure out everything: modifiers, degrees of success, effects, yadda yadda.

If I could call this method a couple times before printing to chat, I could build my own summary card with all the targets and then an overall success/failure with the Panache / Fascinated conditions in there, as needed.

I tried looping the targets and calling perform(), but even awaiting it wasn't capturing a return value. It has a callback you can pass in, but I didn't wanna do callbacks-on-callbacks-on-callbacks, and the perform() was printing a card to chat for each target. My desired summary would have been additional spam on of that -- not ideal.

Ultimately, I decided it's easiest to just let it blast chat. If the player shift + Ts a couple tokens to target four things, it'll give them four prompts and report four results:

/*
* Rolls a Perform - Dance check against all targets.
*
* This uses the Acrobatics skill instead of Performance because of the Acrobatic Performer feat.
*/

const targets = game.user.targets;

if (! actor || targets.size < 1) {
    return ui.notifications.warn("You must have your token selected, and at least one token targeted");
}

targets.forEach(async (target) => {
    await game.pf2e.actions.perform({
        event: event,
        variant: 'dance',
        skill: 'acrobatics',
    });
});

The Dancing Scarf

Herpes Harry the Hamburglin' Hobgoblin has a Dancing Scarf. RAW, this probably doesn't work with Acrobatic Performer, since the feat says it changes your Performance check out for Acrobatics, and the scarf says it's +1 to Performance checks.

But it's kind of shitty to take away somebody's magic item, so we wanted to preserve the bonus when using the Acrobatics'd dance check2. But the roll popup no longer includes the Dancing Scarf as an option when it's got skill: 'acrobatics' passed in.

Fixing this isn't too hard. If you make a copy of the Dancing Scarf and add a new rule element to it, you can indicate that it should apply to the acrobatics version too:

{
  "key": "FlatModifier",
  "predicate": [
    "action:perform:dance"
  ],
  "selector": "acrobatics",
  "type": "item",
  "value": 1
}

It ends up looking like this, with a bonus for either:

Harry's Diseased Dancing Scarf item, showing its Rule Elements in FoundryVTT. There are two Flat Modifier sections, one giving +1 to performance dances, and one giving +1 to acrobatics dances.


  1. Within limits based on skill proficiency

  2. Or the DM didn't notice the wording when everybody assumed it would continue to work. In which case, I hope he doesn't read my blog post!