battleman.py: more formatting cleanup
This commit is contained in:
parent
5fd07e0ae1
commit
5f5fe29032
51
battleman.py
51
battleman.py
|
@ -109,10 +109,10 @@ class Combatant():
|
|||
|
||||
self.hp -= amount
|
||||
|
||||
if self.is_bloodied() and not was_bloodied:
|
||||
print('{} ({}) is bloodied! Remaining hp: {}'.format(self.name, self.index, self.hp))
|
||||
if self.is_down():
|
||||
print('{} ({}) is down!'.format(self.name, self.index))
|
||||
elif self.is_bloodied() and not was_bloodied:
|
||||
print('{} ({}) is bloodied! Remaining hp: {}'.format(self.name, self.index, self.hp))
|
||||
|
||||
|
||||
def is_bloodied(self):
|
||||
|
@ -162,11 +162,11 @@ class Battle():
|
|||
def __str__(self):
|
||||
ret = ''
|
||||
if self.is_started():
|
||||
ret = 'Battle underway, currently on round {}\n'.format(self.round)
|
||||
ret = 'Battle underway, currently on round {}\n\n'.format(self.round)
|
||||
else:
|
||||
ret = 'Battle not yet started\n'
|
||||
ret = 'Battle not yet started\n\n'
|
||||
|
||||
ret = ret + 'Combatants:\n'
|
||||
ret = ret + 'Combatants\n==========\n'
|
||||
ret = ret + self.list_combatants()
|
||||
|
||||
return ret
|
||||
|
@ -222,6 +222,21 @@ class Battle():
|
|||
return ret.rstrip()
|
||||
|
||||
|
||||
# Returns a formatted string with all of the combatants
|
||||
def list_current_group(self):
|
||||
ret = ''
|
||||
|
||||
g = self.groups[current]
|
||||
if g.is_solo_group():
|
||||
ret = ret + '{}: {}\n'.format(g.members[0].index, g.name)
|
||||
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())
|
||||
|
||||
return ret.rstrip()
|
||||
|
||||
|
||||
def next_combatant(self):
|
||||
print('Sorry, this is still a stub function.')
|
||||
g = self.get_current_group()
|
||||
|
@ -250,7 +265,7 @@ def main():
|
|||
# print("Adding enemy group {}".format(i))
|
||||
# battle.add_group(CombatGroup.from_input())
|
||||
|
||||
print "Welcome to 4e Battle Manager.\nCurrent status:"
|
||||
print "Welcome to 4e Battle Manager.\n"
|
||||
print battle
|
||||
|
||||
while True:
|
||||
|
@ -266,7 +281,9 @@ def do_prompt():
|
|||
elif comm == 'a':
|
||||
print('Sorry, this is still a stub function.')
|
||||
elif comm == 'l':
|
||||
battle.list_combatants()
|
||||
print battle.list_combatants()
|
||||
elif comm == 'l':
|
||||
print battle.list_current_group()
|
||||
elif comm == 'b':
|
||||
battle.begin()
|
||||
elif comm == 'd':
|
||||
|
@ -292,7 +309,7 @@ def do_damage():
|
|||
print('Error: you can only run this command after starting the battle')
|
||||
return
|
||||
|
||||
battle.list_combatants()
|
||||
print battle.list_combatants()
|
||||
index = input_int('choose combatant', battle.get_current_group().members[0].index)
|
||||
amount = input_int('damage')
|
||||
battle.deal_damage(index, amount)
|
||||
|
@ -301,16 +318,18 @@ def do_damage():
|
|||
def do_help():
|
||||
print("""Possible commands:
|
||||
? - print this help menu (yay, you already figured that one out)
|
||||
a - add more combatants (works during battle)
|
||||
l - list current combatants
|
||||
a - add more combatants (works during battle) [stub]
|
||||
b - begin the battle
|
||||
l - list combatants
|
||||
p - print info for combatant/group with initiative
|
||||
d - deal damage to someone
|
||||
h - heal someone
|
||||
s - let someone use a healing surge
|
||||
c - apply a condition
|
||||
r - remove a condition (this can also happen automatically)
|
||||
n - next (end the current combat group's turn)
|
||||
w - wait (remove a combatant from the initiative order and into a separate pool)
|
||||
h - heal someone [stub]
|
||||
s - let someone use a healing surge [stub]
|
||||
sw -
|
||||
c - apply a condition [stub]
|
||||
r - remove a condition (this can also happen automatically) [stub]
|
||||
n - next (end the current combat group's turn) [stub]
|
||||
w - wait (remove a combatant from the initiative order and into a separate pool) [stub]
|
||||
q - quit""")
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user