battleman.py: Refactored turn begin/end code
This commit is contained in:
parent
e40b485205
commit
a59a4f1ea4
22
battleman.py
22
battleman.py
|
@ -75,6 +75,20 @@ class CombatGroup():
|
|||
return len(self.members) == 1
|
||||
|
||||
|
||||
def begin_turn(self):
|
||||
msg = None
|
||||
if self.is_solo_group():
|
||||
msg = '{} has initiative.'.format(self.name)
|
||||
else:
|
||||
msg = '{} have initiative.'.format(self.name)
|
||||
|
||||
print msg
|
||||
|
||||
|
||||
def end_turn(self):
|
||||
for c in self.members:
|
||||
c.end_turn()
|
||||
|
||||
|
||||
class Combatant():
|
||||
next_index = 0
|
||||
|
@ -100,8 +114,8 @@ class Combatant():
|
|||
self.conditions.append(condition)
|
||||
|
||||
|
||||
def begin_turn(self):
|
||||
print("{} has initiative.".format(self))
|
||||
def end_turn(self):
|
||||
pass # fixme - need to do a lot of stuff with conditions here
|
||||
|
||||
|
||||
def damage(self, amount):
|
||||
|
@ -211,8 +225,12 @@ class Battle():
|
|||
self.current = 0
|
||||
self.round = 1
|
||||
|
||||
print '\nInitiative Roster:\n'
|
||||
for g in self.groups:
|
||||
print '{} ({})'.format(g.name, g.init)
|
||||
print ''
|
||||
|
||||
self.get_current_group().begin_turn()
|
||||
|
||||
|
||||
# Returns a formatted string with all of the combatants
|
||||
|
|
Loading…
Reference in New Issue
Block a user