Monday, April 10, 2023

Character Stats Progress

I had a lovely Easter Monday off which gave me some time to spend on starting to iron out the details with character stats, how the code updates everything correctly and how it all gets triggered at the right times.

First problem I came across was wanting to have "complex" traits. Lets use Attack Rating as an example (as it was the first cab off the rank I was looking at). Attack Rating is basically one of two values used to determine whether you successfully hit an enemy you're trying to attack, but lets just look at it on it's own for now.

Attack rating has two primarily combination of your Strength and Grace characteristics as ratio of the two (kinda). Super. Easy peasy. Calculate it off your base stats. Some items grant extra Strength and/or Grace. Still easy. Calculate it off your base stats, plus those stats. Super. More annoying, but still doable. Some items also can give you a straight up bonus to your attack rating. By this time, you're at the same place as me logically (I'm assuming you're at least as smart as I am!!) and you can see that things are starting to get a bit sketchy. What if you have multiple items that give various stat bonuses, or a bonus to the Attack Rating itself? What order should they all be processed in? What if a buff is thrown in on top of all that, that affects one of the stats that are involved in this calculation?

If you read that entire last paragraph, kudos to you. The short version is I needed to break complex traits (like Attack Rating) up into it's primary constituents and generate the final value on the fly - which is what the code now does after a good deal of head-scratching and looking at my belly-button in search of a solution.

I'm about halfway through all the complex traits that come together through a combination of your characters base stats combined with potentially items that add to that trait directly (Health or Mana Regeneration are great examples - that use your primary stats, but can be modified by items or buffs directly).

Anyhow. 

tl;dr 

I solved another thing that I discovered I needed to solve today. Feels good.

No comments:

Post a Comment

Character and Item Stats

It feels like I've renamed a thousand thousand properties in classes, updated a myriad of methods across the database, the editor and th...