javierriveracastro / betteroll-swade

A Better Rolls port for SWADE
GNU General Public License v3.0
15 stars 31 forks source link

Fixed a bug in damage mod calculation #595

Closed ddbrown30 closed 1 year ago

ddbrown30 commented 1 year ago

The code wasn't handling the case of multiple modifiers. I found the bug when I had a weapon with a modifier and that weapon had a Smite effect on it. The resulting expression was "+2+4".

The first issue was that indexOf wasn't checking for > 0 so it was actually only ever not going into that block if d was the first character. The second issue was there was nothing that would convert something like "+2+4" into a valid output. I added the eval function there instead of parseInt.

ddbrown30 commented 1 year ago

Oh, I just noticed there's a second bug fix in that file. I also changed the action group localization code just above there. You were manually checking for BRSW to be in the string in order to localize it which meant that it wouldn't localize any other strings. I changed it to always localize since it should have essentially the same behaviour as before except that it's not localizing any other strings.

That one was not intended to be in this PR. I was going to poke you about it directly to confirm first, but oh well. If there's a reason it needs to be the old way that I'm unaware of, just remove it from the PR.

javierriveracastro commented 1 year ago

Thank you. I'll merge both fixes.