Skip to content
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

feat: Add new Pathfinder 2e Creature layout (#436) #438

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

miscoined
Copy link
Contributor

Pull Request Description

Add a new default Pathfinder 2e Creature layout. See #436 for rationale and background. This adds this as a new layout, without replacing the existing Basic layout. I'm opening this as a draft PR for now until I finish adding documentation and layout restoration functionality - I thought early feedback would be useful in this case.

Changes Proposed

  • Add a new Pathfinder 2e Creature Layout
  • Update Pathfinder 2e CSS from the upstream repo
  • Add documentation for the new layout
  • Add/update the default layout block for layout restoration functionality

Related Issues

Progresses #436.

Checklist (WIP)

  • I have read the contribution guidelines and code of conduct.
  • I have tested the changes locally and they are working as expected.
  • I have added appropriate comments and documentation for the code changes.
  • My code follows the coding style and standards of this project.
  • I have rebased my branch on the latest main (or master) branch.
  • All tests (if applicable) have passed successfully.
  • I have run linters and fixed any issues.
  • I have checked for any potential security issues or vulnerabilities.

Screenshots (if applicable)

Will add later, before flipping this out of a draft PR

The previous regex would match the following:
```
abilityMods: [4, 2, 3, -3, 1, -1]
resistances: "[Some Link](note.md)"
```

So that that the first group (the link text) would match:
```
4, 2, 3, -3, 1, -1]\n resistances: "[Some Link
```
and the second group (the path) would match:
```
note.md
```

This commit changes the regex so that it doesn't falsely
match in these cases and instead just matches the actual markdown
link.
pf2e.css generated from the Fantasy-Statblocks-CSS-Development repo
As far as I can tell this is never used anywhere and doesn't appear to
have contents relevant to PF2e.
This allows conditional blocks to do things like check plugin settings
and whether other plugins are enabled. In particular, this allows
layouts to only show encounter buttons when the Initiative Tracker
plugin is enabled.
Separates out the name and value into their own HTML elements rather
than just rendered text so that we can style individual portions with
CSS. This change has no visible effects - existing statblocks should
look exactly the same.
This is instead of adding them to the text content itself. This allows layout authors to customize the appearance with CSS.
Thank you to MostTornBrain for valuable feedback! Most of this comes
from there :)

- Fix traits only showing when the trait property was present (even if
  alignment, size, or rarity was present)
- Add sign (+/-) to perception modifier
- Move Weaknesses before Resistances to match book layout
- Don't show Initiative Tracker encounter buttons if Initiative Tracker
  isn't enabled
- Show the initiative tracker view when the encounter buttons are
  pressed, to match the functionality of encounter buttons in the actual
  encounter blocks
- Bold save names
- Add sign (+/-) to ability modifiers
@valentine195
Copy link
Member

Hey @miscoined, this looks great. Is this meant to slot into existing PF2e creature stat blocks used by the TTRPG share?

@@ -926,6 +979,17 @@ class TableModal extends BasicModal<TableItem> {
this.block.calculate = v;
});
});
new Setting(el)
.setName("Do Not Add Property as CSS Class")
Copy link
Member

Choose a reason for hiding this comment

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

I usually try to prefer making these things perform the task rather than turning it off. Could you please refactor this setting to that?

]
}
],
condition: "return plugin.app.plugins.enabledPlugins.has(\"initiative-tracker\");\n"
Copy link
Member

Choose a reason for hiding this comment

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

This is actually genius! Very clever.

markdown: true,
headingProp: false,
heading: "",
callback: "var s = property.bonus < 0 ? \"-\" : \"+\";\ns += Math.abs(property.bonus);\nif (property.desc) {\n s += \" \" + property.desc\n}\nif (property.damage) {\n s += \", __Damage__ \" + property.damage\n}\nreturn s"
Copy link
Member

Choose a reason for hiding this comment

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

This will return NaN if property.bonus is undefined

@valentine195
Copy link
Member

Sorry I let this sit for so long; been a very busy summer. I appreciate the work you have been doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants