1 ########################################################
2 # Copyright (c) 2006 Russ Adams, Sean Eubanks, Asgard Contributors
3 # This file is part of Asgard.
4 # Asgard is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # Asgard is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with Asgard; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 ########################################################
21 class ConsoleController
:
22 def __init__(self
,battle
,view
,debug
):
23 self
.__battle
= battle
27 battle
.setController(self
)
29 view
.setController(self
)
30 view
.setBattle(battle
)
34 def getCommand(self
,p
,f
):
38 print "\033[1;34m[SELCT]\033[1;0m Turn:" + f
.getName() + "; HP:" + str(f
.getHp())
40 self
.__view
.printEnemySelectMenu(p
)
42 d
= p
.getFighter(int(n
)-1)
44 self
.__view
.printEventTypeMenu(f
)
46 t
= f
.getEventTypes()[int(n
)-1]
57 """Retrieves events from Parties and Executes all Events in queue per iteration"""
59 print "Battle Starts."
60 self
.__view
.printState()
62 # initialize the event checker boolean
65 while not self
.__battle
.isOver():
67 wereEvents
= self
.__battle
.nextTurn()
69 # only print out state if something actually happened
71 self
.__view
.printState()
73 if self
.__battle
.getParty1().isAlive():
74 print "Victory Fanfare. Heros win."
76 print "Game Over. Orcs win."