battleman.py: Added recharge power rerolling, improved recharge inputting.

This commit is contained in:
Anna Rose 2012-03-25 01:18:53 -04:00 committed by Anna Wiggins
parent 1da238be5a
commit fddb2bf8bb

View File

@ -30,13 +30,17 @@ class CombatGroup():
surges = input_int('healing surges', 0) surges = input_int('healing surges', 0)
recharges = [] recharges = []
recharge = ['']
while True: while True:
recharge = input_str("recharge", default='').split(',') data = []
if recharge == ['']: data = input_str("recharge", default='').split(',')
break if len(data) == 2:
else: recharge = {}
recharge['name'] = data[0]
recharge['value'] = int(data[1])
recharge['used'] = False
recharges.append(recharge) recharges.append(recharge)
else:
break
count = input_int('count', 1) count = input_int('count', 1)
@ -188,7 +192,13 @@ class Combatant():
else: else:
print('{} is still affected by {} ({} round{} left).'.format(self, c['name'], c['duration'], 's'[c['duration']==1:])) print('{} is still affected by {} ({} round{} left).'.format(self, c['name'], c['duration'], 's'[c['duration']==1:]))
# fixme: still need to add recharges for r in self.recharges:
if r['used']:
# Roll to recharge
d = Dice.from_str('1d6')
n = d.roll()['total']
if n >= r['value']:
r['used'] = False
def damage(self, amount): def damage(self, amount):