changeset 525:9cc87beb6dbd

converted the wodex roller found a bug in the _do_function method found out why I had to call the extra method extra_ and fixed it
author digitalxero
date Mon, 22 Mar 2010 17:16:57 -0600
parents e07d25a45736
children 579af5562e74
files orpg/dieroller/_base.py orpg/dieroller/rollers/d20.py orpg/dieroller/rollers/std.py orpg/dieroller/rollers/wod.py orpg/dieroller/rollers/wodex.py
diffstat 5 files changed, 443 insertions(+), 274 deletions(-) [+]
line wrap: on
line diff
--- a/orpg/dieroller/_base.py	Mon Mar 22 14:55:37 2010 -0600
+++ b/orpg/dieroller/_base.py	Mon Mar 22 17:16:57 2010 -0600
@@ -3,7 +3,7 @@
 import traceback
 import re
 import time
-from collections import deque, namedtuple
+from collections import deque
 
 from orpg.external.pyparsing import (Word, alphas, Literal, CaselessLiteral,
                        Combine, Optional, nums, Or, Forward, ZeroOrMore,
@@ -32,7 +32,7 @@
        `build_extra` method to change your result string to your liking.
     """
     format_string = "{roll_string}{rolls} = ({result}) {extra}"
-    extra = ""
+    extra_string = ""
 
     def fudge_roll(self, *args):
         """
@@ -47,7 +47,7 @@
         You should override this method if you want to add extra info to a
         roll result string
         """
-        self.extra = ""
+        self.extra_string = ""
 
     def roll(self, *args):
         """
@@ -95,42 +95,38 @@
         """
         self._rolls = []
         self._quiet = False
-        self.extra = ""
-        try:
-            self._bnf.die_pattern.parseString(roll_string)
-            self.build_extra()
-            self._result = self.evaluate_roll()
-            total_rolls = Roll("", 0, 0)
-            total_rolls.result.extend(
-                [[r for r in roll.result] for roll in self._rolls])
-            total_rolls.result.reverse()
-            if len(total_rolls.result) == 1:
-                total_rolls.result = total_rolls.result[0]
-            official = self._official.format(roll_string=roll_string,
-                                             rolls=total_rolls,
-                                             result=self.result)
-            if self.quiet:
-                roll_string = ""
-            else:
-                roll_string = "[{roll_string}] => ".format(
-                    roll_string=roll_string)
+        self.extra_string = ""
+
+        self._bnf.die_pattern.parseString(roll_string)
+        self.build_extra()
+        self._result = self.evaluate_roll()
+        total_rolls = Roll("", 0, 0)
+        total_rolls.result.extend(
+            [[r for r in roll.result] for roll in self._rolls])
+        total_rolls.result.reverse()
+        if len(total_rolls.result) == 1:
+            total_rolls.result = total_rolls.result[0]
+        official = self._official.format(roll_string=roll_string,
+                                         rolls=total_rolls,
+                                         result=self.result)
+        if self.quiet:
+            roll_string = ""
+        else:
+            roll_string = "[{roll_string}] => ".format(
+                roll_string=roll_string)
 
 
-            total_rolls = Roll("", 0, 0)
-            total_rolls.result.extend(
-                [[r for r in roll] for roll in self._rolls])
-            total_rolls.result.reverse()
-            if len(total_rolls.result) == 1:
-                total_rolls.result = total_rolls.result[0]
+        total_rolls = Roll("", 0, 0)
+        total_rolls.result.extend(
+            [[r for r in roll] for roll in self._rolls])
+        total_rolls.result.reverse()
+        if len(total_rolls.result) == 1:
+            total_rolls.result = total_rolls.result[0]
 
-            return official + self.format_string.format(
-                roll_string=roll_string,
-                                             rolls=total_rolls,
-                                             result=self.result,
-                                             extra=self.extra)
-        except Exception:
-            logger.exception(traceback.format_exc())
-            return roll_string
+        return official + self.format_string.format(roll_string=roll_string,
+                                                    rolls=total_rolls,
+                                                    result=self.result,
+                                                    extra=self.extra_string)
 
     def extraroll(self, roll):
         """
@@ -174,9 +170,12 @@
         if the method does not exist.
         """
         roll_str, loc, tokens = args
-        func = getattr(self, tokens.name) or getattr(self, tokens.name + "_")
+        func = getattr(self, tokens.name)
         if callable(func):
-            func(*tokens.args)
+            if tokens.args[0]:
+                func(*tokens.args)
+            else:
+                func()
 
     def _push(self, *args):
         """
@@ -233,6 +232,9 @@
             else:
                 #Ok we are using an OLD roller, so have fun with eval and shit
                 return self.proccessRoll(roll_string)
+        except Exception:
+            logger.exception(traceback.format_exc())
+            return roll_string
         finally:
             print "Roll Time:", time.time()-st
 
@@ -243,7 +245,9 @@
             raise TypeError("roller must be a string")
 
         if value not in self._rollers:
-            raise KeyError("UNKNOWN ROLLER")
+            logger.exception("Unknown Roller: {roller}.\n"\
+                           "    Setting the roller to std".format(roller=value))
+            value = 'std'
 
         self._roller = self._rollers[value]
     roller = property(_get_roller, _set_roller)
--- a/orpg/dieroller/rollers/d20.py	Mon Mar 22 14:55:37 2010 -0600
+++ b/orpg/dieroller/rollers/d20.py	Mon Mar 22 17:16:57 2010 -0600
@@ -17,8 +17,6 @@
 #   $Id: d20.py,v 1.9 2006/11/04 21:24:19 digitalxero Exp $
 #
 # Description: d20 die roller
-__version__ = "$Id: d20.py,v 1.9 2006/11/04 21:24:19 digitalxero Exp $"
-
 # d20 stands for "d20 system" not 20 sided die :)
 
 from orpg.dieroller._base import roller_manager
@@ -39,11 +37,11 @@
 
         if self._sucess(roll, r, ac):
             if int(roll) >= critical:
-                self.extra = "Critical "
+                self.extra_string = "Critical "
 
-            self.extra += "Hit!"
+            self.extra_string += "Hit!"
         else:
-            self.extra = "Miss!"
+            self.extra_string = "Miss!"
 
         self.history.append(roll)
 
@@ -55,9 +53,9 @@
             self.extend_roll(roll, 0, mod)
 
         if self._sucess(roll, r, dc):
-            self.extra = "Success!"
+            self.extra_string = "Success!"
         else:
-            self.extra = "Failure!"
+            self.extra_string = "Failure!"
 
         self.history.append(roll)
 
--- a/orpg/dieroller/rollers/std.py	Mon Mar 22 14:55:37 2010 -0600
+++ b/orpg/dieroller/rollers/std.py	Mon Mar 22 17:16:57 2010 -0600
@@ -8,7 +8,7 @@
     """
     name = "std"
 
-    def ascending(self, *args):
+    def ascending(self):
         """
         Sort the results of each die in ascending order
         """
@@ -16,7 +16,7 @@
         roll.sort()
         self.history.append(roll)
 
-    def descending(self, *args):
+    def descending(self):
         """
         Sort the result of each die in descending order
         """
@@ -44,7 +44,7 @@
         roll.modified = roll.result[:num] if not roll.modified else roll.modified[:num]
         self.history.append(roll)
 
-    def extra_(self, num):
+    def extra(self, num):
         """
         Add an extra die for each current roll larger then `num`
         eg [1d6.extra(2)] => [[3, 4]] = (7)
@@ -77,7 +77,7 @@
                 if not isinstance(r, (int, type(None))):
                     do_open(r)
                 else:
-                    while r > num:
+                    while r >= num:
                         self.extend_roll(roll_, i)
                         r = roll_.modified[i].result[-1]
 
--- a/orpg/dieroller/rollers/wod.py	Mon Mar 22 14:55:37 2010 -0600
+++ b/orpg/dieroller/rollers/wod.py	Mon Mar 22 17:16:57 2010 -0600
@@ -37,10 +37,13 @@
 class WODRoller(BaseRoller):
     """
     World of Darkness die roller
+    This roller is designed for d10's only and always expects a vs target
+    use the .vs method to set the target, all future rolls will use that
+    target, unless you use .vs again
     """
     name = "wod"
     format_string = "{roll_string}{rolls} {extra}"
-    extra_string = "vs {target} result of {wod_result}"
+    format_extra = "vs {target} result of {wod_result}"
     target = 5
     _thr = 0
 
@@ -69,21 +72,27 @@
                 success = 0
 
         if success < 0:
-            self.extra = self.extra_string.format(target=self.target,
+            self.extra_string = self.format_extra.format(target=self.target,
                                                   wod_result='a botch')
         elif success > 0:
-            self.extra = self.extra_string.format(target=self.target,
+            self.extra_string = self.format_extra.format(target=self.target,
                                         wod_result='(' + str(success) + ')')
         else:
-            self.extra = self.extra_string.format(target=self.target,
+            self.extra_string = self.format_extra.format(target=self.target,
                                                   wod_result='a failure')
 
         self.history.append(roll)
 
     def vs(self, target=5):
+        """
+        set the target for all future rolls to use
+        """
         self.target = target
 
     def thr(self, thr=0):
+        """
+        set the thr for all future rolls to use
+        """
         self._thr = thr
 
 roller_manager.register(WODRoller)
--- a/orpg/dieroller/rollers/wodex.py	Mon Mar 22 14:55:37 2010 -0600
+++ b/orpg/dieroller/rollers/wodex.py	Mon Mar 22 17:16:57 2010 -0600
@@ -31,261 +31,419 @@
 #              Much thanks to whoever wrote the original shadowrun roller (akoman I believe)
 
 
-from std import std
-from orpg.dieroller.base import *
+from orpg.dieroller._base import roller_manager
+from std import StandardRoller
 
-__version__ = "$Id: wodex.py,v 1.9 2007/05/06 16:42:55 digitalxero Exp $"
-
-class wodex(std):
+class WODExRoller(StandardRoller):
     name = "wodex"
+    wod_string = "{roll_string}{rolls} Results: {extra}"
+    _std = True
 
-    def __init__(self,source=[]):
-        std.__init__(self,source)
+    def __call__(self, roll_string):
+        self._std = True
+        return super(WODExRoller, self).__call__(roll_string)
+
+    def build_extra(self):
+        if self._std:
+            self.format_string = super(WODExRoller, self).format_string
+        else:
+            self.format_string = self.wod_string
 
-    def vs(self,actualtarget=6):
-        return oldwodVs(self,actualtarget,(6))
+    def vs(self, target=6, mintn=6, maxtn=10):
+        """
+        Rolls a vs on each target between `mintn` and `maxtn`
+        making your selected `target` bold
+        It shows results for each tn
+        """
+        self._std = False
+
+        #Some Sanity Checks
+        target = max(2, min(10, target))
+        mintn = min(max(2, mintn), target)
+        maxtn = max(min(10, maxtn), target)
+
+        roll = self.history.pop()
 
-    def wod(self,actualtarget=8):
-        return newwodVs(self,actualtarget,(8))
+        for tn in xrange(mintn, maxtn+1):
+            success = 0
+            result = '({success} vs {tn}) '
+            for r in roll:
+                if r >= tn:
+                    success += 1
+                elif r == 1:
+                    success -= 1
 
-    def exalt(self, actualtarget=7):
-        return exaltVs(self, actualtarget)
+            if tn == target:
+                result = '<b>' + result + '</b>'
+
+            self.extra_string += result.format(success=success, tn=tn)
+
+        self.history.append(roll)
 
-    def exaltDmg(self, actualtarget=7):
-        return exaltDmg(self, actualtarget)
+    def wod(self, target=8, mintn=8, maxtn=8):
+        """
+        Rolls a vs on each target between `mintn` and `maxtn`
+        making your selected `target` bold
+        It shows results for each tn
+        This is an openended roll on 10, but extra rolls do not cound as
+        failures and thus are not subtracted from the successes
+        """
+        self._std = False
 
-    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)
+        #Some Sanity Checks
+        target = max(2, min(10, target))
+        mintn = min(max(2, mintn), target)
+        maxtn = max(min(10, maxtn), target)
 
-die_rollers.register(wodex)
+        self.open(10)
+
+        roll = self.history.pop()
 
-class oldwodVs(std):
-    def __init__(self,source=[],actualtarget=6,mintn=2,maxtn=10):
-        std.__init__(self, source)
-        if actualtarget > 10:
-            actualtarget = 10
-        if mintn > 10:
-            mintn = 10
-        if maxtn > 10:
-            maxtn = 10
-        if actualtarget < 2:
-            self.target = 2
-        else:
-            self.target = actualtarget
-        #if the target number is higher than max (Mainly for wide rolls) then increase max to tn
-        if actualtarget > maxtn:
-            maxtn = actualtarget
-        if actualtarget < mintn:
-            mintn = actualtarget
-        #store minimum for later use as well, also in result printing section.
-        if mintn < 2:
-            self.mintn = 2
-        else:
-            self.mintn = mintn
-        self.maxtn = maxtn #store for later use in printing results. (Yeah, these comments are now disordered)
+        for tn in xrange(mintn, maxtn+1):
+            success = 0
+            result = '({success} vs {tn}) '
+            for r in roll:
+                if not isinstance(r, int):
+                    for i in xrange(len(r)):
+                        num = r.modified[i] if r.modified else r.result[i]
+                        if num >= tn:
+                            success += 1
+                        elif num == 1 and not i:
+                            success -= 1
+                else:
+                    if r >= tn:
+                        success += 1
+                    elif r == 1:
+                        success -= 1
+
+            if tn == target:
+                result = '<b>' + result + '</b>'
+
+            self.extra_string += result.format(success=success, tn=tn)
+            success = 0
+
+        self.history.append(roll)
+
+    def exalt(self, target=7):
+        """
+        Totals the sucess vs `target` and adds an extra success for each
+        die that is a natural 10
+        """
+        self._std = False
+
+        #Some Sanity Checks
+        target = max(2, min(10, target))
+
+        roll = self.history.pop()
 
-        # WoD etc uses d10 but i've left it so it can roll anything openended
-        # self.openended(self[0].sides)
+        success = 0
+        botch = False
+        for r in roll:
+            if r >= target:
+                success += 1
+            if r == 10:
+                success += 1
+            if r == 1:
+                botch = True
+
+        if success == 0:
+            self.extra_string = 'BOTCH!' if botch else 'Failure'
+        else:
+            rs = '{num} Success'
+            rs += 'es' if success > 1 else ''
+            self.extra_string = rs.format(num=success)
+
+        self.history.append(roll)
+
+    def exaltDmg(self, target=7):
+        """
+        Totals the sucess vs `target`
+        """
+        self._std = False
 
-    #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:
-            if r >= self.target:
-                s += 1
-            elif r == 1:
-                s -= 1
-        return s
+        #Some Sanity Checks
+        target = max(2, min(10, target))
+
+        roll = self.history.pop()
+
+        success = 0
+        botch = False
+        for r in roll:
+            if r >= target:
+                success += 1
+            if r == 1:
+                botch = True
 
-    #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:
-            if r >= curtarget:
-                s += 1
-            elif r == 1:
-                s -= 1
-        return s
+        if success == 0:
+            self.extra_string = 'BOTCH!' if botch else 'Failure'
+        else:
+            rs = '{num} Success'
+            rs += 'es' if success > 1 else ''
+            self.extra_string = rs.format(num=success)
+
+        self.history.append(roll)
+
+    def vswide(self, target=6, maxtn=10):
+        """
+        Wide is just vs(target, 2, maxtn)
+        """
+        self.vs(target, maxtn=maxtn)
+
+roller_manager.register(WODExRoller)
 
 
-    def __str__(self):
-        if len(self.data) > 0:
-            myStr = "[" + str(self.data[0])
-            for a in self.data[1:]:
-                myStr += ","
-                myStr += str(a)
-            myStr += "] Results: "
-            #cycle through from mintn to maxtn, summing successes for each separate TN
-            for targ in range(self.mintn,self.maxtn+1):
-                if (targ == self.target):
-                    myStr += "<b>"
-                myStr += "(" + str(self.xsum(targ)) + "&nbsp;vs&nbsp;" + str(targ) + ") "
-                if (targ == self.target):
-                    myStr += "</b>"
-        else:
-            myStr = "[] = (0)"
+#old
+#from std import std
+#class wodex(std):
+    #name = "old_wodex"
+
+    #def __init__(self,source=[]):
+        #std.__init__(self,source)
+
+    #def vs(self, actualtarget=6):
+        #return oldwodVs(self,actualtarget,(6))
 
-        return myStr
+    #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)
+
+#roller_manager.register(wodex)
 
-class newwodVs(std):
-    def __init__(self,source=[],actualtarget=8,mintn=8,maxtn=8):
-        std.__init__(self, source)
-        if actualtarget > 30:
-            actualtarget = 30
-        if mintn > 10:
-            mintn = 10
-        if maxtn > 10:
-            maxtn = 10
-        if actualtarget < 2:
-            self.target = 2
-        else:
-            self.target = actualtarget
-        #if the target number is higher than max (Mainly for wide rolls) then increase max to tn
-        if actualtarget > maxtn:
-            maxtn = actualtarget
-        if actualtarget < mintn:
-            mintn = actualtarget
-        #store minimum for later use as well, also in result printing section.
-        if mintn < 2:
-            self.mintn = 2
-        else:
-            self.mintn = mintn
-        self.maxtn = maxtn #store for later use in printing results. (Yeah, these comments are now disordered)
-
-        # WoD etc uses d10 but i've left it so it can roll anything openended
-        # self.openended(self[0].sides)
+#class oldwodVs(std):
+    #def __init__(self,source=[],actualtarget=6,mintn=2,maxtn=10):
+        #std.__init__(self, source)
+        #if actualtarget > 10:
+            #actualtarget = 10
+        #if mintn > 10:
+            #mintn = 10
+        #if maxtn > 10:
+            #maxtn = 10
+        #if actualtarget < 2:
+            #self.target = 2
+        #else:
+            #self.target = actualtarget
+        ##if the target number is higher than max (Mainly for wide rolls) then increase max to tn
+        #if actualtarget > maxtn:
+            #maxtn = actualtarget
+        #if actualtarget < mintn:
+            #mintn = actualtarget
+        ##store minimum for later use as well, also in result printing section.
+        #if mintn < 2:
+            #self.mintn = 2
+        #else:
+            #self.mintn = mintn
+        #self.maxtn = maxtn #store for later use in printing results. (Yeah, these comments are now disordered)
 
-    #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
-        for r in self.data:
-            if r >= curtarget:
-                s += 1
-            elif ((r == 1) and (subones == 1)):
-                s -= 1
-        if r == 10:
-            done = 0
-            subones = 0
-            self.append(di(10))
-        if done == 1:
-            return s
-        else:
-            return self.xsum(0)
+        ## WoD etc uses d10 but i've left it so it can roll anything openended
+        ## self.openended(self[0].sides)
 
-    def openended(self,num):
-        if num <= 1:
-            self
-        done = 1
-        for i in range(len(self.data)):
-            if self.data[i].lastroll() == num:
-                self.data[i].extraroll()
-                done = 0
-        if done:
-            return self
-        else:
-            return self.openended(num)
+    ##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:
+            #if r >= self.target:
+                #s += 1
+            #elif r == 1:
+                #s -= 1
+        #return s
+
+    ##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:
+            #if r >= curtarget:
+                #s += 1
+            #elif r == 1:
+                #s -= 1
+        #return s
 
 
-    def __str__(self):
-        if len(self.data) > 0:
-            myStr = "[" + str(self.data[0])
-            for a in self.data[1:]:
-                myStr += ","
-                myStr += str(a)
-            myStr += "] Results: "
-            #cycle through from mintn to maxtn, summing successes for each separate TN
-            for targ in range(self.mintn,self.maxtn+1):
-                if (targ == self.target):
-                    myStr += "<b>"
-                myStr += "(" + str(self.xsum(targ)) + "&nbsp;vs&nbsp;" + str(targ) + ") "
-                if (targ == self.target):
-                    myStr += "</b>"
-        else:
-            myStr = "[] = (0)"
+    #def __str__(self):
+        #if len(self.data) > 0:
+            #myStr = "[" + str(self.data[0])
+            #for a in self.data[1:]:
+                #myStr += ","
+                #myStr += str(a)
+            #myStr += "] Results: "
+            ##cycle through from mintn to maxtn, summing successes for each separate TN
+            #for targ in range(self.mintn,self.maxtn+1):
+                #if (targ == self.target):
+                    #myStr += "<b>"
+                #myStr += "(" + str(self.xsum(targ)) + "&nbsp;vs&nbsp;" + str(targ) + ") "
+                #if (targ == self.target):
+                    #myStr += "</b>"
+        #else:
+            #myStr = "[] = (0)"
 
-        return myStr
+        #return myStr
 
-class exaltVs(std):
-    def __init__(self, source=[], actualtarget=7):
-        std.__init__(self, source)
+#class newwodVs(std):
+    #def __init__(self,source=[],actualtarget=8,mintn=8,maxtn=8):
+        #std.__init__(self, source)
+        #if actualtarget > 30:
+            #actualtarget = 30
+        #if mintn > 10:
+            #mintn = 10
+        #if maxtn > 10:
+            #maxtn = 10
+        #if actualtarget < 2:
+            #self.target = 2
+        #else:
+            #self.target = actualtarget
+        ##if the target number is higher than max (Mainly for wide rolls) then increase max to tn
+        #if actualtarget > maxtn:
+            #maxtn = actualtarget
+        #if actualtarget < mintn:
+            #mintn = actualtarget
+        ##store minimum for later use as well, also in result printing section.
+        #if mintn < 2:
+            #self.mintn = 2
+        #else:
+            #self.mintn = mintn
+        #self.maxtn = maxtn #store for later use in printing results. (Yeah, these comments are now disordered)
 
-        if actualtarget > 10:
-            actualtarget = 10
-
-        if actualtarget < 2:
-            self.target = 2
-        else:
-            self.target = actualtarget
+        ## WoD etc uses d10 but i've left it so it can roll anything openended
+        ## self.openended(self[0].sides)
 
-
-    def xsum(self, target):
-        s = 0
+    ##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
+        #for r in self.data:
+            #if r >= curtarget:
+                #s += 1
+            #elif ((r == 1) and (subones == 1)):
+                #s -= 1
+        #if r == 10:
+            #done = 0
+            #subones = 0
+            #self.append(di(10))
+        #if done == 1:
+            #return s
+        #else:
+            #return self.xsum(0)
 
-        for r in self.data:
-            if r >= target:
-                s += 1
-            if r == 10:
-                s += 1
-
-        return s
+    #def openended(self,num):
+        #if num <= 1:
+            #self
+        #done = 1
+        #for i in range(len(self.data)):
+            #if self.data[i].lastroll() == num:
+                #self.data[i].extraroll()
+                #done = 0
+        #if done:
+            #return self
+        #else:
+            #return self.openended(num)
 
 
-    def __str__(self):
-        if len(self.data) > 0:
-            myStr = str(self.data)
-            myStr += " Results: "
+    #def __str__(self):
+        #if len(self.data) > 0:
+            #myStr = "[" + str(self.data[0])
+            #for a in self.data[1:]:
+                #myStr += ","
+                #myStr += str(a)
+            #myStr += "] Results: "
+            ##cycle through from mintn to maxtn, summing successes for each separate TN
+            #for targ in range(self.mintn,self.maxtn+1):
+                #if (targ == self.target):
+                    #myStr += "<b>"
+                #myStr += "(" + str(self.xsum(targ)) + "&nbsp;vs&nbsp;" + str(targ) + ") "
+                #if (targ == self.target):
+                    #myStr += "</b>"
+        #else:
+            #myStr = "[] = (0)"
+
+        #return myStr
+
+#class exaltVs(std):
+    #def __init__(self, source=[], actualtarget=7):
+        #std.__init__(self, source)
 
-            succ = self.xsum(self.target)
-            if succ == 0 and 1 in self.data:
-                myStr += 'BOTCH!'
-            elif succ == 0:
-                myStr += str(succ) + " Failure"
-            elif succ == 1:
-                myStr += str(succ) + " Success"
-            else:
-                myStr += str(succ) + " Successes"
+        #if actualtarget > 10:
+            #actualtarget = 10
+
+        #if actualtarget < 2:
+            #self.target = 2
+        #else:
+            #self.target = actualtarget
+
+
+    #def xsum(self, target):
+        #s = 0
 
-            return myStr
+        #for r in self.data:
+            #if r >= target:
+                #s += 1
+            #if r == 10:
+                #s += 1
 
-class exaltDmg(std):
-    def __init__(self, source=[], actualtarget=7):
-        std.__init__(self, source)
-        if actualtarget > 10:
-            actualtarget = 10
+        #return s
+
+
+    #def __str__(self):
+        #if len(self.data) > 0:
+            #myStr = str(self.data)
+            #myStr += " Results: "
 
-        if actualtarget < 2:
-            self.target = 2
-        else:
-            self.target = actualtarget
+            #succ = self.xsum(self.target)
+            #if succ == 0 and 1 in self.data:
+                #myStr += 'BOTCH!'
+            #elif succ == 0:
+                #myStr += str(succ) + " Failure"
+            #elif succ == 1:
+                #myStr += str(succ) + " Success"
+            #else:
+                #myStr += str(succ) + " Successes"
 
-    def xsum(self, target):
-        s = 0
+            #return myStr
 
-        for r in self.data:
-            if r >= target:
-                s += 1
-        return s
+#class exaltDmg(std):
+    #def __init__(self, source=[], actualtarget=7):
+        #std.__init__(self, source)
+        #if actualtarget > 10:
+            #actualtarget = 10
+
+        #if actualtarget < 2:
+            #self.target = 2
+        #else:
+            #self.target = actualtarget
 
-    def __str__(self):
-        if len(self.data) > 0:
-            myStr = str(self.data)
-            myStr += " Results: "
+    #def xsum(self, target):
+        #s = 0
 
-            succ = self.xsum(self.target)
+        #for r in self.data:
+            #if r >= target:
+                #s += 1
+        #return s
+
+    #def __str__(self):
+        #if len(self.data) > 0:
+            #myStr = str(self.data)
+            #myStr += " Results: "
 
-            if succ == 0 and 1 in self.data:
-                myStr += 'BOTCH!'
-            elif succ == 0:
-                myStr += str(succ) + " Failure"
-            elif succ == 1:
-                myStr += str(succ) + " Success"
-            else:
-                myStr += str(succ) + " Successes"
+            #succ = self.xsum(self.target)
 
-            return myStr
+            #if succ == 0 and 1 in self.data:
+                #myStr += 'BOTCH!'
+            #elif succ == 0:
+                #myStr += str(succ) + " Failure"
+            #elif succ == 1:
+                #myStr += str(succ) + " Success"
+            #else:
+                #myStr += str(succ) + " Successes"
+
+            #return myStr