comparison orpg/dieroller/rollers/hero.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 # (at your option) any later version.
2 #
3 # This program is distributed in the hope that it will be useful,
4 # but WITHOUT ANY WARRANTY; without even the implied warranty of
5 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 # GNU General Public License for more details.
7 #
8 # You should have received a copy of the GNU General Public License
9 # along with this program; if not, write to the Free Software
10 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
11 # --
12 #
13 # File: Hero.py
14 # Version:
15 # $Id: Hero.py,v .3 DJM & Heroman
16 #
17 # Description: Hero System die roller originally based on Posterboy's D20 Dieroller
18 #
19 # Changelog:
20 # v.3 by Heroman
21 # Added hl() to show hit location (+side), and hk() for Hit Location killing damage
22 # (No random stun multiplier)
23 # v.2 DJM
24 # Removed useless modifiers from the Normal damage roller
25 # Changed Combat Value roller and SKill roller so that positive numbers are bonuses,
26 # negative numbers are penalties
27 # Changed Killing damage roller to correct stun multiplier bug
28 # Handled new rounding issues
29 #
30 # v.1 original release DJM
31
32 __version__ = "$Id: hero.py,v 1.15 2006/11/04 21:24:19 digitalxero Exp $"
33
34 from time import time, clock
35 import random
36
37 from std import std
38 from orpg.dieroller.base import *
39
40 # Hero stands for "Hero system" not 20 sided die :)
41
42 class hero(std):
43 name = "hero"
44
45 def __init__(self,source=[]):
46 std.__init__(self,source)
47
48 # these methods return new die objects for specific options
49
50 def k(self,mod):
51 return herok(self,mod)
52
53 def hl(self):
54 return herohl(self)
55
56 def hk(self):
57 return herohk(self)
58
59 def n(self):
60 return heron(self)
61
62 def cv(self,cv,mod):
63 return herocv(self,cv,mod)
64
65 def sk(self,sk,mod):
66 return herosk(self,sk,mod)
67
68 die_rollers.register(hero)
69
70 class herocv(std):
71 def __init__(self,source=[],cv=10,mod=0):
72 std.__init__(self,source)
73 self.cv = cv
74 self.mod = mod
75
76
77 def __str__(self):
78 myStr = "[" + str(self.data[0])
79 for a in self.data[1:]:
80 myStr += ","
81 myStr += str(a)
82 myStr += "] = (" + str(self.sum()) + ")"
83
84 myStr += " with a CV of " + str(self.cv)
85 myStr += " and a modifier of " + str(self.mod)
86 cvhit = 11 + self.cv - self.sum() + self.mod
87 myStr += " hits up to <b>DCV <font color='#ff0000'>" + str(cvhit) + "</font></b>"
88 return myStr
89
90 class herosk(std):
91 def __init__(self,source=[],sk=11,mod=0):
92 std.__init__(self,source)
93 self.sk = sk
94 self.mod = mod
95
96 def is_success(self):
97 return (((self.sum()-self.mod) <= self.sk))
98
99 def __str__(self):
100 myStr = "[" + str(self.data[0])
101 for a in self.data[1:]:
102 myStr += ","
103 myStr += str(a)
104 strAdd="] - "
105 swapmod=self.mod
106 if self.mod < 0:
107 strAdd= "] + "
108 swapmod= -self.mod
109 myStr += strAdd + str(swapmod)
110 modSum = self.sum()-self.mod
111 myStr += " = (" + str(modSum) + ")"
112 myStr += " vs " + str(self.sk)
113
114 if self.is_success():
115 myStr += " or less <font color='#ff0000'>Success!"
116 else:
117 myStr += " or less <font color='#ff0000'>Failure!"
118
119 Diff = self.sk - modSum
120 myStr += " by " + str(Diff) +" </font>"
121
122 return myStr
123
124 class herok(std):
125 def __init__(self,source=[],mod=0):
126 std.__init__(self,source)
127 self.mod = mod
128
129 def __str__(self):
130 myStr = "[" + str(self.data[0])
131 for a in self.data[1:]:
132 myStr += ","
133 myStr += str(a)
134 myStr += "] = (<font color='#ff0000'><b>" + str(int(round(self.sum()))) + "</b></font>)"
135 stunx = random.randint(1,6)-1
136 if stunx <= 1:
137 stunx = 1
138 myStr += " <b>Body</b> and a stunx of (" + str(stunx)
139 stunx = stunx + self.mod
140 myStr += " + " + str(self.mod)
141 stunsum = round(self.sum()) * stunx
142 myStr += ") for a total of (<font color='#ff0000'><b>" + str(int(stunsum)) + "</b></font>) <b>Stun</b>"
143 return myStr
144
145 class herohl(std):
146 def __init__(self,source=[],mod=0):
147 std.__init__(self,source)
148 self.mod = mod
149
150 def __str__(self):
151 myStr = "[" + str(self.data[0])
152 side = random.randint(1,6)
153 sidestr = "Left "
154 if side >=4:
155 sidestr = "Right "
156 for a in self.data[1:]:
157 myStr += ","
158 myStr += str(a)
159 myStr += "] = (<font color='#ff0000'><b>" + str(int(round(self.sum()))) + "</b></font>) "
160 location = int(round(self.sum()))
161 if location <= 5:
162 myStr += "Location: <B>Head</B>, StunX:<B>x5</B>, NStun:<B>x2</B>, Bodyx:<B>x2</B>"
163 elif location == 6:
164 myStr += "Location: <B>" + sidestr + "Hand</B>, StunX:<B>x1</B>, NStun:<B>x1/2</B>, Bodyx:<B>x1/2</B>"
165 elif location == 7:
166 myStr += "Location: <B>" + sidestr + "Arm</B>, StunX:<B>x2</B>, NStun:<B>x1/2</B>, Bodyx:<B>x1/2</B>"
167 elif location == 8:
168 myStr += "Location: <B>" + sidestr + "Arm</B>, StunX:<B>x2</B>, NStun:<B>x1/2</B>, Bodyx:<B>x1/2</B>"
169 elif location == 9:
170 myStr += "Location: <B>" + sidestr + "Shoulder</B>, StunX:<B>x3</B>, NStun:<B>x1</B>, Bodyx:<B>x1</B>"
171 elif location == 10:
172 myStr += "Location: <B>Chest</B>, StunX:<B>x3</B>, NStun:<B>x1</B>, Bodyx:<B>x1</B>"
173 elif location == 11:
174 myStr += "Location: <B>Chest</B>, StunX:<B>x3</B>, NStun:<B>x1</B>, Bodyx:<B>x1</B>"
175 elif location == 12:
176 myStr += "Location: <B>Stomach</B>, StunX:<B>x4</B>, NStun:<B>x1 1/2</B>, Bodyx:<B>x1</B>"
177 elif location == 13:
178 myStr += "Location: <B>Vitals</B>, StunX:<B>x4</B>, NStun:<B>x1 1/2</B>, Bodyx:<B>x2</B>"
179 elif location == 14:
180 myStr += "Location: <B>" + sidestr + "Thigh</B>, StunX:<B>x2</B>, NStun:<B>x1</B>, Bodyx:<B>x1</B>"
181 elif location == 15:
182 myStr += "Location: <B>" + sidestr + "Leg</B>, StunX:<B>x2</B>, NStun:<B>x1/2</B>, Bodyx:<B>x1/2</B>"
183 elif location == 16:
184 myStr += "Location: <B>" + sidestr + "Leg</B>, StunX:<B>x2</B>, NStun:<B>x1/2</B>, Bodyx:<B>x1/2</B>"
185 elif location >= 17:
186 myStr += "Location: <B>" + sidestr + "Foot</B>, StunX:<B>x1</B>, NStun:<B>x1/2</B>, Bodyx:<B>x1/2</B>"
187 return myStr
188
189 class herohk(std):
190 def __init__(self,source=[],mod=0):
191 std.__init__(self,source)
192 self.mod = mod
193
194 def __str__(self):
195 myStr = "[" + str(self.data[0])
196 for a in self.data[1:]:
197 myStr += ","
198 myStr += str(a)
199 myStr += "] = (<font color='#ff0000'><b>" + str(int(round(self.sum()))) + "</b></font>)"
200 stunx = 1
201 myStr += " <b>Body</b> "
202 stunx = stunx + self.mod
203 stunsum = round(self.sum()) * stunx
204 myStr += " for a total of (<font color='#ff0000'><b>" + str(int(stunsum)) + "</b></font>) <b>Stun</b>"
205 return myStr
206
207 class heron(std):
208 def __init__(self,source=[],mod=0):
209 std.__init__(self,source)
210 self.bodtot=0
211
212 def __str__(self):
213 myStr = "[" + str(self.data[0])
214 if self.data[0] == 6:
215 self.bodtot=self.bodtot+2
216 else:
217 self.bodtot=self.bodtot+1
218 if self.data[0] <= 1:
219 self.bodtot=self.bodtot-1
220 for a in self.data[1:]:
221 myStr += ","
222 myStr += str(a)
223 if a == 6:
224 self.bodtot=self.bodtot+2
225 else:
226 self.bodtot=self.bodtot+1
227 if a <= 1:
228 self.bodtot=self.bodtot-1
229 myStr += "] = (<font color='#ff0000'><b>" + str(self.bodtot) + "</b></font>)"
230 myStr += " <b>Body</b> and "
231 myStr += "(<font color='#ff0000'><b>" + str(int(round(self.sum()))) + "</b></font>) <b>Stun</b>"
232 return myStr