annotate orpg/dieroller/rollers/alternity.py @ 187:24d59375aac9 beta

Traipse Beta 'OpenRPG' {100123-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 (Beta) New Features: Added Bookmarks Added 'boot' command to remote admin Added confirmation window for sent nodes Minor changes to allow for portability to an OpenSUSE linux OS Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG Zoom Mouse plugin added Images added to Plugin UI Switching to Element Tree Map efficiency, from FlexiRPG Added Status Bar to Update Manager New TrueDebug Class in orpg_log (See documentation for usage) Portable Mercurial Tip of the Day added, from Core and community New Reference Syntax added for custom PC sheets New Child Reference for gametree New Parent Reference for gametree New Gametree Recursion method, mapping, context sensitivity, and effeciency.. New Features node with bonus nodes and Node Referencing help added Dieroller structure from Core New DieRoller portability for odd Dice Added 7th Sea die roller; ie [7k3] = [7d10.takeHighest(3).open(10)] New 'Mythos' System die roller added Added new vs. die roller method for WoD; ie [3v3] = [3d10.vs(3)]. Included for Mythos roller also New Warhammer FRPG Die Roller (Special thanks to Puu-san for the support) New EZ_Tree Reference system. Push a button, Traipse the tree, get a reference (Beta!) Fixes: Fix to Text based Server Fix to Remote Admin Commands Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core Fix to Map from gametree not showing to all clients Fix to gametree about menus Fix to Password Manager check on startup Fix to PC Sheets from tool nodes. They now use the tabber_panel Fix to Whiteboard ID to prevent random line or text deleting. Fixes to Server, Remote Server, and Server GUI Fix to Update Manager; cleaner clode for saved repositories Fixes made to Settings Panel and now reactive settings when Ok is pressed Fixes to Alternity roller's attack roll. Uses a simple Tuple instead of a Splice Fix to Use panel of Forms and Tabbers. Now longer enters design mode Fix made Image Fetching. New fetching image and new failed image Modified ID's to prevent non updated clients from ruining the fix. default_manifest.xml renamed to default_upmana.xml
author sirebral
date Sat, 23 Jan 2010 03:46:56 -0600
parents dcae32e219f1
children 7c1a8b36b729
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 #
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
28 # SEG: JAN 21 2010 - v.1.2 O'Flux Release:
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.
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
31 # Tested for Traipse on Win 7
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
32 #
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
33 # Skill Check Example:
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
34 # [1d20.sk(12,-2)]
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
35 # OUTPUT Example:
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
36 # => [6,-3] = (3) AMAZING Success
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
37 #
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
38 # Pistol, Laser; 0 step -- Attack Example:
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
39 # [1d20.at(12,0,(1d4+1,"w"),(1d6+1,"w"),(1d4,"m"))]
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
40 # OUTPUT Example:
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
41 # => [1,0] = (1) CRITICAL SUCCESS AMAZING HIT
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
42 # ===> Damage [4] = (4) mortal ======> Secondary Damage (2) stun / (2) wound
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
43 #
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
44 # Action Check Example:
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
45 # [1d20.ac(14,-1)]
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
46 # OUTPUT Example:
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
47 # => ACTION CHECK : [18,-3] = (15) Marginal failure
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
48 # -1 Step make up bonus next Action Check
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
49 #
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
50 #
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
51
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
52 import re
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
53
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
54 from std import std
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
55 from time import time, clock
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
56 from orpg.dieroller.base import di, die_base, die_rollers
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
57
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
58 ## from orpg.tools.orpg_log import debug
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
59
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
60
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
61 __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
62
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
63 # Alternity stands for "Alternity system" 20 sided die plus mods
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
64
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
65 class alternity(std):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
66 name = "alternity" # ADDED by SEG Nov 2009 ***
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
67
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
68 def __init__(self,source=[]):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
69 std.__init__(self,source)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
70
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
71 # these methods return new die objects for specific options
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
72 def sk(self,score,mod):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
73 return sk(self,score,mod)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
74
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
75 def at(self,score,mod,dmgo,dmgg,dmga):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
76 return at(self,score,mod,dmgo,dmgg,dmga)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
77
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
78 def ac(self,score,mod):
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
79 return ac(self,score,mod)
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
80
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
81 die_rollers.register(alternity)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
82
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
83 class sk(std):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
84 def __init__(self,source=[],sc="10/5/2",mod=0):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
85 std.__init__(self,source)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
86 m = re.match( r"\d+", str(sc) )
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
87 self.score = int( m.group(0) )
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
88 self.mod = mod
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
89
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
90 def getMod(self,mod=0):
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
91 m=0
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
92 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
93 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
94 if mod in mods.keys(): m = mods[mod].value
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
95 elif mod <= -5: m=-di(20).value
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
96 elif mod == 6: m=di(20).value + di(20).value
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
97 elif mod >= 7: m=di(20).value + di(20).value + di(20).value
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
98 return m
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
99
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
100 def getRolLStr(self):
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
101 myStr = "[" + str(self.data[0])
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
102 self.d20 = self.sum()
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
103 amod = self.getMod(self.mod)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
104 self.dieRoll = self.d20 + amod
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
105 for a in self.data[1:]:
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
106 myStr += ","
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
107 myStr += str(a)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
108 myStr += "," + str(amod) + "] = (" + str(self.dieRoll) + ")"
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
109 ## if ( self.d20 == 1 ): self.success = 'CS' # seg - removed - unneeded ** #
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
110 if ( self.dieRoll <= self.score / 4 ): self.success = 'A'
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
111 elif ( self.dieRoll <= self.score / 2 ): self.success = 'G'
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
112 elif ( self.dieRoll <= self.score ): self.success = 'O'
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
113 else: self.success = 'F'
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
114 if ( self.d20 == 20 ): self.success = 'CF'
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
115 return myStr
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
116
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
117 def __str__(self):
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
118 myStr = self.getRolLStr()
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
119 successes = {'CS': " <b><font color='#00aa00'>CRITICAL SUCCESS</font></b>",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
120 'CF': " <b><font color='#ff0000'>CRITICAL FAILURE</font></b>",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
121 'A': " <b><font color='#00aa00'>AMAZING Success</b>",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
122 'G': " <b>Good Success</b>",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
123 'O': " <b>Ordinary Success</b>",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
124 'F': " <b>failure</b>"}
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
125 if ( self.d20 == 1 ): myStr += successes['CS'] # SEG Dec 19 2009
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
126 myStr += successes[self.success]
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
127 return myStr
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
128
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
129 class at(sk):
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
130 ## 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
131 ## 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
132 ## sliced from it, and with the letter attached it created an error.
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
133 ##
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
134 ## 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
135 ## 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
136 ## software will treat it as an object.
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
137
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
138 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
139 sk.__init__(self,source,sc,mod)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
140 self.dmgo = dmgo
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
141 self.dmgg = dmgg
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
142 self.dmga = dmga
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
143
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
144 def getdmg(self,dmgroll):
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
145 astr = "<b>===></b> Damage "
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
146 droll = str(dmgroll[0])
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
147 xyz = droll.split('(')
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
148 secD = (int(xyz[1][:-1])/2) ## SEG* Calculate Secondary Damage
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
149 ## debug(secD) ## seg added debug output
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
150 dtype = dmgroll[1]
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
151 astr += droll
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
152 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
153 elif dtype=="w":
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
154 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
155 +") <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
156 elif dtype=="m":
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
157 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
158 +") <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
159 return astr
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
160
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
161 def __str__(self):
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
162 myStr = self.getRolLStr()
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
163 successes = {'CS': " <b><font size=2 color='#8D38C9'>CRITICAL SUCCESS</font></b>",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
164 'CF': " <b><font size=2 color='#151B54'>CRITICAL FAILURE</font></b>",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
165 'A': " <b><font size=2 color='#E42217'>AMAZING HIT</font></b><BR> ",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
166 'G': " <b><font size=2 color='#306EFF'>Good HIT</font></b><BR> ",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
167 'O': " <b><font size=2 color='#52D017'>Ordinary HIT</font></b><BR> ",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
168 'F': " <b><font size=2 color='#41627E'>miss</font></b>"}
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
169 if ( self.d20 == 1 ): myStr += successes['CS'] # SEG Dec 19 2009
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
170 myStr += successes[self.success]
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
171 if self.success == 'A': myStr += self.getdmg(self.dmga)
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
172 elif self.success == 'G': myStr += self.getdmg(self.dmgg)
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
173 elif self.success == 'O': myStr += self.getdmg(self.dmgo)
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
174 return myStr
187
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
175
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
176 class ac(sk):
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
177 def __init__(self,source=[],sc=10,mod=0):
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
178 sk.__init__(self,source,sc,mod)
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
179
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
180 def GetRoLLStr(self):
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
181 myStr = "[" + str(self.data[0])
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
182 self.d20 = self.sum()
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
183 amod = self.getMod(self.mod)
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
184 self.dieRoll = self.d20 + amod
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
185 for a in self.data[1:]:
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
186 myStr += ","
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
187 myStr += str(a)
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
188 myStr += "," + str(amod) + "] = (" + str(self.dieRoll) + ")"
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
189 if ( self.dieRoll <= self.score / 4 ): self.success = 'A'
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
190 elif ( self.dieRoll <= self.score / 2 ): self.success = 'G'
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
191 elif ( self.dieRoll <= self.score ): self.success = 'O'
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
192 else: self.success = 'F'
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
193 if ( self.d20 == 20 ): self.success = 'CF'
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
194 return myStr
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
195
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
196 def __str__(self):
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
197 myStr = self.GetRoLLStr()
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
198 myStr = " <b><font color='#E42217'>ACTION CHECK : </font></b>"+myStr
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
199 successes = {'CS': " <b><font color='#00aa00'>CRITICAL SUCCESS</font></b>",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
200 'CF': " <b><font color='#ff0000'>CRITICAL FAILURE</font></b><BR> -2 Step make up bonus next Action Check",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
201 'A': " <b><font color='#00aa00'>AMAZING Success</b>",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
202 'G': " <b>Good Success</b>",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
203 'O': " <b>Ordinary Success</b>",
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
204 'F': " <b>Marginal failure</b><BR> -1 Step make up bonus next Action Check"}
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
205 if ( self.d20 == 1 ): myStr += successes['CS'] # SEG Dec 19 2009
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
206 myStr += successes[self.success]
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
207 return myStr
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
208
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
209
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
210
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
211
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
212
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
213
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
214
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
215
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
216
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
217
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
218
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
219
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
220
24d59375aac9 Traipse Beta 'OpenRPG' {100123-01}
sirebral
parents: 184
diff changeset
221