From d695293451c51ba094d1e6e0fa2be83ee43a2656 Mon Sep 17 00:00:00 2001 From: kohashiwakaba Date: Wed, 23 Feb 2022 16:33:27 +0900 Subject: [PATCH] Card/Pill metadata test --- eid_api.lua | 19 +++++++++++++++++++ eid_modifiers.lua | 15 ++++++++------- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/eid_api.lua b/eid_api.lua index 5b26e58f..42473d23 100644 --- a/eid_api.lua +++ b/eid_api.lua @@ -79,6 +79,17 @@ function EID:addCard(id, description, itemName, language) EID.descriptions[language].custom["5.300." .. id] = {id, itemName, description, EID._currentMod} end +-- Adds a metadata for a card. Used for Blank Card/Clear Rune. Optional parameters: isRune +function EID:addCardMetadata(id, mimicCharge, isRune) + if isRune then + EID.blankCardHidden[id] = true + EID.runeIDs[id] = true + end + EID.cardMetadata[id] = { + mimiccharge = type(mimicCharge) == "number" and mimicCharge or -1 + } +end + -- Adds a description for a pilleffect id. Optional parameters: itemName, language function EID:addPill(id, description, itemName, language) itemName = itemName or nil @@ -86,6 +97,14 @@ function EID:addPill(id, description, itemName, language) EID.descriptions[language].custom["5.70." .. id+1] = {id+1, itemName, description, EID._currentMod} end +-- Adds a metadata for a pilleffect. Used for Placebo/False PHD. Optional parameters: class +function EID:addPillMetadata(id, mimicCharge, class) + EID.pillMetadata[id] = { + mimiccharge = type(mimicCharge) == "number" and mimicCharge or -1, + class = class or "0", + } +end + -- Adds a character specific description for the item "Birthright". Optional parameters: playerName, language function EID:addBirthright(characterId, description, playerName, language) playerName = playerName or nil diff --git a/eid_modifiers.lua b/eid_modifiers.lua index 2b9cc703..c4cc0390 100644 --- a/eid_modifiers.lua +++ b/eid_modifiers.lua @@ -21,6 +21,9 @@ end EID.collectiblesOwned = {} EID.collectiblesAbsorbed = {} EID.blackRuneOwned = false +EID.blankCardHidden = {[32]=true,[33]=true,[34]=true,[35]=true,[36]=true,[37]=true,[38]=true,[39]=true,[40]=true,[41]=true,[49]=true,[50]=true,[55]=true,[78]=true} +EID.runeIDs = {[32]=true,[33]=true,[34]=true,[35]=true,[36]=true,[37]=true,[38]=true,[39]=true,[40]=true,[41]=true,[55]=true,[81]=true,[82]=true,[83]=true,[84]=true,[85]=true,[86]=true,[87]=true,[88]=true,[89]=true,[90]=true,[91]=true,[92]=true,[93]=true,[94]=true,[95]=true,[96]=true,[97]=true,} + local lastCheck = 0 function EID:CheckPlayersCollectibles() @@ -328,11 +331,10 @@ if REPENTANCE then end -- Handle Blank Card description addition - local blankCardHidden = {[32]=true,[33]=true,[34]=true,[35]=true,[36]=true,[37]=true,[38]=true,[39]=true,[40]=true,[41]=true,[49]=true,[50]=true,[55]=true,[78]=true} local function BlankCardCallback(descObj) local text = EID:getDescriptionEntry("BlankCardCharge") local charge = EID.cardMetadata[descObj.ObjSubType] - if text ~= nil and charge ~= nil then + if text ~= nil and charge ~= nil and charge.mimiccharge ~= -1 then local iconStr = "#{{Collectible286}} {{ColorSilver}}" if descObj.ObjSubType == 48 then -- ? card text = EID:getDescriptionEntry("BlankCardQCard") @@ -345,11 +347,10 @@ if REPENTANCE then end -- Handle Clear Rune description addition - local runeIDs = {[32]=true,[33]=true,[34]=true,[35]=true,[36]=true,[37]=true,[38]=true,[39]=true,[40]=true,[41]=true,[55]=true,[81]=true,[82]=true,[83]=true,[84]=true,[85]=true,[86]=true,[87]=true,[88]=true,[89]=true,[90]=true,[91]=true,[92]=true,[93]=true,[94]=true,[95]=true,[96]=true,[97]=true,} local function ClearRuneCallback(descObj) local text = EID:getDescriptionEntry("ClearRuneCharge") local charge = EID.cardMetadata[descObj.ObjSubType] - if text ~= nil and charge ~= nil then + if text ~= nil and charge ~= nil and charge.mimiccharge ~= -1 then local iconStr = "#{{Collectible263}} {{ColorSilver}}" EID:appendToDescription(descObj, iconStr..text.." {{"..charge.mimiccharge.."}}{{Battery}}") end @@ -361,7 +362,7 @@ if REPENTANCE then local text = EID:getDescriptionEntry("PlaceboCharge") local adjustedID = EID:getAdjustedSubtype(descObj.ObjType, descObj.ObjVariant, descObj.ObjSubType) local charge = EID.pillMetadata[adjustedID-1] - if text ~= nil and charge ~= nil then + if text ~= nil and charge ~= nil and charge.mimiccharge ~= -1 then local iconStr = "#{{Collectible348}} {{ColorSilver}}" EID:appendToDescription(descObj, iconStr..text.." {{"..charge.mimiccharge.."}}{{Battery}}") end @@ -453,8 +454,8 @@ if REPENTANCE then elseif descObj.ObjVariant == PickupVariant.PICKUP_TAROTCARD then if EID.collectiblesOwned[451] then table.insert(callbacks, TarotClothCallback) end - if EID.collectiblesOwned[286] and not blankCardHidden[descObj.ObjSubType] and descObj.ObjSubType <= 80 then table.insert(callbacks, BlankCardCallback) end - if EID.collectiblesOwned[263] and runeIDs[descObj.ObjSubType] then table.insert(callbacks, ClearRuneCallback) end + if EID.collectiblesOwned[286] and not EID.blankCardHidden[descObj.ObjSubType] and EID.cardMetadata[descObj.ObjSubType] then table.insert(callbacks, BlankCardCallback) end + if EID.collectiblesOwned[263] and EID.runeIDs[descObj.ObjSubType] and EID.cardMetadata[descObj.ObjSubType] then table.insert(callbacks, ClearRuneCallback) end -- Pill Callbacks elseif descObj.ObjVariant == PickupVariant.PICKUP_PILL then if EID.collectiblesOwned[654] then table.insert(callbacks, FalsePHDCallback) end