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 ########################################################
23 def __init__(self
,name
):
31 def setName(self
,name
):
36 for f
in self
.__fighters
:
42 def getNextEvent(self
, enemy
, ctime
, cont
):
43 """Check moves for enemy."""
45 ffWithHighestDex
= None
46 efWithHighestDex
= None
48 if not self
.isAlive():
51 # find the enemy that's ready that has the highest dex
52 for f
in enemy
.getFighters():
53 if f
.getStat("tom").getCurrent() <= ctime
and f
.isAlive():
54 if efWithHighestDex
== None:
56 elif efWithHighestDex
.getStat("dex").getCurrent() < f
.getStat("dex").getCurrent():
59 #find the friendly fighter that's ready that has the highest dex
60 for f
in self
.__fighters
:
61 if f
.getStat("tom").getCurrent() <= ctime
and f
.isAlive():
62 if ffWithHighestDex
== None:
64 elif ffWithHighestDex
.getStat("dex").getCurrent() < f
.getStat("dex").getCurrent():
67 # does the friendly or the enemy have the highest dex
68 # if friendly, make event
69 if ffWithHighestDex
== None:
71 elif efWithHighestDex
== None:
72 return ffWithHighestDex
.makeEvent(enemy
,ctime
,cont
)
73 elif ffWithHighestDex
.getStat("dex").getCurrent() < efWithHighestDex
.getStat("dex").getCurrent():
74 return ffWithHighestDex
.makeEvent(enemy
,ctime
,cont
)
76 #otherwise, return none
79 def addFighter(self
,fighter
):
80 if self
.sizeOfParty() != 6:
81 self
.__fighters
.append(fighter
)
85 def getFighter(self
, n
):
87 return self
.__fighters
[n
]
89 def getFighters(self
):
90 return self
.__fighters
92 def sizeOfParty(self
):
93 """Compute party's size."""
94 return len(self
.__fighters
)
96 def giveExp(self
, exp
):
97 """Divy up battle experience among living fighters in party."""
98 fighters
= self
.getFighters()