battleman: fixed 'print' command on a group, cleaned up and added some output
This commit is contained in:
parent
9c6ac3056b
commit
4c6f96832b
|
@ -122,9 +122,9 @@ class CommandParser(Cmd):
|
|||
if num_cmds == 1:
|
||||
return getattr(self, 'do_'+cmds[0])(data)
|
||||
elif num_cmds > 1:
|
||||
sys.stdout.write('Error: Ambiguous command: {}'.format(comm))
|
||||
print 'Error: Ambiguous command: {}'.format(comm)
|
||||
else:
|
||||
print 'Error: Unrecognized command {}'.format(comm)
|
||||
print 'Error: Unrecognized command: {}'.format(comm)
|
||||
|
||||
|
||||
# We are overriding do_help to avoid printing info about
|
||||
|
|
|
@ -135,7 +135,6 @@ class Battle():
|
|||
|
||||
|
||||
# Returns a formatted string with just the current group
|
||||
# fixme: non-solo groups only print indexes...
|
||||
def format_current_group(self):
|
||||
if self.validate_started():
|
||||
return self.validate_started()
|
||||
|
@ -145,7 +144,7 @@ class Battle():
|
|||
return '{}'.format(g.members[0].format_full_info())
|
||||
else:
|
||||
ret = '{}\n'.format(g.name)
|
||||
for c in g.members:
|
||||
for c in g.members.values():
|
||||
ret = ret + ' {}\n'.format(c)
|
||||
return ret.rstrip()
|
||||
|
||||
|
@ -181,12 +180,12 @@ class Battle():
|
|||
for c in self.combatant_hash.values():
|
||||
c.tick_conditions()
|
||||
|
||||
print 'Beginning round {}'.format(self.round)
|
||||
print 'Beginning round {}.'.format(self.round)
|
||||
|
||||
|
||||
def validate_started(self):
|
||||
if not self.is_started():
|
||||
return 'Error: you can only run this command after starting the battle'
|
||||
return 'Error: you can only run this command after starting the battle.'
|
||||
return None
|
||||
|
||||
|
||||
|
@ -211,9 +210,10 @@ class Battle():
|
|||
|
||||
if c:
|
||||
self.wait_list[index] = c
|
||||
print '{} is now in the wait list.'.format(c)
|
||||
self.next_combatant(same_index = True)
|
||||
else:
|
||||
print 'Error: Failed to find combatant {}'.format(index)
|
||||
print 'Error: Failed to find combatant {}.'.format(index)
|
||||
|
||||
|
||||
def unwait(self, index):
|
||||
|
@ -226,6 +226,7 @@ class Battle():
|
|||
c = self.wait_list[index]
|
||||
del self.wait_list[index]
|
||||
self.groups.insert(self.current, CombatGroup(c.name, {c.index: c}, 0))
|
||||
print '{} is no longer waiting.'.format(c)
|
||||
self.next_combatant(same_index = True)
|
||||
else:
|
||||
if index in self.combatant_hash:
|
||||
|
|
Loading…
Reference in New Issue
Block a user