13 July 2016

Data, Data, Data

Working on a D&D 5th Edition character creator-type thing in Javascript, and at least in the initial phase it's difficult to visualize progress from the webpage itself. As implied by the previous blog post, I'm not actually making the page live until more progress is made.

That said, my progress thus far has been on data collection. Lots and lots of data, and there's still more to collect.
Feats Sampler

Basic Bonuses

There's a common structure I'm working on here for everything, but that sample above shows the gist. If something gives a set-in-stone bonus, such as Alert giving a +5 to Initiative, then the Feats.Alert object will simply have a variable with the name of the thing getting the bonus, and a value equal to that bonus.

Player Choice Bonuses

More complicated things, such as Athlete, have a choice: You choose 1 Ability Score to give one bonus to, and there's a restriction for which Ability Score you can choose.

In this case, parsing Feats.Athlete has a variable AbilityScore1, which tells me the player will get to choose 1 Ability Score to increase. Feats.Athlete.AbilityScore1.Bonus tells me the selected score will be increased by 1, and Feats.Athlete.AbilityScore1.Restriction is an array containing the Ability Scores the player can choose to raise. If something does not have a Restriction variable (such as the Resilient feat), then I'll know the player can choose any score to increase.

Complicated Descriptions

More, um... complicated things, I'm just storing as an array in Anon, like pretty much all of the feats (Feats.Alert.Anon). This is stuff that I won't bother parsing for the moment, other than just to put in an additional information section on the character sheet.

Races

The only other thing of note for data is info on races. It's actually pretty much the same, minus 1 little extra thing about sub-races.

Races["RaceName"] and Races["RaceName"].Sub["SubRace"]
I'm not really bothering with any flavor text here, either; just the bonuses are good enough. Partly because I don't want to use any of the actual names of places or whatnot if they happen to be there, since that's a copyright no-no, I think.

But things are actually coming along nicely. I have the stat bonuses for the Races. All the feat info is pulled (just from the core). Next I want to pull all the Background bonuses.

Honestly, the only super tough thing I'm suspecting to have difficulties with will be when I get to Classes. My thought process is to tackle each class one at a time, and the structure will probably be based on level bonuses. So a sample Class might look something like:

var Classes = {
    Barbarian: {
        1: {
             (Level 1 Player Choices/Bonuses Here)
        },
        2: {
            (Level 2 Player Choices/Bonuses Here)
        },
        (You get the idea)
    },

    (Other classes)

}

Onward and upward. Progress is slow, but it's still being made. Whee!