def __init__(self, name, strength = 0, dexterity = 0, constitution = 0, intelligence = 0, wisdom = 0, charisma = 0, wp = -1, fatigue = -1, status = ["None"], skills = None): self.__name = name self.__attributes = { "Strength" : strength, "Dexterity" : dexterity, "Constitution" : constitution, "Intelligence" : intelligence, "Wisdom" : wisdom, "Charisma" : charisma } self.__health = Health(self.__attributes["Constitution"], self.__attributes["Strength"], status, wp, fatigue) if skills is not None: self.__skills = skills else: self.__skills = SkillList()
class Creature: """ The SkillDnD class which holds and manages a creature. Functions: get_name() -> returns the creature's name string get_attributes() -> returns a dictionary with keys of attribute name, and values equal to the attribute's value get_skills([string:whatToReturn]) -> returns a list of the creature's skills get_wound_percentage() -> returns the value for the creature's wound point percentage get_status_effects() -> returns a list of status effects affecting the creature get_fatigue_percentage() -> returns the value for the creature's fatigue percentage use_skill(string:skillName[,int:difficulty,Creature:target, int:modifiers]) -> returns a value indicating the degree of success of the action """ def __init__(self, name, strength = 0, dexterity = 0, constitution = 0, intelligence = 0, wisdom = 0, charisma = 0, wp = -1, fatigue = -1, status = ["None"], skills = None): self.__name = name self.__attributes = { "Strength" : strength, "Dexterity" : dexterity, "Constitution" : constitution, "Intelligence" : intelligence, "Wisdom" : wisdom, "Charisma" : charisma } self.__health = Health(self.__attributes["Constitution"], self.__attributes["Strength"], status, wp, fatigue) if skills is not None: self.__skills = skills else: self.__skills = SkillList() def get_name(self): return self.__name def get_attributes(self): return self.__attributes def get_skills(self, whatToReturn = "all names"): if whatToReturn == "list of Skill": return self.__skills else: return self.__skills.get_all_skill_names() def get_wound_percentage(self): return self.__health.get_wound_percentage() def get_status_effects(self): return self.__health.get_status() def get_fatigue_percentage(self): return self.__health.get_fatigue_percentage() def use_skill(self, skillName, difficulty = 0, target = None, modifiers = 0): # set initial variables skill = self.__skills.get_skill(skillName) attributeBonus = 0 for i in skill.get_associated_attributes(): if self.__attributes[i] >= 10: attributeBonus += int((self.__attributes[i] - 10) / 2) else: attributeBonus += int((self.__attributes[i] - 11) / 2) return skill.use(attributeBonus, difficulty, target, modifiers)