From f70d4074a8bdf70fce7e1774d9635fafd0b5c4e5 Mon Sep 17 00:00:00 2001 From: Felix H Date: Mon, 29 Jan 2024 04:56:25 +0100 Subject: [PATCH] Update Glowing Hourglass description when it is depleted (#636) * added descriptions for glowing hour glass uses * add callback for glowing hourglass * removed one entry for glowing hourglass, updated description * better callback for glowing hourglass * removed newline --- descriptions/rep/en_us.lua | 1 + eid_modifiers.lua | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/descriptions/rep/en_us.lua b/descriptions/rep/en_us.lua index ce606c2e..4c7a97b5 100644 --- a/descriptions/rep/en_us.lua +++ b/descriptions/rep/en_us.lua @@ -1173,6 +1173,7 @@ EID.descriptions[languageCode].ClearRuneCharge = "Clear Rune charge:" EID.descriptions[languageCode].PlaceboCharge = "Placebo charge:" EID.descriptions[languageCode].FlipItemToggleInfo = "(Hold {{CONFIG_BoC_Toggle}} to show description)" +EID.descriptions[languageCode].GlowingHourglassTransformed = "Will change back to Glowing Hourglass next floor" EID.descriptions[languageCode].FalsePHDHeart = "Spawns 1 {{BlackHeart}} Black Heart" EID.descriptions[languageCode].FalsePHDDamage = "↑ {{Damage}} +0.6 Damage" diff --git a/eid_modifiers.lua b/eid_modifiers.lua index f7d591ef..d0c36b63 100644 --- a/eid_modifiers.lua +++ b/eid_modifiers.lua @@ -287,6 +287,23 @@ if EID.isRepentance then return descObj end + -- Handle Glowing Hourglass description + local function GlowingHourglassCallback(descObj) + if REPENTOGON then + local transformedText = EID:getDescriptionEntry("GlowingHourglassTransformed") + local numUses = Isaac.GetPlayer():GetActiveItemDesc().VarData + if numUses == 3 then + -- Replace with the description of The Hourglass + descObj.Description = EID:getDescriptionObj(5, 100, 66).Description + if transformedText ~= nil then + EID:appendToDescription(descObj, "#{{Warning}} "..transformedText) + end + end + end + return descObj + end + + -- Handle Bingeeater description addition local function BingeEaterCallback(descObj) local bingeBuff = EID:getDescriptionEntry("bingeEaterBuffs", descObj.ObjSubType) @@ -752,6 +769,8 @@ if EID.isRepentance then -- Using magic numbers here in case it's slightly faster, and because the callback names give context -- Check Birthright first because it overwrites the description instead of appending to it if descObj.ObjSubType == 619 then table.insert(callbacks, BirthrightCallback) end + -- Glowing Hourglass overwrites the description when used three times + if REPENTOGON and descObj.ObjSubType == 422 then table.insert(callbacks, GlowingHourglassCallback) end if descObj.ObjSubType == 644 then table.insert(callbacks, ConsolationPrizeCallback) end if EID.collectiblesOwned[664] then table.insert(callbacks, BingeEaterCallback) end