Mercurial > traipse_dev
annotate orpg/dieroller/rollers/std.py @ 245:682032381be8 beta
Traipse Beta 'OpenRPG' {101130-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 (Closing/Closed)
New Features:
New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order
New to Server GUI, can now clear log
New Earthdawn Dieroller
New IronClaw roller, sheet, and image
Updates:
Update to Warhammer PC Sheet. Rollers set as macros. Should work with little maintanence.
Update to Browser Server window. Display rooms with ' " & cleaner
Update to Server. Handles ' " & cleaner
Update to Dieroller. Cleaner, more effecient expression system
Update to Hidden Die plugin, allows for non standard dice rolls
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
Fix to Single and Double quotes in Whiteboard text
Fix to Background images not showing when using the Image Server
Fix to Duplicate chat names appearing
Fix to Server GUI's logging output
Fix to FNB.COLORFUL_TABS bug
Fix to Gametree for XSLT Sheets
Fix to Gametree for locating gametree files
Fix to Send to Chat from Gametree
Fix to Gametree, renaming and remapping operates correctly
Fix to aliaslib, prevents error caused when SafeHTML is sent None
author | sirebral |
---|---|
date | Tue, 30 Nov 2010 02:34:58 -0600 |
parents | b44dad398833 |
children |
rev | line source |
---|---|
171 | 1 from orpg.dieroller.base import die_base, die_rollers |
2 | |
3 class std(die_base): | |
4 name = "std" | |
5 | |
212 | 6 def __init__(self, source=[]): |
7 die_base.__init__(self, source) | |
171 | 8 |
9 # Examples of adding member functions through inheritance. | |
10 | |
11 def ascending(self): | |
12 result = self[:] | |
13 result.sort() | |
14 return result | |
15 | |
16 def descending(self): | |
17 result = self[:] | |
18 result.sort() | |
19 result.reverse() | |
20 return result | |
21 | |
212 | 22 def takeHighest(self, num_dice): |
171 | 23 return self.descending()[:num_dice] |
24 | |
25 def takeLowest(self,num_dice): | |
26 return self.ascending()[:num_dice] | |
27 | |
212 | 28 def extra(self, num): |
171 | 29 for i in range(len(self.data)): |
30 if self.data[i].lastroll() >= num: | |
31 self.data[i].extraroll() | |
32 return self | |
33 | |
212 | 34 def open(self, num): |
35 if num <= 1: self | |
171 | 36 done = 1 |
37 for i in range(len(self.data)): | |
38 if self.data[i].lastroll() >= num: | |
39 self.data[i].extraroll() | |
40 done = 0 | |
238 | 41 if done: return self |
212 | 42 else: return self.open(num) |
171 | 43 |
44 def minroll(self,min): | |
45 for i in range(len(self.data)): | |
46 if self.data[i].lastroll() < min: | |
47 self.data[i].roll(min) | |
48 return self | |
49 | |
212 | 50 def each(self, mod): |
171 | 51 mod = int(mod) |
52 for i in range(len(self.data)): | |
53 self.data[i].modify(mod) | |
54 return self | |
55 | |
56 def vs(self, target): | |
57 for dn in self.data: | |
58 dn.target = target | |
59 return self | |
60 | |
61 | |
62 ## If we are testing against a saving throw, we check for | |
63 ## greater than or equal to against the target value and | |
64 ## we only return the number of successful saves. A negative | |
65 ## value will never be generated. | |
66 def sum(self): | |
67 retValue = 0 | |
68 for dn in self.data: | |
69 setValue = reduce( lambda x, y : int(x)+int(y), dn.history ) | |
70 if dn.target: | |
212 | 71 for dv in dn.history: |
72 if int(dv) >= dn.target: retValue += 1 | |
171 | 73 else: |
74 retValue += setValue | |
75 return retValue | |
76 | |
184 | 77 die_rollers.register(std) |