Skip to content

Add weapon boost automation#22298

Open
Geliogabalus wants to merge 4 commits intofoundryvtt:v14-devfrom
Geliogabalus:weapon-boost
Open

Add weapon boost automation#22298
Geliogabalus wants to merge 4 commits intofoundryvtt:v14-devfrom
Geliogabalus:weapon-boost

Conversation

@Geliogabalus
Copy link
Copy Markdown
Contributor

@Geliogabalus Geliogabalus commented May 10, 2026

Add boost damage dice to the weapon damage rolls when boost-* trait is present. By default the extra dice are disabled.

If Effect: Boost is present, the damage dice become enabled. When the effect is added via auxiliary actions buttom the effect is customized for the particular weapon.

The effect lasts till the end of the next turn and doesn't clear itself after the strike.

image image

@CarlosFdez
Copy link
Copy Markdown
Collaborator

CarlosFdez commented May 10, 2026

Heyo, thanks for starting work on this. Talks of this have circulated and we kinda have an idea of what it should look like, so if you're patient, could you make these adjustments?

  1. The equipment effect should be in a pf2e compendium and then added to duplicates.json. Otherwise it won't work for boost traits manually added by players in a pf2e world.

  2. Use the traits config rather than parsing the trait. weapon.system.traits.config.boost should have the value if I correctly guessed its path. The value is a string unfortunately, so you'll have to parse that value. You can use something like parseTermsFromSimpleFormula, ensure there is only a single term, then add that.

  3. It would be preferable for the damage die/modifier to be on the weapon always but disabled. That way if someone rolls damage, they can check on boost at that moment. The effect should instead enable it and otherwise do nothing (the modifier/die can include self:effect:boost in its predicate I think. Double check what I have the right roll option of course). Check out the WeaponDamagePF2e#calculate() function for where that occurs currently.

@Geliogabalus
Copy link
Copy Markdown
Contributor Author

I've started to do suggested updates and there is an incosistency with the rules in a way how boost traits are defined. Currently, there are following traits defined in the system: boost-1, boost-1d4, boost-1d6, boost-1d8, boost-1d10, boost-1d12, boost-2d10. Looking at the wording of the rules, it states that boost trait should has a die size (similar to fatal and deadly). The damage should scale with the quality of the weapon so this traits naming is not reflecting the rules. It seems there is an inconsistency in the rules where some weapons have 1d10 and some d10 as a postfix, but no weapon specifies several dice in boost entry or fixed damage (boost-1). Weapons with boost.

I think, it makes sense to refactor the boost trait definition to make it consistent with deadly and fatal but it will need some migration I believe which I don't know how to do.

In any case, I will process only boost-1{dieSize} in the current pr because two other traits don't make sense from the rules standpoint.

@Geliogabalus
Copy link
Copy Markdown
Contributor Author

Heyo, thanks for starting work on this. Talks of this have circulated and we kinda have an idea of what it should look like, so if you're patient, could you make these adjustments?

  1. The equipment effect should be in a pf2e compendium and then added to duplicates.json. Otherwise it won't work for boost traits manually added by players in a pf2e world.
  2. Use the traits config rather than parsing the trait. weapon.system.traits.config.boost should have the value if I correctly guessed its path. The value is a string unfortunately, so you'll have to parse that value. You can use something like parseTermsFromSimpleFormula, ensure there is only a single term, then add that.
  3. It would be preferable for the damage die/modifier to be on the weapon always but disabled. That way if someone rolls damage, they can check on boost at that moment. The effect should instead enable it and otherwise do nothing (the modifier/die can include self:effect:boost in its predicate I think. Double check what I have the right roll option of course). Check out the WeaponDamagePF2e#calculate() function for where that occurs currently.

@CarlosFdez
Updated the PR according to your notes.

  • moved effect to the pf2e compendium with duplicated.json update
  • updated damage calculation to include disabled boost entry by default. It is enabled when effect is present (effect has RollOption rule element, I wanted to restrict it for the particular weapon so I didn't rely on just self:effect:boost present). Still parsing damage die from the trait name as I am restricting extra dice to the valid traits only (see previous comment).

@CarlosFdez
Copy link
Copy Markdown
Collaborator

@TikaelSol what's the reason we have boost 1? Is there a weapon with it?

for (const trait of weaponTraits.filter((t) => t.startsWith("boost-1d"))) {
if (!weapon.isOfType("weapon")) continue;
const dieSize = trait.substring(trait.indexOf("-") + 2) as DamageDieSize;
const isBoosted = options.has(`item:${weapon.id}:boosted`) || options.has("item:weapon:boosted");
Copy link
Copy Markdown
Collaborator

@CarlosFdez CarlosFdez May 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can move this to the predicate field of the lower damage die object. [{ or: [] }] if you need both.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing that will also allow a disabled boost row to exist in the damage roll as well in the same way deadly does on non-crits, allowing it to work with npcs as well if you remove the weapon check.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand exactly. It was showing boost toggle even when there were no effect present and now after removing weapon check it works for npc as well

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No you're right, I misread. Preferable use predicate because its cleaner but not to fix any bug or anything.

Comment thread src/module/actor/character/helpers.ts Outdated
Comment thread src/module/actor/character/helpers.ts Outdated
Comment thread src/module/actor/character/helpers.ts Outdated
Comment thread src/module/system/damage/weapon.ts Outdated
Comment thread src/module/system/damage/weapon.ts Outdated

// Boost trait, ignore invalid boost traits
for (const trait of weaponTraits.filter((t) => t.startsWith("boost-1d"))) {
if (!weapon.isOfType("weapon")) continue;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should work on npcs as well. Bo-Shek for example has 2d10 boost. You can more or less copy what deadly does for the diceNumber. While npcs don't support aux actions yet, the existance of the effect as well as the toggle in the damage roll should be handy.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made it work for npc and tested it. It is working as intended when the effect is applied from the compendium and user otherwise can toggle it manually. We can make checkbox in the sheet since it is controlled by roll option right now.

@CarlosFdez
Copy link
Copy Markdown
Collaborator

CarlosFdez commented May 10, 2026

Fair point on boost being per weapon. There might be a better way to handle boost being per weapon if we want to restrict that using a choice set, but I'm not certain about it so I'll come back to you with it later!

I've started to do suggested updates and there is an incosistency with the rules in a way how boost traits are defined. Currently, there are following traits defined in the system: boost-1, boost-1d4, boost-1d6, boost-1d8, boost-1d10, boost-1d12, boost-2d10. Looking at the wording of the rules, it states that boost trait should has a die size (similar to fatal and deadly). The damage should scale with the quality of the weapon so this traits naming is not reflecting the rules. It seems there is an inconsistency in the rules where some weapons have 1d10 and some d10 as a postfix, but no weapon specifies several dice in boost entry or fixed damage (boost-1). Weapons with boost.

Boost 1 looks like a holdover from playtest and we can probably remove it (depends on what tikael says). Boost-2d10 is used by an NPC (Bo-Shek). I'm thinking its like deadly where the number of dice are on the trait itself.

EDIT: We may have to move boost-2d10 to npc attack traits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants