Start to add armor, items.
This commit is contained in:
parent
2ad5415cbf
commit
b484122d49
15
WebApp/Armor.py
Normal file
15
WebApp/Armor.py
Normal 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)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
from Skill import Skill
|
from Skill import Skill
|
||||||
|
from Item import Item
|
||||||
|
from DicePool import DicePool
|
||||||
class Character:
|
class Character:
|
||||||
def __init__(self, max_hp: int):
|
def __init__(self, max_hp: int):
|
||||||
self.Body = Skill("Body")
|
self.Body = Skill("Body")
|
||||||
|
@ -12,7 +14,7 @@ class Character:
|
||||||
self.Ideals = ""
|
self.Ideals = ""
|
||||||
self.Bonds = ""
|
self.Bonds = ""
|
||||||
self.Flaws = ""
|
self.Flaws = ""
|
||||||
self.Inventory = "" #This should probably be a list of class items
|
self.Inventory = list[Item]()
|
||||||
self.Backstory = ""
|
self.Backstory = ""
|
||||||
self.Armor = ""
|
self.Armor = ""
|
||||||
self.LegalTender = 0
|
self.LegalTender = 0
|
||||||
|
@ -32,5 +34,18 @@ class Character:
|
||||||
else:
|
else:
|
||||||
self.LegalTender += amount_earned
|
self.LegalTender += amount_earned
|
||||||
return True
|
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:
|
||||||
|
|
||||||
|
|
|
@ -7,4 +7,9 @@ class DicePool:
|
||||||
def remove_from_pool(self, die : Die):
|
def remove_from_pool(self, die : Die):
|
||||||
self.pool.remove(die)
|
self.pool.remove(die)
|
||||||
def clear_pool(self):
|
def clear_pool(self):
|
||||||
self.pool.clear()
|
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
4
WebApp/Item.py
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
class Item:
|
||||||
|
def __init__(self, name: str, description: str):
|
||||||
|
self.Name = name
|
||||||
|
self.description = description
|
|
@ -1,7 +1,7 @@
|
||||||
import DicePool
|
import DicePool
|
||||||
from Die import Die
|
from Die import Die
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
from DicePool import DicePool
|
||||||
class Skill:
|
class Skill:
|
||||||
class ProficiencyLevel(Enum):
|
class ProficiencyLevel(Enum):
|
||||||
novice = 0
|
novice = 0
|
||||||
|
@ -17,8 +17,8 @@ class Skill:
|
||||||
self.SkillDice = Die(4)
|
self.SkillDice = Die(4)
|
||||||
self.ProficiencyPool = list[Die]()
|
self.ProficiencyPool = list[Die]()
|
||||||
self.ProficiencyPool.append(Die(1))
|
self.ProficiencyPool.append(Die(1))
|
||||||
def use(self):
|
def use(self, pool : DicePool):
|
||||||
return self.SkillDice.roll()
|
pool.add_to_pool(self.SkillDice)
|
||||||
def upgrade_skill(self):
|
def upgrade_skill(self):
|
||||||
num_pass = 0
|
num_pass = 0
|
||||||
if len(self.ProficiencyPool)>0:
|
if len(self.ProficiencyPool)>0:
|
||||||
|
|
Loading…
Reference in a new issue