battleman.py: Fixed recharges getting a roll the round they are used.
This commit is contained in:
parent
656e46d28e
commit
f5d16bfbaa
|
@ -113,6 +113,7 @@ class Combatant():
|
||||||
recharge_index = 0
|
recharge_index = 0
|
||||||
for r in recharges:
|
for r in recharges:
|
||||||
r['index'] = recharge_index
|
r['index'] = recharge_index
|
||||||
|
r['just_used'] = False
|
||||||
self.recharges[recharge_index] = r
|
self.recharges[recharge_index] = r
|
||||||
recharge_index += 1
|
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.
|
# fixme - this rolls on the same turn the power is used. Need a way to avoid that.
|
||||||
for r in self.recharges.values():
|
for r in self.recharges.values():
|
||||||
if r['used']:
|
if r['used']:
|
||||||
|
if r['just_used']:
|
||||||
|
r['just_used'] = False
|
||||||
|
continue
|
||||||
|
|
||||||
# Roll to recharge
|
# Roll to recharge
|
||||||
d = Dice.from_str('1d6')
|
d = Dice.from_str('1d6')
|
||||||
n = d.roll()['total']
|
n = d.roll()['total']
|
||||||
|
@ -297,6 +302,7 @@ class Combatant():
|
||||||
return
|
return
|
||||||
|
|
||||||
self.recharges[index]['used'] = True
|
self.recharges[index]['used'] = True
|
||||||
|
self.recharges[index]['just_used'] = True
|
||||||
|
|
||||||
|
|
||||||
def choose_recharge_power(self):
|
def choose_recharge_power(self):
|
||||||
|
@ -556,6 +562,7 @@ def main():
|
||||||
do_prompt()
|
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():
|
def do_prompt():
|
||||||
print('')
|
print('')
|
||||||
(comm, rdata) = input_str('', default='?', show_default=False, prompt_str='>').partition(' ')[::2]
|
(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)
|
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):
|
def do_remove_condition(data):
|
||||||
if len(data) >= 1:
|
if len(data) >= 1:
|
||||||
c = battle.get_combatant(int(data[0]))
|
c = battle.get_combatant(int(data[0]))
|
||||||
|
@ -766,7 +772,6 @@ def do_remove_condition(data):
|
||||||
c.remove_condition(index)
|
c.remove_condition(index)
|
||||||
|
|
||||||
|
|
||||||
# fixme: if you pick someone with no recharges, you get stuck in a loop
|
|
||||||
def do_use_recharge_power(data):
|
def do_use_recharge_power(data):
|
||||||
if len(data) >= 1:
|
if len(data) >= 1:
|
||||||
c = battle.get_combatant(int(data[0]))
|
c = battle.get_combatant(int(data[0]))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user