comparison orpg/dieroller/rollers/std.py @ 171:ff48c2741fe7 beta

Traipse Beta 'OpenRPG' {091210-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 (Beta) New Features: Added Bookmarks Added 'boot' command to remote admin Added confirmation window for sent nodes Minor changes to allow for portability to an OpenSUSE linux OS Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG Zoom Mouse plugin added Images added to Plugin UI Switching to Element Tree Map efficiency, from FlexiRPG Added Status Bar to Update Manager New TrueDebug Class in orpg_log (See documentation for usage) Portable Mercurial Tip of the Day added, from Core and community New Reference Syntax added for custom PC sheets New Child Reference for gametree New Gametree Recursion method, mapping, context sensitivity, and effeciency.. New Features node with bonus nodes and Node Referencing help added Added 7th Sea die roller method; ie [7k3] = [7d10.takeHighest(3).open(10)] New 'Mythos' System die roller added Added new vs. die roller method for WoD; ie [3v3] = [3d10.vs(3)]. Includes support for Mythos roller. Fixes: Fix to Text based Server Fix to Remote Admin Commands Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core Fix to Map from gametree not showing to all clients Fix to gametree about menus Fix to Password Manager check on startup Fix to PC Sheets from tool nodes. They now use the tabber_panel Fixed Whiteboard ID to prevent random line or text deleting. Modified ID's to prevent non updated clients from ruining the fix. default_manifest.xml renamed to default_upmana.xml Fix to Update Manager; cleaner clode for saved repositories Fixes made to Settings Panel and no reactive settings when Ok is pressed.
author sirebral
date Thu, 10 Dec 2009 22:30:40 -0600
parents
children dcae32e219f1 b633f4c64aae 81d0bfd5e800
comparison
equal deleted inserted replaced
165:e4a803df4c88 171:ff48c2741fe7
1 from orpg.dieroller.base import die_base, die_rollers
2
3 class std(die_base):
4 name = "std"
5
6 def __init__(self,source=[]):
7 die_base.__init__(self,source)
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
22 def takeHighest(self,num_dice):
23 return self.descending()[:num_dice]
24
25 def takeLowest(self,num_dice):
26 return self.ascending()[:num_dice]
27
28 def extra(self,num):
29 for i in range(len(self.data)):
30 if self.data[i].lastroll() >= num:
31 self.data[i].extraroll()
32 return self
33
34 def open(self,num):
35 if num <= 1:
36 self
37 done = 1
38 for i in range(len(self.data)):
39 if self.data[i].lastroll() >= num:
40 self.data[i].extraroll()
41 done = 0
42 if done:
43 return self
44 else:
45 return self.open(num)
46
47 def minroll(self,min):
48 for i in range(len(self.data)):
49 if self.data[i].lastroll() < min:
50 self.data[i].roll(min)
51 return self
52
53 def each(self,mod):
54 mod = int(mod)
55 for i in range(len(self.data)):
56 self.data[i].modify(mod)
57 return self
58
59
60 def vs(self, target):
61 for dn in self.data:
62 dn.target = target
63 return self
64
65
66 ## If we are testing against a saving throw, we check for
67 ## greater than or equal to against the target value and
68 ## we only return the number of successful saves. A negative
69 ## value will never be generated.
70 def sum(self):
71 retValue = 0
72 for dn in self.data:
73 setValue = reduce( lambda x, y : int(x)+int(y), dn.history )
74 if dn.target:
75 if setValue >= dn.target:
76 retValue += 1
77
78 else:
79 retValue += setValue
80
81 return retValue
82
83 die_rollers.register(std)