diff --git a/lib/battle.py b/lib/battle.py index 89dd365..0fd7e98 100644 --- a/lib/battle.py +++ b/lib/battle.py @@ -177,6 +177,11 @@ class Battle(): # there's a sentinel value in CombatGroup g.begin_turn() + # Handle groups of dead/down NPCs + if not g.has_pcs() and g.group_down() and not from_unwait and not same_index: + print '{} {} down.'.format(g.name, ['is', 'are'][len(g.members) != 1]) + self.next_combatant() + def next_round(self): if self.round == None: @@ -360,6 +365,20 @@ class CombatGroup(): self.turn_began = False + def has_pcs(self): + for c in self.members.values(): + if c.pc: + return True + + return False + + + def group_down(self): + for c in self.members.values(): + if c.hp > 0: + return False + + return True class Combatant(): @@ -565,6 +584,16 @@ class Combatant(): self.use_surge() self.add_condition('Second Wind (+2 all def)', 't', 1, 's') + + def use_action_point(self): + if self.ap <= 0: + print "{} doesn't have any action points.".format(self) + return + + self.ap -= 1 + + print '{} used an action point!'.format(self) + def use_recharge_power(self, index): if index not in self.recharges: