![]() At level 1Īt level 1, a character's HP is equal to the highest possible roll on their hit die (the number in the name of the die, for those of you unfamiliar with dice that have more than 6 sides) plus their Constitution modifier. How to Calculate Max HPĪ character's maximum HP is equal to their HP at level 1 plus the sum of the increase they received at each level. For example, a level 3 character got to where they are by being a level 1 character and levelling up twice. To reach level n, a character starts at level 1 and levels up n-1 times. Your code will never have to handle a level outside that range. A character's level is an integer from 1 to 20, inclusive 1. All that this affects is how many times to add a value to the running total in the following section. Sorcerer: d6įinally, the character's level. The following table lists the hit dice for each class. Next, every class has an assigned "hit die" type, which is involved in calculating HP. You don't have to handle this feat in your answer.) That's not the text of the feat but the math works out to be exactly the same. (This is entirely irrelevant to the challenge, but if you're curious about how it affects maximum HP: You can assume the "Tough" feat adds 2 to a character's Constitution modifier for the purposes of HP calculation, since that's effectively what it does. Though the Constitution modifier can change as a character levels up, its effects on HP are applied retroactively, so only its current value is needed to calculate current max HP. Your code will never have to handle scores outside that range, which also means it will never have to handle a modifier lower than -5 or greater than +5. Adventurers can only have ability scores from 1 to 20, inclusive. In short, the modifier is equal to floor( (ability_score - 10) / 2 ). The only relevant knowledge required for this challenge is how the Constitution ability score affects another stat, which is the Constitution modifier. Each DND character has six integer ability scores, including one for Constitution. The first thing you need to know about to calculate max HP is the "Constitution modifier". For this challenge, you will write a program or function to calculate the correct value automatically. For whatever reason, one of the things that gives me trouble is figuring out what their new maximum HP value should be. I have trouble remembering everything I have to do when leveling up a D&D character.
0 Comments
Leave a Reply. |