Tabletop gaming is one of my favorite things to do. Unfortunately, my friends are either not interested in playing, or our schedules never line up. Oh well. Time to program a game with rules based on my preferred tabletop variant: Pathfinder.
I already got a random “Character Ability Roller” set up based on the method of rolling for each ability score with 4 dice and excluding the lowest roll so you don’t end up with low scores. I also implemented an ability modifier algorithm. Ability Modifiers are used in the game to determine your capability of using the ability to perform an action, like swinging a sword for instance: You roll a d20 for your “chances to hit”, and then increase your chance by adding your strength ability modifier to the result before comparing it against the enemy’s defenses.
I had to figure out how to floor (round down) to the nearest even number. I managed to do so by dividing the number by 2, then using a floor() function to round down. Ability modifiers zero out at 10, so I had to subtract 10 from the ability score before rounding it. As you can see in my screenshot, it works great.
Next up is to flesh out more of the character properties, like health and defenses and skills and such.