-
Notifications
You must be signed in to change notification settings - Fork 475
Add weapon boost automation #22298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v14-dev
Are you sure you want to change the base?
Add weapon boost automation #22298
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| { | ||
| "_id": "YVm3rVSAYxoSrOvb", | ||
| "img": "systems/pf2e/icons/abilities/blue-battery.webp", | ||
| "name": "Effect: Boost", | ||
| "system": { | ||
| "description": { | ||
| "value": "<p>The weapon is currently boosted.</p>" | ||
| }, | ||
| "duration": { | ||
| "expiry": "turn-end", | ||
| "sustained": false, | ||
| "unit": "rounds", | ||
| "value": 1 | ||
| }, | ||
| "fromSpell": false, | ||
| "level": { | ||
| "value": 1 | ||
| }, | ||
| "publication": { | ||
| "license": "ORC", | ||
| "remaster": true, | ||
| "title": "Starfinder Player Core" | ||
| }, | ||
| "rules": [ | ||
| { | ||
| "key": "RollOption", | ||
| "domain": "strike-damage", | ||
| "option": "item:weapon:boosted" | ||
| } | ||
| ], | ||
| "start": { | ||
| "initiative": null, | ||
| "value": 0 | ||
| }, | ||
| "tokenIcon": { | ||
| "show": true | ||
| }, | ||
| "traits": { | ||
| "value": [] | ||
| } | ||
| }, | ||
| "type": "effect" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -359,6 +359,24 @@ class WeaponDamagePF2e { | |
| modifiers.push(modifier); | ||
| } | ||
|
|
||
| // Boost trait, ignore invalid boost traits | ||
| for (const trait of weaponTraits.filter((t) => t.startsWith("boost-1d"))) { | ||
|
Geliogabalus marked this conversation as resolved.
Outdated
|
||
| if (!weapon.isOfType("weapon")) continue; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| const dieSize = trait.substring(trait.indexOf("-") + 2) as DamageDieSize; | ||
| const isBoosted = options.has(`item:${weapon.id}:boosted`) || options.has("item:weapon:boosted"); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can construct a choice set that works for both PCs and NPCs and provides the weapon flag in question. So we can use the effect to choose the weapon and just rely on a single roll option that will contain the ID, making the code itself simpler. This would auto set {
"choices": {
"ownedItems": true,
"predicate": [
{
"or": [
{
"and": [
"self:type:npc",
"item:type:melee"
]
},
{
"and": [
"self:type:character",
"item:type:weapon"
]
}
]
}
],
"types": [
"melee",
"weapon"
]
},
"flag": "weapon",
"rollOption": "item:boosted",
"key": "ChoiceSet",
"prompt": "PF2E.SpecificRule.Prompt.Weapon",
"predicate": [
{
"or": [
"self:type:npc",
"self:type:character"
]
}
]
}
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. might need an |
||
| damageDice.push( | ||
| new DamageDicePF2e({ | ||
| selector: `${weapon.id}-damage`, | ||
| slug: trait, | ||
| label: traitLabels[trait], | ||
| diceNumber: weapon.system.damage.dice, | ||
| dieSize, | ||
| critical: false, | ||
| enabled: isBoosted, | ||
| }), | ||
| ); | ||
| } | ||
|
|
||
| // Add roll notes to the context | ||
| const runeNotes = propertyRunes.flatMap((r) => { | ||
| const data = RUNE_DATA.weapon.property[r].damage?.notes ?? []; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.