2009-07-13, 11:02 PM
Fiel Wrote:Rewrote it closer to the actual function
Code:def randStat(VariationType, WeaponStat):
baseChange = (WeaponStat / 10) + 1
if VarationType == "Gachapon" and baseChange > 7:
baseChange = 7
if VariationType == "RegItem" and baseChange > 5:
baseChange = 5
if VariationType == "ChaosScroll":
baseChange = 5
rand = CRand32.Rand()
wepStatDelta = 0
for change in range(baseChange):
wepStatDelta += rand & 1
rand >>= 1
rand = CRand32.Rand()
if(rand > 0):
return WeaponStat + wepStatDelta
else:
return WeaponStat - wepStatDelta
I'll post the translated ASM later.
Assuming CRand32.Rand() produces integers from -2^31 to 2^31 - 1, then there's a higher chance in losing stats than gaining stats, though it's an abnormally low difference. Would been better doing a
if (rand & 1) == 1
instead, as it would cost less workpower. :x
Oh well, assuming 50-50, the table turns out like this:
Page-widthener
(But that's only, and only if you're certain on this.)
Noah

