battleman.py: Code cleanup and output format cleanup for combatant info printing.
This commit is contained in:
parent
a89acda1ac
commit
2cd5120ec0
19
battleman.py
19
battleman.py
|
@ -339,7 +339,7 @@ sw: {sw}
|
||||||
conditions:
|
conditions:
|
||||||
{conditions}
|
{conditions}
|
||||||
recharge powers:
|
recharge powers:
|
||||||
{recharge}""".format(index=self.index, name=self.name, hp=self.hp, max_hp=self.max_hp, temp_hp=self.temp_hp, surge=self.surges, ap=self.ap, sw=self.sw, conditions=self.format_condition_summary(), recharge=self.format_recharge_summary(), separator='='*len(self.name))
|
{recharge}""".format(index=self.index, name=self.name, hp=self.hp, max_hp=self.max_hp, temp_hp=self.temp_hp, surge=self.surges, ap=self.ap, sw=self.sw, conditions=self.format_condition_summary(' '), recharge=self.format_recharge_summary(' '), separator='='*len(self.name))
|
||||||
|
|
||||||
|
|
||||||
def format_health_summary(self):
|
def format_health_summary(self):
|
||||||
|
@ -356,7 +356,7 @@ recharge powers:
|
||||||
return '{} hp{}{}{}'.format(self.hp, temp_info, bloodied, ', '.join([x['name'] for x in self.conditions.values()]))
|
return '{} hp{}{}{}'.format(self.hp, temp_info, bloodied, ', '.join([x['name'] for x in self.conditions.values()]))
|
||||||
|
|
||||||
|
|
||||||
def format_condition_summary(self):
|
def format_condition_summary(self, initial=''):
|
||||||
summary = ''
|
summary = ''
|
||||||
for (index, c) in self.conditions.items():
|
for (index, c) in self.conditions.items():
|
||||||
type_string = ''
|
type_string = ''
|
||||||
|
@ -364,14 +364,14 @@ recharge powers:
|
||||||
type_string = 'Save Ends'
|
type_string = 'Save Ends'
|
||||||
elif c['cond_type'] == 't':
|
elif c['cond_type'] == 't':
|
||||||
type_string = '{} Round{}'.format(c['duration'], 's'[ c['duration']==1: ] )
|
type_string = '{} Round{}'.format(c['duration'], 's'[ c['duration']==1: ] )
|
||||||
summary = summary + '{}: {} ({})\n'.format(index, c['name'], type_string)
|
summary = summary + '{}{}: {} ({})\n'.format(initial, index, c['name'], type_string)
|
||||||
|
|
||||||
return summary.rstrip()
|
return summary.rstrip()
|
||||||
|
|
||||||
def format_recharge_summary(self):
|
def format_recharge_summary(self, initial):
|
||||||
summary = ''
|
summary = ''
|
||||||
for (index, r) in self.recharges.items():
|
for (index, r) in self.recharges.items():
|
||||||
summary = summary + '{}: {} (Recharge: {}, Available: {})\n'.format(index, r['name'], r['value'], ['Yes', 'No'][ r['used'] ])
|
summary = summary + '{}{}: {} (Recharge: {}, Available: {})\n'.format(initial, index, r['name'], r['value'], ['Yes', 'No'][ r['used'] ])
|
||||||
return summary.rstrip()
|
return summary.rstrip()
|
||||||
|
|
||||||
|
|
||||||
|
@ -491,17 +491,14 @@ class Battle():
|
||||||
if self.validate_started():
|
if self.validate_started():
|
||||||
return self.validate_started()
|
return self.validate_started()
|
||||||
|
|
||||||
ret = ''
|
|
||||||
|
|
||||||
g = self.groups[self.current]
|
g = self.groups[self.current]
|
||||||
if g.is_solo_group():
|
if g.is_solo_group():
|
||||||
ret = '{}\n'.format(g.members[0].format_full_info())
|
return '{}'.format(g.members[0].format_full_info())
|
||||||
else:
|
else:
|
||||||
ret = ret + '{}'.format(g.name)
|
ret = '{}\n'.format(g.name)
|
||||||
for c in g.members:
|
for c in g.members:
|
||||||
ret = ret + ' {}\n'.format(c)
|
ret = ret + ' {}\n'.format(c)
|
||||||
|
return ret.rstrip()
|
||||||
return ret.rstrip()
|
|
||||||
|
|
||||||
|
|
||||||
def next_combatant(self):
|
def next_combatant(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user