Added code to handle groups of NPCs who are 'down'
This commit is contained in:
parent
261304d78b
commit
0db48c544d
|
@ -177,6 +177,11 @@ class Battle():
|
||||||
# there's a sentinel value in CombatGroup
|
# there's a sentinel value in CombatGroup
|
||||||
g.begin_turn()
|
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):
|
def next_round(self):
|
||||||
if self.round == None:
|
if self.round == None:
|
||||||
|
@ -360,6 +365,20 @@ class CombatGroup():
|
||||||
self.turn_began = False
|
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():
|
class Combatant():
|
||||||
|
@ -565,6 +584,16 @@ class Combatant():
|
||||||
self.use_surge()
|
self.use_surge()
|
||||||
self.add_condition('Second Wind (+2 all def)', 't', 1, 's')
|
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):
|
def use_recharge_power(self, index):
|
||||||
if index not in self.recharges:
|
if index not in self.recharges:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user