From 7e7e57223512daa8887a088de7f14ac50106b7de Mon Sep 17 00:00:00 2001 From: Wofsauge Date: Wed, 17 Jul 2024 19:43:17 +0200 Subject: [PATCH] small code cleanup --- features/eid_conditionals.lua | 7 ------- features/eid_modifiers.lua | 38 ++++++++++++++++++----------------- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/features/eid_conditionals.lua b/features/eid_conditionals.lua index 919118b4..0f1bcc11 100644 --- a/features/eid_conditionals.lua +++ b/features/eid_conditionals.lua @@ -341,17 +341,10 @@ TODOS I'VE DECIDED NOT TODO RIGHT NOW: Incubus effects; a lot are AB+ only; annoying to test; plus Lilith has to be added for all of them too TODOs unrelated to conditionals: -Luck modifier that prints out a percentage for the effect based on your current luck stat -What item is Liberty Cap, Broken Syringe, etc. currently giving? -RNG cheat for Crooked Penny Implement the standardized colors for characters, items, map names, etc -Make Glitched Crown type pedestals work better in EID (pause on one item and press tab to switch to the next item) Don't show Void stat ups depending on what Void has absorbed (abyss absorbed = no void stat ups etc, reroll item = might become actives) REPENTOGON TODOS: -Glyph of balance (test with bethany but repentogon's is probably always right) -Item reminder previews of immaculate/cambion progress (cambion's increases after two familiars; vardata like glowing hourglass?) -Purity's current stat boost Attack formula simulator? (yeah right) MAYBE SOME DAYS: diff --git a/features/eid_modifiers.lua b/features/eid_modifiers.lua index a55cd9da..27c328c5 100644 --- a/features/eid_modifiers.lua +++ b/features/eid_modifiers.lua @@ -733,7 +733,7 @@ if EID.isRepentance then return descObj end - + -- Handle Glitched Crown style pedestals local currentSelection = {} -- keep track of which description we're looking at for a given pedestal local goingToSpindown = false @@ -741,54 +741,56 @@ if EID.isRepentance then if not descObj.Entity then return descObj end local entity = descObj.Entity local curRoomIndex = game:GetLevel():GetCurrentRoomDesc().ListIndex - - if EID.GlitchedCrownCheck[curRoomIndex] and EID.GlitchedCrownCheck[curRoomIndex][descObj.Entity.InitSeed..descObj.Entity.Index] then + + if EID.GlitchedCrownCheck[curRoomIndex] and EID.GlitchedCrownCheck[curRoomIndex][descObj.Entity.InitSeed .. descObj.Entity.Index] then -- this table has collectible ID keys that define the first frame and most recent frame that that ID has been seen on this pedestal -- we need to filter out items that haven't been seen in a while (due to a reroll perhaps), then sort by first frame - local pedestalID = descObj.Entity.InitSeed..descObj.Entity.Index + local pedestalID = descObj.Entity.InitSeed .. descObj.Entity.Index local items = EID.GlitchedCrownCheck[curRoomIndex][pedestalID] local sortedItems = {} - for id,frames in pairs(items) do + for id, frames in pairs(items) do if EID.GameUpdateCount - frames[2] > 120 then items[id] = nil else - table.insert(sortedItems, {id, frames[1]}) + table.insert(sortedItems, { id, frames[1] }) end end if #sortedItems < 5 then return descObj end table.sort(sortedItems, function(a, b) return a[2] < b[2] end) - + currentSelection[pedestalID] = currentSelection[pedestalID] or 0 - + -- watch for Tab being pressed to advance our selection by 1 -- when spindown dice is involved, watch for tab being released instead of pressed, it makes more sense if goingToSpindown and EID:TabReleased() or not goingToSpindown and EID:TabPressed() then currentSelection[pedestalID] = currentSelection[pedestalID] + 1 if currentSelection[pedestalID] > #sortedItems then currentSelection[pedestalID] = 0 end end - + -- display the overview description if currentSelection[pedestalID] == 0 then descObj = EID:getDescriptionObj(5, 100, 689, nil, false) descObj.Description = "" - for _,item in ipairs(sortedItems) do + for _, item in ipairs(sortedItems) do descObj.Description = descObj.Description .. "#{{NameC" .. item[1] .. "}}" end - -- display a specific description - -- don't replace the desc if the pedestal's already showing the correct item + -- display a specific description + -- don't replace the desc if the pedestal's already showing the correct item else - descObj = EID:getDescriptionObj(5, 100, sortedItems[currentSelection[pedestalID]][1]) + descObj = EID:getDescriptionObj(5, 100, sortedItems[currentSelection[pedestalID]][1]) end - + local nextIcon = "{{Collectible689}}" - if currentSelection[pedestalID]+1 <= #sortedItems then nextIcon = "{{Collectible" .. sortedItems[currentSelection[pedestalID]+1][1] .. "}}" end - EID:appendToDescription(descObj, "#{{Blank}} ".. EID:ReplaceVariableStr(EID:getDescriptionEntry("GlitchedCrownToggleInfo"),1,nextIcon)) - + if currentSelection[pedestalID] + 1 <= #sortedItems then nextIcon = "{{Collectible" .. + sortedItems[currentSelection[pedestalID] + 1][1] .. "}}" end + EID:appendToDescription(descObj, + "#{{Blank}} " .. EID:ReplaceVariableStr(EID:getDescriptionEntry("GlitchedCrownToggleInfo"), 1, nextIcon)) + -- manually apply Flip; changing the description's item stops future callbacks to avoid infinite loops, but we want Flip still, it works fine descObj.Entity = entity if EID.collectiblesOwned[711] and descObj.ObjSubType ~= entity.SubType then descObj = FlipCallback(descObj) end end - + return descObj end