From b484122d49730cf99f3337763ac235e9085e7794 Mon Sep 17 00:00:00 2001 From: ko Date: Sat, 19 Apr 2025 20:54:54 -0400 Subject: [PATCH] Start to add armor, items. --- WebApp/Armor.py | 15 +++++++++++++++ WebApp/Character.py | 17 ++++++++++++++++- WebApp/DicePool.py | 7 ++++++- WebApp/Item.py | 4 ++++ WebApp/Skill.py | 6 +++--- 5 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 WebApp/Armor.py create mode 100644 WebApp/Item.py diff --git a/WebApp/Armor.py b/WebApp/Armor.py new file mode 100644 index 0000000..e57b963 --- /dev/null +++ b/WebApp/Armor.py @@ -0,0 +1,15 @@ +from enum import Enum +from Item import Item +class ArmorLocation(Enum): + head = 0, + left_arm = 1 + torso = 2 + right_arm = 3 + left_leg = 4 + right_leg = 5 +class Armor(Item): + def __init__(self, name:str, description:str, location : ArmorLocation): + self.BodyPart = location + Item.__init__(name, description) + + diff --git a/WebApp/Character.py b/WebApp/Character.py index 9b55a80..37df617 100644 --- a/WebApp/Character.py +++ b/WebApp/Character.py @@ -1,4 +1,6 @@ from Skill import Skill +from Item import Item +from DicePool import DicePool class Character: def __init__(self, max_hp: int): self.Body = Skill("Body") @@ -12,7 +14,7 @@ class Character: self.Ideals = "" self.Bonds = "" self.Flaws = "" - self.Inventory = "" #This should probably be a list of class items + self.Inventory = list[Item]() self.Backstory = "" self.Armor = "" self.LegalTender = 0 @@ -32,5 +34,18 @@ class Character: else: self.LegalTender += amount_earned return True + def action(self, primary_skill: Skill, secondary_skill: Skill = None) ->: + action_pool = DicePool() + primary_skill.use(action_pool) + if seondary_skill is not None: + secondary_skill.use(action_pool) + action_pool.roll() + action_pool.clear() + + + + + except: + diff --git a/WebApp/DicePool.py b/WebApp/DicePool.py index 19f8aa9..9bc0c86 100644 --- a/WebApp/DicePool.py +++ b/WebApp/DicePool.py @@ -7,4 +7,9 @@ class DicePool: def remove_from_pool(self, die : Die): self.pool.remove(die) def clear_pool(self): - self.pool.clear() \ No newline at end of file + self.pool.clear() + def roll(self) -> int: + result:int = 0 + for die in self.Pool: + result = result + die.roll() + return result \ No newline at end of file diff --git a/WebApp/Item.py b/WebApp/Item.py new file mode 100644 index 0000000..4d8dc66 --- /dev/null +++ b/WebApp/Item.py @@ -0,0 +1,4 @@ +class Item: + def __init__(self, name: str, description: str): + self.Name = name + self.description = description \ No newline at end of file diff --git a/WebApp/Skill.py b/WebApp/Skill.py index 0581e7c..bf72372 100644 --- a/WebApp/Skill.py +++ b/WebApp/Skill.py @@ -1,7 +1,7 @@ import DicePool from Die import Die from enum import Enum - +from DicePool import DicePool class Skill: class ProficiencyLevel(Enum): novice = 0 @@ -17,8 +17,8 @@ class Skill: self.SkillDice = Die(4) self.ProficiencyPool = list[Die]() self.ProficiencyPool.append(Die(1)) - def use(self): - return self.SkillDice.roll() + def use(self, pool : DicePool): + pool.add_to_pool(self.SkillDice) def upgrade_skill(self): num_pass = 0 if len(self.ProficiencyPool)>0: