mkscho63 / sta

This is an unofficial system for Foundry VTT using Modiphius's Star Trek Adventures 2d20 RPG. This system attempts to replicate the feeling of playing through an episode of the epic SciFi that is Star Trek. I am in no way associated with Modiphius.
MIT License
32 stars 33 forks source link

Refactor and update to weapon rolling system #69

Closed hiddenkrypt closed 1 year ago

hiddenkrypt commented 2 years ago

First of all this commit addresses outstanding bug/issues #36, #67 , #68

There's a lot of changes in here, and a diff is going to be hard to look at because I also fixed a lot of eslint errors, and due to mistakes, ended up committing all my changes at once. Sorry about that. Hopefully I can sufficiently describe the changes here.

All files have been fixed to pass eslint.


Changed sheet scripts to treat characterweapons and starshipweapons the same as regular items and call on actor.js rollGenericItem(). Did this by deleting the entire click handler for the .rollable.challenge class set, and adding .rollable to the existing click handlers for .chat class items

Changed Actor.js to correctly use characterweapon items with roll.js performWeaponRoll().

Heavily overhauled roll.js. Created new helper functions to simplify repeated code, including generating strings from challenge dice, which is now done in multiple places. performWeaponRoll() now generates a nice weapon block for chat using the genericItemTemplate(), and also generates the damage roll to append to it. I think it looks quite slick.

Original UI , and with the LCARS UI Module: weapon chat card

weapon chat card

The genericItemTemplate() now takes an itemId string and appends it to an html element as an attribute named data-item-id to enable functions from the Maestro module. This has been tested with the latest Maestro version and latest FoundryVTT.

Damage for weapon rolls is computed directly at roll time from the weapon's base damage stat and the owner's security stat rather than scraping the number off the character sheet HTML.

All rolls are now asynchronous, to match the upcoming changes in FoundryVTT. This will prevent depreciation warnings in the console, and breaking change headaches when the new version of FVTT comes out.

changing the way weapon rolls are done prompted a change to i18n strings. I think this works, my Deutsch is strong but I'm less confident in my French, and I'll be honest I had to look up the Spanish. I don't know it the STA core book has been released in these languages, if it has then that should be the proper source for these strings and will probably need fixing to be honest.