(no commit message)
[asgard.git] / consoleview.py
blob8c8e28a329f8011864e48a69919a9194faa627a1
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 ########################################################
19 class ConsoleView:
20 """Viewer object for Asgard"""
22 def __init__(self):
23 pass
25 def printParty(self, p):
26 """Show party stats."""
28 print "\033[1;35m[PARTY]\033[1;0m NAME:"+p.getName()
30 for f in p.getFighters():
31 self.printFighter(f)
33 def printFighter(self, f):
34 """Show fighter stats."""
36 job = f.getJob()
38 print "\033[1;35m[FGHTR]\033[1;0m NAME:"+f.getName()+"\tJOB:"+job.getName()+"\tHP:"+str(f.getHp())+"\tPOWR:"+str(f.getAttack())+"\tDFNS:"+str(f.getDefense())+"\tEVAD:"+str(f.getEvade())
40 #Uncomment this when getEquiption is implemented
41 #printEquiption(f.getEquiption())
43 def printEvent(self, e):
44 """Show Event data."""
46 print "\033[1;33m[EVENT]\033[1;0m ATKR:" + e.getAttacker().getName() + "\tDfdr:" + e.getDefender().getName() + "\tTYPE:" + e.getType()
48 def printEquiption(self, eq):
49 """Show equiption for fighter."""
51 print "\033[1;36m[EQUIP]\033[1;0m HEAD:" + eq.getHead() + "\tARMR:" + eq.getArmor() + "\tLEFT:" + eq.getLeft() + "\tRGHT:" + eq.getRight()
53 def printEventTypeMenu(self, f):
54 """Show battle menu options for fighter."""
56 i = 1
57 menu = ""
58 for e in f.getEventTypes():
59 menu += "("+str(i)+")"+" "+e
60 i += 1
61 print menu
63 def printEnemySelectMenu(self, p):
64 """Show enemy selection options for fighter"""
66 i = 1
67 menu = ""
68 for f in p.getFighters():
69 # Dead fighters tell no tales...
70 if not f.isAlive():
71 i += 1
72 continue
74 # Create enemy selection menu
75 menu += "("+str(i)+")"+" "+f.getName()+" "+"HP: "+str(f.getHp())+"\t"
77 i += 1
79 print menu
81 def printState(self):
82 """Show state."""
84 if self.__controller.getDebug():
85 # Retrieve parties 1 and 2
86 party1 = self.__battle.getParty1()
87 party2 = self.__battle.getParty2()
89 # Print Party1
90 self.printParty(party1)
92 # Print Party2
93 self.printParty(party2)
95 print "============================================================="
97 def setBattle(self,b):
98 self.__battle = b
100 def setController(self,c):
101 self.__controller = c