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 ########################################################
20 """Viewer object for Asgard"""
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():
33 def printFighter(self
, f
):
34 """Show fighter stats."""
37 prefix
= "\033[1;35m[FGHTR]\033[1;0m "
38 basic
= "NAME:"+f
.getName()+"\tJOB:"+f
.getJobType() + "\tLEVEL:"+str(f
.getStat("level").getMax())
39 health
= "\tHP:"+str(f
.getStat("hp").getCurrent())+"/"+str(f
.getStat("hp").getMax())+" MP:"+str(f
.getStat("mp").getCurrent())+"/"+str(f
.getStat("mp").getMax())
40 extended
= "\tPOWR:"+str(f
.getAttack())+"\tDFNS:"+str(f
.getDefense())+"\tEVAD:"+str(f
.getEvade())
42 print prefix
+ basic
+ health
+ extended
44 def printEvent(self
, e
):
45 """Show Event data."""
48 print "\033[1;33m[EVENT]\033[1;0m EXECUTOR:" + e
.getExecutor().getName() + "\tNAME:" + e
.getEventType().getName() + "\tTYPE:" + e
.getEventType().getTypeName()
50 for t
in e
.getTransactions():
51 self
.printTransaction(t
)
53 def printTransaction(self
, t
):
55 print "\033[1;37m[TRANS]\033[1;0m TARGET:" + t
.getTarget().getName() + "\t",
57 if t
.getStatus() != None:
58 print "STATUS:" + t
.getStatus()
59 elif t
.getStat() != "":
60 print "STAT:" + t
.getStat() + "\tCHANGE:" + str(t
.getChange())
62 def printEquiption(self
, eq
):
63 """Show equiption for fighter."""
65 print "\033[1;36m[EQUIP]\033[1;0m HEAD:" + eq
.getHead() + "\tARMR:" + eq
.getArmor() + "\tLEFT:" + eq
.getLeft() + "\tRGHT:" + eq
.getRight()
67 def printEventTypeMenu(self
, f
, etypes
):
68 """Show battle menu options for fighter."""
75 for e
in f
.getEventTypes(etypes
):
77 if etype
.getName() == e
:
78 mp
= etype
.getMpCost()
79 menu
+= "("+str(i
)+")"+" "+e
+"["+str(mp
)+"]\t"
83 def printTargetSelectMenu(self
, vparty
, hparty
):
84 """Show enemy selection options for fighter"""
87 menu
= vparty
.getName() + ": "
88 for f
in vparty
.getFighters():
89 # Dead fighters tell no tales...
94 # Create enemy selection menu
95 menu
+= "("+str(i
)+")"+" "+f
.getName()+" "+"HP: "+str(f
.getStat("hp").getCurrent())+"/"+str(f
.getStat("hp").getMax())+"\t"
99 menu
= menu
+ '\n' + hparty
.getName() + ": "
101 for f
in hparty
.getFighters():
102 # Dead fighters tell no tales...
107 # Create enemy selection menu
108 menu
+= "("+str(i
)+")"+" "+f
.getName()+" "+"HP: "+str(f
.getStat("hp").getCurrent())+"/"+str(f
.getStat("hp").getMax())+"\t"
115 def printState(self
):
118 if self
.__controller
.getDebug():
119 # Retrieve parties 1 and 2
120 party1
= self
.__battle
.getParty1()
121 party2
= self
.__battle
.getParty2()
122 print "============================================================="
125 self
.printParty(party1
)
128 self
.printParty(party2
)
130 print "============================================================="
132 def printStartupMenu(self
):
133 """ Prints out the menu seen at startup and in-between battles. """
134 print "============================================================="
135 print "[1]. New Game"
136 print "[2]. Load Game"
137 print "[3]. Save Game"
138 print "[4]. Random Battle"
140 print "============================================================="
142 def setBattle(self
,b
):
145 def setController(self
,c
):
146 self
.__controller
= c