Skip to content

Instantly share code, notes, and snippets.

@SandwichChef
Last active December 21, 2020 05:24
Show Gist options
  • Select an option

  • Save SandwichChef/6168c224934ac7f626d8282376df467b to your computer and use it in GitHub Desktop.

Select an option

Save SandwichChef/6168c224934ac7f626d8282376df467b to your computer and use it in GitHub Desktop.
"""
jwmonet
Relearning Python
20201220
"""
import random
class MyException(Exception):
pass
# The idea is that entities are anything that can participate in combat, including monsters or player characters,
# or perhaps NPCs
class Entity:
stats: object
stats = dict()
def __init__(self):
self.stats = dict(name="Default", lvl=1, CurrentHP=10, MaxHP=10, ATK=5, DEF=5, CurrentTP=10, MaxTP=10, XP=0)
def roll_stats(self):
self.stats["MaxHP"] = random.randrange(10, 20, 1)
self.stats["CurrentHP"] = self.stats["MaxHP"]
self.stats["ATK"] = random.randrange(1, 10, 1)
self.stats["DEF"] = random.randrange(1, 10, 1)
self.stats["MaxTP"] = random.randrange(10, 20, 1)
self.stats["CurrentTP"] = self.stats["MaxTP"]
class Character(Entity):
# @staticmethod
def generate_character(self):
#generated_character = Character(stats=())
self.roll_stats()
print("What would you like to name your character?")
character_name = input()
self.stats["name"] = character_name
# def __init__(self):
# super().__init__()
def dump_stats(self):
print("Your character's stats are as follows")
for x, y in self.stats.items():
print(x, y)
def finalize_character(self):
pass
class Monster(Entity):
def generate_monster(self):
self.roll_stats()
pass
c = Character()
c.generate_character()
c.dump_stats()
# input("Would you like to roll your stats again?")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment