2009-07-13, 01:55 PM
I ran a debugger on the server stuff. Here's what I found. It's not bulletproof (pretty easy to find weaknesses in this algorithm I've posted), so I'll need more time with the function. Think of the following as a very good idea for how it should work.
Code:
def CalcRandStat(VariationType, StatOnWeapon):
if VariationType == 0: # Gach item
PossibleIterations = (StatOnWeapon / 5) + 1
if PossibleIterations > 7:
PossibleIterations = 7
if VariationType == 1: # Regular weapon
PossibleIterations = (StatOnWeapon / 5) + 1
if PossibleIterations > 5:
PossibleIterations = 5
randStat = 0
for Iter in range(PossibleIterations):
randStat += getVariation()
StatOnWeapon += randStat
return StatOnWeapon
def getVariation():
myVar = CRand32.Random()
#complete guesses on these probabilities. But this is how the function works
if myVar < 0.30:
return -1
if myVar < 0.70:
return 0
else:
return 1