Mercurial > traipse_dev
view orpg/dieroller/rollers/d20.py @ 237:42f4809ad8a8 beta
Traipse Beta 'OpenRPG' {100616-01}
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 (Closing/Closed)
New Features:
New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order
New to Server GUI, can now clear log
Updates:
Update to Warhammer PC Sheet. Rollers set as macros. Should work with little maintanence.
Update to Browser Server window. Display rooms with ' " & cleaner
Update to Server. Handles ' " & cleaner.
Fixes:
Fix to InterParse that was causing an Infernal Loop with Namespace Internal
Fix to XML data, removed old Minidom and switched to Element Tree
Fix to Server that was causing eternal attempt to find a Server ID, in Register Rooms thread
Fix to metaservers.xml file not being created
Fix to Single and Double quotes in Whiteboard text
Fix to Background images not showing when using the Image Server
Fix to Duplicate chat names appearing
Fix to Server GUI's logging output
Fix to FNB.COLORFUL_TABS bug.
author | sirebral |
---|---|
date | Wed, 16 Jun 2010 03:11:55 -0500 |
parents | 9230a33defd9 |
children | b44dad398833 |
line wrap: on
line source
# (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: d20.py # Author: OpenRPG Dev Team # Maintainer: # Version: # $Id: d20.py,v Traipse 'Ornery-Orc' prof.ebral Exp $ # # Description: d20 die roller __version__ = "$Id: d20.py,v Traipse 'Ornery-Orc' prof.ebral Exp $" # d20 stands for "d20 system" not 20 sided die :) from std import std from orpg.dieroller.base import * class d20(std): name = "d20" def __init__(self,source=[]): std.__init__(self,source) def attack(self,AC,mod,critical): return d20attack(self,AC,mod,critical) def dc(self,DC,mod): return d20dc(self,DC,mod) die_rollers.register(d20) class d20dc(std): def __init__(self,source=[],DC=10,mod=0): std.__init__(self,source) print "Source", source self.DC = DC self.mod = mod #self.append(static_di(mod)) def is_success(self): return ((self.sum()+self.mod >= self.DC or self.data[0] == 20) and self.data[0] != 1) def __str__(self): myStr = "[" + str(self.data[0]) for a in self.data[1:]: myStr += ", " myStr += str(a) myStr += ", "+str(self.mod)+ "] = (" + str(self.sum()+self.mod) + ")" myStr += " vs DC " + str(self.DC) if self.is_success(): myStr += " Success!" else: myStr += " Failure!" return myStr class d20attack(std): def __init__(self,source=[],AC=10,mod=0,critical=20): std.__init__(self,source) self.mod = mod self.critical = critical self.AC = AC self.append(static_di(mod)) self.critical_check() def attack(AC=10,mod=0,critical=20): self.mod = mod self.critical = critical self.AC = AC def critical_check(self): self.critical_result = 0 self.critical_roll = 0 if self.data[0] >= self.critical and self.is_hit(): self.critical_roll = die_base(20) + self.mod if self.critical_roll.sum() >= self.AC: self.critical_result = 1 def is_critical(self): return self.critical_result def is_hit(self): return ((self.sum() >= self.AC or self.data[0] == 20) and self.data[0] != 1) def __str__(self): myStr = "[" + str(self.data[0]) for a in self.data[1:]: myStr += "," myStr += str(a) myStr += "] = (" + str(self.sum()) + ")" myStr += " vs AC " + str(self.AC) if self.is_critical(): myStr += " Critical" if self.is_hit(): myStr += " Hit!" else: myStr += " Miss!" return myStr