mirror of
https://github.com/Threnklyn/dungeon-sheets.git
synced 2026-06-06 04:38:28 +02:00
WIP add more details in encounter
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
from dungeonsheets.stats import Ability, ArmorClass, Initiative, Speed
|
||||
|
||||
|
||||
class Agent:
|
||||
"""An actor in an encounter"""
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ def _resolve_mechanic(mechanic, module, SuperClass, warning_message=None):
|
||||
return Mechanic
|
||||
|
||||
|
||||
class Character(Actor):
|
||||
class Character(Agent):
|
||||
"""A generic player character."""
|
||||
|
||||
# General attirubtes
|
||||
|
||||
@@ -1,17 +1,27 @@
|
||||
from .strategy import Strategy
|
||||
|
||||
class Encounter:
|
||||
"""A combat encounter between two parties -- good guys and bad guys"""
|
||||
|
||||
def __init__(self, good_guys, bad_guys):
|
||||
self.good_guys = good_guys
|
||||
self.bad_guys = 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
|
||||
|
||||
self.all_agents = parties[0]
|
||||
for party in parties[1:]:
|
||||
self.all_agents += party
|
||||
|
||||
def rating(self):
|
||||
raise NotImplementedError() # Deadly for Python :/
|
||||
|
||||
def simulate(self):
|
||||
"""Who will win?"""
|
||||
|
||||
# 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
|
||||
|
||||
def analyze(self):
|
||||
|
||||
+15
-6
@@ -211,8 +211,8 @@ class Speed:
|
||||
return "{:d}{:s}".format(speed, other_speed)
|
||||
|
||||
|
||||
class Initiative:
|
||||
"""A character's initiative"""
|
||||
class NumericalInitiative:
|
||||
"""A numerical representation of initiative"""
|
||||
|
||||
def __get__(self, char, Character):
|
||||
ini = char.dexterity.modifier
|
||||
@@ -222,12 +222,21 @@ class Initiative:
|
||||
ini += char.wisdom.modifier
|
||||
if char.has_feature(RakishAudacity):
|
||||
ini += char.charisma.modifier
|
||||
ini = "{:+d}".format(ini)
|
||||
|
||||
has_advantage = (
|
||||
char.has_feature(NaturalExplorerRevised)
|
||||
or char.has_feature(FeralInstinct)
|
||||
or char.has_feature(AmbushMaster)
|
||||
char.has_feature(NaturalExplorerRevised)
|
||||
or char.has_feature(FeralInstinct)
|
||||
or char.has_feature(AmbushMaster)
|
||||
)
|
||||
return ini, has_advantage
|
||||
|
||||
|
||||
class Initiative(NumericalInitiative):
|
||||
"""A character's initiative"""
|
||||
|
||||
def __get__(self, char, Character):
|
||||
ini, has_advantage = super(Initiative, self).__get__(char, Character)
|
||||
ini = "{:+d}".format(ini)
|
||||
if has_advantage:
|
||||
ini += "(A)"
|
||||
return ini
|
||||
|
||||
Reference in New Issue
Block a user