comparison orpg/dieroller/rollers/d20.py @ 228:24769389a7ba alpha

Traipse Alpha 'OpenRPG' {100612-01} 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 04:38:29 -0500
parents b633f4c64aae
children b44dad398833
comparison
equal deleted inserted replaced
225:2c6db2043764 228:24769389a7ba
39 die_rollers.register(d20) 39 die_rollers.register(d20)
40 40
41 class d20dc(std): 41 class d20dc(std):
42 def __init__(self,source=[],DC=10,mod=0): 42 def __init__(self,source=[],DC=10,mod=0):
43 std.__init__(self,source) 43 std.__init__(self,source)
44 print "Source", source
44 self.DC = DC 45 self.DC = DC
45 self.mod = mod 46 self.mod = mod
46 self.append(static_di(mod)) 47 #self.append(static_di(mod))
47 48
48 def is_success(self): 49 def is_success(self):
49 return ((self.sum() >= self.DC or self.data[0] == 20) and self.data[0] != 1) 50 return ((self.sum()+self.mod >= self.DC or self.data[0] == 20) and self.data[0] != 1)
50 51
51 def __str__(self): 52 def __str__(self):
52 myStr = "[" + str(self.data[0]) 53 myStr = "[" + str(self.data[0])
53 for a in self.data[1:]: 54 for a in self.data[1:]:
54 myStr += "," 55 myStr += ", "
55 myStr += str(a) 56 myStr += str(a)
56 myStr += "] = (" + str(self.sum()) + ")" 57 myStr += ", "+str(self.mod)+ "] = (" + str(self.sum()+self.mod) + ")"
57 myStr += " vs DC " + str(self.DC) 58 myStr += " vs DC " + str(self.DC)
58 if self.is_success(): myStr += " Success!" 59 if self.is_success(): myStr += " Success!"
59 else: myStr += " Failure!" 60 else: myStr += " Failure!"
60 return myStr 61 return myStr
61 62