diff --git a/WebApp/Character.py b/WebApp/Character.py new file mode 100644 index 0000000..9b55a80 --- /dev/null +++ b/WebApp/Character.py @@ -0,0 +1,36 @@ +from Skill import Skill +class Character: + def __init__(self, max_hp: int): + self.Body = Skill("Body") + self.Mental = Skill("Mental") + self.Profound = Skill("Profound") + self.Aura = Skill("Aura") + self.Setting = Skill("Setting") + self.NaturalVisualDescription = "" + self.WithBelongsVisualDescription = "" + self.Personality = "" + self.Ideals = "" + self.Bonds = "" + self.Flaws = "" + self.Inventory = "" #This should probably be a list of class items + self.Backstory = "" + self.Armor = "" + self.LegalTender = 0 + self.MaxHp = 0 + self.CurrentHp = 0 + def spend_money(self, amount_to_spend : int ) -> bool: + if amount_to_spend <= 0: + return False + elif self.LegalTender >= amount_to_spend: + self.LegalTender -= amount_to_spend + return True + else: + return False + def earn_money(self, amount_earned: int) -> bool: + if amount_earned <= 0: + return False + else: + self.LegalTender += amount_earned + return True + + diff --git a/WebApp/DicePool.py b/WebApp/DicePool.py new file mode 100644 index 0000000..19f8aa9 --- /dev/null +++ b/WebApp/DicePool.py @@ -0,0 +1,10 @@ +import Die +class DicePool: + def __init__(self): + self.pool = list[Die]() + def add_to_pool(self, die : Die): + self.pool.append(die) + def remove_from_pool(self, die : Die): + self.pool.remove(die) + def clear_pool(self): + self.pool.clear() \ No newline at end of file diff --git a/WebApp/Die.py b/WebApp/Die.py new file mode 100644 index 0000000..d6eae57 --- /dev/null +++ b/WebApp/Die.py @@ -0,0 +1,6 @@ +from random import randint +class Die: + def __init__(self, diemax: int): + self.Max = diemax + def roll(self): + return randint(1, self.Max) \ No newline at end of file diff --git a/WebApp/Skill.py b/WebApp/Skill.py new file mode 100644 index 0000000..0581e7c --- /dev/null +++ b/WebApp/Skill.py @@ -0,0 +1,47 @@ +import DicePool +from Die import Die +from enum import Enum + +class Skill: + class ProficiencyLevel(Enum): + novice = 0 + studied = 1 + proficient = 2 + advanced = 3 + expert = 4 + legendary = 5 + def __init__(self, name): + self.Proficiency = self.ProficiencyLevel.novice + self.SubSkills = list[Skill]() + self.Name = name + self.SkillDice = Die(4) + self.ProficiencyPool = list[Die]() + self.ProficiencyPool.append(Die(1)) + def use(self): + return self.SkillDice.roll() + def upgrade_skill(self): + num_pass = 0 + if len(self.ProficiencyPool)>0: + for die in self.ProficiencyPool: + if die.roll() < die.Max: + return + if self.Proficiency == self.ProficiencyLevel.novice: + # Because novice is the only D1 available, clear dice pool + # before adding to pool + self.Proficiency = self.ProficiencyLevel.studied + self.ProficiencyPool.clear() + self.ProficiencyPool.append(Die(20)) + elif self.Proficiency == self.ProficiencyLevel.studied: + self.Proficiency = self.ProficiencyLevel.proficient + self.ProficiencyPool.append(Die(20)) + elif self.Proficiency == self.ProficiencyLevel.proficient: + self.Proficiency = self.ProficiencyLevel.advanced + self.ProficiencyPool.append(Die(20)) + elif self.Proficiency == self.ProficiencyLevel.advanced: + self.Proficiency = self.ProficiencyLevel.expert + self.ProficiencyPool.append(Die(20)) + elif self.Proficiency == self.ProficiencyLevel.expert: + self.Proficiency = self.ProficiencyLevel.legendary + self.ProficiencyPool.clear() + for skill in self.SubSkills: + skill.upgrade_skill()