Mercurial > traipse_dev
comparison orpg/dieroller/rollers/runequest.py @ 227:81d0bfd5e800 alpha
Traipse Alpha 'OpenRPG' {100612-00}
Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for
developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to
the code. 'Ornery-Orc's main goal is to offer more advanced features and enhance the productivity of the user.
Update Summary (Preparing to close updates)
New Features:
New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order
Fixes:
Fix to InterParse that was causing an Infernal Loop with Namespace Internal
Fix to XML data, removed old Minidom and switched to Element Tree
Fix to Server that was causing eternal attempt to find a Server ID, in Register Rooms thread
Fix to metaservers.xml file not being created
author | sirebral |
---|---|
date | Sat, 12 Jun 2010 03:50:37 -0500 |
parents | 5c9a118476b2 |
children |
comparison
equal
deleted
inserted
replaced
182:4b2884f29a72 | 227:81d0bfd5e800 |
---|---|
50 # o Fixed Riposte spelling | 50 # o Fixed Riposte spelling |
51 # o Deleted sorcalc - never used | 51 # o Deleted sorcalc - never used |
52 # o Added Sorcery Fumble table to sorcery spell roller | 52 # o Added Sorcery Fumble table to sorcery spell roller |
53 # | 53 # |
54 | 54 |
55 __version__ = "$Id: runequest.py,v 1.4 2006/11/15 12:11:22 digitalxero Exp $" | 55 __version__ = "$Id: runequest.py,v Traipse 'Ornery-Orc' prof.ebral Exp $" |
56 | 56 |
57 from time import time, clock | 57 from time import time, clock |
58 import random | 58 import random |
59 from math import floor | 59 from math import floor |
60 | 60 |
66 class runequest(std): | 66 class runequest(std): |
67 name = "runequest" | 67 name = "runequest" |
68 def __init__(self,source=[]): | 68 def __init__(self,source=[]): |
69 std.__init__(self,source) | 69 std.__init__(self,source) |
70 | 70 |
71 # these methods return new die objects for specific options | |
72 | |
73 def skill(self,sk,mod,ma): | 71 def skill(self,sk,mod,ma): |
74 return rqskill(self,sk,mod,ma) | 72 return rqskill(self,sk,mod,ma) |
75 | 73 |
76 def parry(self,sk,mod,ma,AP): | 74 def parry(self,sk,mod,ma,AP): |
77 return rqparry(self,sk,mod,ma,AP) | 75 return rqparry(self,sk,mod,ma,AP) |
110 self.s = initial | 108 self.s = initial |
111 self.f = final | 109 self.f = final |
112 | 110 |
113 def __str__(self): | 111 def __str__(self): |
114 myStr = "Unrestricted Training" | 112 myStr = "Unrestricted Training" |
115 | |
116 if self.s == 0: | 113 if self.s == 0: |
117 myStr = "Initial training completed for Cost(50) Time(20) Skill(1 + modifier)" | 114 myStr = "Initial training completed for Cost(50) Time(20) Skill(1 + modifier)" |
118 else: | 115 else: |
119 cost = 0 | 116 cost = 0 |
120 time = 0 | 117 time = 0 |
121 myStr = "Training: " | 118 myStr = "Training: " |
122 | |
123 while self.s < self.f and self.s < 75: | 119 while self.s < self.f and self.s < 75: |
124 cost += self.s * 5 | 120 cost += self.s * 5 |
125 time += self.s * 1 | 121 time += self.s * 1 |
126 self.s += random.uniform(1,4) + 1 | 122 self.s += random.uniform(1,4) + 1 |
127 | |
128 myStr = "Training completed:\n" | 123 myStr = "Training completed:\n" |
129 myStr += "\tCost(" + str(int(cost)) + ")\n" | 124 myStr += "\tCost(" + str(int(cost)) + ")\n" |
130 myStr += "\tTime(" + str(int(time)) + ")\n" | 125 myStr += "\tTime(" + str(int(time)) + ")\n" |
131 myStr += "\tSkill(" + str(int(self.s)) + ")" | 126 myStr += "\tSkill(" + str(int(self.s)) + ")" |
132 | |
133 return myStr | 127 return myStr |
134 | 128 |
135 | 129 |
136 # RQ Skill Training Cost Limited | 130 # RQ Skill Training Cost Limited |
137 # | 131 # |
148 self.cost = cost | 142 self.cost = cost |
149 self.sk = sk | 143 self.sk = sk |
150 | 144 |
151 def __str__(self): | 145 def __str__(self): |
152 myStr = "" | 146 myStr = "" |
153 | |
154 if self.sk == 0 and self.cost >= 50: | 147 if self.sk == 0 and self.cost >= 50: |
155 myStr = "Initial training completed for Cost(50), Time(50), Skill(1 + modifier)" | 148 myStr = "Initial training completed for Cost(50), Time(50), Skill(1 + modifier)" |
156 else: | 149 else: |
157 cost = 0 | 150 cost = 0 |
158 time = 0 | 151 time = 0 |
159 icost = self.sk * 5 | 152 icost = self.sk * 5 |
160 | |
161 myStr = "Training: " | 153 myStr = "Training: " |
162 | |
163 while (cost + icost) < self.cost: | 154 while (cost + icost) < self.cost: |
164 if self.sk >= 75: | 155 if self.sk >= 75: |
165 break | 156 break |
166 | |
167 cost += icost | 157 cost += icost |
168 time += self.sk * 1 | 158 time += self.sk * 1 |
169 self.sk += random.uniform(1,4) + 1 | 159 self.sk += random.uniform(1,4) + 1 |
170 icost = self.sk * 5 | 160 icost = self.sk * 5 |
171 | |
172 myStr = "Training completed: " | 161 myStr = "Training completed: " |
173 myStr += "Cost(" + str(int(cost)) + ") " | 162 myStr += "Cost(" + str(int(cost)) + ") " |
174 myStr += "Time(" + str(int(time)) + ") " | 163 myStr += "Time(" + str(int(time)) + ") " |
175 myStr += "Skill(" + str(int(self.sk)) + ")" | 164 myStr += "Skill(" + str(int(self.sk)) + ")" |
176 | |
177 return myStr | 165 return myStr |
178 | 166 |
179 | 167 |
180 # RQ Skill Training Time Limited | 168 # RQ Skill Training Time Limited |
181 # | 169 # |
192 self.time = time | 180 self.time = time |
193 self.sk = sk | 181 self.sk = sk |
194 | 182 |
195 def __str__(self): | 183 def __str__(self): |
196 myStr = "" | 184 myStr = "" |
197 | |
198 if self.sk == 0 and self.time >= 20: | 185 if self.sk == 0 and self.time >= 20: |
199 myStr = "Initial training completed for Cost(50), Time(50), Skill(1 + modifier)" | 186 myStr = "Initial training completed for Cost(50), Time(50), Skill(1 + modifier)" |
200 else: | 187 else: |
201 cost = 0 | 188 cost = 0 |
202 time = 0 | 189 time = 0 |
203 itime = self.sk * 1 | 190 itime = self.sk * 1 |
204 | |
205 myStr = "Trainingsss: " | 191 myStr = "Trainingsss: " |
206 | |
207 while (time + itime) < self.time: | 192 while (time + itime) < self.time: |
208 if self.sk >= 75: | 193 if self.sk >= 75: |
209 break | 194 break |
210 | |
211 cost += self.sk * 5 | 195 cost += self.sk * 5 |
212 time += itime | 196 time += itime |
213 self.sk += random.uniform(1,4) + 1 | 197 self.sk += random.uniform(1,4) + 1 |
214 itime = self.sk * 5 | 198 itime = self.sk * 5 |
215 | |
216 myStr = "Training completed: " | 199 myStr = "Training completed: " |
217 myStr += "Cost(" + str(int(cost)) + ") " | 200 myStr += "Cost(" + str(int(cost)) + ") " |
218 myStr += "Time(" + str(int(time)) + ") " | 201 myStr += "Time(" + str(int(time)) + ") " |
219 myStr += "Skill(" + str(int(self.sk)) + ")" | 202 myStr += "Skill(" + str(int(self.sk)) + ")" |
220 | |
221 return myStr | 203 return myStr |
222 | 204 |
223 # RQ Skill Roll | 205 # RQ Skill Roll |
224 # | 206 # |
225 # [1d100.skill(50,0,0)] | 207 # [1d100.skill(50,0,0)] |
279 swapmod= -self.mod | 261 swapmod= -self.mod |
280 modSum = self.sum() | 262 modSum = self.sum() |
281 # build output string | 263 # build output string |
282 myStr = " (" + str(modSum) + ")" | 264 myStr = " (" + str(modSum) + ")" |
283 myStr += " vs [" + str(self.sk) + strAdd + str(swapmod) + "]" | 265 myStr += " vs [" + str(self.sk) + strAdd + str(swapmod) + "]" |
284 | |
285 if self.is_fumble(): | 266 if self.is_fumble(): |
286 myStr += " <b><font color=red>Fumble!</font></b>" | 267 myStr += " <b><font color=red>Fumble!</font></b>" |
287 elif self.is_critical(): | 268 elif self.is_critical(): |
288 myStr += " <b><font color=green>Critical!</font></b>" | 269 myStr += " <b><font color=green>Critical!</font></b>" |
289 elif self.is_special(): | 270 elif self.is_special(): |
292 myStr += " <i><font color=green>Special!</font></i>" | 273 myStr += " <i><font color=green>Special!</font></i>" |
293 elif self.is_success(): | 274 elif self.is_success(): |
294 myStr += " <font color=blue>Success!</font>" | 275 myStr += " <font color=blue>Success!</font>" |
295 else: | 276 else: |
296 myStr += " <font color=red>Failure!</font>" | 277 myStr += " <font color=red>Failure!</font>" |
297 | |
298 Diff = self.sk - modSum | 278 Diff = self.sk - modSum |
299 myStr += " </font>" | 279 myStr += " </font>" |
300 | |
301 return myStr | 280 return myStr |
302 | 281 |
303 # | 282 # |
304 # RQ Parry Roll | 283 # RQ Parry Roll |
305 # | 284 # |
339 fum = (100 - self.sk ) | 318 fum = (100 - self.sk ) |
340 final_fum = ( 100 - int( floor( fum/20 ) ) ) | 319 final_fum = ( 100 - int( floor( fum/20 ) ) ) |
341 return ( self.sum() >= final_fum ) | 320 return ( self.sum() >= final_fum ) |
342 | 321 |
343 def __str__(self): | 322 def __str__(self): |
344 | |
345 # get fumble roll result in case needed | 323 # get fumble roll result in case needed |
346 fum_roll = random.randint(1,100) | 324 fum_roll = random.randint(1,100) |
347 | 325 |
348 # get special AP | 326 # get special AP |
349 spec_AP = int( floor ( self.AP * 1.5 ) ) | 327 spec_AP = int( floor ( self.AP * 1.5 ) ) |
357 modSum = self.sum() | 335 modSum = self.sum() |
358 | 336 |
359 # build output string | 337 # build output string |
360 myStr = " (" + str(modSum) + ")" | 338 myStr = " (" + str(modSum) + ")" |
361 myStr += " vs [" + str(self.sk) + strAdd + str(swapmod) + "]" | 339 myStr += " vs [" + str(self.sk) + strAdd + str(swapmod) + "]" |
362 | |
363 if self.is_fumble(): | 340 if self.is_fumble(): |
364 myStr += " <b><font color=red>Fumble!</font> See Fumble Chart [" + str(fum_roll) + "]</b>" | 341 myStr += " <b><font color=red>Fumble!</font> See Fumble Chart [" + str(fum_roll) + "]</b>" |
365 elif self.is_critical() and self.is_riposte(): | 342 elif self.is_critical() and self.is_riposte(): |
366 myStr += " <b><font color=green>Critical!</font> All damage blocked!</b>" | 343 myStr += " <b><font color=green>Critical!</font> All damage blocked!</b>" |
367 myStr += " Riposte next SR" | 344 myStr += " Riposte next SR" |
376 myStr += " <i><font color=green>Special!</font> Weapon/Shield AP [" + str(spec_AP) + "]</i>" | 353 myStr += " <i><font color=green>Special!</font> Weapon/Shield AP [" + str(spec_AP) + "]</i>" |
377 elif self.is_success(): | 354 elif self.is_success(): |
378 myStr += " <font color=blue>Success!</font> Weapon/Shield AP [" + str(self.AP) + "]" | 355 myStr += " <font color=blue>Success!</font> Weapon/Shield AP [" + str(self.AP) + "]" |
379 else: | 356 else: |
380 myStr += " <font color=red>Failure!</font>" | 357 myStr += " <font color=red>Failure!</font>" |
381 | |
382 Diff = self.sk - modSum | 358 Diff = self.sk - modSum |
383 myStr += " </font>" | 359 myStr += " </font>" |
384 | |
385 return myStr | 360 return myStr |
386 | 361 |
387 # RQ Dodge Roll | 362 # RQ Dodge Roll |
388 # | 363 # |
389 # same as skill but with fumble dice and armor points | 364 # same as skill but with fumble dice and armor points |
422 fum = (100 - self.sk ) | 397 fum = (100 - self.sk ) |
423 final_fum = ( 100 - int( floor( fum/20 ) ) ) | 398 final_fum = ( 100 - int( floor( fum/20 ) ) ) |
424 return ( self.sum() >= final_fum ) | 399 return ( self.sum() >= final_fum ) |
425 | 400 |
426 def __str__(self): | 401 def __str__(self): |
427 | |
428 # get fumble roll result in case needed | 402 # get fumble roll result in case needed |
429 fum_roll = random.randint(1,100) | 403 fum_roll = random.randint(1,100) |
430 | 404 |
431 # get special AP | 405 # get special AP |
432 spec_AP = int( floor ( self.AP * 1.5 ) ) | 406 spec_AP = int( floor ( self.AP * 1.5 ) ) |
440 modSum = self.sum() | 414 modSum = self.sum() |
441 | 415 |
442 # build output string | 416 # build output string |
443 myStr = " (" + str(modSum) + ")" | 417 myStr = " (" + str(modSum) + ")" |
444 myStr += " vs [" + str(self.sk) + strAdd + str(swapmod) + "]" | 418 myStr += " vs [" + str(self.sk) + strAdd + str(swapmod) + "]" |
445 | |
446 if self.is_fumble(): | 419 if self.is_fumble(): |
447 myStr += " <b><font color=red>Fumble!</font> See Fumble Chart [" + str(fum_roll) + "]</b>" | 420 myStr += " <b><font color=red>Fumble!</font> See Fumble Chart [" + str(fum_roll) + "]</b>" |
448 elif self.is_critical() and self.is_riposte(): | 421 elif self.is_critical() and self.is_riposte(): |
449 myStr += " <b><font color=green>Critical!</font> All damage dodged!</b>" | 422 myStr += " <b><font color=green>Critical!</font> All damage dodged!</b>" |
450 myStr += " Riposte on next SR" | 423 myStr += " Riposte on next SR" |
459 myStr += " <i><font color=green>Special!</font> Damage dodged</b>" | 432 myStr += " <i><font color=green>Special!</font> Damage dodged</b>" |
460 elif self.is_success(): | 433 elif self.is_success(): |
461 myStr += " <font color=blue>Success!</font> Damage dodged</b>" | 434 myStr += " <font color=blue>Success!</font> Damage dodged</b>" |
462 else: | 435 else: |
463 myStr += " <font color=red>Failure!</font>" | 436 myStr += " <font color=red>Failure!</font>" |
464 | |
465 Diff = self.sk - modSum | 437 Diff = self.sk - modSum |
466 myStr += " </font>" | 438 myStr += " </font>" |
467 | 439 return myStr |
468 return myStr | |
469 | |
470 | 440 |
471 | 441 |
472 # | 442 # |
473 # RQ Attack Roll | 443 # RQ Attack Roll |
474 # | 444 # |
533 myStr += "<B>Left Arm</B>" | 503 myStr += "<B>Left Arm</B>" |
534 else: | 504 else: |
535 myStr += "<B>Head</B>" | 505 myStr += "<B>Head</B>" |
536 hit_loc = myStr | 506 hit_loc = myStr |
537 | 507 |
538 | |
539 # get normal damage in case needed | 508 # get normal damage in case needed |
540 norm_damage = random.randint(self.mindam*(self.trueswd+1),self.maxdam*(self.trueswd+1)) + self.bondam | 509 norm_damage = random.randint(self.mindam*(self.trueswd+1),self.maxdam*(self.trueswd+1)) + self.bondam |
541 norm_damage_string = "{" + str( self.mindam*(self.trueswd+1) ) + "-" | 510 norm_damage_string = "{" + str( self.mindam*(self.trueswd+1) ) + "-" |
542 norm_damage_string += str(self.maxdam*(self.trueswd+1)) + "+" + str(self.bondam) | 511 norm_damage_string += str(self.maxdam*(self.trueswd+1)) + "+" + str(self.bondam) |
543 norm_damage_string += "}[" + str(norm_damage) + "] " | 512 norm_damage_string += "}[" + str(norm_damage) + "] " |
561 modSum = self.sum() | 530 modSum = self.sum() |
562 | 531 |
563 # build output string | 532 # build output string |
564 myStr = " (" + str(modSum) + ")" | 533 myStr = " (" + str(modSum) + ")" |
565 myStr += " vs [" + str(self.sk) + strAdd + str(swapmod) + "]" | 534 myStr += " vs [" + str(self.sk) + strAdd + str(swapmod) + "]" |
566 | |
567 if self.is_fumble(): | 535 if self.is_fumble(): |
568 myStr += " <b><font color=red>Fumble!</font> See Fumble Chart [" + str(fum_roll) + "]</b>" | 536 myStr += " <b><font color=red>Fumble!</font> See Fumble Chart [" + str(fum_roll) + "]</b>" |
569 elif (self.is_supercritical() and self.is_success()): | 537 elif (self.is_supercritical() and self.is_success()): |
570 myStr += " <b><font color=green>Super Critical!</font></b> Damage: " + str(super_damage_string) + "<u>No Armor Stops</u>" + str(hit_loc) | 538 myStr += " <b><font color=green>Super Critical!</font></b> Damage: " + str(super_damage_string) + "<u>No Armor Stops</u>" + str(hit_loc) |
571 elif (self.is_critical() and self.is_success()): | 539 elif (self.is_critical() and self.is_success()): |
576 myStr += " <i><font color=green>Special!</font></i> Damage: " + str(crit_damage_string) + str(hit_loc) | 544 myStr += " <i><font color=green>Special!</font></i> Damage: " + str(crit_damage_string) + str(hit_loc) |
577 elif self.is_success(): | 545 elif self.is_success(): |
578 myStr += " <font color=blue>Success!</font> Damage: " + str(norm_damage_string) + str(hit_loc) | 546 myStr += " <font color=blue>Success!</font> Damage: " + str(norm_damage_string) + str(hit_loc) |
579 else: | 547 else: |
580 myStr += " <font color=red>Failure!</font>" | 548 myStr += " <font color=red>Failure!</font>" |
581 | |
582 return myStr | 549 return myStr |
583 | 550 |
584 # | 551 # |
585 # | 552 # |
586 # Sorcery Roll: [1d100.sorcery(90, 10, 5, 4, 3, 2, 1)] | 553 # Sorcery Roll: [1d100.sorcery(90, 10, 5, 4, 3, 2, 1)] |
689 myStr += "Extra POW:[" + str( extra_pow ) + "], " | 656 myStr += "Extra POW:[" + str( extra_pow ) + "], " |
690 myStr += "Ceremony:[+" + str( ceremony_roll ) + "%], " | 657 myStr += "Ceremony:[+" + str( ceremony_roll ) + "%], " |
691 myStr += "Intensity(-3):[" + str( self.int ) + "], " | 658 myStr += "Intensity(-3):[" + str( self.int ) + "], " |
692 myStr += "Accelerate(-5):[" + str( self.acc ) + "], " | 659 myStr += "Accelerate(-5):[" + str( self.acc ) + "], " |
693 myStr += "Multispell(-10):[" + str( self.mlt ) + "] ---" | 660 myStr += "Multispell(-10):[" + str( self.mlt ) + "] ---" |
694 | 661 return myStr |
695 return myStr | 662 |
696 |