171
|
1 ## a vs die roller as used by WOD games
|
|
2 #!/usr/bin/env python
|
|
3 # Copyright (C) 2000-2001 The OpenRPG Project
|
|
4 #
|
|
5 # openrpg-dev@lists.sourceforge.net
|
|
6 #
|
|
7 # This program is free software; you can redistribute it and/or modify
|
|
8 # it under the terms of the GNU General Public License as published by
|
|
9 # the Free Software Foundation; either version 2 of the License, or
|
|
10 # (at your option) any later version.
|
|
11 #
|
|
12 # This program is distributed in the hope that it will be useful,
|
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15 # GNU General Public License for more details.
|
|
16 #
|
|
17 # You should have received a copy of the GNU General Public License
|
|
18 # along with this program; if not, write to the Free Software
|
|
19 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
20 # --
|
|
21 #
|
|
22 # File: trinity.py
|
|
23 # Author: Jacob Matthew, Talisan Creations
|
|
24 # Maintainer:
|
|
25 # Version:
|
184
|
26 # $Id: trinity.py,v Traipse 'Ornery-Orc' prof.ebral Exp $
|
171
|
27 #
|
|
28 # Description: Aeon Trinity die roller
|
|
29 # Modified from the WoD dieroller "$Id: trinity.py,v 1.2 2007/05/05 05:30:10 digitalxero Exp $"
|
|
30 # Targetthr is the Threshhold target
|
|
31 # for compatibility with Mage die rolls.
|
|
32 # Threshhold addition by robert t childers
|
|
33 # Threshhold functionality removed, some tags remain in code.
|
|
34
|
184
|
35 __version__ = "$Id: trinity.py,v Traipse 'Ornery-Orc' prof.ebral Exp $"
|
171
|
36
|
|
37 from std import std
|
|
38 from orpg.dieroller.base import *
|
|
39
|
|
40 class trinity(std):
|
|
41 name = "trinity"
|
|
42
|
|
43 def __init__(self,source=[],target=7,targetthr=0):
|
|
44 std.__init__(self,source)
|
|
45 self.target = target
|
|
46 self.targetthr = targetthr
|
|
47
|
|
48 def vs(self,target):
|
|
49 self.target = target
|
|
50 return self
|
|
51
|
|
52 def thr(self,targetthr):
|
|
53 self.targetthr = targetthr
|
|
54 return self
|
|
55
|
|
56 def sum(self):
|
|
57 rolls = []
|
|
58 s = 0
|
|
59 b = 0
|
|
60 for a in self.data:
|
|
61 rolls.extend(a.gethistory())
|
|
62 for r in rolls:
|
|
63 if r >= self.target:
|
|
64 s += 1
|
|
65 elif r == 1:
|
|
66 b -= 1
|
|
67 if s == 0:
|
|
68 return b
|
|
69 else:
|
|
70 return s
|
|
71
|
|
72 def __str__(self):
|
|
73 if len(self.data) > 0:
|
|
74 myStr = "[" + str(self.data[0])
|
|
75 for a in self.data[1:]:
|
|
76 myStr += ","
|
|
77 myStr += str(a)
|
|
78 if self.sum() < 0:
|
|
79 myStr += "] result of a (" + str(self.sum()) + ") botch"
|
|
80 elif self.sum() == 0:
|
|
81 myStr += "] result of a failure"
|
|
82 else:
|
|
83 myStr += "] result of (" + str(self.sum()) + ") success"
|
|
84
|
|
85
|
|
86 return myStr
|
|
87
|
184
|
88 die_rollers.register(trinity)
|