annotate orpg/dieroller/hackmaster.py @ 156:3b6888bb53b5 beta

Traipse Beta 'OpenRPG' {091125-02} 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) Added Bookmarks Fix to Remote Admin Commands Minor fix to text based Server Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core 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 default_manifest.xml renamed to default_upmana.xml Cleaner clode for saved repositories New TrueDebug Class in orpg_log (See documentation for usage) Mercurial's hgweb folder is ported to upmana Pretty important update that can help remove thousands of dead children from your gametree. Children, <forms />, <group_atts />, <horizontal />, <cols />, <rows />, <height />, etc... are all tags now. Check your gametree and look for dead children!! New Gametree Recursion method, mapping, and context sensitivity. !Infinite Loops return error instead of freezing the software! New Syntax added for custom PC sheets Tip of the Day added, from Core and community Fixed Whiteboard ID to prevent random line or text deleting. Modified ID's to prevent non updated clients from ruining the fix.
author sirebral
date Wed, 25 Nov 2009 12:34:04 -0600
parents 449a8900f9ac
children
rev   line source
156
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
1 #!/usr/bin/env python
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
2 # Copyright Not Yet, see how much I trust you
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
3 #
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
4 # openrpg-dev@lists.sourceforge.net
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
5 #
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
6 # This program is free software; you can redistribute it and/or modify
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
7 # it under the terms of the GNU General Public License as published by
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
8 # the Free Software Foundation; either version 2 of the License, or
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
9 # (at your option) any later version.
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
10 #
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
11 # This program is distributed in the hope that it will be useful,
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
14 # GNU General Public License for more details.
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
15 #
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
16 # You should have received a copy of the GNU General Public License
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
17 # along with this program; if not, write to the Free Software
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
18 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
19 # --
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
20 #
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
21 # File: hackmaster.py
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
22 # Author: Ric Soard
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
23 # Maintainer:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
24 # Version:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
25 # $Id: hackmaster.py,v 0.4 2003/08/12
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
26 #
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
27 # Description: special die roller for HackMaster(C)(TM) RPG
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
28 # has penetration damage - .damage(bonus,honor)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
29 # has attack - .attack(bonus, honor)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
30 # has severity .severity(honor)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
31 # has help - .help()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
32 #
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
33 #
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
34 import random
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
35 from die import *
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
36
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
37 __version__ = "$Id: hackmaster.py,v 1.8 2006/11/15 12:11:22 digitalxero Exp $"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
38
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
39 #hackmaster Class basically passes into functional classes
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
40 class hackmaster(std):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
41
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
42 def __init__(self,source=[]):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
43 std.__init__(self,source)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
44
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
45
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
46 def damage(self, mod, hon):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
47 return HMdamage(self, mod, hon)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
48
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
49
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
50 def attack(self, mod, hon):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
51 return HMattack(self, mod, hon)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
52
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
53
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
54 def help(self):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
55 return HMhelp(self)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
56
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
57
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
58 def severity(self, honor):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
59 return HMSeverity(self, honor)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
60
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
61
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
62 # HM Damage roller - rolles penetration as per the PHB - re-rolles on max die - 1, adds honor to the penetration rolls
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
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
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
64 # die. if High honor then a 4 will appear followed by a another die.
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
65 class HMdamage(std):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
66
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
67 def __init__(self,source=[], mod = 0, hon = 0):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
68 std.__init__(self,source)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
69 self.mod = mod
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
70 self.hon = hon
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
71 self.check_pen()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
72 #here we roll the mod die
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
73 self.append(static_di(self.mod))
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
74 #here we roll the honor die
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
75 self.append(static_di(self.hon))
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
76
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
77
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
78 def damage(mod = 0, hon = 0):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
79 self.mod = mod
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
80 self.hon = hon
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
81
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
82 # This function is called by default to display the die string to the chat window.
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
83 # Our die string attempts to explain the results
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
84
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
85 def __str__(self):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
86 myStr = "Damage "
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
87 myStr += "[Damage Roll, Modifiers, Honor]: " + " [" + str(self.data[0])
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
88 for a in self.data[1:]:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
89 myStr += ","
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
90 myStr += str(a)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
91 myStr += "] = (" + str(self.sum()) + ")"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
92
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
93 return myStr
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
94
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
95 # This function checks to see if we need to reroll for penetration
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
96
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
97 def check_pen(self):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
98 for i in range(len(self.data)):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
99 if self.data[i].lastroll() >= self.data[i].sides:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
100 self.pen_roll(i)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
101
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
102 #this function rolls the penetration die, and checks to see if it needs to be re-rolled again.
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
103
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
104 def pen_roll(self,num):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
105 result = int(random.uniform(1,self.data[num].sides+1))
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
106 self.data[num].value += (result - 1 + self.hon)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
107 self.data[num].history.append(result - 1 + self.hon)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
108 if result >= self.data[num].sides:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
109 self.pen_roll(num)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
110
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
111 # this function rolls for the HM Attack. the function checks for a 20 and displays critical, and a 1
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
112 # and displays fumble
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
113 class HMattack(std):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
114
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
115 def __init__(self, source=[], mod = 0, base_severity = 0, hon = 0, size = 0):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
116 std.__init__(self,source)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
117 self.size = size
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
118 self.mod = mod
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
119 self.base_severity = base_severity
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
120 self.hon = hon
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
121 self.fumble = 0
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
122 self.crit = 0
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
123 self.check_crit()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
124 #this is a static die that adds the modifier
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
125 self.append(static_di(self.mod))
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
126 #this is a static die that adds honor, we want high rolls so it's +1
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
127 self.append(static_di(self.hon))
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
128
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
129
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
130
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
131 def check_crit(self):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
132 if self.data[0] == self.data[0].sides:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
133 self.crit = 1
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
134 if self.data[0] == 1:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
135 self.fumble = 1
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
136
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
137
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
138 #this function is the out put to the chat window, it basicaly just displays the roll unless
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
139 #it's a natural 20, or a natural 1
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
140
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
141 def __str__(self):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
142 if self.crit > 0:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
143 myStr = "Critical Hit!!: "
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
144 elif self.fumble > 0:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
145 myStr = "FUMBLE!!"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
146 else:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
147 myStr = "To Hit:"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
148 myStr += "[To Hit Roll, Modifiers, Honor]" + " [" + str(self.data[0])
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
149 for a in self.data[1:]:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
150 myStr += ","
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
151 myStr += str(a)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
152 myStr += "] = (" + str(self.sum()) + ")"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
153 return myStr
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
154
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
155 class HMhelp(std):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
156
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
157 def __init__(self,source=[]):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
158 std.__init__(self,source)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
159 self.source = source
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
160
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
161
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
162 def __str__(self):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
163 myStr = " <br /> .attack(Bonus, Honor): <br />"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
164 myStr += " The attack roll rolles the dice and adds your bonus <br />"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
165 myStr += " and honor modifier and returns you final roll. <br />"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
166 myStr += " On a natural 20 the dieroller displays Critical Hit!! <br />"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
167 myStr += " On a natural 1 the dieroller displays FUMBLE!! <br />"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
168 myStr += " Example A 1st level fighter with +1 to hit and a +2 sword and High Honor <br />"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
169 myStr += " would roll [1d20.attack(3,1)] <br />"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
170 myStr += " .damage(Bonus, Honor): <br />"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
171 myStr += " The damage roll rolls the dice and rerolls on a max roll for <br />"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
172 myStr += " penetration damage, the penetration die is -1 and is rerolled on a max roll <br />"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
173 myStr += " The roller returns the damage dice, monidifiers, and honor <br />"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
174 myStr += " Example A magic-user uses a quaterstaff +1 with high honor, he would roll <br />"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
175 myStr += " [1d6.damage(1,1)] <br />"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
176 myStr += " .severity(honor): <br />"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
177 myStr += " the severity is for critical hit resolution - the character rolls <br />"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
178 myStr += " a d8 and adds honor bonus. the die is rerolled on natural 8 and natural 1 with a -1 modifier <br />"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
179 myStr += " on an 8 the reroll is added on a 1 the reroll is subtracted <br />"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
180 myStr += " Example [1d8.severity(1)] <br />"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
181 myStr += " .help() : <br />"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
182 myStr += " displays this message <br />"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
183
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
184 return myStr
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
185
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
186 # the severity roll is for critical resolution. The die is rerolled and added
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
187 #on a natural 8 and rerolled and subtracted on a 1
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
188 class HMSeverity(std):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
189
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
190 def __init__(self, source =[], honor=0):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
191 std.__init__(self,source)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
192 self.source = source
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
193 self.hon = honor
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
194 self.data = []
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
195 self.append(di(8))
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
196 self.CheckReroll()
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
197 self.append(static_di(self.hon))
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
198
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
199
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
200
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
201 def __str__(self):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
202 myStr = "[Severity Dice, Honor]" + " [" + str(self.data[0])
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
203 for a in self.data[1:]:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
204 myStr += ","
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
205 myStr += str(a)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
206 myStr += "] = (" + str(self.sum()) + ")"
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
207 return myStr
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
208
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
209
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
210 def CheckReroll(self):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
211 if self.data[0] == self.data[0].sides:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
212 self.crit_chain(0,1)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
213 if self.data[0] == 1:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
214 self.crit_chain(0,-1)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
215
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
216 #this function needes moved for severity
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
217
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
218 def crit_chain(self,num,neg):
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
219 result = int(random.uniform(1,self.data[num].sides+1))
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
220 self.data[num].value += (((result - 1) * neg) + self.hon)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
221 self.data[num].history.append(((result - 1) * neg) + self.hon)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
222 if result >= self.data[num].sides:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
223 self.crit_chain(num,1)
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
224 if result == 1:
3b6888bb53b5 Traipse Beta 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
225 self.crit_chain(num,-1)