Mercurial > traipse_dev
comparison orpg/dieroller/hero.py @ 71:449a8900f9ac ornery-dev
Code refining almost completed, for this round. Some included files are still in need of some clean up, but this is test worthy.
author | sirebral |
---|---|
date | Thu, 20 Aug 2009 03:00:39 -0500 |
parents | 4385a7d0efd1 |
children | bf799efe7a8a |
comparison
equal
deleted
inserted
replaced
70:52a5fa913008 | 71:449a8900f9ac |
---|---|
31 | 31 |
32 from die import * | 32 from die import * |
33 from time import time, clock | 33 from time import time, clock |
34 import random | 34 import random |
35 | 35 |
36 | |
37 __version__ = "$Id: hero.py,v 1.15 2006/11/04 21:24:19 digitalxero Exp $" | 36 __version__ = "$Id: hero.py,v 1.15 2006/11/04 21:24:19 digitalxero Exp $" |
38 | 37 |
39 # Hero stands for "Hero system" not 20 sided die :) | 38 # Hero stands for "Hero system" not 20 sided die :) |
40 | 39 |
41 class hero(std): | 40 class hero(std): |
41 | |
42 def __init__(self,source=[]): | 42 def __init__(self,source=[]): |
43 std.__init__(self,source) | 43 std.__init__(self,source) |
44 | 44 |
45 # these methods return new die objects for specific options | 45 # these methods return new die objects for specific options |
46 | 46 |
47 | |
47 def k(self,mod): | 48 def k(self,mod): |
48 return herok(self,mod) | 49 return herok(self,mod) |
49 | 50 |
51 | |
50 def hl(self): | 52 def hl(self): |
51 return herohl(self) | 53 return herohl(self) |
52 | 54 |
55 | |
53 def hk(self): | 56 def hk(self): |
54 return herohk(self) | 57 return herohk(self) |
55 | 58 |
59 | |
56 def n(self): | 60 def n(self): |
57 return heron(self) | 61 return heron(self) |
58 | 62 |
63 | |
59 def cv(self,cv,mod): | 64 def cv(self,cv,mod): |
60 return herocv(self,cv,mod) | 65 return herocv(self,cv,mod) |
61 | 66 |
67 | |
62 def sk(self,sk,mod): | 68 def sk(self,sk,mod): |
63 return herosk(self,sk,mod) | 69 return herosk(self,sk,mod) |
64 | 70 |
65 class herocv(std): | 71 class herocv(std): |
72 | |
66 def __init__(self,source=[],cv=10,mod=0): | 73 def __init__(self,source=[],cv=10,mod=0): |
67 std.__init__(self,source) | 74 std.__init__(self,source) |
68 self.cv = cv | 75 self.cv = cv |
69 self.mod = mod | 76 self.mod = mod |
70 | 77 |
71 | 78 |
79 | |
72 def __str__(self): | 80 def __str__(self): |
73 myStr = "[" + str(self.data[0]) | 81 myStr = "[" + str(self.data[0]) |
74 for a in self.data[1:]: | 82 for a in self.data[1:]: |
75 myStr += "," | 83 myStr += "," |
76 myStr += str(a) | 84 myStr += str(a) |
81 cvhit = 11 + self.cv - self.sum() + self.mod | 89 cvhit = 11 + self.cv - self.sum() + self.mod |
82 myStr += " hits up to <b>DCV <font color='#ff0000'>" + str(cvhit) + "</font></b>" | 90 myStr += " hits up to <b>DCV <font color='#ff0000'>" + str(cvhit) + "</font></b>" |
83 return myStr | 91 return myStr |
84 | 92 |
85 class herosk(std): | 93 class herosk(std): |
94 | |
86 def __init__(self,source=[],sk=11,mod=0): | 95 def __init__(self,source=[],sk=11,mod=0): |
87 std.__init__(self,source) | 96 std.__init__(self,source) |
88 self.sk = sk | 97 self.sk = sk |
89 self.mod = mod | 98 self.mod = mod |
90 | 99 |
100 | |
91 def is_success(self): | 101 def is_success(self): |
92 return (((self.sum()-self.mod) <= self.sk)) | 102 return (((self.sum()-self.mod) <= self.sk)) |
93 | 103 |
104 | |
94 def __str__(self): | 105 def __str__(self): |
95 myStr = "[" + str(self.data[0]) | 106 myStr = "[" + str(self.data[0]) |
96 for a in self.data[1:]: | 107 for a in self.data[1:]: |
97 myStr += "," | 108 myStr += "," |
98 myStr += str(a) | 109 myStr += str(a) |
115 myStr += " by " + str(Diff) +" </font>" | 126 myStr += " by " + str(Diff) +" </font>" |
116 | 127 |
117 return myStr | 128 return myStr |
118 | 129 |
119 class herok(std): | 130 class herok(std): |
120 def __init__(self,source=[],mod=0): | 131 |
121 std.__init__(self,source) | 132 def __init__(self,source=[],mod=0): |
122 self.mod = mod | 133 std.__init__(self,source) |
123 | 134 self.mod = mod |
135 | |
136 | |
124 def __str__(self): | 137 def __str__(self): |
125 myStr = "[" + str(self.data[0]) | 138 myStr = "[" + str(self.data[0]) |
126 for a in self.data[1:]: | 139 for a in self.data[1:]: |
127 myStr += "," | 140 myStr += "," |
128 myStr += str(a) | 141 myStr += str(a) |
136 stunsum = round(self.sum()) * stunx | 149 stunsum = round(self.sum()) * stunx |
137 myStr += ") for a total of (<font color='#ff0000'><b>" + str(int(stunsum)) + "</b></font>) <b>Stun</b>" | 150 myStr += ") for a total of (<font color='#ff0000'><b>" + str(int(stunsum)) + "</b></font>) <b>Stun</b>" |
138 return myStr | 151 return myStr |
139 | 152 |
140 class herohl(std): | 153 class herohl(std): |
141 def __init__(self,source=[],mod=0): | 154 |
142 std.__init__(self,source) | 155 def __init__(self,source=[],mod=0): |
143 self.mod = mod | 156 std.__init__(self,source) |
144 | 157 self.mod = mod |
158 | |
159 | |
145 def __str__(self): | 160 def __str__(self): |
146 myStr = "[" + str(self.data[0]) | 161 myStr = "[" + str(self.data[0]) |
147 side = random.randint(1,6) | 162 side = random.randint(1,6) |
148 sidestr = "Left " | 163 sidestr = "Left " |
149 if side >=4: | 164 if side >=4: |
180 elif location >= 17: | 195 elif location >= 17: |
181 myStr += "Location: <B>" + sidestr + "Foot</B>, StunX:<B>x1</B>, NStun:<B>x1/2</B>, Bodyx:<B>x1/2</B>" | 196 myStr += "Location: <B>" + sidestr + "Foot</B>, StunX:<B>x1</B>, NStun:<B>x1/2</B>, Bodyx:<B>x1/2</B>" |
182 return myStr | 197 return myStr |
183 | 198 |
184 class herohk(std): | 199 class herohk(std): |
185 def __init__(self,source=[],mod=0): | 200 |
186 std.__init__(self,source) | 201 def __init__(self,source=[],mod=0): |
187 self.mod = mod | 202 std.__init__(self,source) |
188 | 203 self.mod = mod |
204 | |
205 | |
189 def __str__(self): | 206 def __str__(self): |
190 myStr = "[" + str(self.data[0]) | 207 myStr = "[" + str(self.data[0]) |
191 for a in self.data[1:]: | 208 for a in self.data[1:]: |
192 myStr += "," | 209 myStr += "," |
193 myStr += str(a) | 210 myStr += str(a) |
198 stunsum = round(self.sum()) * stunx | 215 stunsum = round(self.sum()) * stunx |
199 myStr += " for a total of (<font color='#ff0000'><b>" + str(int(stunsum)) + "</b></font>) <b>Stun</b>" | 216 myStr += " for a total of (<font color='#ff0000'><b>" + str(int(stunsum)) + "</b></font>) <b>Stun</b>" |
200 return myStr | 217 return myStr |
201 | 218 |
202 class heron(std): | 219 class heron(std): |
220 | |
203 def __init__(self,source=[],mod=0): | 221 def __init__(self,source=[],mod=0): |
204 std.__init__(self,source) | 222 std.__init__(self,source) |
205 self.bodtot=0 | 223 self.bodtot=0 |
206 | 224 |
225 | |
207 def __str__(self): | 226 def __str__(self): |
208 myStr = "[" + str(self.data[0]) | 227 myStr = "[" + str(self.data[0]) |
209 if self.data[0] == 6: | 228 if self.data[0] == 6: |
210 self.bodtot=self.bodtot+2 | 229 self.bodtot=self.bodtot+2 |
211 else: | 230 else: |