sangheili868 / StarWars5e.Site

The frontend web app project for StarWars5e
30 stars 14 forks source link

Add Fighting Styles to Features Expansion and Fighting Styles Modal #72

Open akanieski opened 2 years ago

akanieski commented 2 years ago

Proposed Look from Character Sheet:

image

Will launch "modal" similar to "Choose Manuevers"

image

As well it will work from Character Builder's Class Details UI image

And will also tip the user off when they have access to a fighting style but have not chosen it. image

akanieski commented 2 years ago

I think I have a decent grasp of how to create a "Choose Fighting Style" modal.. but what I don't know is if the backend will be capable of storing the fighting styles selected.. and if so I'm looking for feedback as to where in the character JSON the data should be stored..

I noticed that Fighting Styles are not always tied to classes but can come as a one-off feat.. if thats the case perhaps it should be on the root of character?

Possible solution - notice the below character json:

{
  ..
  "featureConfigs": [
    {
      "featureConfigType": "FightingStyleType",
      "featureRowKey": "Class-Fighter-Fighting Style-1",
      "data": "Area Style"
    }
  ],
  ..
}

One issue I see is that the features displayed are assembled dynamically based on class/archetype and are not reflected in the characters json. That being said this makes it so you need to marry "stateful" things like 'what fighting style was chosen' with dynamic things like 'what feats are available to this character'.

This can work though if you create a more generic way of storing "feature configurations" and then map them to their respective features at runtime.

This would allow for a generic configuration of features. It's an array as opposed to a dictionary/map because you can take the same feature multiple times. Since there is no relation between the specific instance of the feature and the

akanieski commented 2 years ago

On second thought, I notice now that there is a mechanism for assembling a "complete character" which seems to include assembling stateful things like feature "usage". I suspect Feature Config should likely follow the same paradigm.

sangheili868 commented 2 years ago

Here's what I would recommend:

Characters are stored as raw JSONs in the database so you should be able to add whatever you want to it without worrying about the database schema. Every character has a "builderVersion" to tell what version of the character JSON it should work with. We had discussed implementing a generic feature manager that would allow us to attach functionality and options/choices to features, but it never got done because me and speedreeder lost interest. Not sure if the new guys in charge want to continue with the same plan we had or figure out something on their own.

P.S. I'm Tyrzaphir in the sw5e discord server, hit me up if you wanna chat more directly. I'm happy to give advice like this but I am no longer involved in direct development of this site.

akanieski commented 2 years ago

After looking over Tyrzaphir's recommendations I'm thinking we should build into this PR the "metadata" system. This way we can avoid having to change the CharacterSave json format as much as possible in one shot.

I have fear for unleashing schema changes. :-)