battleman.py: Implemented adding a combatant to the wait list
This commit is contained in:
52
battleman.py
52
battleman.py
@ -42,6 +42,7 @@ def main():
|
||||
print "Welcome to 4e Battle Manager.\n"
|
||||
|
||||
# Resume battle if needed
|
||||
# fixme: critical: indexes get reused when restoring! Maybe switch to shelve?
|
||||
if settings.resume:
|
||||
try:
|
||||
with open(BP_FILE, 'r') as f:
|
||||
@ -53,13 +54,32 @@ def main():
|
||||
|
||||
else:
|
||||
# hard-coding test cases for now.
|
||||
# Eventually, use a state-saving text file that's easy to edit, or at least copy...
|
||||
btl.add_group(CombatGroup("Adele", [Combatant("Adele", hp=26, pc=True, surges=8, sw=1)], 2))
|
||||
btl.add_group(CombatGroup("Aristaire", [Combatant("Aristaire", hp=20, pc=True, surges=6, sw=1)], 0))
|
||||
# fixme: Eventually, use a state-saving text file that's easy to edit, or at least copy...
|
||||
adele = Combatant("Adele", hp=26, pc=True, surges=8, sw=1)
|
||||
adele_dict = {adele.index: adele}
|
||||
aristaire = Combatant("Aristaire", hp=20, pc=True, surges=6, sw=1)
|
||||
aristaire_dict = {aristaire.index: aristaire}
|
||||
|
||||
btl.add_group(CombatGroup("Foobolds", [Combatant("Foobold", hp=50), Combatant("Foobold", hp=50), Combatant("Foobold", hp=50), Combatant("Foobold", hp=50), Combatant("Foobold", hp=50)], 20))
|
||||
btl.add_group(CombatGroup("Barglins", [Combatant("Barglin", hp=1), Combatant("Barglin", hp=1)], 3))
|
||||
btl.add_group(CombatGroup("Orcs of Baz", [Combatant("Orc", hp=32), Combatant("Orc", hp=32)], 1))
|
||||
foobolds = {}
|
||||
for i in range(5):
|
||||
c = Combatant("Foobold", hp=50)
|
||||
foobolds[c.index] = c
|
||||
|
||||
barglins = {}
|
||||
for i in range(2):
|
||||
c = Combatant("Barglin", hp=50)
|
||||
barglins[c.index] = c
|
||||
|
||||
orcs = {}
|
||||
for i in range(2):
|
||||
c = Combatant("Orc", hp=50)
|
||||
orcs[c.index] = c
|
||||
|
||||
btl.add_group(CombatGroup("Adele", adele_dict, 2))
|
||||
btl.add_group(CombatGroup("Aristaire", aristaire_dict, 0))
|
||||
btl.add_group(CombatGroup("Foobolds", foobolds, 20))
|
||||
btl.add_group(CombatGroup("Barglins", barglins, 3))
|
||||
btl.add_group(CombatGroup("Orcs of Baz", orcs, 1))
|
||||
|
||||
print btl
|
||||
|
||||
@ -352,16 +372,28 @@ class CommandParser(cmd.Cmd):
|
||||
|
||||
def do_wait(self, line):
|
||||
"""wait
|
||||
This function is still a stub"""
|
||||
Removes the specified combatant from the initiative roster and add them to the wait list."""
|
||||
|
||||
do_stub()
|
||||
data = parse_data(line)
|
||||
|
||||
c = battle.do_combatant_select(self.btl, data)
|
||||
if not c:
|
||||
return
|
||||
|
||||
self.btl.wait(c.index)
|
||||
|
||||
|
||||
def do_unwait(self, line):
|
||||
"""unwait
|
||||
This function is still a stub"""
|
||||
Removes the specified combatant from the wait list and adds them back into the initiative roster."""
|
||||
|
||||
do_stub()
|
||||
data = parse_data(line)
|
||||
|
||||
c = battle.do_combatant_select(self.btl, data)
|
||||
if not c:
|
||||
return
|
||||
|
||||
self.btl.unwait(c.index)
|
||||
|
||||
|
||||
def do_next(self, line):
|
||||
|
Reference in New Issue
Block a user