annotate orpg/dieroller/rollers/hackmaster.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 dcae32e219f1
children
rev   line source
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
1 #!/usr/bin/env python
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
2 # Copyright Not Yet, see how much I trust you
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
3 #
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
4 # openrpg-dev@lists.sourceforge.net
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
5 #
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
6 # This program is free software; you can redistribute it and/or modify
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
7 # it under the terms of the GNU General Public License as published by
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
8 # the Free Software Foundation; either version 2 of the License, or
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
9 # (at your option) any later version.
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
10 #
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
11 # This program is distributed in the hope that it will be useful,
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
14 # GNU General Public License for more details.
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
15 #
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
16 # You should have received a copy of the GNU General Public License
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
17 # along with this program; if not, write to the Free Software
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
18 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
19 # --
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
20 #
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
21 # File: hackmaster.py
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
22 # Author: Ric Soard
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
23 # Maintainer:
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
24 # Version:
184
dcae32e219f1 Traipse Beta 'OpenRPG' {100117-00}
sirebral
parents: 171
diff changeset
25 # $Id: hackmaster.py,v Traipse 'Ornery-Orc' prof.ebral Exp
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
26 #
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
27 # Description: special die roller for HackMaster(C)(TM) RPG
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
28 # has penetration damage - .damage(bonus,honor)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
29 # has attack - .attack(bonus, honor)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
30 # has severity .severity(honor)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
31 # has help - .help()
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
32 #
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
33 #
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
34
184
dcae32e219f1 Traipse Beta 'OpenRPG' {100117-00}
sirebral
parents: 171
diff changeset
35 __version__ = "$Id: hackmaster.py,v Traipse 'Ornery-Orc' prof.ebral Exp $"
171
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
36
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
37 import random
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
38 from std import std
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
39 from orpg.dieroller.base import *
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
40
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
41 #hackmaster Class basically passes into functional classes
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
42 class hackmaster(std):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
43 name = "hackmaster"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
44
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
45 def __init__(self,source=[]):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
46 std.__init__(self,source)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
47
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
48 def damage(self, mod, hon):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
49 return HMdamage(self, mod, hon)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
50
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
51 def attack(self, mod, hon):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
52 return HMattack(self, mod, hon)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
53
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
54 def help(self):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
55 return HMhelp(self)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
56
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
57 def severity(self, honor):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
58 return HMSeverity(self, honor)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
59
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
60 die_rollers.register(hackmaster)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
61
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
62 # HM Damage roller - rolles penetration as per the PHB - re-rolles on max die - 1, adds honor to the penetration rolls
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
63 # and this appears to be invisible to the user ( if a 4 on a d4 is rolled a 3 will appear and be followed by another
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
64 # die. if High honor then a 4 will appear followed by a another die.
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
65 class HMdamage(std):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
66 def __init__(self,source=[], mod = 0, hon = 0):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
67 std.__init__(self,source)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
68 self.mod = mod
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
69 self.hon = hon
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
70 self.check_pen()
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
71 #here we roll the mod die
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
72 self.append(static_di(self.mod))
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
73 #here we roll the honor die
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
74 self.append(static_di(self.hon))
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
75
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
76 def damage(mod = 0, hon = 0):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
77 self.mod = mod
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
78 self.hon = hon
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
79
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
80 # This function is called by default to display the die string to the chat window.
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
81 # Our die string attempts to explain the results
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
82 def __str__(self):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
83 myStr = "Damage "
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
84 myStr += "[Damage Roll, Modifiers, Honor]: " + " [" + str(self.data[0])
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
85 for a in self.data[1:]:
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
86 myStr += ","
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
87 myStr += str(a)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
88 myStr += "] = (" + str(self.sum()) + ")"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
89
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
90 return myStr
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
91
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
92 # This function checks to see if we need to reroll for penetration
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
93 def check_pen(self):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
94 for i in range(len(self.data)):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
95 if self.data[i].lastroll() >= self.data[i].sides:
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
96 self.pen_roll(i)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
97
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
98 #this function rolls the penetration die, and checks to see if it needs to be re-rolled again.
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
99 def pen_roll(self,num):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
100 result = int(random.uniform(1,self.data[num].sides+1))
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
101 self.data[num].value += (result - 1 + self.hon)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
102 self.data[num].history.append(result - 1 + self.hon)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
103 if result >= self.data[num].sides:
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
104 self.pen_roll(num)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
105
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
106 # this function rolls for the HM Attack. the function checks for a 20 and displays critical, and a 1
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
107 # and displays fumble
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
108 class HMattack(std):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
109 def __init__(self, source=[], mod = 0, base_severity = 0, hon = 0, size = 0):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
110 std.__init__(self,source)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
111 self.size = size
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
112 self.mod = mod
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
113 self.base_severity = base_severity
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
114 self.hon = hon
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
115 self.fumble = 0
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
116 self.crit = 0
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
117 self.check_crit()
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
118 #this is a static die that adds the modifier
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
119 self.append(static_di(self.mod))
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
120 #this is a static die that adds honor, we want high rolls so it's +1
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
121 self.append(static_di(self.hon))
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
122
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
123 def check_crit(self):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
124 if self.data[0] == self.data[0].sides:
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
125 self.crit = 1
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
126 if self.data[0] == 1:
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
127 self.fumble = 1
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
128
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
129
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
130 #this function is the out put to the chat window, it basicaly just displays the roll unless
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
131 #it's a natural 20, or a natural 1
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
132 def __str__(self):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
133 if self.crit > 0:
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
134 myStr = "Critical Hit!!: "
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
135 elif self.fumble > 0:
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
136 myStr = "FUMBLE!!"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
137 else:
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
138 myStr = "To Hit:"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
139 myStr += "[To Hit Roll, Modifiers, Honor]" + " [" + str(self.data[0])
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
140 for a in self.data[1:]:
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
141 myStr += ","
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
142 myStr += str(a)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
143 myStr += "] = (" + str(self.sum()) + ")"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
144 return myStr
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
145
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
146 class HMhelp(std):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
147 def __init__(self,source=[]):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
148 std.__init__(self,source)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
149 self.source = source
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
150
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
151 def __str__(self):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
152 myStr = " <br /> .attack(Bonus, Honor): <br />"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
153 myStr += " The attack roll rolles the dice and adds your bonus <br />"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
154 myStr += " and honor modifier and returns you final roll. <br />"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
155 myStr += " On a natural 20 the dieroller displays Critical Hit!! <br />"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
156 myStr += " On a natural 1 the dieroller displays FUMBLE!! <br />"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
157 myStr += " Example A 1st level fighter with +1 to hit and a +2 sword and High Honor <br />"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
158 myStr += " would roll [1d20.attack(3,1)] <br />"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
159 myStr += " .damage(Bonus, Honor): <br />"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
160 myStr += " The damage roll rolls the dice and rerolls on a max roll for <br />"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
161 myStr += " penetration damage, the penetration die is -1 and is rerolled on a max roll <br />"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
162 myStr += " The roller returns the damage dice, monidifiers, and honor <br />"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
163 myStr += " Example A magic-user uses a quaterstaff +1 with high honor, he would roll <br />"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
164 myStr += " [1d6.damage(1,1)] <br />"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
165 myStr += " .severity(honor): <br />"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
166 myStr += " the severity is for critical hit resolution - the character rolls <br />"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
167 myStr += " a d8 and adds honor bonus. the die is rerolled on natural 8 and natural 1 with a -1 modifier <br />"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
168 myStr += " on an 8 the reroll is added on a 1 the reroll is subtracted <br />"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
169 myStr += " Example [1d8.severity(1)] <br />"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
170 myStr += " .help() : <br />"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
171 myStr += " displays this message <br />"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
172 return myStr
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
173
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
174 # the severity roll is for critical resolution. The die is rerolled and added
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
175 #on a natural 8 and rerolled and subtracted on a 1
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
176 class HMSeverity(std):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
177 def __init__(self, source =[], honor=0):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
178 std.__init__(self,source)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
179 self.source = source
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
180 self.hon = honor
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
181 self.data = []
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
182 self.append(di(8))
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
183 self.CheckReroll()
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
184 self.append(static_di(self.hon))
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
185
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
186 def __str__(self):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
187 myStr = "[Severity Dice, Honor]" + " [" + str(self.data[0])
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
188 for a in self.data[1:]:
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
189 myStr += ","
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
190 myStr += str(a)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
191 myStr += "] = (" + str(self.sum()) + ")"
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
192 return myStr
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
193
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
194 def CheckReroll(self):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
195 if self.data[0] == self.data[0].sides:
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
196 self.crit_chain(0,1)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
197 if self.data[0] == 1:
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
198 self.crit_chain(0,-1)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
199
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
200 #this function needes moved for severity
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
201 def crit_chain(self,num,neg):
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
202 result = int(random.uniform(1,self.data[num].sides+1))
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
203 self.data[num].value += (((result - 1) * neg) + self.hon)
ff48c2741fe7 Traipse Beta 'OpenRPG' {091210-00}
sirebral
parents:
diff changeset
204 self.data[num].history.append(((result - 1) * neg) + self.hon)
184
dcae32e219f1 Traipse Beta 'OpenRPG' {100117-00}
sirebral
parents: 171
diff changeset
205 if result >= self.data[num].sides: self.crit_chain(num,1)
dcae32e219f1 Traipse Beta 'OpenRPG' {100117-00}
sirebral
parents: 171
diff changeset
206 if result == 1: self.crit_chain(num,-1)
dcae32e219f1 Traipse Beta 'OpenRPG' {100117-00}
sirebral
parents: 171
diff changeset
207