annotate orpg/dieroller/trinity.py @ 155:bf799efe7a8a alpha

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