1 ########################################################
2 #Copyright (c) 2006 Russ Adams, Sean Eubanks, Asgard Contributors
3 #This file is part of Asgard.
5 #Asgard is free software; you can redistribute it and/or modify
6 #it under the terms of the GNU General Public License as published by
7 #the Free Software Foundation; either version 2 of the License, or
8 #(at your option) any later version.
10 #Asgard is distributed in the hope that it will be useful,
11 #but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 #GNU General Public License for more details.
15 #You should have received a copy of the GNU General Public License
16 #along with Asgard; if not, write to the Free Software
17 #Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 ########################################################
21 class ConsoleController
:
22 def __init__(self
,debug
,battle
,view
):
24 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 # sum exp from enemy party
76 for f
in self
.__battle
.getParty2().getFighters():
80 self
.__battle
.getParty1().giveExp(exp
)
82 print "Victory Fanfare. Heros win "+str(exp
)+" exp!"
84 print "Game Over. Orcs win."