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

Option to display calculated attack bonus in auto power cards #352

Merged
merged 9 commits into from
Apr 2, 2024

Conversation

FoxLee
Copy link
Collaborator

@FoxLee FoxLee commented Apr 2, 2024

Adds a new option for how the "attack" line should be displayed on auto-generated power cards. A new client-scoped setting lets you pick between:

  • Display the ability score name. In this case, the tooltip contains the calculated attack bonus and formula (with substituted values) in parenthesis.
  • Display the calculated attack bonus. In this case, the tooltip contains the ability score name and formula (with substituted values) in parenthesis.

In both cases, attacks with no ability mod will display the calculated attack bonus as before, but now will also display the formula (with substituted values) in the tooltip.

To get the attack bonus before sending the card, I added a call to getAttackBonus() in the item's roll() function, which is then passed to prepareCardData() as an extra (optional) parameter. I've made the same edit to the actor sheet's function for toggling power details.

This seems to be working smoothly, but there may be corner cases that were not obvious to me. Please double-check me before accepting!

FoxLee added 9 commits April 1, 2024 21:32
Added strings for new setting and string for "tier".
- Worked out how to use getAttackBonus rather than the huge mess I was making so far.
- Removed the descriptive text formula translator. I like the idea but the text clutters up the tooltip too much, so it just became a needless complication.
Must update more aggressively before I start work on something!
@EndlesNights
Copy link
Owner

Look all good to me right after some light testing.

@EndlesNights EndlesNights merged commit 9e5d1a3 into EndlesNights:main Apr 2, 2024
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