Mercurial > traipse_dev
diff orpg/dieroller/wodex.py @ 71:449a8900f9ac ornery-dev
Code refining almost completed, for this round. Some included files are still in need of some clean up, but this is test worthy.
author | sirebral |
---|---|
date | Thu, 20 Aug 2009 03:00:39 -0500 |
parents | 4385a7d0efd1 |
children | bf799efe7a8a |
line wrap: on
line diff
--- a/orpg/dieroller/wodex.py Tue Aug 18 20:48:36 2009 -0500 +++ b/orpg/dieroller/wodex.py Thu Aug 20 03:00:39 2009 -0500 @@ -36,25 +36,32 @@ __version__ = "$Id: wodex.py,v 1.9 2007/05/06 16:42:55 digitalxero Exp $" class wodex(std): + def __init__(self,source=[]): std.__init__(self,source) + def vs(self,actualtarget=6): return oldwodVs(self,actualtarget,(6)) + def wod(self,actualtarget=8): return newwodVs(self,actualtarget,(8)) + def exalt(self, actualtarget=7): return exaltVs(self, actualtarget) + def exaltDmg(self, actualtarget=7): return exaltDmg(self, actualtarget) + def vswide(self,actualtarget=6,maxtarget=10): #wide simply means it reports TNs from 2 to a specified max. return oldwodVs(self,actualtarget,2,maxtarget) class oldwodVs(std): + def __init__(self,source=[],actualtarget=6,mintn=2,maxtn=10): std.__init__(self, source) if actualtarget > 10: @@ -84,6 +91,7 @@ #count successes, by looping through each die, and checking it against the currently set TN #1's subtract successes. + def __sum__(self): s = 0 for r in self.data: @@ -96,6 +104,7 @@ #a modified sum, but this one takes a target argument, and is there because otherwise it is difficult to loop through #tns counting successes against each one without changing target, which is rather dangerous as the original TN could #easily be lost. 1s subtract successes from everything. + def xsum(self,curtarget): s = 0 for r in self.data: @@ -106,6 +115,7 @@ return s + def __str__(self): if len(self.data) > 0: myStr = "[" + str(self.data[0]) @@ -126,6 +136,7 @@ return myStr class newwodVs(std): + def __init__(self,source=[],actualtarget=8,mintn=8,maxtn=8): std.__init__(self, source) if actualtarget > 30: @@ -156,6 +167,7 @@ #a modified sum, but this one takes a target argument, and is there because otherwise it is difficult to loop through #tns counting successes against each one without changing target, which is rather dangerous as the original TN could #easily be lost. 1s subtract successes from original but not re-rolls. + def xsum(self,curtarget,subones=1): s = 0 done = 1 @@ -173,6 +185,7 @@ else: return self.xsum(0) + def openended(self,num): if num <= 1: self @@ -187,6 +200,7 @@ return self.openended(num) + def __str__(self): if len(self.data) > 0: myStr = "[" + str(self.data[0]) @@ -207,6 +221,7 @@ return myStr class exaltVs(std): + def __init__(self, source=[], actualtarget=7): std.__init__(self, source) @@ -219,6 +234,7 @@ self.target = actualtarget + def xsum(self, target): s = 0 @@ -231,6 +247,7 @@ return s + def __str__(self): if len(self.data) > 0: myStr = str(self.data) @@ -249,6 +266,7 @@ return myStr class exaltDmg(std): + def __init__(self, source=[], actualtarget=7): std.__init__(self, source) if actualtarget > 10: @@ -259,6 +277,7 @@ else: self.target = actualtarget + def xsum(self, target): s = 0 @@ -267,6 +286,7 @@ s += 1 return s + def __str__(self): if len(self.data) > 0: myStr = str(self.data)