diff --git a/dungeonsheets/agent.py b/dungeonsheets/agent.py index c5ee799..b4fd79e 100644 --- a/dungeonsheets/agent.py +++ b/dungeonsheets/agent.py @@ -1,8 +1,10 @@ -from dungeonsheets.stats import Ability, ArmorClass, Initiative, Speed, Skill +from dungeonsheets.conditions.conditions import Blinded, Charmed +from dungeonsheets.stats import Ability, ArmorClass, Initiative, Speed, Skill, CurrentInitiative, CurrentHP +from abc import ABC -class Agent: - """An actor in an encounter""" +class Agent(ABC): + """An actor in an encounter. Use Monster or Character, not this class directly!""" # General attributes name = "" @@ -51,6 +53,10 @@ class Agent: stealth = Skill(ability="dexterity") survival = Skill(ability="wisdom") + # Conditions + blinded = Blinded() + charmed = Charmed() + # TODO finish me! # Inventory cp = 0 @@ -74,9 +80,18 @@ class Agent: custom_features = list() feature_choices = list() + # Current Status: + initiative_roll = CurrentInitiative() + current_hp = CurrentHP() + statuses = list() + + # TODO: Pull in the monster class-variables here too + def __init__(self): pass + # TODO: Perhaps these are better stored like the skills are as objects with a __get__? + @property def actions(self): """All the things I can do in a turn""" diff --git a/dungeonsheets/conditions/__init__.py b/dungeonsheets/conditions/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/dungeonsheets/conditions/conditions.py b/dungeonsheets/conditions/conditions.py new file mode 100644 index 0000000..af7bd68 --- /dev/null +++ b/dungeonsheets/conditions/conditions.py @@ -0,0 +1,9 @@ +class Condition: + """A condition that can be held by an agent""" + pass + +class Blinded(Condition): + pass + +class Charmed(Condition): + pass \ No newline at end of file diff --git a/dungeonsheets/encounter/encounter.py b/dungeonsheets/encounter/encounter.py index e9ba29a..74c7d68 100644 --- a/dungeonsheets/encounter/encounter.py +++ b/dungeonsheets/encounter/encounter.py @@ -1,16 +1,10 @@ class Encounter: """A combat encounter between two parties -- good guys and bad guys""" - def __init__(self, *parties): - if len(parties) < 2: - raise ValueError("You need at least 2 parties to hold an encounter") - if len(parties) is not 2: - raise NotImplementedError("Haven't implemented AI for 3+ groups") # TODO: Implement this - - # Combine all parties into a single group - self.all_agents = parties[0] - for party in parties[1:]: - self.all_agents += party + def __init__(self, group_a, group_b): + self.group_a = group_a + self.group_b = group_b + self.all_agents = group_a + group_b def rating(self): raise NotImplementedError() # Deadly for Python :/ @@ -21,6 +15,7 @@ class Encounter: # Initiative for agent in self.all_agents: agent.roll_initiative() + self.all_agents = sorted(self.all_agents, key=lambda a: a.initiative_roll) raise NotImplementedError() # Apparently the mind flayers win for now