From ab7e4aa5183ce405033018fb2288d46bd68f49b3 Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sat, 28 Mar 2026 10:48:53 -0400 Subject: [PATCH] add addSelfCondition --- features/eid_conditionals_funcs.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/features/eid_conditionals_funcs.lua b/features/eid_conditionals_funcs.lua index 130df9a4..f85a7747 100644 --- a/features/eid_conditionals_funcs.lua +++ b/features/eid_conditionals_funcs.lua @@ -1,6 +1,6 @@ local game = Game() local modTextsAdded = 0 -local function newModdedCondition(text, language) +function newModdedCondition(text, language) if text == nil then return nil end modTextsAdded = modTextsAdded + 1 EID:CreateDescriptionTableIfMissing("ConditionalDescs", language) @@ -43,6 +43,21 @@ function EID:addSynergyCondition(ID1, ID2, text1, text2, language, extraTable) EID:AddSynergyConditional(ID1, ID2, modifierText1, modifierText2, extraTable) end +-- Shortcut function for when you see a second copy of an item you already own (so it can say no effect or unique effects) +-- It will not show while in the Item Reminder, as that would be silly +-- ownedID can be a collectible ID or a full item string (like "5.350.54") +-- The text will be added as a new line, with the owned item's icon at the start +-- By default, the text will also be shown while holding Diplopia/Crooked Penny +-- Optional parameters: language, extraTable, includeDiplopiaCrooked +-- Example usage: EID:addSelfConditional(myUselessIfDupedItemID, "No effect from multiple copies") +function EID:addSelfCondition(ownedID, text, language, extraTable, includeDiplopiaCrooked) + language = language or EID.DefaultLanguageCode + if includeDiplopiaCrooked == nil then includeDiplopiaCrooked = true end + local modifierText = newModdedCondition(text, language) + if includeDiplopiaCrooked then EID:AddItemConditional(ownedID, {ownedID, 347, 485}, modifierText, extraTable, false) + else EID:AddItemConditional(ownedID, ownedID, modifierText, extraTable, false) end +end + -- Function for adding text to a pedestal's description when you're playing a specific character -- The character's head icon will be at the start of appended lines -- By default, adding a conditional to a base character will also add it to the Tainted version of the character