Start to add armor, items.

This commit is contained in:
ko 2025-04-19 20:54:54 -04:00
parent 2ad5415cbf
commit b484122d49
5 changed files with 44 additions and 5 deletions

15
WebApp/Armor.py Normal file
View file

@ -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)

View file

@ -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:

View file

@ -8,3 +8,8 @@ class DicePool:
self.pool.remove(die)
def clear_pool(self):
self.pool.clear()
def roll(self) -> int:
result:int = 0
for die in self.Pool:
result = result + die.roll()
return result

4
WebApp/Item.py Normal file
View file

@ -0,0 +1,4 @@
class Item:
def __init__(self, name: str, description: str):
self.Name = name
self.description = description

View file

@ -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: