battleman.py: Fixed recharges getting a roll the round they are used.

This commit is contained in:
Anna Rose 2012-03-25 14:16:09 -04:00
parent 656e46d28e
commit f5d16bfbaa

View File

@ -113,6 +113,7 @@ class Combatant():
recharge_index = 0
for r in recharges:
r['index'] = recharge_index
r['just_used'] = False
self.recharges[recharge_index] = r
recharge_index += 1
@ -205,6 +206,10 @@ class Combatant():
# fixme - this rolls on the same turn the power is used. Need a way to avoid that.
for r in self.recharges.values():
if r['used']:
if r['just_used']:
r['just_used'] = False
continue
# Roll to recharge
d = Dice.from_str('1d6')
n = d.roll()['total']
@ -297,6 +302,7 @@ class Combatant():
return
self.recharges[index]['used'] = True
self.recharges[index]['just_used'] = True
def choose_recharge_power(self):
@ -556,6 +562,7 @@ def main():
do_prompt()
# fixme - change input behavior. If an action has a sensible default, do that when no args are passed - require args to change default behavior
def do_prompt():
print('')
(comm, rdata) = input_str('', default='?', show_default=False, prompt_str='>').partition(' ')[::2]
@ -744,7 +751,6 @@ def do_add_condition(data):
c.add_condition(name, ctype, duration, end_type)
# fixme: if you pick someone with no conditions, you get stuck in a loop
def do_remove_condition(data):
if len(data) >= 1:
c = battle.get_combatant(int(data[0]))
@ -766,7 +772,6 @@ def do_remove_condition(data):
c.remove_condition(index)
# fixme: if you pick someone with no recharges, you get stuck in a loop
def do_use_recharge_power(data):
if len(data) >= 1:
c = battle.get_combatant(int(data[0]))