D Infinity Rep support

This commit is contained in:
Buurazu authored and GitHub committed 2022-06-18 02:39:16 -04:00
1 parent 282b81bf38
commit 8036d30a8b
1 file changed
+22 -7
+22 -7
View File
@@ -16,23 +16,38 @@ function EID:SeedToFloat(seed)
return seed * multi;
end
-- D Infinity --
local dinfinityList = { [0] = 105, 166, 284, 283, 285, 406, 386 }
-- Repentance's D Infinity order: D1, D4, D6, Eternal D6, D7, D8, D10, D12, D20, D100
if REPENTANCE then dinfinityList = { 476, 284, 105, 609, 437, 406, 285, 386, 166, 283 } end
if REPENTANCE then dinfinityList = { [0] = 476, 284, 105, 609, 437, 406, 285, 386, 166, 283 } end
-- Returns the item ID of D Infinity's current die
-- For Repentance, the Drop button is tracked, which is probably not 100% successful, and handled elsewhere
function EID:CurrentDInfinity(rng)
function EID:CurrentDInfinity(rng, player)
if not REPENTANCE then
rng = EID:RNGNext(rng, 0x1, 0x9, 0x1D) -- magic disassembled numbers!
return dinfinityList[rng % 7]
else
-- track our current selected dinfinity dice! test if it is preserved between pickups of it
-- TBA
return 489
local playerID = EID:getPlayerID(player)
return dinfinityList[EID.DInfinityState[playerID]] or 476
end
end
local justDidD = false
if REPENTANCE then
-- To help with Rep tracking, watch for D Infinity to get used and resync its current dice
function EID:WatchForDInfinity()
justDidD = true
end
EID:AddCallback(ModCallbacks.MC_PRE_USE_ITEM, EID.WatchForDInfinity, CollectibleType.COLLECTIBLE_D_INFINITY)
function EID:WatchForDice(collectibleType, rng, player)
if not justDidD or collectibleType == 489 then return end
justDidD = false
local playerID = EID:getPlayerID(player)
for i,v in ipairs(dinfinityList) do
if v == collectibleType then EID.DInfinityState[playerID] = i end
end
end
EID:AddCallback(ModCallbacks.MC_PRE_USE_ITEM, EID.WatchForDice)
end
-- Metronome --
-- Banned items: Metronome, Plan C, Glowing Hour Glass, Breath of Life, Clicker, R Key
@@ -252,4 +267,4 @@ function EID:VoidRNGCheck(player, isRune)
eidTable[2] = {table.unpack(increases)}
-- if there were no absorbable pedestals, the "single increase" stats are the same as the "one extra" stats
if count == 0 then eidTable[3] = {table.unpack(increases)} end
end
end