annotate orpg/dieroller/rollers/alternity.py @ 248:1df5912db00c beta tip

Traipse Beta 'OpenRPG' {101205-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 (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 New ShapeShifter PC Sheet 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 Update to location.py, allows for more portable references when starting Traipse Update to the Features node 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 Server, removing wxPython dependencies where not needed 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 Sun, 05 Dec 2010 10:53:30 -0600
parents 72e0cce81a47
children
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 return myStr
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
122
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
123 def __str__(self):
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
124 myStr = self.getRolLStr()
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
125
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
126 ## varN = "myStr"
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
127 ## debug(varN)
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
128 ## debug(myStr) ## seg added debug output
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
129
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
130 successes = {'CS': " <b><font size=2 color='#8D38C9'>CRITICAL SUCCESS</font></b>",
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
131 'CF': " <b><font size=2 color='#151B54'>CRITICAL FAILURE</font></b>",
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
132 'A': " <b><font size=2 color='#E42217'>AMAZING Success</font></b>",
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
133 'G': " <b><font size=2 color='#306EFF'>Good Success</font></b>",
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
134 'O': " <b><font size=2 color='#52D017'>Ordinary Success</font></b>",
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
135 'F': " <b><font size=2 color='#41627E'>failure</font></b>"}
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
136
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
137 if ( self.d20 == 1 ): myStr += successes['CS'] # SEG Dec 19 2009
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
138 myStr += successes[self.success]
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
139 if ( self.d20 == 1 ) and (self.success == 'F') :
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
140 myStr += " final result ==> "
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
141 myStr += successes['O'] # SEG JAN 23 2010
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
142 return myStr
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
143
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
144 class at(sk):
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
145 ## 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
146 ## 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
147 ## sliced from it, and with the letter attached it created an error.
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
148 ##
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
149 ## 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
150 ## 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
151 ## software will treat it as an object.
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
152
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
153 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
154 sk.__init__(self,source,sc,mod)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
155 self.dmgo = dmgo
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
156 self.dmgg = dmgg
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
157 self.dmga = dmga
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
158
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
159 def getdmg(self,dmgroll):
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
160 astr = "<b>===></b> Damage "
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
161 droll = str(dmgroll[0])
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
162 xyz = droll.split('(')
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
163 secD = (int(xyz[1][:-1])/2) ## SEG* Calculate Secondary Damage
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
164
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
165 ## varN = "secD"
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
166 ## debug(varN)
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
167 ## debug(secD) ## seg added debug output
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
168
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
169 dtype = dmgroll[1]
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
170 astr += droll
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
171 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
172 elif dtype=="w":
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
173 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
174 +") <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
175 elif dtype=="m":
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
176 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
177 +") <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
178 return astr
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
179
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
180 def __str__(self):
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
181 myStr = self.getRolLStr()
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
182
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
183 ## varN = "myStr"
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
184 ## debug(varN)
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
185 ## debug(myStr) ## seg added debug output
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
186
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
187 successes = {'CS': " <b><font size=2 color='#8D38C9'>CRITICAL SUCCESS</font></b>",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
188 'CF': " <b><font size=2 color='#151B54'>CRITICAL FAILURE</font></b>",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
189 'A': " <b><font size=2 color='#E42217'>AMAZING HIT</font></b><BR> ",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
190 'G': " <b><font size=2 color='#306EFF'>Good HIT</font></b><BR> ",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
191 'O': " <b><font size=2 color='#52D017'>Ordinary HIT</font></b><BR> ",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
192 'F': " <b><font size=2 color='#41627E'>miss</font></b>"}
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
193 if ( self.d20 == 1 ):
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
194 myStr += successes['CS'] # SEG Dec 19 2009
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
195
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
196 if ( self.d20 == 1 ) and (self.success == 'F') :
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
197 myStr += successes['F'] # SEG JAN 23 2010
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
198 myStr += " final result ==> "
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
199 self.success = 'O'
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
200
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
201 myStr += successes[self.success]
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
202 if self.success == 'A': myStr += self.getdmg(self.dmga)
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
203 elif self.success == 'G': myStr += self.getdmg(self.dmgg)
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
204 elif self.success == 'O': myStr += self.getdmg(self.dmgo)
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
205 return myStr
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
206
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
207 class ac(sk):
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
208 def __init__(self,source=[],sc=10,mod=0):
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
209 sk.__init__(self,source,sc,mod)
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
210
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
211 def __str__(self):
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
212 myStr = self.getRolLStr()
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
213
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
214 ## varN = "myStr"
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
215 ## debug(varN)
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
216 ## debug(myStr) ## seg added debug output
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
217
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
218 myStr = " <b><font color='#E42217'>ACTION CHECK : </font></b>"+myStr
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
219 successes = {'CS': " <b><font size=2 color='#8D38C9'>CRITICAL SUCCESS</font></b>",
242
72e0cce81a47 Traipse Beta 'OpenRPG' {100817-00}
sirebral
parents: 189
diff changeset
220 'CF': " <b><font size=2 color='#151B54'>CRITICAL FAILURE</font></b>",
189
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
221 'A': " <b><font size=2 color='#E42217'>AMAZING Success</font></b>",
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
222 'G': " <b><font size=2 color='#306EFF'>Good Success</font></b>",
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
223 'O': " <b><font size=2 color='#52D017'>Ordinary Success</font></b>",
7c1a8b36b729 Traipse Beta 'OpenRPG' {100125-00}
sirebral
parents: 187
diff changeset
224 'F': " <b><font size=2 color='#41627E'>Marginal failure</font></b>"}
242
72e0cce81a47 Traipse Beta 'OpenRPG' {100817-00}
sirebral
parents: 189
diff changeset
225 if self.d20 == 1:
72e0cce81a47 Traipse Beta 'OpenRPG' {100817-00}
sirebral
parents: 189
diff changeset
226 myStr += successes['CS']
72e0cce81a47 Traipse Beta 'OpenRPG' {100817-00}
sirebral
parents: 189
diff changeset
227 myStr += ' (' +successes[self.success]+ ' )'
72e0cce81a47 Traipse Beta 'OpenRPG' {100817-00}
sirebral
parents: 189
diff changeset
228 elif self.d20 == 20:
72e0cce81a47 Traipse Beta 'OpenRPG' {100817-00}
sirebral
parents: 189
diff changeset
229 myStr += successes['CF']
72e0cce81a47 Traipse Beta 'OpenRPG' {100817-00}
sirebral
parents: 189
diff changeset
230 myStr += ' (' +successes[self.success]+ ' )'
72e0cce81a47 Traipse Beta 'OpenRPG' {100817-00}
sirebral
parents: 189
diff changeset
231 else: myStr += successes[self.success]
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
232 return myStr
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
233