3 def computeBaseError(base
, err
):
5 beg
= min(base
- n
,base
+ n
)
6 end
= max(base
- n
,base
+ n
)
7 return random
.randint(beg
,end
)
9 def computeHM(cdex
, cagl
):
10 """Hit/Miss? If Hit, how many?"""
12 hitPC
= (cdex
- cagl
) + 50
13 # Check that Hit % is in [0,100]
14 if hitPC
< 0: hitPC
= 0
15 if hitPC
> 100: hitPC
= 100
17 x
= random
.randint(1,100)
19 if x
> hitPC
: return 0
22 if (cdex
>= 1) and (cdex
<= 100):
24 elif (cdex
>= 101) and (cdex
<= 200):
25 x
= random
.randint(1,200)
26 if (x
>= 1) and (x
<= 100):
28 elif x
>= 101: return 2
29 elif (cdex
>= 201) and (cdex
<= 254):
30 x
= random
.randint(1,254)
31 if (x
>= 1) and (x
<= 100):
33 elif (x
>= 101) and (x
<= 200):
35 elif x
>= 201: return 3
37 x
= random
.randint(1,2)
41 def eventOccurs(percent
):
42 a
= random
.randint(1,100)
46 def jobStatQuery(jTree
,sname
):
51 jStatQuery
= jTree
.xpathEval("/stat[@name='" + sname
+ "']")
54 jStatElem
= jStatQuery
[0]
56 if jStatElem
.prop("plus") != None:
57 plus
= int(jStatElem
.prop("plus"))
59 if jStatElem
.prop("growthRate") != None:
60 growthRate
= float(jStatElem
.prop("growthRate"))
62 if jStatElem
.prop("chance") != None:
63 growthRate
= float(jStatElem
.prop("chance"))
65 return (plus
,chance
,growthRate
)