From: Digital X. <dig...@us...> - 2007-05-05 05:28:37
|
Update of /cvsroot/openrpg/openrpg1/orpg/dieroller In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22296/orpg/dieroller Modified Files: Tag: BRANCH-1-7-1 utils.py wodex.py Added Files: Tag: BRANCH-1-7-1 trinity.py Log Message: Added the exalted and trinity rollers Index: utils.py =================================================================== RCS file: /cvsroot/openrpg/openrpg1/orpg/dieroller/utils.py,v retrieving revision 1.20.2.1 retrieving revision 1.20.2.2 diff -C2 -d -r1.20.2.1 -r1.20.2.2 *** utils.py 18 Apr 2007 21:54:31 -0000 1.20.2.1 --- utils.py 5 May 2007 05:28:37 -0000 1.20.2.2 *************** *** 43,50 **** from runequest import * from savage import * import re ! rollers = ['std','wod','d20','hero','shadowrun', 'sr4','hackmaster','srex','wodex', 'gurps', 'runequest', 'sw'] class roller_manager: --- 43,51 ---- from runequest import * from savage import * + from trinity import * import re ! rollers = ['std','wod','d20','hero','shadowrun', 'sr4','hackmaster','srex','wodex', 'gurps', 'runequest', 'sw', 'trinity'] class roller_manager: Index: wodex.py =================================================================== RCS file: /cvsroot/openrpg/openrpg1/orpg/dieroller/wodex.py,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** wodex.py 4 Nov 2006 21:24:19 -0000 1.6 --- wodex.py 5 May 2007 05:28:37 -0000 1.6.2.1 *************** *** 46,49 **** --- 46,55 ---- 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) *************** *** 200,201 **** --- 206,286 ---- return myStr + + class exaltVs(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 xsum(self, target): + s = 0 + + for r in self.data: + if r >= target: + s += 1 + if r == 10: + s += 1 + + return s + + + def __str__(self): + if len(self.data) > 0: + myStr = str(self.data) + myStr += " Results: " + + 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" + + return myStr + + 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 xsum(self, target): + s = 0 + + 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: " + + 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" + + return myStr \ No newline at end of file --- NEW FILE: trinity.py --- ## a vs die roller as used by WOD games #!/usr/bin/env python # Copyright (C) 2000-2001 The OpenRPG Project # # ope...@li... # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # -- # # File: trinity.py # Author: Jacob Matthew, Talisan Creations # Maintainer: # Version: # $Id: trinity.py,v 1.1.2.1 2007/05/05 05:28:37 digitalxero Exp $ # # Description: Aeon Trinity die roller # Modified from the WoD dieroller "$Id: trinity.py,v 1.1.2.1 2007/05/05 05:28:37 digitalxero Exp $" # Targetthr is the Threshhold target # for compatibility with Mage die rolls. # Threshhold addition by robert t childers # Threshhold functionality removed, some tags remain in code. from die import * __version__ = "$Id: trinity.py,v 1.1.2.1 2007/05/05 05:28:37 digitalxero Exp $" class trinity(std): def __init__(self,source=[],target=7,targetthr=0): std.__init__(self,source) self.target = target self.targetthr = targetthr def vs(self,target): self.target = target return self def thr(self,targetthr): self.targetthr = targetthr return self def sum(self): rolls = [] s = 0 b = 0 for a in self.data: rolls.extend(a.gethistory()) for r in rolls: if r >= self.target: s += 1 elif r == 1: b -= 1 if s == 0: return b else: 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) if self.sum() < 0: myStr += "] result of a (" + str(self.sum()) + ") botch" elif self.sum() == 0: myStr += "] result of a failure" else: myStr += "] result of (" + str(self.sum()) + ") success" return myStr |