kakaroto / Beyond20

D&D Beyond Character Sheet Integration in Roll20
GNU General Public License v3.0
489 stars 144 forks source link

Investigate why Chaos Bolt spell includes damage with no defined type #1086

Closed OwlbearStudios closed 4 months ago

OwlbearStudios commented 11 months ago

Describe the bug When casting the spell 'Chaos Bolt' in D&DBeyond, the damage type for the d6 roll is blank when it gets passed to FoundryVTT. Foundry VTT does not know how to handle a blank damage type and throws an error message. The damage type for the 2d8 roll is listed as "Chaotic Energy", and I believe just putting in the same damage type (or really any text) would fix the issue.

To Reproduce Steps to reproduce the behavior:

  1. Click cast 'Chaos Bolt' in D&DBeyond
  2. Roll the attack roll in Foundry VTT
  3. Roll the damage roll in Foundry VTT (see damage listed as 2d8[Chaotic Energy] + 1d6[])
  4. See error in console, damage roll does not happen in FoundryVTT chat.

Expected behavior Damage from the d6 of the spell should be rolled normally without error

Screenshots To help explain your problem, add screenshots of where you clicked in D&D Beyond, a screenshot of your Beyond20 character settings if applicable and the result you saw in the VTT. image image image

Browser Info (please complete the following information):

Additional context Foundry VTT version 10 build 303 Foundry 5e Game System version 2.3.1

OwlbearStudios commented 11 months ago

I was able to "fix" the issue locally by adding the following JS code on line 2225 of fvtt.js:

for(let i = 0; i < request['damage-types'].length; i++) { if(request['damage-types'][i] == "") { request['damage-types'][i] = "Chaotic Energy" request['critical-damage-types'][i] = "Chaotic Energy" } }

However, all players in my campaign would have to add this fix and they are not as technical as I.

kakaroto commented 10 months ago

Thanks for the report. I've just fixed the bug directly in the Beyond20 module (https://github.com/kakaroto/Beyond20/commit/ab609f1eaa3b25d2b664a06473563f9d076d1acc), but I just did the fix quickly straight from github and have not tested any of it. If you can test/confirm it fixes it (and it should fix it for all your players too), then I can push an update to the module with the fix. I'll still need to investigate why the damage type was empty in the first place, I don't remember if it's expected or if it's a bug. So I'll reopen the issue for now.

OwlbearStudios commented 7 months ago

Hey, sorry for the long delay. I can confirm that I tested the fix and it seems to be working! :-)

Only issue I am discovering (which may be completely unrelated), is that the spell slots on the native actor don't match up. It shows 1/1 for levels 1 through 9 even though the player has max of level 5 spells and more than just 1 slot in the lower levels. It also causes a weird disconnect with the real actor (vs the beyond20 native actor) as the real actor's spell slots never go down or match the what is showing in DndBeyond. Additionally, the spells can be cast infinite number of times in FoundryVTT because the 1/1 is auto replenished whenever the spell is cast again. This may be a limitation of the native actor feature or a bug. I am willing to open another issue to track this if required, but wanted to make sure its not related to this bug before I do so.

Thanks!

OwlbearStudios commented 7 months ago

Additionally, as you are investigating why the damage type was empty in the first place, is there a chance to give it the option to chose the damage type (instead of just showing "Chaotic Energy") based on the roll value of the 2d8 damage? Having the correct damage type when using any sort of automation module in Foundry would greatly speed up combat as it will help auto calculate damage based on resistances/vulnerabilities/immunities.