Mercurial > traipse_dev
diff orpg/dieroller/rollers/alternity.py @ 195:b633f4c64aae alpha
Traipse Alpha 'OpenRPG' {100219-00}
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 (Patch-2)
New Features:
New Namespace method with two new syntaxes
Fixes:
Fix to Server GUI startup errors
Fix to Server GUI Rooms tab updating
Fix to Chat and Settings if non existant die roller is picked
Fix to Dieroller and .open() used with .vs(). Successes are correctly calculated
Fix to Alias Lib's Export to Tree, Open, Save features
Fix to alias node, now works properly
Fix to Splitter node, minor GUI cleanup
author | sirebral |
---|---|
date | Sat, 24 Apr 2010 08:37:20 -0500 |
parents | 5c9a118476b2 |
children |
line wrap: on
line diff
--- a/orpg/dieroller/rollers/alternity.py Fri Jan 15 22:45:51 2010 -0600 +++ b/orpg/dieroller/rollers/alternity.py Sat Apr 24 08:37:20 2010 -0500 @@ -18,20 +18,49 @@ # # Changelog: # -# v.1 original release JEC -# -# Traipse Release: -# The changes made in the Traipe release are intended to create a more direct connection -# between the source and the intrepretor. IF, ELIF statements have been replaced with dictionaries, +# v.1 original release JEC +# +# Traipse Release: +# The changes made in the Traipe release are intended to create a more direct connection +# between the source and the intrepretor. IF, ELIF statements have been replaced with dictionaries, # unused objects have been replace with re-usable objects, and the code has been condensed. - +# +# SEG: JAN 24 2010 - v.1.4 O'Flux Release: +# Edits & Additions: fixed a few minor bugs; Damage roll & Display Issues. +# Added Secondary Damage Calculation and Display. Fix all errors. +# Added proper results for Critcal Successes with failure ==> final Result Ordinary Success +# Removed reduntent Method to make parent class true with all others working as child. +# Made all special output same colour codes font size. Cleaned out old commented lines. +# Tested for Traipse on Win 7 +# +# Skill Check Example: +# [1d20.sk(12,-2)] +# OUTPUT Example: +# => [6,-3] = (3) AMAZING Success +# +# Pistol, Laser; 0 step -- Attack Example: +# [1d20.at(12,0,(1d4+1,"w"),(1d6+1,"w"),(1d4,"m"))] +# OUTPUT Example: +# => [1,0] = (1) CRITICAL SUCCESS AMAZING HIT +# ===> Damage [4] = (4) mortal ======> Secondary Damage (2) stun / (2) wound +# +# Action Check Example: +# [1d20.ac(14,-1)] +# OUTPUT Example: +# => ACTION CHECK : [18,-3] = (15) Marginal failure +# -1 Step make up bonus next Action Check +# +# import re - + from std import std from time import time, clock from orpg.dieroller.base import di, die_base, die_rollers +##from orpg.tools.orpg_log import debug + + __version__ = "$Id: alternity.py,v 0.1 2003/01/02 12:00:00 cchriss Exp $" # Alternity stands for "Alternity system" 20 sided die plus mods @@ -49,6 +78,9 @@ def at(self,score,mod,dmgo,dmgg,dmga): return at(self,score,mod,dmgo,dmgg,dmga) + def ac(self,score,mod): + return ac(self,score,mod) + die_rollers.register(alternity) class sk(std): @@ -59,25 +91,29 @@ self.mod = mod def getMod(self,mod=0): - m=0 - mods = { -4: -di(12), -3: -di(8), -2: -di(6), -1: -di(4), 1: -di(4), - 2: di(6), 3: di(8), 4: di(12), 5: di(20)} - if mod in mods.keys(): m = mods[mod].value + m=0 + mods = { -4: -di(12), -3: -di(8), -2: -di(6), -1: -di(4), 1: di(4), + 2: di(6), 3: di(8), 4: di(12), 5: di(20)} # SEG fix 1: di(4) # + if mod in mods.keys(): m = mods[mod].value elif mod <= -5: m=-di(20).value elif mod == 6: m=di(20).value + di(20).value elif mod >= 7: m=di(20).value + di(20).value + di(20).value return m def getRolLStr(self): - myStr = "[" + str(self.data[0]) + myStr = "[" + str(self.data[0]) self.d20 = self.sum() - amod = self.getMod(self.mod) - self.dieRoll = self.d20 + amod + self.amod = self.getMod(self.mod) + +## varN = "self.amod" +## debug(varN) +## debug(self.amod) ## seg added debug output + + self.dieRoll = self.d20 + self.amod for a in self.data[1:]: myStr += "," myStr += str(a) - myStr += "," + str(amod) + "] = (" + str(self.dieRoll) + ")" - if ( self.d20 == 1 ): self.success = 'CS' + myStr += "," + str(self.amod) + "] = (" + str(self.dieRoll) + ")" if ( self.dieRoll <= self.score / 4 ): self.success = 'A' elif ( self.dieRoll <= self.score / 2 ): self.success = 'G' elif ( self.dieRoll <= self.score ): self.success = 'O' @@ -86,51 +122,127 @@ return myStr def __str__(self): - myStr = self.getRolLStr() - successes = {'CS': " <b><font color='#00aa00'>CRITICAL SUCCESS</font></b>", - 'CF': " <b><font color='#ff0000'>CRITICAL FAILURE</font></b>", - 'A': " <b>AMAZING Success</b>", - 'G': " <b>Good Success</b>", - 'O': " <b>Ordinary Success</b>", - 'F': " <b>failure</b>"} + myStr = self.getRolLStr() + +## varN = "myStr" +## debug(varN) +## debug(myStr) ## seg added debug output + + successes = {'CS': " <b><font size=2 color='#8D38C9'>CRITICAL SUCCESS</font></b>", + 'CF': " <b><font size=2 color='#151B54'>CRITICAL FAILURE</font></b>", + 'A': " <b><font size=2 color='#E42217'>AMAZING Success</font></b>", + 'G': " <b><font size=2 color='#306EFF'>Good Success</font></b>", + 'O': " <b><font size=2 color='#52D017'>Ordinary Success</font></b>", + 'F': " <b><font size=2 color='#41627E'>failure</font></b>"} + + if ( self.d20 == 1 ): myStr += successes['CS'] # SEG Dec 19 2009 myStr += successes[self.success] + if ( self.d20 == 1 ) and (self.success == 'F') : + myStr += " final result ==> " + myStr += successes['O'] # SEG JAN 23 2010 return myStr -class at(sk): - ## Traipse Usage: The source I received had the damage rolls like this 1d6s, with the damage type a - ## letter that could be sliced from the roll. However, the roll is parsed before the letter can be - ## sliced from it, and with the letter attached it created an error. - ## - ## The Traipse method puts the damage type and the damage roll into a Tuple, ie (1d6, 's'). - ## When uing this method you must include single or double quoutes around the damage type or the +class at(sk): + ## Traipse Usage: The source I received had the damage rolls like this 1d6s, with the damage type a + ## letter that could be sliced from the roll. However, the roll is parsed before the letter can be + ## sliced from it, and with the letter attached it created an error. + ## + ## The Traipse method puts the damage type and the damage roll into a Tuple, ie (1d6, 's'). + ## When using this method you must include single or double quoutes around the damage type or the ## software will treat it as an object. + def __init__(self,source=[],sc=10, mod=0, dmgo="(1d6, 's')",dmgg="(1d6, 'w')",dmga="(1d6, 'm')"): sk.__init__(self,source,sc,mod) self.dmgo = dmgo self.dmgg = dmgg self.dmga = dmga - def getdmg(self,dmgroll): - astr = "===> Damage " + def getdmg(self,dmgroll): + astr = "<b>===></b> Damage " droll = str(dmgroll[0]) + xyz = droll.split('(') + secD = (int(xyz[1][:-1])/2) ## SEG* Calculate Secondary Damage + +## varN = "secD" +## debug(varN) +## debug(secD) ## seg added debug output + dtype = dmgroll[1] astr += droll - if dtype=="s": astr += " stun" - elif dtype=="w": astr += " wound" - elif dtype=="m":astr += " mortal" + if dtype=="s": astr += " <b><font size=2 color='#52D017'>stun</font></b><BR>" + elif dtype=="w": + astr += " <b><font size=2 color='#C11B17'>wound</font></b>"+" <b>======></b> Secondary Damage ("+str(secD) \ + +") <b><font size=2 color='#52D017'>stun</font></b><BR>" # SEG* Display Secondary Damage + elif dtype=="m": + astr += " <b><font size=2 color='#FF0000'>mortal</font></b>"+" <b>======></b> Secondary Damage ("+str(secD) \ + +") <b><font size=2 color='#52D017'>stun</font></b>"+" <b>/</b> ("+str(secD)+") <b><font size=2 color='#C11B17'>wound</font></b><BR>" # SEG* Display Secondary Damage return astr def __str__(self): - myStr = self.getRolLStr() - successes = {'CS': " <b><font color='#00aa00'>CRITICAL SUCCESS</font></b>", - 'CF': " <b><font color='#ff0000'>CRITICAL FAILURE</font></b>", - 'A': " <b><font color='#00aa00'>AMAZING HIT</font></b> ", - 'G': " <b>Good HIT</b> ", - 'O': " <b>Ordinary HIT</b> ", - 'F': " <b>miss</b>"} - myStr += successes[self.success] - if self.success == 'A': myStr += self.getdmg(self.dmga) - elif self.success == 'G': myStr += self.getdmg(self.dmgg) - elif self.success == 'O': myStr += self.getdmg(self.dmgo) + myStr = self.getRolLStr() + +## varN = "myStr" +## debug(varN) +## debug(myStr) ## seg added debug output + + successes = {'CS': " <b><font size=2 color='#8D38C9'>CRITICAL SUCCESS</font></b>", + 'CF': " <b><font size=2 color='#151B54'>CRITICAL FAILURE</font></b>", + 'A': " <b><font size=2 color='#E42217'>AMAZING HIT</font></b><BR> ", + 'G': " <b><font size=2 color='#306EFF'>Good HIT</font></b><BR> ", + 'O': " <b><font size=2 color='#52D017'>Ordinary HIT</font></b><BR> ", + 'F': " <b><font size=2 color='#41627E'>miss</font></b>"} + if ( self.d20 == 1 ): + myStr += successes['CS'] # SEG Dec 19 2009 + + if ( self.d20 == 1 ) and (self.success == 'F') : + myStr += successes['F'] # SEG JAN 23 2010 + myStr += " final result ==> " + self.success = 'O' + + myStr += successes[self.success] + if self.success == 'A': myStr += self.getdmg(self.dmga) + elif self.success == 'G': myStr += self.getdmg(self.dmgg) + elif self.success == 'O': myStr += self.getdmg(self.dmgo) return myStr - + +class ac(sk): + def __init__(self,source=[],sc=10,mod=0): + sk.__init__(self,source,sc,mod) + + def __str__(self): + myStr = self.getRolLStr() + +## varN = "myStr" +## debug(varN) +## debug(myStr) ## seg added debug output + + myStr = " <b><font color='#E42217'>ACTION CHECK : </font></b>"+myStr + successes = {'CS': " <b><font size=2 color='#8D38C9'>CRITICAL SUCCESS</font></b>", + 'CF': " <b><font size=2 color='#151B54'>CRITICAL FAILURE</font></b><BR> -2 Step make up bonus next Action Check", + 'A': " <b><font size=2 color='#E42217'>AMAZING Success</font></b>", + 'G': " <b><font size=2 color='#306EFF'>Good Success</font></b>", + 'O': " <b><font size=2 color='#52D017'>Ordinary Success</font></b>", + 'F': " <b><font size=2 color='#41627E'>Marginal failure</font></b>"} + if ( self.d20 == 1 ): myStr += successes['CS'] # SEG Dec 19 2009 + myStr += successes[self.success] + if ( self.d20 == 1 ) and (self.success == 'F') : + myStr += " final result ==> " + myStr += successes['O'] # SEG JAN 23 2010 + if ( self.d20 != 1 ) and (self.success == 'F') : + myStr += "<BR> -1 Step make up bonus next Action Check" + + return myStr + + + + + + + + + + + + + +