diff --git a/battleman.py b/battleman.py index ec4a737..c48c054 100755 --- a/battleman.py +++ b/battleman.py @@ -131,6 +131,7 @@ class Combatant(): self.hp -= amount + # fixme - should we change this output? if self.is_down(): print('{} ({}) is down!'.format(self.name, self.index)) elif self.is_bloodied() and not was_bloodied: @@ -146,6 +147,7 @@ class Combatant(): self.hp = min(self.hp + amount, self.max_hp + self.temp_hp) + # fixme - should we change this output? if was_down: print('{} ({}) is conscious.'.format(self.name, self.index)) if was_bloodied and not self.is_bloodied(): @@ -162,18 +164,22 @@ class Combatant(): return self.hp <= 0 - def get_health_summary(self): + def format_health_summary(self): bloodied = '' + temp_info = '' if self.is_bloodied(): bloodied = ', bloodied' if len(self.conditions): bloodied = bloodied + ', ' - return '{} hp{}{}'.format(self.hp, bloodied, ', '.join([x.name for x in self.conditions])) + if self.temp_hp > 0: + temp_info = ', {} temp hp'.format(self.temp_hp) + + return '{} hp{}{}{}'.format(self.hp, temp_info, bloodied, ', '.join([x.name for x in self.conditions])) def __str__(self): - return "{} ({hp} hp)".format(self.name, hp=self.hp) + return "{}: {} ({})".format(self.index, self.name, self.format_health_summary()) def input_str(prompt, default=None, show_default=False, prompt_str=':'): @@ -251,7 +257,7 @@ class Battle(): print '\nInitiative Roster:\n' for g in self.groups: - print '{} ({})'.format(g.name, g.init) + print '{} ({})'.format(g.name, g.init) # fixme - should we change this output? print '' self.next_round() @@ -264,11 +270,11 @@ class Battle(): for g in self.groups: if g.is_solo_group(): - ret = ret + '{}: {}\n'.format(g.members[0].index, g.name) + ret = ret + '{}\n'.format(g.members[0]) else: ret = ret + '{}:\n'.format(g.name) for c in g.members: - ret = ret + '\t{}: {} ({})\n'.format(c.index, c.name, c.get_health_summary()) + ret = ret + '\t{}\n'.format(c) return ret.rstrip() @@ -279,11 +285,11 @@ class Battle(): g = self.groups[current] if g.is_solo_group(): - ret = ret + '{}: {}\n'.format(g.members[0].index, g.name) + ret = ret + '{}\n'.format(g.members[0]) else: ret = ret + '{}:\n'.format(g.name) for c in g.members: - ret = ret + '\t{}: {} ({})\n'.format(c.index, c.name, c.get_health_summary()) + ret = ret + '\t{}\n'.format(c) return ret.rstrip()