annotate orpg/dieroller/runequest.py @ 155:bf799efe7a8a alpha

Traipse Alpha '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 (Cleaning up for 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:32:34 -0600
parents 449a8900f9ac
children
rev   line source
155
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
1
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
2
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
3
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
4
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
5 # (at your option) any later version.
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
6 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
7 # This program is distributed in the hope that it will be useful,
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
10 # GNU General Public License for more details.
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
11 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
12 # You should have received a copy of the GNU General Public License
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
13 # along with this program; if not, write to the Free Software
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
14 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
15 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
16 #-------------------------------------------------------------------------
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
17 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
18 # Usage:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
19 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
20 # Die Roller: /dieroller rq
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
21 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
22 # Skill Roll: [1d100.skill(50,0,0)] # ( skill%, modifer, MA% )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
23 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
24 # Parry Roll: [1d100.parry(50,0,0,12)] # ( skill%, modifer, MA%, Weapon/Shield AP )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
25 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
26 # Dodge Roll: [1d100.parry(50,0,0)] # ( skill%, modifer, MA% )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
27 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
28 # Attack Roll: [1d100.attack(50,0,0,2,9,3,0)]
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
29 # ( skill%, modifer, MA%, min weap dam, max weap dam, dam bonus, truesword )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
30 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
31 # Sorcery Roll: [1d100.sorcery(90, 0, 3, 6, 1, 1, 1)]
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
32 # (sk, mod, pow, cer, int, acc, mlt)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
33 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
34 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
35 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
36 # Skill Training Unlimited Roll: [1d100.trainskill(30,75)] # (starting skill%, desired skill%)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
37 # Skill Training Cost Limited: [1d100.trainskillcost(1000, 50) # (payment, starting skill%)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
38 # Skill Training Time Limited: [1d100.trainskilltime(150, 50) # (time, strting skill%)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
39 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
40 #-------------------------------------------------------------------------
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
41 # --
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
42 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
43 # File: rq.py
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
44 # Version:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
45 # $Id: rq.py,v .1 pelwer
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
46 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
47 # Description: Runequest die roller originally based on Heroman's Hero Dieroller
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
48 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
49 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
50 # v.1 - pelwer - 2/5/2005
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
51 # o Original release
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
52 # v.2 - pelwer - 10/30/2006
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
53 # o Ported to openrpg+ by removing dependance on whrandom
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
54 # o Fixed Riposte spelling
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
55 # o Deleted sorcalc - never used
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
56 # o Added Sorcery Fumble table to sorcery spell roller
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
57 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
58
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
59 from die import *
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
60 from time import time, clock
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
61 import random
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
62 from math import floor
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
63
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
64 __version__ = "$Id: runequest.py,v 1.4 2006/11/15 12:11:22 digitalxero Exp $"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
65
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
66 # rq stands for "Runequest"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
67
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
68 class runequest(std):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
69
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
70 def __init__(self,source=[]):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
71 std.__init__(self,source)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
72
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
73 # these methods return new die objects for specific options
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
74
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
75
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
76 def skill(self,sk,mod,ma):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
77 return rqskill(self,sk,mod,ma)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
78
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
79
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
80 def parry(self,sk,mod,ma,AP):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
81 return rqparry(self,sk,mod,ma,AP)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
82
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
83
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
84 def dodge(self,sk,mod,ma):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
85 return rqdodge(self,sk,mod,ma)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
86
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
87
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
88 def attack(self,sk,mod,ma,mindam,maxdam,bondam,trueswd):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
89 return rqattack(self,sk,mod,ma,mindam,maxdam,bondam,trueswd)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
90
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
91
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
92 def sorcery(self,sk,mod,pow,cer,int,acc,mlt):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
93 return rqsorcery(self,sk,mod,pow,cer,int,acc,mlt)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
94
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
95
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
96 def trainskill(self,initial,final):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
97 return rqtrainskill(self,initial,final)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
98
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
99
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
100 def trainskillcost(self,cost,sk):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
101 return rqtrainskillcost(self,cost,sk)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
102
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
103
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
104 def trainskilltime(self,time,sk):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
105 return rqtrainskilltime(self,time,sk)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
106
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
107 # RQ Skill Training Cost/Time unlimited
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
108 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
109 # [1d100.trainskill(10,20)]
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
110 # initial skill%, final skill%
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
111 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
112 # sk = skill %
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
113 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
114 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
115 class rqtrainskill(std):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
116
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
117 def __init__(self,source=[],initial=11,final=0):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
118 std.__init__(self,source)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
119 self.s = initial
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
120 self.f = final
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
121
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
122
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
123 def __str__(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
124 myStr = "Unrestricted Training"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
125
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
126 if self.s == 0:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
127 myStr = "Initial training completed for Cost(50) Time(20) Skill(1 + modifier)"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
128 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
129 cost = 0
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
130 time = 0
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
131 myStr = "Training: "
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
132
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
133 while self.s < self.f and self.s < 75:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
134 cost += self.s * 5
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
135 time += self.s * 1
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
136 self.s += random.uniform(1,4) + 1
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
137
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
138 myStr = "Training completed:\n"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
139 myStr += "\tCost(" + str(int(cost)) + ")\n"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
140 myStr += "\tTime(" + str(int(time)) + ")\n"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
141 myStr += "\tSkill(" + str(int(self.s)) + ")"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
142
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
143 return myStr
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
144
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
145
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
146 # RQ Skill Training Cost Limited
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
147 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
148 # [1d100.trainskillcost(50,0)]
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
149 # cost, skill%
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
150 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
151 # cost = cash for training
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
152 # sk = skill %
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
153 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
154 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
155 class rqtrainskillcost(std):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
156
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
157 def __init__(self,source=[],cost=11,sk=0):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
158 std.__init__(self,source)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
159 self.cost = cost
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
160 self.sk = sk
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
161
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
162
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
163 def __str__(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
164 myStr = ""
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
165
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
166 if self.sk == 0 and self.cost >= 50:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
167 myStr = "Initial training completed for Cost(50), Time(50), Skill(1 + modifier)"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
168 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
169 cost = 0
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
170 time = 0
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
171 icost = self.sk * 5
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
172
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
173 myStr = "Training: "
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
174
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
175 while (cost + icost) < self.cost:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
176 if self.sk >= 75:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
177 break
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
178
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
179 cost += icost
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
180 time += self.sk * 1
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
181 self.sk += random.uniform(1,4) + 1
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
182 icost = self.sk * 5
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
183
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
184 myStr = "Training completed: "
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
185 myStr += "Cost(" + str(int(cost)) + ") "
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
186 myStr += "Time(" + str(int(time)) + ") "
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
187 myStr += "Skill(" + str(int(self.sk)) + ")"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
188
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
189 return myStr
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
190
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
191
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
192 # RQ Skill Training Time Limited
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
193 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
194 # [1d100.trainskilltime(50,0)]
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
195 # time, skill%
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
196 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
197 # time = time for training
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
198 # sk = skill %
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
199 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
200 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
201 class rqtrainskilltime(std):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
202
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
203 def __init__(self,source=[],time=11,sk=0):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
204 std.__init__(self,source)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
205 self.time = time
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
206 self.sk = sk
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
207
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
208
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
209 def __str__(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
210 myStr = ""
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
211
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
212 if self.sk == 0 and self.time >= 20:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
213 myStr = "Initial training completed for Cost(50), Time(50), Skill(1 + modifier)"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
214 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
215 cost = 0
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
216 time = 0
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
217 itime = self.sk * 1
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
218
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
219 myStr = "Trainingsss: "
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
220
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
221 while (time + itime) < self.time:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
222 if self.sk >= 75:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
223 break
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
224
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
225 cost += self.sk * 5
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
226 time += itime
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
227 self.sk += random.uniform(1,4) + 1
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
228 itime = self.sk * 5
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
229
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
230 myStr = "Training completed: "
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
231 myStr += "Cost(" + str(int(cost)) + ") "
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
232 myStr += "Time(" + str(int(time)) + ") "
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
233 myStr += "Skill(" + str(int(self.sk)) + ")"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
234
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
235 return myStr
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
236
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
237 # RQ Skill Roll
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
238 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
239 # [1d100.skill(50,0,0)]
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
240 # skill%, modifer, ma%
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
241 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
242 # sk = skill %
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
243 # mod = modifier %
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
244 # ma = martial arts %
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
245 # skill = sk + mod
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
246 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
247 # success roll <= skill
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
248 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
249 # failure roll > skill
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
250 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
251 # crit
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
252 # push( @{$::Cre{Weapons}{$weap_cnt}}, POSIX::floor( skill/20 ) );
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
253 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
254 # special
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
255 # push( @{$::Cre{Weapons}{$weap_cnt}}, POSIX::floor( $skill/5 ) );
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
256 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
257 # fumble: if ( $skill > 100 ) { $fum = 0; } else { $fum = 100 - $skill; }
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
258 # $fum = 100 - POSIX::floor( $fum/20 );
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
259 # if ( $fum == 100 ) { $fum = '00'; };
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
260 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
261 class rqskill(std):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
262
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
263 def __init__(self,source=[],sk=11,mod=0,ma=0):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
264 std.__init__(self,source)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
265 self.sk = sk
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
266 self.mod = mod
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
267 self.ma = ma
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
268
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
269
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
270 def is_success(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
271 return (((self.sum() <= (self.sk + self.mod)) or (self.sum() <= 5)) and (self.sum() <= 95))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
272
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
273
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
274 def is_ma(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
275 return (self.sum() <= self.ma)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
276
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
277
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
278 def is_special(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
279 return (self.sum() <= int(floor((self.sk + self.mod)/5)))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
280
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
281
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
282 def is_critical(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
283 return (self.sum() <= int(floor((self.sk + self.mod) / 20)))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
284
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
285
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
286 def is_fumble(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
287 if ( self.sk >= 100 ):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
288 fum = 0
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
289 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
290 fum = (100 - self.sk )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
291 final_fum = ( 100 - int( floor( fum/20 ) ) )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
292 return ( self.sum() >= final_fum )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
293
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
294
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
295 def __str__(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
296 strAdd="+"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
297 swapmod= self.mod
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
298 if self.mod < 0:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
299 strAdd= "-"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
300 swapmod= -self.mod
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
301 modSum = self.sum()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
302 # build output string
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
303 myStr = " (" + str(modSum) + ")"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
304 myStr += " vs [" + str(self.sk) + strAdd + str(swapmod) + "]"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
305
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
306 if self.is_fumble(): myStr += " <b><font color=red>Fumble!</font></b>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
307 elif self.is_critical(): myStr += " <b><font color=green>Critical!</font></b>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
308 elif self.is_special(): myStr += " <i><font color=green>Special!</font></i>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
309 elif self.is_success() and self.is_ma(): myStr += " <i><font color=green>Special!</font></i>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
310 elif self.is_success(): myStr += " <font color=blue>Success!</font>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
311 else: myStr += " <font color=red>Failure!</font>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
312
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
313 Diff = self.sk - modSum
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
314 myStr += " </font>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
315
71
449a8900f9ac Code refining almost completed, for this round. Some included files are still in need of some clean up, but this is test worthy.
sirebral
parents: 0
diff changeset
316 return myStr
155
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
317
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
318 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
319 # RQ Parry Roll
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
320 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
321 # same as skill but with fumble dice and armor points
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
322 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
323 # [1d100.parry(50,0,0,12)]
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
324 # skill%, modifer, ma%, Weapon AP
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
325 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
326
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
327 class rqparry(std):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
328
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
329 def __init__(self,source=[],sk=11,mod=0,ma=0,AP=0):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
330 std.__init__(self,source)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
331 self.sk = sk
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
332 self.mod = mod
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
333 self.ma = ma
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
334 self.AP = AP
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
335
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
336
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
337 def is_success(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
338 return (((self.sum() <= (self.sk + self.mod)) or (self.sum() <= 5)) and (self.sum() <= 95))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
339
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
340
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
341 def is_special(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
342 return (self.sum() <= int(floor((self.sk + self.mod) / 5)))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
343
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
344
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
345 def is_ma(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
346 return (self.sum() <= self.ma)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
347
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
348
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
349 def is_riposte(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
350 return (self.sum() <= (self.ma / 5))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
351
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
352
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
353 def is_critical(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
354 return ( ( self.sum() <= int( floor( ( self.sk + self.mod )/20 ) ) ) )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
355
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
356
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
357 def is_fumble(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
358 if ( self.sk >= 100 ):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
359 fum = 0
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
360 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
361 fum = (100 - self.sk )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
362 final_fum = ( 100 - int( floor( fum/20 ) ) )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
363 return ( self.sum() >= final_fum )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
364
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
365
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
366 def __str__(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
367
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
368 # get fumble roll result in case needed
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
369 fum_roll = random.randint(1,100)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
370
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
371 # get special AP
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
372 spec_AP = int( floor ( self.AP * 1.5 ) )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
373
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
374 # figure out +/- for modifer
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
375 strAdd="+"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
376 swapmod= self.mod
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
377 if self.mod < 0:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
378 strAdd= "-"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
379 swapmod= -self.mod
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
380 modSum = self.sum()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
381
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
382 # build output string
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
383 myStr = " (" + str(modSum) + ")"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
384 myStr += " vs [" + str(self.sk) + strAdd + str(swapmod) + "]"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
385
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
386 if self.is_fumble():
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
387 myStr += " <b><font color=red>Fumble!</font> See Fumble Chart [" + str(fum_roll) + "]</b>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
388 elif self.is_critical() and self.is_riposte():
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
389 myStr += " <b><font color=green>Critical!</font> All damage blocked!</b>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
390 myStr += " Riposte next SR"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
391 elif self.is_critical():
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
392 myStr += " <b><font color=green>Critical!</font> All damage blocked!</b>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
393 elif self.is_special and self.is_riposte():
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
394 myStr += " <i><font color=green>Special!</font> Weapon/Shield AP [" + str(spec_AP) + "]</i>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
395 myStr += " Riposte next SR"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
396 elif self.is_special():
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
397 myStr += " <i><font color=green>Special!</font> Weapon/Shield AP [" + str(spec_AP) + "]</i>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
398 elif self.is_success() and self.is_ma():
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
399 myStr += " <i><font color=green>Special!</font> Weapon/Shield AP [" + str(spec_AP) + "]</i>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
400 elif self.is_success():
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
401 myStr += " <font color=blue>Success!</font> Weapon/Shield AP [" + str(self.AP) + "]"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
402 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
403 myStr += " <font color=red>Failure!</font>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
404
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
405 Diff = self.sk - modSum
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
406 myStr += " </font>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
407
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
408 return myStr
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
409
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
410 # RQ Dodge Roll
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
411 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
412 # same as skill but with fumble dice and armor points
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
413 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
414 # [1d100.parry(50,0,0)]
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
415 # skill%, modifer, ma%
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
416 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
417
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
418 class rqdodge(std):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
419
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
420 def __init__(self,source=[],sk=11,mod=0,ma=0,AP=0):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
421 std.__init__(self,source)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
422 self.sk = sk
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
423 self.mod = mod
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
424 self.ma = ma
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
425 self.AP = AP
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
426
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
427
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
428 def is_success(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
429 return (((self.sum() <= (self.sk + self.mod)) or (self.sum() <= 5)) and (self.sum() <= 95))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
430
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
431
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
432 def is_special(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
433 return (self.sum() <= int(floor((self.sk + self.mod) / 5)))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
434
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
435
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
436 def is_ma(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
437 return (self.sum() <= self.ma)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
438
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
439
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
440 def is_riposte(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
441 return (self.sum() <= (self.ma / 5))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
442
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
443
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
444 def is_critical(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
445 return ( ( self.sum() <= int( floor( ( self.sk + self.mod )/20 ) ) ) )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
446
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
447
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
448 def is_fumble(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
449 if ( self.sk >= 100 ):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
450 fum = 0
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
451 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
452 fum = (100 - self.sk )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
453 final_fum = ( 100 - int( floor( fum/20 ) ) )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
454 return ( self.sum() >= final_fum )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
455
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
456
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
457 def __str__(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
458
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
459 # get fumble roll result in case needed
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
460 fum_roll = random.randint(1,100)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
461
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
462 # get special AP
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
463 spec_AP = int( floor ( self.AP * 1.5 ) )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
464
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
465 # figure out +/- for modifer
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
466 strAdd="+"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
467 swapmod= self.mod
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
468 if self.mod < 0:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
469 strAdd= "-"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
470 swapmod= -self.mod
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
471 modSum = self.sum()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
472
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
473 # build output string
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
474 myStr = " (" + str(modSum) + ")"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
475 myStr += " vs [" + str(self.sk) + strAdd + str(swapmod) + "]"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
476
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
477 if self.is_fumble():
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
478 myStr += " <b><font color=red>Fumble!</font> See Fumble Chart [" + str(fum_roll) + "]</b>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
479 elif self.is_critical() and self.is_riposte():
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
480 myStr += " <b><font color=green>Critical!</font> All damage dodged!</b>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
481 myStr += " Riposte on next SR"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
482 elif self.is_critical():
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
483 myStr += " <b><font color=green>Critical!</font> All damage dodged!</b>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
484 elif self.is_special and self.is_riposte():
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
485 myStr += " <i><font color=green>Special!</font> Damage dodged</b>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
486 myStr += " Riposte on next SR"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
487 elif self.is_special():
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
488 myStr += " <i><font color=green>Special!</font> Damage dodged</b>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
489 elif self.is_success() and self.is_ma():
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
490 myStr += " <i><font color=green>Special!</font> Damage dodged</b>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
491 elif self.is_success():
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
492 myStr += " <font color=blue>Success!</font> Damage dodged</b>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
493 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
494 myStr += " <font color=red>Failure!</font>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
495
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
496 Diff = self.sk - modSum
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
497 myStr += " </font>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
498
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
499 return myStr
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
500
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
501
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
502
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
503 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
504 # RQ Attack Roll
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
505 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
506 # same as skill but with fumble dice and armor points
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
507 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
508 # [1d100.attack(50,0,0,2,9,3,1)]
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
509 # skill%, modifer, ma%, min weap dam, max weap dam, dam bonus, truesword_enabled
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
510 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
511 class rqattack(std):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
512
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
513 def __init__(self,source=[],sk=11,mod=0,ma=0,mindam=0,maxdam=0,bondam=0,trueswd=0):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
514 std.__init__(self,source)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
515 self.sk = sk
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
516 self.mod = mod
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
517 self.ma = ma
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
518 self.mindam = mindam
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
519 self.maxdam = maxdam
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
520 self.bondam = bondam
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
521 self.trueswd = trueswd
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
522
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
523
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
524 def is_success(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
525 return (((self.sum() <= (self.sk + self.mod)) or (self.sum() <= 5)) and (self.sum() <= 95))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
526
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
527
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
528 def is_ma(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
529 return (self.sum() <= self.ma)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
530
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
531
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
532 def is_special(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
533 return (self.sum() <= int(floor((self.sk + self.mod) / 5)))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
534
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
535
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
536 def is_critical(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
537 return ((self.sum() <= int(floor((self.sk + self.mod) / 20))))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
538
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
539
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
540 def is_supercritical(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
541 return (self.sum() == 1)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
542
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
543
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
544 def is_fumble(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
545 if ( self.sk >= 100 ):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
546 fum = 0
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
547 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
548 fum = (100 - self.sk )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
549 final_fum = ( 100 - int( floor( fum/20 ) ) )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
550 return ( self.sum() >= final_fum )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
551
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
552
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
553 def __str__(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
554
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
555 # get fumble roll result in case needed
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
556 fum_roll = random.randint(1,100)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
557
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
558 # get hit location roll result in case needed
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
559 location = random.randint(1,20)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
560 myStr = " to the ["+ str(location) + "] "
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
561 if location < 5:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
562 myStr += "<B>Right Leg</B>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
563 elif location < 9:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
564 myStr += "<B>Left Leg</B>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
565 elif location < 12:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
566 myStr += "<B>Abdomen</B>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
567 elif location < 13:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
568 myStr += "<B>Chest</B>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
569 elif location < 16:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
570 myStr += "<B>Right Arm</B>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
571 elif location < 19:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
572 myStr += "<B>Left Arm</B>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
573 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
574 myStr += "<B>Head</B>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
575 hit_loc = myStr
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
576
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
577
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
578 # get normal damage in case needed
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
579 norm_damage = random.randint(self.mindam*(self.trueswd+1),self.maxdam*(self.trueswd+1)) + self.bondam
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
580 norm_damage_string = "{" + str( self.mindam*(self.trueswd+1) ) + "-"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
581 norm_damage_string += str(self.maxdam*(self.trueswd+1)) + "+" + str(self.bondam)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
582 norm_damage_string += "}[" + str(norm_damage) + "] "
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
583
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
584 # get special/critical damage in case needed
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
585 crit_damage = random.randint( self.mindam*(self.trueswd+2), self.maxdam*(self.trueswd+2) ) + self.bondam
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
586 crit_damage_string = "{" + str( self.mindam*(self.trueswd+2) ) + "-" + str(self.maxdam*(self.trueswd+2)) + "+" + str(self.bondam) + "}[" + str(crit_damage) + "] "
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
587
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
588 # get supercritical damage in case needed
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
589 super_damage = norm_damage + self.maxdam
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
590 super_damage_string = "{" + str( self.mindam*(self.trueswd+1) ) + "-"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
591 super_damage_string += str(self.maxdam*(self.trueswd+1)) + "+" + str(self.maxdam)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
592 super_damage_string += "+" + str(self.bondam) + "}[" + str(super_damage) + "] "
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
593
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
594 # figure out +/- for modifer
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
595 strAdd="+"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
596 swapmod= self.mod
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
597 if self.mod < 0:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
598 strAdd= "-"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
599 swapmod= -self.mod
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
600 modSum = self.sum()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
601
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
602 # build output string
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
603 myStr = " (" + str(modSum) + ")"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
604 myStr += " vs [" + str(self.sk) + strAdd + str(swapmod) + "]"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
605
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
606 if self.is_fumble():
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
607 myStr += " <b><font color=red>Fumble!</font> See Fumble Chart [" + str(fum_roll) + "]</b>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
608 elif (self.is_supercritical() and self.is_success()):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
609 myStr += " <b><font color=green>Super Critical!</font></b> Damage: " + str(super_damage_string) + "<u>No Armor Stops</u>" + str(hit_loc)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
610 elif (self.is_critical() and self.is_success()):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
611 myStr += " <b><font color=green>Critical!</font></b> Damage: " + str(crit_damage_string) + "<u>No Armor Stops</u>" + str(hit_loc)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
612 elif ( self.is_special() and self.is_success() ):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
613 myStr += " <i><font color=green>Special!</font></i> Damage: " + str(crit_damage_string) + str(hit_loc)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
614 elif (self.is_success() and self.is_ma()):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
615 myStr += " <i><font color=green>Special!</font></i> Damage: " + str(crit_damage_string) + str(hit_loc)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
616 elif self.is_success():
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
617 myStr += " <font color=blue>Success!</font> Damage: " + str(norm_damage_string) + str(hit_loc)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
618 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
619 myStr += " <font color=red>Failure!</font>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
620
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
621 return myStr
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
622
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
623 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
624 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
625 # Sorcery Roll: [1d100.sorcery(90, 10, 5, 4, 3, 2, 1)]
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
626 # (sk, mod, pow, cer, int, acc, mlt)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
627 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
628 # Ceremony: (+1d6% per strike rank spent on ceremony)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
629 # Intensity: (-3% per point of Intensity)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
630 # Duration: (-4% per point of Duration)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
631 # Range: (-5% per point of Range)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
632 # Multispell: (-10% per each spell over 1)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
633 # Acceleration: (-5% per point of Acceleration)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
634 # Hold: (-2% per point in spell Held)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
635 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
636 class rqsorcery(std):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
637
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
638 def __init__(self,source=[],sk=11,mod=0,pow=0,cer=0,int=0,acc=0,mlt=0):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
639 std.__init__(self,source)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
640 self.sk = sk # sorcery skill
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
641 self.mod = mod # additional modifier ( from duration, range, etc )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
642 self.pow = pow # boost pow and additional pow ( from duration, range, etc )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
643 self.cer = cer # ceremony d6
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
644 self.int = int # intensity ( -3% )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
645 self.acc = acc # accelerate ( -5% )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
646 self.mlt = mlt # multispell ( -10% )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
647
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
648
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
649 def is_success(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
650 return (((self.sum() <= (self.sk + self.mod)) or (self.sum() <= 5)) and (self.sum() <= 95))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
651
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
652
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
653 def is_special(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
654 return ( ( self.sum() <= int( floor( ( self.sk + self.mod )/5 ) ) ) )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
655
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
656
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
657 def is_critical(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
658 return ( ( self.sum() <= int( floor( ( self.sk + self.mod )/20 ) ) ) )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
659
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
660
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
661 def is_fumble(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
662 if ( self.sk >= 100 ):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
663 fum = 0
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
664 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
665 fum = (100 - self.sk )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
666 final_fum = ( 100 - int( floor( fum/20 ) ) )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
667 return ( self.sum() >= final_fum )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
668
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
669
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
670 def __str__(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
671
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
672 # get fumble roll result in case needed
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
673 fum_roll = random.randint(2,12)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
674 if fum_roll == 12 :
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
675 fum_string = "<br /><font color=purple>Caster temporarily forgets spell. Make an INTx5 roll each day to remember.</font>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
676 if fum_roll == 11 :
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
677 fum_string = "<br /><font color=purple>Caster temporarily forgets spell. Make an INTx5 roll each hour to remember. </font>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
678 if fum_roll == 10 :
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
679 fum_string = "<br /><font color=purple>Spell produces reverse of the intended effect. </font>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
680 if fum_roll == 9 :
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
681 fum_string = "<br /><font color=purple>Caster is Stunned. Roll INTx3 to recover at SR 10 each round. </font>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
682 if fum_roll == 8 :
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
683 fum_string = "<br /><font color=purple>Caster takes 2D6 Damage to THP </font>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
684 if fum_roll == 7 :
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
685 fum_string = "<br /><font color=purple>Spell produces reverse of the intended effect at 2x Intensity. </font>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
686 if fum_roll == 6 :
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
687 fum_string = "<br /><font color=purple>Spell is cast on companions (if harmful) or on random nearby foes (if beneficial) </font>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
688 if fum_roll == 5 :
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
689 fum_string = "<br /><font color=purple>Caster takes 1d6 Damage to Head </font>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
690 if fum_roll == 4 :
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
691 fum_string = "<br /><font color=purple>Spell is cast on caster (if harmful) or on random nearby foe (if beneficial) </font>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
692 if fum_roll == 3 :
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
693 fum_string = "<br /><font color=purple>Caster takes 1d6 Damage to THP </font>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
694 if fum_roll == 2 :
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
695 fum_string = "<br /><font color=purple>Caster takes 1 point of Damage to Head </font>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
696
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
697 # roll ceremony
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
698 ceremony_roll = random.randint( self.cer, (self.cer*6) )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
699
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
700 # subtract manipulations
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
701 extra_mod = self.mod
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
702 self.mod += ceremony_roll - self.int*3 - self.acc*5 - self.mlt*10
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
703
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
704 # add up power cost
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
705 extra_pow = self.pow
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
706 self.pow += self.int + self.mlt + self.acc
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
707 special_pow = int( floor( ( self.pow )/2 ) )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
708
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
709 # figure out +/- for modifer
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
710 strAdd="+"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
711 swapmod= self.mod
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
712 if self.mod < 0:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
713 strAdd= "-"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
714 swapmod= -self.mod
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
715 modSum = self.sum()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
716
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
717 # build output string
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
718 myStr = " (" + str(modSum) + ")"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
719 myStr += " vs [" + str(self.sk) + strAdd + str(swapmod) + "]"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
720
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
721 if self.is_fumble():
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
722 myStr += " <b><font color=red>Fumble!</font> POW Cost: [" + str(self.pow) + "],</b> " + fum_string
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
723 elif self.is_critical():
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
724 myStr += " <b><font color=green>Critical!</font></b> POW Cost: [1] "
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
725 elif self.is_special():
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
726 myStr += " <i><font color=green>Special!</font></i> POW Cost: [" + str(special_pow) + "] "
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
727 elif self.is_success():
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
728 myStr += " <font color=blue>Success!</font> POW Cost: [" + str(self.pow) + "] "
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
729 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
730 myStr += " <font color=red>Failure!</font> POW Cost: [1]"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
731
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
732 # print spell details
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
733 myStr += "<br /> --- Other Modifiers:[" + str( extra_mod ) + "], "
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
734 myStr += "Extra POW:[" + str( extra_pow ) + "], "
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
735 myStr += "Ceremony:[+" + str( ceremony_roll ) + "%], "
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
736 myStr += "Intensity(-3):[" + str( self.int ) + "], "
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
737 myStr += "Accelerate(-5):[" + str( self.acc ) + "], "
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
738 myStr += "Multispell(-10):[" + str( self.mlt ) + "] ---"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
739
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 71
diff changeset
740 return myStr