Cynicide / RMSS-FoundryVTT

An Implementation of the Rolemaster Standard System for FoundryVTT
GNU General Public License v3.0
6 stars 0 forks source link

Automatic Stat Bonus Calculation #9

Open rdefendi opened 1 year ago

rdefendi commented 1 year ago

The character sheet should automatically calculate stat bonuses. I see that it adds up the columns but doesn't populate the data. Either we want to populate that data or provide a way for the user to do so.

If we're comfortable putting in that data, this issue stops here and is self-explanatory.

Assuming that we're worried about copyright, which I assume is the issue, I propose the following:

We treat it like the Alien RPG module treats stunts. Build the structure for handling the lookup into the module, but let the user fill in the data from their legitimately owned books. I suggest for the time being we just leave racial bonuses as they are, having a lookup based on race might be too complex (correct me if I'm wrong).

Ideally, there's a way to have a user-filled datasource the stat bonuses can reference with a basic hlookup to fill stat bonuses. For instance, can we do a basic table lookup, like with a spreadsheet? If so, we could provide a stat bonus table and fill in all the stat bonuses with 0. It would be a small matter for the user to fill in their table with the actual bonuses. (and back them up against updates maybe?)

A compendium would be better. You can lock a compendium. I don't know if you can lookup on a journal. These are thoughts, though. That's probably why Alien used compendiums.

Cynicide commented 1 year ago

Can you provide an example or a screenshot? I created this character from scratch, filled out the values for Agility (Temp, Potential, Basic and Racial) and imported all the Skill Categories. I can see the Stat Bonus calculated next to the stats and in the Skill Categories.

2022-12-15 19_30_58-Window

2022-12-15 19_32_02-Window

Are you talking about the Basic Bonus for each Stat? Yeah, that was excluded on purpose as it appears only in the published book. If we wanted to look it up I'm not sure what the best entity would be. I want to say a Rollable Table but it's not really a rollable value.

I'd have to think about what the best solution would be as we'd need to anticipate the entity being there and not being there.

rdefendi commented 1 year ago

Yes, sorry, I meant the basic bonus, and I was thinking a rollable table, as long as it can be used for a lookup. it seems to have the proper data structure. And I'd be proposing that the entity always be there. We put in a table for the lookup to happen, we just have all the bonuses set to zero by default. So there's no situation where the lookup is returning null data (unless the user deletes the table). They just need to replace the stats that don't have a zero bonus with their real bonuses.

The logical way to put in the racial and professionals would be through custom items that the user fills out with data that the sheet poulates. But in that case we DO have the issue that data is now hardcoded to look to another place and you can't just replace it on the sheet easily. With this one, if the user doesn't want to fill out the basic bonuses until later, they can at least use the special bonus field in the meantime if the basic bonus column isn't editable anymore.

Actually, it would be better if you could just create a race or profession item and drop it on the sheet. I think I have my next enhancement.

Cynicide commented 1 year ago

I implemented this last night and it's a simple case of iterating through the rollable tables looking for one that is named something specific. There is some error handling that has to happen as the table rows use Text for their results which need to be converted into a Number. There is a danger that a GM might type a non-Number character into he field so there needs to be scaffolding around it to check. The only niggle is the final temp state value is "104+" which I need to see if we can express as a field in Foundry. If not the upper bounds might have to be set to 1000 or something like that.

The lions share of the work will be handling errors and exceptions. So what I'm most likely going to do is implement the following checks:

If the table doesn't exist: Don't do anything to the basic stat bonus value. If you go through the table and you don't find a value matching the stat temp value: Don't change the basic bonus value. If you go through the table and find a value matching the stat temp value but the basic bonus fails conversion into an integer type: Don't change the basic bonus value.

This way we can preserve any text that has been typed into that field.

I may also consider making the Basic Stat Bonus text red if there has been an issue looking up the Value so it can be flagged to the GM.

Things that still need to be added:

Configuration for Table Name - Allow the GM to specify the name of the Stat Bonus Table. Configuration to enable/disable this lookup.

As far as races go, most things in Foundry that are not Actors are Items. So we will need to add an Item type of "Race". I don't think that adding things like Racial Bonuses and Names will be too hard as I've already written drag and drop handlers for other things.

Where it gets hard is the Adolescence Rank Table since this infers that Races can provide Ranks to Skill Categories. There is a bunch of different options to allow Entities like Races and Professions to provide ranks. Basically I'd be building a framework to perform a lot of checks to see if the Skill/Skill Category was already owned, if it already had ranks. Then we'd need to decide what to do if the user deleted that skill category or skill from their sheet.

rdefendi commented 1 year ago

That sounds great. I’ll probably put the race enhancement in today, while it’s fresh, but that doesn’t mean it needs to be a high priority.