diff --git a/descriptions/rep/en_us.lua b/descriptions/rep/en_us.lua index dd5fe833..c167926b 100644 --- a/descriptions/rep/en_us.lua +++ b/descriptions/rep/en_us.lua @@ -214,7 +214,7 @@ local repCollectibles={ [562] = {"562", "Rock Bottom", "Prevents stats from being lowered for the rest of the run"}, -- Rock Bottom [563] = {"563", "Nancy Bombs", "+5 bombs#Bombs explode with a random bomb effect"}, -- Nancy Bombs [564] = {"564", "A Bar of Soap", "↑ +0.5 Tears up#↑ +0.2 Shot Speed up"}, -- A Bar of Soap - [565] = {"565", "Blood Puppy", "Familiar that chases enemies#After killing enough enemies, it becomes more powerful but will also try to hurt you#Attacking it returns it to normal"}, -- Blood Puppy + [565] = {"565", "Blood Puppy", "Familiar that chases enemies#After killing 15 enemies, it deals more damage, drops half a heart every 10 kills, but will also try to hurt you#After killing 40 enemies, it deals even more damage, drops full hearts, and can destroy rocks#Attacking it returns it to normal"}, -- Blood Puppy [566] = {"566", "Dream Catcher", "+1 half Soul Heart when entering a new floor#Displays upcoming Treasure Room item and boss in the stage transition nightmare"}, -- Dream Catcher [567] = {"567", "Paschal Candle", "↑ +0.4 Fire Rate up for every room cleared without taking damage#Up to +2 Fire Rate possible"}, -- Paschal Candle [568] = {"568", "Divine Intervention", "Double tapping a fire key creates a shield#Shield lasts 1 second, pushes enemies away and reflects enemy projectiles and lasers"}, -- Divine Intervention @@ -1049,4 +1049,4 @@ if EID.enableDebug then EID.descriptions[languageCode].repTrinkets = repTrinkets EID.descriptions[languageCode].repCards = repCards EID.descriptions[languageCode].repPills = repPills -end \ No newline at end of file +end diff --git a/eid_modifiers.lua b/eid_modifiers.lua index fd5b5236..7dc6677b 100644 --- a/eid_modifiers.lua +++ b/eid_modifiers.lua @@ -106,7 +106,7 @@ local game = Game() if descObj.ObjType ~= 5 or descObj.ObjVariant ~= PickupVariant.PICKUP_COLLECTIBLE then return false end - if EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_SPINDOWN_DICE) then + if EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_SPINDOWN_DICE) or (EID.absorbedSpindown and EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_VOID)) then return true end return false diff --git a/main.lua b/main.lua index fbc6e7fb..8dd1c69e 100644 --- a/main.lua +++ b/main.lua @@ -28,6 +28,7 @@ EID.sacrificeCounter = {} EID.itemConfig = Isaac.GetItemConfig() EID.itemUnlockStates = {} EID.CraneItemType = {} +EID.absorbedSpindown = false -- Sprite inits EID.IconSprite = Sprite() @@ -186,7 +187,7 @@ questionMarkSprite:LoadGraphics() function EID:IsAltChoice(pickup) -- do not run this while Curse of the Blind is active, since this function is really just a "is collectible pedestal a red question mark" check - if game:GetLevel():GetCurses() & LevelCurse.CURSE_OF_BLIND == LevelCurse.CURSE_OF_BLIND then + if EID:hasCurseBlind() then return false end if pickup:GetData() == nil then @@ -244,8 +245,10 @@ local initialItemNext = false local flipItemNext = false if REPENTANCE then EID.flipItemPositions = {} + EID.flipMaxIndex = -1 local lastGetItemResult = {nil, nil, nil, nil} -- itemID, Frame, gridIndex, InitSeed + local lastFrameGridChecked = 0 function EID:postGetCollectible(selectedCollectible, itemPoolType, decrease, seed) -- Handle Crane Game @@ -301,8 +304,8 @@ if REPENTANCE then -- Update a Flip item's init seed after D6 rerolls or using Flip (aka Grid Index didn't change, Init Seed did) if EID.flipItemPositions[curRoomIndex] and not EID.flipItemPositions[curRoomIndex][entity.InitSeed] then - -- Fix pedestal grid indexes (fixes bugs with restock shops, hopefully it isn't laggy) - EID:CheckFlipGridIndexes() + -- Check if any Flip pedestals have changed grid indexes (fixes bugs with Greed shops) + if lastFrameGridChecked ~= Isaac.GetFrameCount() then EID:CheckFlipGridIndexes() end for k,v in pairs(EID.flipItemPositions[curRoomIndex]) do if v[2] == gridPos then EID.flipItemPositions[curRoomIndex][entity.InitSeed] = v @@ -319,8 +322,18 @@ if REPENTANCE then end EID:AddCallback(ModCallbacks.MC_POST_PICKUP_INIT, EID.postPickupInit, PickupVariant.PICKUP_COLLECTIBLE) + function EID:CheckPedestalIndex(entity) + -- Only pedestals with indexes that were present at room load can be flip pedestals; fixes shop restock machines + if EID.flipItemPositions[curRoomIndex] and EID.flipItemPositions[curRoomIndex][entity.InitSeed] and entity.Index > EID.flipMaxIndex then + EID.flipItemPositions[curRoomIndex][entity.InitSeed] = nil + entity:GetData()["EID_FlipItemID"] = nil + end + end + EID:AddCallback(ModCallbacks.MC_POST_PICKUP_UPDATE, EID.CheckPedestalIndex, PickupVariant.PICKUP_COLLECTIBLE) + -- Before using Flip, swap all flippable pedestal's current item with the flip one (also, fix grid index if needed) function EID:CheckFlipGridIndexes(collectibleType) + lastFrameGridChecked = Isaac.GetFrameCount() local curRoomIndex = game:GetLevel():GetCurrentRoomIndex() if EID.flipItemPositions[curRoomIndex] then local pedestals = Isaac.FindByType(5, 100, -1, true, false) @@ -331,7 +344,7 @@ if REPENTANCE then flipEntry[2] = gridPos if collectibleType == CollectibleType.COLLECTIBLE_FLIP then -- don't swap a flip shadow with an empty pedestal! - if pedestal.SubType == 0 then flipEntry = nil + if pedestal.SubType == 0 then EID.flipItemPositions[curRoomIndex][pedestal.InitSeed] = nil else flipEntry[1] = pedestal.SubType end end end @@ -339,6 +352,18 @@ if REPENTANCE then end end EID:AddCallback(ModCallbacks.MC_PRE_USE_ITEM, EID.CheckFlipGridIndexes, CollectibleType.COLLECTIBLE_FLIP) + + -- Watch for a Void absorbing a Spindown Dice + function EID:CheckVoidAbsorbs(collectibleType) + local pedestals = Isaac.FindByType(5, 100, -1, true, false) + for _, pedestal in ipairs(pedestals) do + if pedestal.SubType == CollectibleType.COLLECTIBLE_SPINDOWN_DICE then + EID.absorbedSpindown = true + return + end + end + end + EID:AddCallback(ModCallbacks.MC_PRE_USE_ITEM, EID.CheckVoidAbsorbs, CollectibleType.COLLECTIBLE_VOID) end --------------------------------------------------------------------------- @@ -507,21 +532,28 @@ function EID:printBulletPoints(description, renderPos) end end --------------------------------------------------------------------------- ----------------------------Handle New Room-------------------------------- +----------------------------Handle New Room-------------------------------- local isMirrorRoom = false +local isDeathCertRoom = false if REPENTANCE then function EID:onNewRoom() isMirrorRoom = game:GetLevel():GetCurrentRoom():IsMirrorWorld() + local level = game:GetLevel() + local id = level:GetCurrentRoomIndex() + isDeathCertRoom = (id >=0 and GetPtrHash(level:GetRoomByIdx(id)) == GetPtrHash(level:GetRoomByIdx(id, 2))) + -- Handle Flip Item initialItemNext = false flipItemNext = false + EID.flipMaxIndex = -1 local curRoomIndex = game:GetLevel():GetCurrentRoomIndex() - if EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_FLIP) and EID.flipItemPositions[curRoomIndex] then + if EID.flipItemPositions[curRoomIndex] then local pedestals = Isaac.FindByType(5, 100, -1, true, false) for _, pedestal in ipairs(pedestals) do local flipEntry = EID.flipItemPositions[curRoomIndex][pedestal.InitSeed] if flipEntry then + if pedestal.Index > EID.flipMaxIndex then EID.flipMaxIndex = pedestal.Index end pedestal:GetData()["EID_FlipItemID"] = flipEntry[1] end end @@ -995,7 +1027,7 @@ local function onRender(t) elseif closest.Variant == PickupVariant.PICKUP_COLLECTIBLE then --Handle Collectibles if EID:getEntityData(closest, "EID_DontHide") ~= true then - if (EID:hasCurseBlind() and not closest:ToPickup().Touched and EID.Config["DisableOnCurse"]) or (EID.Config["DisableOnAltPath"] and not closest:ToPickup().Touched and EID:IsAltChoice(closest)) or (game.Challenge == Challenge.CHALLENGE_APRILS_FOOL and EID.Config["DisableOnAprilFoolsChallenge"]) then + if (EID:hasCurseBlind() and not closest:ToPickup().Touched and EID.Config["DisableOnCurse"] and not isDeathCertRoom) or (EID.Config["DisableOnAltPath"] and not closest:ToPickup().Touched and EID:IsAltChoice(closest)) or (game.Challenge == Challenge.CHALLENGE_APRILS_FOOL and EID.Config["DisableOnAprilFoolsChallenge"]) then EID:renderQuestionMark() return end @@ -1083,16 +1115,22 @@ if EID.MCMLoaded or REPENTANCE then ["BagFloorContent"] = true, ["CraneItemType"] = true, ["FlipItemPositions"] = true, + ["AbsorbedSpindownDice"] = true, } if EID:HasData() then local savedEIDConfig = json.decode(Isaac.LoadModData(EID)) if REPENTANCE then + EID.BagItems = {} + EID.CraneItemType = {} EID.flipItemPositions = {} + EID.absorbedSpindown = false + if isSave then EID.BagItems = savedEIDConfig["BagContent"] EID.bagOfCraftingRoomQueries = savedEIDConfig["BagFloorContent"] EID.CraneItemType = savedEIDConfig["CraneItemType"] + EID.absorbedSpindown = savedEIDConfig["AbsorbedSpindownDice"] -- turn list back into dict because json cant save dict indices. local flipItemTable = {} @@ -1109,8 +1147,6 @@ if EID.MCMLoaded or REPENTANCE then savedEIDConfig[k] = nil end end - else - EID.BagItems = {} end -- Only copy Saved config entries that exist in the save @@ -1156,6 +1192,7 @@ if EID.MCMLoaded or REPENTANCE then EID.Config["BagContent"] = EID.BagItems or {} EID.Config["BagFloorContent"] = EID.bagOfCraftingRoomQueries or {} EID.Config["CraneItemType"] = EID.CraneItemType or {} + EID.Config["AbsorbedSpindownDice"] = EID.absorbedSpindown or false -- turn dictionary into list because json cant save dict indices. local flipItemTable = {}