comparison orpg/dieroller/rollers/gurps.py @ 195:b633f4c64aae alpha

Traipse Alpha 'OpenRPG' {100219-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 (Patch-2) New Features: New Namespace method with two new syntaxes Fixes: Fix to Server GUI startup errors Fix to Server GUI Rooms tab updating Fix to Chat and Settings if non existant die roller is picked Fix to Dieroller and .open() used with .vs(). Successes are correctly calculated Fix to Alias Lib's Export to Tree, Open, Save features Fix to alias node, now works properly Fix to Splitter node, minor GUI cleanup
author sirebral
date Sat, 24 Apr 2010 08:37:20 -0500
parents 5c9a118476b2
children
comparison
equal deleted inserted replaced
182:4b2884f29a72 195:b633f4c64aae
49 # Corrects numerous descriptions 49 # Corrects numerous descriptions
50 # v.1 original gurps release by Naryt 2005/10/17 16:34:00 50 # v.1 original gurps release by Naryt 2005/10/17 16:34:00
51 51
52 from time import time, clock 52 from time import time, clock
53 import random 53 import random
54
55 from std import std 54 from std import std
56 from orpg.dieroller.base import * 55 from orpg.dieroller.base import *
57 56
58
59 __version__ = "$Id: gurps.py,v 1.5 2007/05/06 16:42:55 digitalxero Exp $" 57 __version__ = "$Id: gurps.py,v 1.5 2007/05/06 16:42:55 digitalxero Exp $"
60 58
61 # gurps 59 # gurps
62 60
63 class gurps(std): 61 class gurps(std):
64 name = "gurps" 62 name = "gurps"
65 63
66 def __init__(self,source=[]): 64 def __init__(self,source=[]):
67 std.__init__(self,source) 65 std.__init__(self,source)
68 66
69 # these methods return new die objects for specific options
70
71 # Original msk roll renamed to be easier to understand/remember
72 def skill(self,skill,mod): 67 def skill(self,skill,mod):
73 return gurpsskill(self,skill,mod) 68 return gurpsskill(self,skill,mod)
74 69
75 def defaultskill(self,stat,defaultlevel,mod): 70 def defaultskill(self,stat,defaultlevel,mod):
76 return gurpsdefaultskill(self,stat,defaultlevel,mod) 71 return gurpsdefaultskill(self,stat,defaultlevel,mod)
131 else: 126 else:
132 myStr += " or less <font color='#ff0000'><b>Success!</b> by " + str(Diff) +" </font>" 127 myStr += " or less <font color='#ff0000'><b>Success!</b> by " + str(Diff) +" </font>"
133 else: 128 else:
134 if self.sum() == 18: 129 if self.sum() == 18:
135 myStr += " or less <font color='#ff0000'><b>Critical Failure!</b></font> [B556]" 130 myStr += " or less <font color='#ff0000'><b>Critical Failure!</b></font> [B556]"
136 # elif self.sum() == 17 and (self.skill+self.mod < 16):
137 # myStr += " or less <font color='#ff0000'><b>Critical Failure!</b></font> [B556]"
138 elif self.sum() == 17: 131 elif self.sum() == 17:
139 if (self.skill+self.mod) < 16: 132 if (self.skill+self.mod) < 16:
140 myStr += " or less <font color='#ff0000'><b>Critical Failure!</b></font> [B556]" 133 myStr += " or less <font color='#ff0000'><b>Critical Failure!</b></font> [B556]"
141 else: 134 else:
142 myStr += " or less <font color='#ff0000'><b>Failure!</b></font> [B556]" 135 myStr += " or less <font color='#ff0000'><b>Failure!</b></font> [B556]"
277 class gurpscrit_hit(std): 270 class gurpscrit_hit(std):
278 def __init__(self,source=[],mod=0): 271 def __init__(self,source=[],mod=0):
279 std.__init__(self,source) 272 std.__init__(self,source)
280 273
281 def __str__(self): 274 def __str__(self):
282 myStr = "[" + str(self.data[0]) #Variable myStr holds text and first we put a [ into it and then adds the first die rolled 275 myStr = "[" + str(self.data[0])
283 for a in self.data[1:]: #This is a for loop. It will do the next two lines of code for every die (except the first die which we handled in the line above) in the roll. 276 for a in self.data[1:]:
284 myStr += "," #Adds a comma after each die 277 myStr += ","
285 myStr += str(a) #Adds the value of each die. 278 myStr += str(a)
286 myStr += "] = " #Adds ] = to the end of the string (note the += means append to whatever is already stored in the variable 279 myStr += "] = "
287 myStr += str(self.sum()) #Finally we add the actual result of the roll and myStr contains something like [3,2,1] = 6 280 myStr += str(self.sum())
288
289 if self.sum() > 8 and self.sum() < 12: 281 if self.sum() > 8 and self.sum() < 12:
290 myStr += " <font color='#ff0000'>The blow inflicts normal damage.</font> [B556]" 282 myStr += " <font color='#ff0000'>The blow inflicts normal damage.</font> [B556]"
291 elif self.sum() == 12: 283 elif self.sum() == 12:
292 myStr += " <font color='#ff0000'>The blow inflicts normal damage, AND victim drops anything they hold--even if no damage penetrates DR.</font> [B556]" 284 myStr += " <font color='#ff0000'>The blow inflicts normal damage, AND victim drops anything they hold--even if no damage penetrates DR.</font> [B556]"
293 elif self.sum() == 8: 285 elif self.sum() == 8:
308 class gurpscrit_headblow(std): 300 class gurpscrit_headblow(std):
309 def __init__(self,source=[],mod=0): 301 def __init__(self,source=[],mod=0):
310 std.__init__(self,source) 302 std.__init__(self,source)
311 303
312 def __str__(self): 304 def __str__(self):
313 myStr = "[" + str(self.data[0]) #Variable myStr holds text and first we put a [ into it and then adds the first die rolled 305 myStr = "[" + str(self.data[0])
314 for a in self.data[1:]: #This is a for loop. It will do the next two lines of code for every die (except the first die which we handled in the line above) in the roll. 306 for a in self.data[1:]:
315 myStr += "," #Adds a comma after each die 307 myStr += ","
316 myStr += str(a) #Adds the value of each die. 308 myStr += str(a)
317 myStr += "] = " #Adds ] = to the end of the string (note the += means append to whatever is already stored in the variable 309 myStr += "] = "
318 myStr += str(self.sum()) #Finally we add the actual result of the roll and myStr contains something like [3,2,1] = 6 310 myStr += str(self.sum())
319
320 if self.sum() > 8 and self.sum() < 12: 311 if self.sum() > 8 and self.sum() < 12:
321 myStr += " <font color='#ff0000'>The blow inflicts normal damage.</font> [B556]" 312 myStr += " <font color='#ff0000'>The blow inflicts normal damage.</font> [B556]"
322 elif self.sum() == 12 or self.sum() == 13: 313 elif self.sum() == 12 or self.sum() == 13:
323 myStr += " <font color='#ff0000'>Normal damage to the head, BUT if any penetrates DR victim is scarred (-1 to appearance, -2 if burning or corrosive attacks) OR, if <i>crushing</i> then victim deafened [see B422 for duration].</font> [B556]" 314 myStr += " <font color='#ff0000'>Normal damage to the head, BUT if any penetrates DR victim is scarred (-1 to appearance, -2 if burning or corrosive attacks) OR, if <i>crushing</i> then victim deafened [see B422 for duration].</font> [B556]"
324 elif self.sum() == 8: 315 elif self.sum() == 8:
345 class gurpscrit_miss(std): 336 class gurpscrit_miss(std):
346 def __init__(self,source=[],mod=0): 337 def __init__(self,source=[],mod=0):
347 std.__init__(self,source) 338 std.__init__(self,source)
348 339
349 def __str__(self): 340 def __str__(self):
350 myStr = "[" + str(self.data[0]) #Variable myStr holds text and first we put a [ into it and then adds the first die rolled 341 myStr = "[" + str(self.data[0])
351 for a in self.data[1:]: #This is a for loop. It will do the next two lines of code for every die (except the first die which we handled in the line above) in the roll. 342 for a in self.data[1:]:
352 myStr += "," #Adds a comma after each die 343 myStr += ","
353 myStr += str(a) #Adds the value of each die. 344 myStr += str(a)
354 myStr += "] = " #Adds ] = to the end of the string (note the += means append to whatever is already stored in the variable 345 myStr += "] = "
355 myStr += str(self.sum()) #Finally we add the actual result of the roll and myStr contains something like [3,2,1] = 6 346 myStr += str(self.sum())
356
357 if self.sum() > 8 and self.sum() < 12: 347 if self.sum() > 8 and self.sum() < 12:
358 myStr += " <font color='#ff0000'>You drop your weapon (& a <i>cheap</i> weapon breaks).</font> [B556]" 348 myStr += " <font color='#ff0000'>You drop your weapon (& a <i>cheap</i> weapon breaks).</font> [B556]"
359 elif self.sum() == 12 or self.sum() == 8: 349 elif self.sum() == 12 or self.sum() == 8:
360 myStr += " <font color='#ff0000'>Your weapon turns in your hand; must Ready it before it can be used again.</font> [B556]" 350 myStr += " <font color='#ff0000'>Your weapon turns in your hand; must Ready it before it can be used again.</font> [B556]"
361 elif self.sum() == 13 or self.sum() == 7: 351 elif self.sum() == 13 or self.sum() == 7:
384 class gurpscrit_unarm(std): 374 class gurpscrit_unarm(std):
385 def __init__(self,source=[],mod=0): 375 def __init__(self,source=[],mod=0):
386 std.__init__(self,source) 376 std.__init__(self,source)
387 377
388 def __str__(self): 378 def __str__(self):
389 myStr = "[" + str(self.data[0]) #Variable myStr holds text and first we put a [ into it and then adds the first die rolled 379 myStr = "[" + str(self.data[0])
390 for a in self.data[1:]: #This is a for loop. It will do the next two lines of code for every die (except the first die which we handled in the line above) in the roll. 380 for a in self.data[1:]:
391 myStr += "," #Adds a comma after each die 381 myStr += ","
392 myStr += str(a) #Adds the value of each die. 382 myStr += str(a)
393 myStr += "] = " #Adds ] = to the end of the string (note the += means append to whatever is already stored in the variable 383 myStr += "] = "
394 myStr += str(self.sum()) #Finally we add the actual result of the roll and myStr contains something like [3,2,1] = 6 384 myStr += str(self.sum())
395
396 if self.sum() > 8 and self.sum() < 12: 385 if self.sum() > 8 and self.sum() < 12:
397 myStr += " <font color='#ff0000'>You lose your balance; you can do nothing else (not even free actions) until next turn, and all defenses -2 until next turn.</font> [B557]" 386 myStr += " <font color='#ff0000'>You lose your balance; you can do nothing else (not even free actions) until next turn, and all defenses -2 until next turn.</font> [B557]"
398 elif self.sum() == 12: 387 elif self.sum() == 12:
399 myStr += " <font color='#ff0000'>You trip; make a DX roll to avoid falling at -4 if kicking or twice the normal penatly for a technique that normally requires a DX to avoid injury on even a normal failure (e.g., Jump Kick).</font> [B557]" 388 myStr += " <font color='#ff0000'>You trip; make a DX roll to avoid falling at -4 if kicking or twice the normal penatly for a technique that normally requires a DX to avoid injury on even a normal failure (e.g., Jump Kick).</font> [B557]"
400 elif self.sum() == 8: 389 elif self.sum() == 8: