Added universal RNGNext function
This commit is contained in:
1 parent
b670249687
commit
b1f2644979
2 files changed
+20
-20
No files matched your search
+18
-9
@@ -1055,17 +1055,11 @@ end
|
|||||||
-- Didn't seem right to put them in main or eid_modifiers
|
-- Didn't seem right to put them in main or eid_modifiers
|
||||||
local numVoidable = 0
|
local numVoidable = 0
|
||||||
local numRunable = 0
|
local numRunable = 0
|
||||||
local function VoidRNGNext(num)
|
|
||||||
num = num ~ ((num >> 5) & 4294967295)
|
|
||||||
num = num ~ ((num << 9) & 4294967295)
|
|
||||||
num = num ~ ((num >> 7) & 4294967295)
|
|
||||||
return num >> 0;
|
|
||||||
end
|
|
||||||
local function GetTwoIncreases(rng, tbl)
|
local function GetTwoIncreases(rng, tbl)
|
||||||
local statTable = {1,2,3,4,5,6}
|
local statTable = {1,2,3,4,5,6}
|
||||||
-- perform 5 random swaps of our stat table
|
-- perform 5 random swaps of our stat table
|
||||||
for i = 6, 2, -1 do
|
for i = 6, 2, -1 do
|
||||||
rng = VoidRNGNext(rng)
|
rng = EID:RNGNext(rng, 5, 9, 7)
|
||||||
local result = (rng % i) + 1
|
local result = (rng % i) + 1
|
||||||
local temp = statTable[i]
|
local temp = statTable[i]
|
||||||
statTable[i] = statTable[result]
|
statTable[i] = statTable[result]
|
||||||
@@ -1103,14 +1097,13 @@ end
|
|||||||
-- Determine what stats will be increased after 1 absorption, the whole room's absorption, and whole room + a purchased item above your head
|
-- Determine what stats will be increased after 1 absorption, the whole room's absorption, and whole room + a purchased item above your head
|
||||||
function EID:VoidRNGCheck(player, isRune)
|
function EID:VoidRNGCheck(player, isRune)
|
||||||
local increases = {0, 0, 0, 0, 0, 0}
|
local increases = {0, 0, 0, 0, 0, 0}
|
||||||
local shopItemIncreases = {}; local singleIncreases = {}
|
|
||||||
|
|
||||||
local startRNG = (isRune and player:GetCardRNG(Card.RUNE_BLACK):GetSeed()) or player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_VOID):GetSeed()
|
local startRNG = (isRune and player:GetCardRNG(Card.RUNE_BLACK):GetSeed()) or player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_VOID):GetSeed()
|
||||||
local count = (isRune and numRunable) or numVoidable
|
local count = (isRune and numRunable) or numVoidable
|
||||||
local eidTable = (isRune and EID.BlackRuneStatIncreases) or EID.VoidStatIncreases
|
local eidTable = (isRune and EID.BlackRuneStatIncreases) or EID.VoidStatIncreases
|
||||||
|
|
||||||
-- in Repentance, an additional RNG call is done before the 5 for stat ups when using Void
|
-- in Repentance, an additional RNG call is done before the 5 for stat ups when using Void
|
||||||
if REPENTANCE and not isRune then startRNG = VoidRNGNext(startRNG) end
|
if REPENTANCE and not isRune then startRNG = EID:RNGNext(startRNG, 5, 9, 7) end
|
||||||
for i = 1, count do
|
for i = 1, count do
|
||||||
startRNG = GetTwoIncreases(startRNG, increases)
|
startRNG = GetTwoIncreases(startRNG, increases)
|
||||||
if i == 1 then eidTable[3] = {table.unpack(increases)} end
|
if i == 1 then eidTable[3] = {table.unpack(increases)} end
|
||||||
@@ -1716,3 +1709,19 @@ end
|
|||||||
function EID:AddIconToObject(eType, eVariant, eSubType, iconName)
|
function EID:AddIconToObject(eType, eVariant, eSubType, iconName)
|
||||||
EID.ObjectIcon[eType.."."..eVariant.."."..eSubType] = EID.InlineIcons[iconName]
|
EID.ObjectIcon[eType.."."..eVariant.."."..eSubType] = EID.InlineIcons[iconName]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- reimplementation of RNG Seed shift feature used by the game. Mostly used for RNG Prediction features
|
||||||
|
function EID:RNGNext(rngNum, shift1, shift2, shift3)
|
||||||
|
rngNum = rngNum ~ ((rngNum >> shift1) & 4294967295)
|
||||||
|
rngNum = rngNum ~ ((rngNum << shift2) & 4294967295)
|
||||||
|
rngNum = rngNum ~ ((rngNum >> shift3) & 4294967295)
|
||||||
|
return rngNum >> 0;
|
||||||
|
end
|
||||||
|
|
||||||
|
-- General RNG functions for RNG predicting
|
||||||
|
function EID:SeedToFloat(seed)
|
||||||
|
local multi = 2.3283061589829401E-10;
|
||||||
|
return seed * multi;
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
+2
-11
@@ -217,18 +217,9 @@ local recheckPickups = false
|
|||||||
local customRNGSeed = 0x77777770
|
local customRNGSeed = 0x77777770
|
||||||
local customRNGShift = {0,0,0}
|
local customRNGShift = {0,0,0}
|
||||||
|
|
||||||
local function RNGNext()
|
|
||||||
local num = customRNGSeed
|
|
||||||
num = num ~ ((num >> customRNGShift[1]) & 4294967295)
|
|
||||||
num = num ~ ((num << customRNGShift[2]) & 4294967295)
|
|
||||||
num = num ~ ((num >> customRNGShift[3]) & 4294967295)
|
|
||||||
customRNGSeed = num >> 0;
|
|
||||||
return customRNGSeed;
|
|
||||||
end
|
|
||||||
|
|
||||||
local function nextFloat()
|
local function nextFloat()
|
||||||
local multi = 2.3283061589829401E-10;
|
local multi = 2.3283061589829401E-10;
|
||||||
return RNGNext() * multi;
|
return EID:RNGNext(customRNGSeed, customRNGShift[1], customRNGShift[2], customRNGShift[3]) * multi;
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Convert a pickup's ID into what ingredient it counts as
|
-- Convert a pickup's ID into what ingredient it counts as
|
||||||
@@ -387,7 +378,7 @@ function EID:calculateBagOfCrafting(componentsTable)
|
|||||||
compCounts[compId + 1] = compCounts[compId + 1] + 1
|
compCounts[compId + 1] = compCounts[compId + 1] + 1
|
||||||
compTotalWeight = compTotalWeight + pickupValues[compId + 1]
|
compTotalWeight = compTotalWeight + pickupValues[compId + 1]
|
||||||
customRNGShift = componentShifts[compId + 1]
|
customRNGShift = componentShifts[compId + 1]
|
||||||
RNGNext()
|
EID:RNGNext(customRNGSeed, customRNGShift[1], customRNGShift[2], customRNGShift[3])
|
||||||
end
|
end
|
||||||
customRNGShift = componentShifts[7]
|
customRNGShift = componentShifts[7]
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user