annotate orpg/dieroller/rollers/alternity.py @ 237:42f4809ad8a8 beta

Traipse Beta 'OpenRPG' {100616-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 (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 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. 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.
author sirebral
date Wed, 16 Jun 2010 03:11:55 -0500
parents 7c1a8b36b729
children 72e0cce81a47
rev   line source
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
1 # (at your option) any later version.
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
2 #
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
3 # This program is distributed in the hope that it will be useful,
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
4 # but WITHOUT ANY WARRANTY; without even the implied warranty of
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
5 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
6 # GNU General Public License for more details.
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
7 #
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
8 # You should have received a copy of the GNU General Public License
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
9 # along with this program; if not, write to the Free Software
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
10 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
11 # --
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
12 #
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
13 # File: Alternity.py
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
14 # Version:
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
15 # $Id: Alternity.py,v .1 JEC (cchriss@thecastle.com)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
16 #
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
17 # Description: Alternity die roller based on Posterboy's D20 Dieroller
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
18 #
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
19 # Changelog:
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
20 #
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
21 # v.1 original release JEC
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
22 #
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
23 # Traipse Release:
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
24 # The changes made in the Traipe release are intended to create a more direct connection
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
25 # between the source and the intrepretor. IF, ELIF statements have been replaced with dictionaries,
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
26 # unused objects have been replace with re-usable objects, and the code has been condensed.
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
27 #
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
28 # SEG: JAN 24 2010 - v.1.4 O'Flux Release:
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
29 # Edits & Additions: fixed a few minor bugs; Damage roll & Display Issues.
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
30 # Added Secondary Damage Calculation and Display. Fix all errors.
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
31 # Added proper results for Critcal Successes with failure ==> final Result Ordinary Success
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
32 # Removed reduntent Method to make parent class true with all others working as child.
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
33 # Made all special output same colour codes font size. Cleaned out old commented lines.
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
34 # Tested for Traipse on Win 7
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
35 #
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
36 # Skill Check Example:
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
37 # [1d20.sk(12,-2)]
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
38 # OUTPUT Example:
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
39 # => [6,-3] = (3) AMAZING Success
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
40 #
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
41 # Pistol, Laser; 0 step -- Attack Example:
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
42 # [1d20.at(12,0,(1d4+1,"w"),(1d6+1,"w"),(1d4,"m"))]
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
43 # OUTPUT Example:
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
44 # => [1,0] = (1) CRITICAL SUCCESS AMAZING HIT
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
45 # ===> Damage [4] = (4) mortal ======> Secondary Damage (2) stun / (2) wound
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
46 #
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
47 # Action Check Example:
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
48 # [1d20.ac(14,-1)]
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
49 # OUTPUT Example:
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
50 # => ACTION CHECK : [18,-3] = (15) Marginal failure
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
51 # -1 Step make up bonus next Action Check
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
52 #
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
53 #
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
54
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
55 import re
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
56
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
57 from std import std
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
58 from time import time, clock
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
59 from orpg.dieroller.base import di, die_base, die_rollers
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
60
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
61 ##from orpg.tools.orpg_log import debug
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
62
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
63
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
64 __version__ = "$Id: alternity.py,v 0.1 2003/01/02 12:00:00 cchriss Exp $"
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
65
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
66 # Alternity stands for "Alternity system" 20 sided die plus mods
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
67
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
68 class alternity(std):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
69 name = "alternity" # ADDED by SEG Nov 2009 ***
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
70
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
71 def __init__(self,source=[]):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
72 std.__init__(self,source)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
73
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
74 # these methods return new die objects for specific options
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
75 def sk(self,score,mod):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
76 return sk(self,score,mod)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
77
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
78 def at(self,score,mod,dmgo,dmgg,dmga):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
79 return at(self,score,mod,dmgo,dmgg,dmga)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
80
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
81 def ac(self,score,mod):
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
82 return ac(self,score,mod)
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
83
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
84 die_rollers.register(alternity)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
85
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
86 class sk(std):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
87 def __init__(self,source=[],sc="10/5/2",mod=0):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
88 std.__init__(self,source)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
89 m = re.match( r"\d+", str(sc) )
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
90 self.score = int( m.group(0) )
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
91 self.mod = mod
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
92
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
93 def getMod(self,mod=0):
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
94 m=0
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
95 mods = { -4: -di(12), -3: -di(8), -2: -di(6), -1: -di(4), 1: di(4),
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
96 2: di(6), 3: di(8), 4: di(12), 5: di(20)} # SEG fix 1: di(4) #
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
97 if mod in mods.keys(): m = mods[mod].value
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
98 elif mod <= -5: m=-di(20).value
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
99 elif mod == 6: m=di(20).value + di(20).value
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
100 elif mod >= 7: m=di(20).value + di(20).value + di(20).value
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
101 return m
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
102
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
103 def getRolLStr(self):
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
104 myStr = "[" + str(self.data[0])
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
105 self.d20 = self.sum()
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
106 self.amod = self.getMod(self.mod)
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
107
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
108 ## varN = "self.amod"
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
109 ## debug(varN)
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
110 ## debug(self.amod) ## seg added debug output
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
111
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
112 self.dieRoll = self.d20 + self.amod
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
113 for a in self.data[1:]:
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
114 myStr += ","
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
115 myStr += str(a)
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
116 myStr += "," + str(self.amod) + "] = (" + str(self.dieRoll) + ")"
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
117 if ( self.dieRoll <= self.score / 4 ): self.success = 'A'
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
118 elif ( self.dieRoll <= self.score / 2 ): self.success = 'G'
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
119 elif ( self.dieRoll <= self.score ): self.success = 'O'
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
120 else: self.success = 'F'
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
121 if ( self.d20 == 20 ): self.success = 'CF'
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
122 return myStr
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
123
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
124 def __str__(self):
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
125 myStr = self.getRolLStr()
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
126
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
127 ## varN = "myStr"
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
128 ## debug(varN)
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
129 ## debug(myStr) ## seg added debug output
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
130
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
131 successes = {'CS': " <b><font size=2 color='#8D38C9'>CRITICAL SUCCESS</font></b>",
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
132 'CF': " <b><font size=2 color='#151B54'>CRITICAL FAILURE</font></b>",
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
133 'A': " <b><font size=2 color='#E42217'>AMAZING Success</font></b>",
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
134 'G': " <b><font size=2 color='#306EFF'>Good Success</font></b>",
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
135 'O': " <b><font size=2 color='#52D017'>Ordinary Success</font></b>",
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
136 'F': " <b><font size=2 color='#41627E'>failure</font></b>"}
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
137
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
138 if ( self.d20 == 1 ): myStr += successes['CS'] # SEG Dec 19 2009
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
139 myStr += successes[self.success]
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
140 if ( self.d20 == 1 ) and (self.success == 'F') :
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
141 myStr += " final result ==> "
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
142 myStr += successes['O'] # SEG JAN 23 2010
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
143 return myStr
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
144
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
145 class at(sk):
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
146 ## Traipse Usage: The source I received had the damage rolls like this 1d6s, with the damage type a
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
147 ## letter that could be sliced from the roll. However, the roll is parsed before the letter can be
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
148 ## sliced from it, and with the letter attached it created an error.
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
149 ##
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
150 ## The Traipse method puts the damage type and the damage roll into a Tuple, ie (1d6, 's').
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
151 ## When using this method you must include single or double quoutes around the damage type or the
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
152 ## software will treat it as an object.
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
153
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
154 def __init__(self,source=[],sc=10, mod=0, dmgo="(1d6, 's')",dmgg="(1d6, 'w')",dmga="(1d6, 'm')"):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
155 sk.__init__(self,source,sc,mod)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
156 self.dmgo = dmgo
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
157 self.dmgg = dmgg
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
158 self.dmga = dmga
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
159
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
160 def getdmg(self,dmgroll):
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
161 astr = "<b>===></b> Damage "
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
162 droll = str(dmgroll[0])
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
163 xyz = droll.split('(')
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
164 secD = (int(xyz[1][:-1])/2) ## SEG* Calculate Secondary Damage
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
165
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
166 ## varN = "secD"
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
167 ## debug(varN)
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
168 ## debug(secD) ## seg added debug output
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
169
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
170 dtype = dmgroll[1]
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
171 astr += droll
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
172 if dtype=="s": astr += " <b><font size=2 color='#52D017'>stun</font></b><BR>"
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
173 elif dtype=="w":
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
174 astr += " <b><font size=2 color='#C11B17'>wound</font></b>"+" <b>======></b> Secondary Damage ("+str(secD) \
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
175 +") <b><font size=2 color='#52D017'>stun</font></b><BR>" # SEG* Display Secondary Damage
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
176 elif dtype=="m":
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
177 astr += " <b><font size=2 color='#FF0000'>mortal</font></b>"+" <b>======></b> Secondary Damage ("+str(secD) \
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
178 +") <b><font size=2 color='#52D017'>stun</font></b>"+" <b>/</b> ("+str(secD)+") <b><font size=2 color='#C11B17'>wound</font></b><BR>" # SEG* Display Secondary Damage
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
179 return astr
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
180
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
181 def __str__(self):
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
182 myStr = self.getRolLStr()
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
183
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
184 ## varN = "myStr"
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
185 ## debug(varN)
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
186 ## debug(myStr) ## seg added debug output
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
187
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
188 successes = {'CS': " <b><font size=2 color='#8D38C9'>CRITICAL SUCCESS</font></b>",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
189 'CF': " <b><font size=2 color='#151B54'>CRITICAL FAILURE</font></b>",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
190 'A': " <b><font size=2 color='#E42217'>AMAZING HIT</font></b><BR> ",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
191 'G': " <b><font size=2 color='#306EFF'>Good HIT</font></b><BR> ",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
192 'O': " <b><font size=2 color='#52D017'>Ordinary HIT</font></b><BR> ",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
193 'F': " <b><font size=2 color='#41627E'>miss</font></b>"}
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
194 if ( self.d20 == 1 ):
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
195 myStr += successes['CS'] # SEG Dec 19 2009
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
196
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
197 if ( self.d20 == 1 ) and (self.success == 'F') :
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
198 myStr += successes['F'] # SEG JAN 23 2010
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
199 myStr += " final result ==> "
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
200 self.success = 'O'
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
201
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
202 myStr += successes[self.success]
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
203 if self.success == 'A': myStr += self.getdmg(self.dmga)
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
204 elif self.success == 'G': myStr += self.getdmg(self.dmgg)
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
205 elif self.success == 'O': myStr += self.getdmg(self.dmgo)
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
206 return myStr
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
207
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
208 class ac(sk):
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
209 def __init__(self,source=[],sc=10,mod=0):
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
210 sk.__init__(self,source,sc,mod)
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
211
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
212 def __str__(self):
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
213 myStr = self.getRolLStr()
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
214
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
215 ## varN = "myStr"
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
216 ## debug(varN)
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
217 ## debug(myStr) ## seg added debug output
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
218
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
219 myStr = " <b><font color='#E42217'>ACTION CHECK : </font></b>"+myStr
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
220 successes = {'CS': " <b><font size=2 color='#8D38C9'>CRITICAL SUCCESS</font></b>",
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
221 'CF': " <b><font size=2 color='#151B54'>CRITICAL FAILURE</font></b><BR> -2 Step make up bonus next Action Check",
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
222 'A': " <b><font size=2 color='#E42217'>AMAZING Success</font></b>",
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
223 'G': " <b><font size=2 color='#306EFF'>Good Success</font></b>",
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
224 'O': " <b><font size=2 color='#52D017'>Ordinary Success</font></b>",
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
225 'F': " <b><font size=2 color='#41627E'>Marginal failure</font></b>"}
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
226 if ( self.d20 == 1 ): myStr += successes['CS'] # SEG Dec 19 2009
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
227 myStr += successes[self.success]
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
228 if ( self.d20 == 1 ) and (self.success == 'F') :
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
229 myStr += " final result ==> "
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
230 myStr += successes['O'] # SEG JAN 23 2010
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
231 if ( self.d20 != 1 ) and (self.success == 'F') :
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
232 myStr += "<BR> -1 Step make up bonus next Action Check"
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
233
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
234 return myStr
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
235
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
236
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
237
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
238
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
239
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
240
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
241
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
242
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
243
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
244
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
245
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
246
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
247
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
248