annotate orpg/dieroller/trinity.py @ 156:3b6888bb53b5 beta

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