Skip to content

Commit

Permalink
Merge pull request #16 from Coffee-fueled-deadlines/Development
Browse files Browse the repository at this point in the history
Development -> Main
  • Loading branch information
Coffee-fueled-deadlines committed Sep 7, 2024
2 parents 3d09e0c + 12bc3ad commit 712fcc3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions PyDnD/Player.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# Built-in/Generic Imports
import json
from uuid import uuid4
import math
import warnings

# Import LevelingSystem
Expand Down Expand Up @@ -509,6 +510,18 @@ def serialize_to_json(self, filepath):

print(f"Player data serialized to {filepath}")

# Get Modifier for Stat
def get_modifier(self, stat):
"""Returns modifier for given stat
Args:
stat (int): The player ability score to calculate the modifier for
Returns:
modifier(int): The modifier for the given stat
"""
return math.floor(stat/2)-5

@staticmethod
def deserialize_from_json(filepath):
"""
Expand Down

0 comments on commit 712fcc3

Please sign in to comment.