Conditionals overhaul (#666)

* more general type check

* conditional work + characterInfo

* conditional work + characterInfo

* conditional overhaul WIP

* fix typo with BagLearnedRecipes

* Cursed Eye + Black Candle synergy

* conditional stuff

* Change Brittle wording

* Teleport 2.0 Red Room check

* Changed collectiblesToCheck format, moved some mods to conds

* Add getPlayerName, tweak replaceNameMarkupStrings

* massive conditional overhaul

* AB+ birthright check fix

* oh yeah birthright isn't zero-indexed yet

* update with mirades

* update with mirades

* Move blank card / rune IDs

* move rune IDs, reduce reused code

* Add {{NameOnlyX###}} markup

* more conditionals

* more conditionals

* Update eid_conditionals.lua

* separate icon from name in variablecharge

* keep old localizations working

* split Dead Cat so it doesn't have a variable text

* Blank Card + ? Card

* moving Blank Card + ? Card

* Pretend english detailed doesn't exist

* Oops! No Comma!

* milk override

* Placenta no red hp

* actually no placenta still gives +1 health

* Dark Arts conditional

* Marbles percentage

* Dark Arts conditional
This commit is contained in:
Buurazu authored and GitHub committed 2024-06-09 17:59:56 +02:00
1 parent 68caf34fed
commit ac2aecae92
30 files changed
+614 -358

No files matched your search

+22 -7
View File
@@ -617,6 +617,12 @@ function EID:getObjectName(Type, Variant, SubType)
return Type.."."..Variant.."."..SubType
end
function EID:getPlayerName(id)
local playerInfo = EID:getDescriptionEntry("characterInfo")[id]
local birthrightInfo = EID.isRepentance and EID:getDescriptionEntry("birthright")[id+1]
return (playerInfo and playerInfo[1]) or (birthrightInfo and birthrightInfo[1]) or "???"
end
-- returns the name of a pill based on the pilleffect id
function EID:getPillName(pillID, isHorsepill)
local moddedDesc = EID:getDescriptionEntry("custom", "5.70."..pillID)
@@ -713,6 +719,12 @@ end
function EID:replaceNameMarkupStrings(text)
for word in string.gmatch(text, "{{Name.-}}") do
local strTrimmed = string.gsub(word, "{{Name(.-)}}", function(a) return a end)
local showIcon = true
-- If the markup is {{NameOnlyX###}}, do not print an icon before the name
if string.find(text, "NameOnly") then
strTrimmed = string.gsub(word, "{{NameOnly(.-)}}", function(a) return a end)
showIcon = false
end
local indicator = string.sub(strTrimmed, 1, 1)
local id = tonumber(string.sub(strTrimmed, 2, -1))
local name = ""
@@ -723,15 +735,17 @@ function EID:replaceNameMarkupStrings(text)
end
name = EID:getObjectName(entityID[1], entityID[2], entityID[3])
elseif indicator == "C" then -- Collectible
name = "{{Collectible"..id.."}}"..EID:getObjectName(5, 100, id)
name = (showIcon and "{{Collectible"..id.."}} " or "")..EID:getObjectName(5, 100, id)
elseif indicator == "T" then -- Trinket
name = "{{Trinket"..id.."}}"..EID:getObjectName(5, 350, id)
name = (showIcon and "{{Trinket"..id.."}} " or "")..EID:getObjectName(5, 350, id)
elseif indicator == "P" then -- Pills
name = "{{Pill"..id.."}}"..EID:getPillName(id, false)
name = (showIcon and "{{Pill"..id.."}} " or "")..EID:getPillName(id, false)
elseif indicator == "K" then -- Card
name = "{{Card"..id.."}}"..EID:getObjectName(5, 300, id)
name = (showIcon and "{{Card"..id.."}} " or "")..EID:getObjectName(5, 300, id)
elseif indicator == "I" then -- Player (I for Isaac)
name = (showIcon and "{{Player"..id.."}} " or "")..EID:getPlayerName(id)
end
text = string.gsub(text, word, "{{ColorYellow}}"..name.."{{CR}}", 1)
text = string.gsub(text, word, name, 1)
end
return text
end
@@ -1179,7 +1193,7 @@ function EID:PlayersHaveCharacter(playerType, includeTainted)
if player:GetPlayerType() == playerType then
return true, player
end
if includeTainted and REPENTANCE and Isaac.GetPlayerTypeByName(player:GetName()) == playerType then
if includeTainted and EID.isRepentance and Isaac.GetPlayerTypeByName(player:GetName()) == playerType then
return true, player
end
end
@@ -1586,7 +1600,7 @@ function EID:getLanguage()
end
function EID:AddToCollectiblesToCheckList(itemID)
table.insert(EID.collectiblesToCheck, itemID)
EID.collectiblesToCheck[itemID] = true
end
-- Add a specific entity to be ignored by EID. Set entitySubType to -1 in order to ignore all entities with this type+variant combi
@@ -2057,5 +2071,6 @@ end
-- Replaces Variable placeholders in string with a given value
-- Example: "My {1} message" --> "My test message"
function EID:ReplaceVariableStr(str, varID, newString)
if type(str) ~= "string" or newString == nil then return str end
return str:gsub("{"..varID.."}", newString)
end