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

Unarmed Stike Fails to Roll #157

Closed
1 task done
Doc-Sun opened this issue Nov 18, 2024 · 15 comments
Closed
1 task done

Unarmed Stike Fails to Roll #157

Doc-Sun opened this issue Nov 18, 2024 · 15 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Doc-Sun
Copy link

Doc-Sun commented Nov 18, 2024

Describe the bug
UnarmStrike Fails to roll or output to chat.

To Reproduce
Steps to reproduce the behavior:

  1. _Go to character sheet with an unarmed attack weapon
  2. _Click on the roll for the unarmed attack
  3. _See that it does not output

Expected behavior
Unarmed attack should roll (even if it just uses flat damage and not the scaling damage)

Screenshots
image

Foundry VTT Version
12.331

Cosmere RPG System Version
0.2.0

Browser
Chrome

Additional context
Tried with a new PC and a already created on from the last update. Same issue

Checklist:

  • I have searched the existing issues to ensure this bug has not already been reported
@Doc-Sun Doc-Sun added the bug Something isn't working label Nov 18, 2024
@stanavdb stanavdb added this to the Release 0.2.1 milestone Nov 19, 2024
@MangoFVTT
Copy link
Collaborator

@zithith this issue seems to happen explicitly when a damage item has no dice. Since the graze formula (unless overriden) calls @damage.dice automatically, it breaks with this error when parsing the roll:

image

@zithith
Copy link
Collaborator

zithith commented Nov 19, 2024

@zithith this issue seems to happen explicitly when a damage item has no dice. Since the graze formula (unless overriden) calls @damage.dice automatically, it breaks with this error when parsing the roll:

[image]

Damn. Should have checked that case. I was testing using unarmed for so long at the beginning I forgot to go back and check after I changed the default formula.
I'll have a think about how to add some defensive code in there...

... I don't think there's a clever/neat way to do this. My guess for now would be to extend the turnery statement that sets the graze formula/replace it with a proper branching block that so that it checks if the dice only roll has any dice, then selects that, and if it doesn't it checks to see if there is a numeric term as the first term of the base pool, then we'd need to extract that?... and if not that, then return?

@stanavdb
Copy link
Collaborator

Couldn't we just fill the @damage.dice with 0 if there are no dice?

@zithith
Copy link
Collaborator

zithith commented Nov 19, 2024 via email

@stanavdb
Copy link
Collaborator

Possibly, but then your graze damage value for unarmed would be 0, which isn't right

Could we take the first numeric term if there's no dice terms, and if there's no numeric terms fall back to 0?

@zithith
Copy link
Collaborator

zithith commented Nov 20, 2024 via email

@stanavdb
Copy link
Collaborator

Actually, having given it some more thought, the best solution is to have @damage.dice to be 0 if there are no dice. It doesn't really make any sense for it to be any other value.
But then we also have to set the graze override for unarmed strike to something like max(@damage.dice, 1)

@stanavdb
Copy link
Collaborator

@zithith Are you picking this one up? (If so could you self assign)

@zithith
Copy link
Collaborator

zithith commented Nov 20, 2024

Yeah, I could do this tonight, will grab it

@zithith zithith self-assigned this Nov 20, 2024
@zithith
Copy link
Collaborator

zithith commented Nov 20, 2024

Actually, having given it some more thought, the best solution is to have @damage.dice to be 0 if there are no dice. It doesn't really make any sense for it to be any other value.
But then we also have to set the graze override for unarmed strike to something like max(@damage.dice, 1)

Yeah I think this works. Will need to honour the scaling damage on the unarmed attack though

@stanavdb
Copy link
Collaborator

Yeah I think this works. Will need to honour the scaling damage on the unarmed attack though

That should just happen automatically though right? If @damage.dice just takes the value of all dice rolled.

@zithith
Copy link
Collaborator

zithith commented Nov 20, 2024

It'll rely on the output of #91 but I think the point stands about the fact that we just manually override the unarmed item by default.
Base unarmed damage will be @unarmedDamage + @mod while the graze override would be that without the mod
Then anyone else who wants to do flat damage will just see that they have to override it or get a default of 0

@MangoFVTT
Copy link
Collaborator

MangoFVTT commented Nov 20, 2024

@zithith i would make it @ unarmed or @unarmed.dice (which could also be derived to a flat number ofc). all the formula attributes i've ever seen are single words or dot-connected, it looks weird for it to be 2 words and i'm not confident non programmer types would remember the camel casing. Plus it's just easier to remember

@MangoFVTT
Copy link
Collaborator

Btw another simply way to resolve this would be to just make the basic unarmed damage 1d1, which would still be a 1 but count as a die term 😅

@zithith
Copy link
Collaborator

zithith commented Nov 20, 2024

Btw another simply way to resolve this would be to just make the basic unarmed damage 1d1, which would still be a 1 but count as a die term 😅

I... I don't hate this 😂
Would have to be something like (@unarmed.scalar)d1, but it could work...
Reeeal workaround.

Or whatever the term is. I appreciate unarmedDamage is unlikely to make the cut, it was just for demonstration purposes. This can be decided in #91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

4 participants