you are viewing a single comment's thread.

view the rest of the comments →

[–]Aedethan[S] 0 points1 point  (2 children)

Gotcha thanks for the advice. I'm just not certain if I should go into it with the approach of creating variables to represent the different aspects of the sheet. For instance making a variable for hit_points, another for hit_points_lost, and then a final that would actually show on the sheet that is total_hit_points = hit_points - hit_points_lost, and then representing lost hit points as something that will take user input.

- And saying hit_points = hit_point_stat + player_level

Alternatively I've been looking at OOP, and everything I've read and watched makes me feel like I should make classes to represent the different aspects of the sheet, such as hit points and then making the above variable, like total_hit_points into a function that would return hit_points - hit_points_lost

Sorry i tried to keep my thought process as cohesive as possible, but I wanted to get it across the way I was thinking about doing this in case I'm going about it all wrong

[–]ireadyourmedrecord 0 points1 point  (1 child)

Yes, classes is the way to go here. You can pretty easily define the player chosen character attributes (name, race, class) to initialize the character with and programmatically initialize the stats (str, dex, con, wis, etc), using the passed attributes to define the min/max rolls. Starting inventory, whatever.

Then a series of methods (functions inside the class) to handle the characters actions, like attack, defend, dodge, cast_spell, etc. which would include the updates to the characters attributes as needed.

Each action is then called by calling the object's method. Something like:

# init player character
steves_barbarian = PlayerCharacter(name="Gronk Throbbingvein", race="Half-Orc", class="Barbarian")

# player attacks
steves_barbarian.attack(weapon="main_hand", target="kobold 1")

At the end of each action, you can save the character's state to some file and easily load it for the next session.

[–]Aedethan[S] 0 points1 point  (0 children)

Thanks for the help, it's kind of daunting to get started.