annotate orpg/dieroller/rollers/alternity.py @ 210:5b1550e604d8 alpha

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