Mercurial > traipse_dev
comparison orpg/dieroller/rollers/wodex.py @ 167:5c9a118476b2 alpha
Traipse Alpha '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 (Keeping up with 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 Parent Reference for gametree
New Gametree Recursion method, mapping, context sensitivity, and
effeciency..
New Features node with bonus nodes and Node Referencing help added
Dieroller structure from Core
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
Fixes to Alternity roller's attack roll. Uses a simple Tuple instead of
a Splice
author | sirebral |
---|---|
date | Thu, 10 Dec 2009 10:53:33 -0600 |
parents | |
children | dcae32e219f1 |
comparison
equal
deleted
inserted
replaced
166:eef2463cd441 | 167:5c9a118476b2 |
---|---|
1 ## a vs die roller as used by WOD games | |
2 #!/usr/bin/env python | |
3 # Copyright (C) 2000-2001 The OpenRPG Project | |
4 # | |
5 # openrpg-dev@lists.sourceforge.net | |
6 # | |
7 # This program is free software; you can redistribute it and/or modify | |
8 # it under the terms of the GNU General Public License as published by | |
9 # the Free Software Foundation; either version 2 of the License, or | |
10 # (at your option) any later version. | |
11 # | |
12 # This program is distributed in the hope that it will be useful, | |
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 # GNU General Public License for more details. | |
16 # | |
17 # You should have received a copy of the GNU General Public License | |
18 # along with this program; if not, write to the Free Software | |
19 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
20 # -- | |
21 # | |
22 # File: wodex.py | |
23 # Original Author: Darloth | |
24 # Maintainer: | |
25 # Original Version: 1.0 | |
26 # | |
27 # Description: A modified form of the World of Darkness die roller to | |
28 # conform to ShadowRun rules-sets, then modified back to the WoD for | |
29 # the new WoD system. Thanks to the ORPG team | |
30 # for the original die rollers. | |
31 # Much thanks to whoever wrote the original shadowrun roller (akoman I believe) | |
32 | |
33 | |
34 from std import std | |
35 from orpg.dieroller.base import * | |
36 | |
37 __version__ = "$Id: wodex.py,v 1.9 2007/05/06 16:42:55 digitalxero Exp $" | |
38 | |
39 class wodex(std): | |
40 name = "wodex" | |
41 | |
42 def __init__(self,source=[]): | |
43 std.__init__(self,source) | |
44 | |
45 def vs(self,actualtarget=6): | |
46 return oldwodVs(self,actualtarget,(6)) | |
47 | |
48 def wod(self,actualtarget=8): | |
49 return newwodVs(self,actualtarget,(8)) | |
50 | |
51 def exalt(self, actualtarget=7): | |
52 return exaltVs(self, actualtarget) | |
53 | |
54 def exaltDmg(self, actualtarget=7): | |
55 return exaltDmg(self, actualtarget) | |
56 | |
57 def vswide(self,actualtarget=6,maxtarget=10): #wide simply means it reports TNs from 2 to a specified max. | |
58 return oldwodVs(self,actualtarget,2,maxtarget) | |
59 | |
60 die_rollers.register(wodex) | |
61 | |
62 class oldwodVs(std): | |
63 def __init__(self,source=[],actualtarget=6,mintn=2,maxtn=10): | |
64 std.__init__(self, source) | |
65 if actualtarget > 10: | |
66 actualtarget = 10 | |
67 if mintn > 10: | |
68 mintn = 10 | |
69 if maxtn > 10: | |
70 maxtn = 10 | |
71 if actualtarget < 2: | |
72 self.target = 2 | |
73 else: | |
74 self.target = actualtarget | |
75 #if the target number is higher than max (Mainly for wide rolls) then increase max to tn | |
76 if actualtarget > maxtn: | |
77 maxtn = actualtarget | |
78 if actualtarget < mintn: | |
79 mintn = actualtarget | |
80 #store minimum for later use as well, also in result printing section. | |
81 if mintn < 2: | |
82 self.mintn = 2 | |
83 else: | |
84 self.mintn = mintn | |
85 self.maxtn = maxtn #store for later use in printing results. (Yeah, these comments are now disordered) | |
86 | |
87 # WoD etc uses d10 but i've left it so it can roll anything openended | |
88 # self.openended(self[0].sides) | |
89 | |
90 #count successes, by looping through each die, and checking it against the currently set TN | |
91 #1's subtract successes. | |
92 def __sum__(self): | |
93 s = 0 | |
94 for r in self.data: | |
95 if r >= self.target: | |
96 s += 1 | |
97 elif r == 1: | |
98 s -= 1 | |
99 return s | |
100 | |
101 #a modified sum, but this one takes a target argument, and is there because otherwise it is difficult to loop through | |
102 #tns counting successes against each one without changing target, which is rather dangerous as the original TN could | |
103 #easily be lost. 1s subtract successes from everything. | |
104 def xsum(self,curtarget): | |
105 s = 0 | |
106 for r in self.data: | |
107 if r >= curtarget: | |
108 s += 1 | |
109 elif r == 1: | |
110 s -= 1 | |
111 return s | |
112 | |
113 | |
114 def __str__(self): | |
115 if len(self.data) > 0: | |
116 myStr = "[" + str(self.data[0]) | |
117 for a in self.data[1:]: | |
118 myStr += "," | |
119 myStr += str(a) | |
120 myStr += "] Results: " | |
121 #cycle through from mintn to maxtn, summing successes for each separate TN | |
122 for targ in range(self.mintn,self.maxtn+1): | |
123 if (targ == self.target): | |
124 myStr += "<b>" | |
125 myStr += "(" + str(self.xsum(targ)) + " vs " + str(targ) + ") " | |
126 if (targ == self.target): | |
127 myStr += "</b>" | |
128 else: | |
129 myStr = "[] = (0)" | |
130 | |
131 return myStr | |
132 | |
133 class newwodVs(std): | |
134 def __init__(self,source=[],actualtarget=8,mintn=8,maxtn=8): | |
135 std.__init__(self, source) | |
136 if actualtarget > 30: | |
137 actualtarget = 30 | |
138 if mintn > 10: | |
139 mintn = 10 | |
140 if maxtn > 10: | |
141 maxtn = 10 | |
142 if actualtarget < 2: | |
143 self.target = 2 | |
144 else: | |
145 self.target = actualtarget | |
146 #if the target number is higher than max (Mainly for wide rolls) then increase max to tn | |
147 if actualtarget > maxtn: | |
148 maxtn = actualtarget | |
149 if actualtarget < mintn: | |
150 mintn = actualtarget | |
151 #store minimum for later use as well, also in result printing section. | |
152 if mintn < 2: | |
153 self.mintn = 2 | |
154 else: | |
155 self.mintn = mintn | |
156 self.maxtn = maxtn #store for later use in printing results. (Yeah, these comments are now disordered) | |
157 | |
158 # WoD etc uses d10 but i've left it so it can roll anything openended | |
159 # self.openended(self[0].sides) | |
160 | |
161 #a modified sum, but this one takes a target argument, and is there because otherwise it is difficult to loop through | |
162 #tns counting successes against each one without changing target, which is rather dangerous as the original TN could | |
163 #easily be lost. 1s subtract successes from original but not re-rolls. | |
164 def xsum(self,curtarget,subones=1): | |
165 s = 0 | |
166 done = 1 | |
167 for r in self.data: | |
168 if r >= curtarget: | |
169 s += 1 | |
170 elif ((r == 1) and (subones == 1)): | |
171 s -= 1 | |
172 if r == 10: | |
173 done = 0 | |
174 subones = 0 | |
175 self.append(di(10)) | |
176 if done == 1: | |
177 return s | |
178 else: | |
179 return self.xsum(0) | |
180 | |
181 def openended(self,num): | |
182 if num <= 1: | |
183 self | |
184 done = 1 | |
185 for i in range(len(self.data)): | |
186 if self.data[i].lastroll() == num: | |
187 self.data[i].extraroll() | |
188 done = 0 | |
189 if done: | |
190 return self | |
191 else: | |
192 return self.openended(num) | |
193 | |
194 | |
195 def __str__(self): | |
196 if len(self.data) > 0: | |
197 myStr = "[" + str(self.data[0]) | |
198 for a in self.data[1:]: | |
199 myStr += "," | |
200 myStr += str(a) | |
201 myStr += "] Results: " | |
202 #cycle through from mintn to maxtn, summing successes for each separate TN | |
203 for targ in range(self.mintn,self.maxtn+1): | |
204 if (targ == self.target): | |
205 myStr += "<b>" | |
206 myStr += "(" + str(self.xsum(targ)) + " vs " + str(targ) + ") " | |
207 if (targ == self.target): | |
208 myStr += "</b>" | |
209 else: | |
210 myStr = "[] = (0)" | |
211 | |
212 return myStr | |
213 | |
214 class exaltVs(std): | |
215 def __init__(self, source=[], actualtarget=7): | |
216 std.__init__(self, source) | |
217 | |
218 if actualtarget > 10: | |
219 actualtarget = 10 | |
220 | |
221 if actualtarget < 2: | |
222 self.target = 2 | |
223 else: | |
224 self.target = actualtarget | |
225 | |
226 | |
227 def xsum(self, target): | |
228 s = 0 | |
229 | |
230 for r in self.data: | |
231 if r >= target: | |
232 s += 1 | |
233 if r == 10: | |
234 s += 1 | |
235 | |
236 return s | |
237 | |
238 | |
239 def __str__(self): | |
240 if len(self.data) > 0: | |
241 myStr = str(self.data) | |
242 myStr += " Results: " | |
243 | |
244 succ = self.xsum(self.target) | |
245 if succ == 0 and 1 in self.data: | |
246 myStr += 'BOTCH!' | |
247 elif succ == 0: | |
248 myStr += str(succ) + " Failure" | |
249 elif succ == 1: | |
250 myStr += str(succ) + " Success" | |
251 else: | |
252 myStr += str(succ) + " Successes" | |
253 | |
254 return myStr | |
255 | |
256 class exaltDmg(std): | |
257 def __init__(self, source=[], actualtarget=7): | |
258 std.__init__(self, source) | |
259 if actualtarget > 10: | |
260 actualtarget = 10 | |
261 | |
262 if actualtarget < 2: | |
263 self.target = 2 | |
264 else: | |
265 self.target = actualtarget | |
266 | |
267 def xsum(self, target): | |
268 s = 0 | |
269 | |
270 for r in self.data: | |
271 if r >= target: | |
272 s += 1 | |
273 return s | |
274 | |
275 def __str__(self): | |
276 if len(self.data) > 0: | |
277 myStr = str(self.data) | |
278 myStr += " Results: " | |
279 | |
280 succ = self.xsum(self.target) | |
281 | |
282 if succ == 0 and 1 in self.data: | |
283 myStr += 'BOTCH!' | |
284 elif succ == 0: | |
285 myStr += str(succ) + " Failure" | |
286 elif succ == 1: | |
287 myStr += str(succ) + " Success" | |
288 else: | |
289 myStr += str(succ) + " Successes" | |
290 | |
291 return myStr |