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:
1 parent
68caf34fed
commit
ac2aecae92
30 files changed
+614
-358
No files matched your search
+22
-7
@@ -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
|
||||
+292
-109
@@ -1,27 +1,220 @@
|
||||
local game = Game()
|
||||
|
||||
--[[ Descs that need a variant:
|
||||
respawn items that respawn you as the tainted version of yourself
|
||||
tainted isaac Consolation Prize, Experimental Treatment
|
||||
things that apply only to Lost/Tainted Lost (broken heart card, magic skin)
|
||||
spoilers descs
|
||||
lachyphragy in co-op? tech zero in co-op? yum heart and such obviously
|
||||
black candle + cursed penny / cursed eye
|
||||
healing stuff for keeper?
|
||||
iron bar + notched axe
|
||||
IV bag in hard mode
|
||||
IV bag for keeper (hmm, two different modifiers needed!)
|
||||
swallowed penny keeper
|
||||
experimental pill phd / false phd / phd + falsephd prints nothing
|
||||
iv bag also has interaction with PHD...
|
||||
Items that have synergies with other specific items
|
||||
Items that override other items (brimstone, mom's knife, epic fetus stuff)
|
||||
EID.DescriptionConditions = {}
|
||||
-- table of collectible IDs to periodically check if the players own. used by eid_modifiers.lua
|
||||
EID.collectiblesToCheck = {}
|
||||
|
||||
--[[
|
||||
Argument 1: The item ID
|
||||
For convenience, numbers are assumed to be a collectible ID; strings in Type.Var.Sub format can be used as well
|
||||
If you're adding a condition that applies to many items, you can pass in a table of IDs
|
||||
If you're adding a condition that applies to an entire type of item, pass in a string in Type.Var format
|
||||
|
||||
Argument 2: The function that will apply the condition if it returns true
|
||||
|
||||
TODO: new config options for spoiler descs, and for hiding the "needed for collection" stuff
|
||||
Argument 3 (optional): Additional text for finding the string in the localization file
|
||||
For example, if you put "Overridden" here, modifying Tech X, it will look for ConditionalDescs["5.100.395 (Overridden)"] AND ConditionalDescs["Overridden"]
|
||||
|
||||
Argument 4 (optional): Table with any additional options, usually not needed:
|
||||
variableText: If there's a {1} in the desc, it will be replaced with this; can be a function for more dynamic text results, it will get descObj passed into it
|
||||
variableText2: If there's a {2} in the desc, it will be replaced with this; can be a function
|
||||
locTable: Specify a different table to look for the localization string in, rather than ConditionalDescs
|
||||
noTable: Set to true to look in the base localizations only (requires modText) (not used yet...)
|
||||
lineColor: Appended lines will be highlighted with this color
|
||||
replaceColor: Find/replace text will be highlighted with this color
|
||||
bulletpoint: Appended lines will begin with this bulletpoint
|
||||
noFallback: Don't fallback to English if this isn't localized; by default, conditionals don't fallback, to avoid printing English text in unupdated languages
|
||||
|
||||
Argument 5 (very optional): The position in the table to insert this new condition, in case mods want to insert modifiers before our base ones
|
||||
]]
|
||||
function EID:AddConditional(IDs, funcText, modText, extraTable, insertPoint)
|
||||
if type(IDs) ~= "table" then IDs = {IDs} end
|
||||
if modText == "" then modText = nil end
|
||||
extraTable = extraTable or {}
|
||||
-- make a shallow copy of the passed-in table
|
||||
local newTable = {}; for k,v in pairs(extraTable) do newTable[k] = v end
|
||||
newTable.func = funcText;
|
||||
newTable.modifierText = modText;
|
||||
if newTable.noFallback == nil then newTable.noFallback = true end
|
||||
for _, id in ipairs(IDs) do
|
||||
if type(id) ~= "string" then id = "5.100." .. id end
|
||||
-- Check for only one period in the id string to mark it as being a general condition
|
||||
local _, count = string.gsub(id, "%.", "")
|
||||
if count == 1 then newTable.general = true end
|
||||
EID.DescriptionConditions[id] = EID.DescriptionConditions[id] or {}
|
||||
if insertPoint then table.insert(EID.DescriptionConditions[id], insertPoint, newTable)
|
||||
else table.insert(EID.DescriptionConditions[id], newTable) end
|
||||
end
|
||||
end
|
||||
|
||||
-- Easy to use functions for conditionals that rely on having a specific collectible/character
|
||||
-- By default, they'll have a bulletpoint for the coll/char, and {1} becomes the coll/char's name
|
||||
|
||||
-- checkInReminder is for if a synergy is no longer relevant once the item isn't obtainable (e.g. Abyss locusts) (true by default)
|
||||
function EID:AddCollectibleConditional(IDs, ownedIDs, modText, extraTable, checkInReminder)
|
||||
if type(ownedIDs) ~= "table" then ownedIDs = {ownedIDs} end
|
||||
if checkInReminder == nil then checkInReminder = true end
|
||||
extraTable = extraTable or {}
|
||||
for _, ownedID in ipairs(ownedIDs) do
|
||||
EID.collectiblesToCheck[ownedID] = true
|
||||
if extraTable.variableText == nil then extraTable.variableText = "{{NameOnlyC" .. ownedID .. "}}" end
|
||||
if extraTable.bulletpoint == nil then extraTable.bulletpoint = "Collectible" .. ownedID end
|
||||
EID:AddConditional(IDs, function() return EID:ConditionalCollCheck(ownedID,checkInReminder) end, modText, extraTable)
|
||||
end
|
||||
end
|
||||
|
||||
-- For adding pairs of abilities to collectibles; you can define a different modifier text for each of them
|
||||
-- example: EID:AddSynergyConditional({list of IDs overridden by Brimstone}, Brimstone, "Overridden", "Overrides")
|
||||
function EID:AddSynergyConditional(IDs, ownedIDs, modText1, modText2, extraTable1, extraTable2, checkInReminder)
|
||||
EID:AddCollectibleConditional(IDs, ownedIDs, modText1, extraTable1, checkInReminder)
|
||||
EID:AddCollectibleConditional(ownedIDs, IDs, modText2 or modText1, extraTable2 or extraTable1, checkInReminder)
|
||||
end
|
||||
|
||||
-- includeTainted is for if you want to check the normal and tainted version of a character (true by default)
|
||||
function EID:AddPlayerConditional(IDs, charIDs, modText, extraTable, includeTainted)
|
||||
if type(charIDs) ~= "table" then charIDs = {charIDs} end
|
||||
if includeTainted == nil then includeTainted = true end
|
||||
extraTable = extraTable or {}
|
||||
for _, charID in ipairs(charIDs) do
|
||||
if extraTable.variableText == nil then extraTable.variableText = "{{NameOnlyI" .. charID .. "}}" end
|
||||
if extraTable.bulletpoint == nil then extraTable.bulletpoint = "Player" .. charID end
|
||||
EID:AddConditional(IDs, function() return EID:ConditionalCharCheck(charID,includeTainted) end, modText, extraTable)
|
||||
end
|
||||
end
|
||||
|
||||
-- Adding our conditionals (should this be its own file away from the functions that add/print conditionals?)
|
||||
|
||||
--[[
|
||||
TODO STUFF:
|
||||
|
||||
new config options for spoiler-heavy descriptions if we make any (chaos card and plan C?)
|
||||
CO-OP BENEFIT ITEMS! tech zero / extension cord in co-op? yum heart and such
|
||||
Items that override other items (brimstone, mom's knife, epic fetus stuff)
|
||||
BFFs / the fly booster + Tainted Apollyon, Tainted Eve; melody trinket + Tainted Eve; these are insane synergies that deserve attention
|
||||
TODO: Make some of these coll/char IDs be from the enum for readability? or just keep it to comments
|
||||
TODO: A find/replace pair for some Keeper descriptions that talk about Red hearts but work for him, Red -> Coin or Red/Coin; Could be good for Dead Cat
|
||||
TODO: AB+ tarot cloth buffs table?
|
||||
-- hey what if all these Luck addons that I kinda don't like instead showed an accurate percentage of what they do at your current luck (although this is Modifier territory, with a per character display)
|
||||
-- todo: TrinketConditional, use it for the crystal key + pandora's box or whichever key it is, and Black Feather items maybe
|
||||
-- todo: Vibrant/Dim Bulb + doesn't work with pocket consumables. could be conditional actually if we have a list of char IDs with pocket actives
|
||||
-- todo: idk about the BFFs synergy stuff but I noticed that Brown Nugget is incorrectly dealt with, it gained double damage in rep
|
||||
-- hive mind and BFFs synergy has a lot of overlap also
|
||||
-- brown nugget + sacrificial altar in AB+?!
|
||||
-- ? Card + single use actives in Repentance? Alabaster Box
|
||||
-- unrelated to conditionals: Glyph of Balance prediction in Item Reminder?
|
||||
|
||||
-- meta todo: Put a 100% save file for AB+ and for Rep on my flash drive
|
||||
|
||||
]]
|
||||
|
||||
-- silly function but I don't want to mess with Game() colon functions in the conditions table
|
||||
-- General conditions
|
||||
-- Tarot Cloth (AB+ and Rep) (fallback to English because most are just find+replace)
|
||||
EID:AddCollectibleConditional("5.300", 451, nil, {locTable = "tarotClothBuffsAB", replaceColor = "ColorShinyPurple", noFallback = false})
|
||||
if EID.isRepentance then EID:AddCollectibleConditional("5.300", 451, nil, {locTable = "tarotClothBuffs", replaceColor = "ColorShinyPurple", noFallback = false}) end
|
||||
EID:AddCollectibleConditional("5.100", 356, nil, {locTable = "carBattery", replaceColor = "BlinkYellowGreen"}) -- Car Battery
|
||||
|
||||
-- IV Bag conditions (need to be applied in a specific order)
|
||||
EID:AddCollectibleConditional(135, 75, "PHD") -- PHD improves IV Bag
|
||||
EID:AddPlayerConditional(135, 14, "Keeper 0-1") -- Keeper gets 0-1 coins
|
||||
if EID.isRepentance then EID:AddConditional(135, function() return EID:IsHardMode() end, "Hard Mode") end -- Hard Mode pays out less
|
||||
|
||||
-- Greed Mode
|
||||
EID:AddConditional({241, "5.300.15"}, function() return game:IsGreedMode() end) -- Contract From Below, Temperance
|
||||
EID:AddConditional("5.300.15", function() return game:IsGreedMode() and EID:PlayersHaveCollectible(451) end, "Tarot") -- Temperance + Greed + Tarot
|
||||
|
||||
-- Different effect for No Red Health players
|
||||
-- TODO: separate this into a Rep-only part, and figure out what they do exactly with Keeper/Forgotten
|
||||
EID:AddConditional({442, 676}, function() return EID:CheckForNoRedHealthPlayer() end, "No Red") -- Dark Prince's Crown, Empty Heart
|
||||
EID:AddConditional(81, function() return EID:CheckForNoRedHealthPlayer() end) -- Dead Cat
|
||||
--TODO: Keeper/Forgotten DON'T benefit from Empty Heart but DO benefit from Dark Prince's Crown? Nothing's consistent... does the Soul benefit while Forgotten does
|
||||
|
||||
-- Achievement checks (these always return true without REPENTOGON)
|
||||
EID:AddConditional("5.350.23", function() return EID:HaveNotUnlockedAchievement(82) end) -- Sacrifice Poster unlocks The Lost
|
||||
|
||||
-- Specific character synergies/changes
|
||||
EID:AddPlayerConditional(549, {10,14})-- Keeper/Lost + Brittle Bones
|
||||
EID:AddPlayerConditional(108, 14, "No Effect") -- Keeper + The Wafer
|
||||
EID:AddPlayerConditional(227, 14, "Keeper 0-1") -- Keeper + Piggy Bank
|
||||
EID:AddPlayerConditional(501, 14) -- Keeper + Greed's Gullet
|
||||
EID:AddPlayerConditional(230, 14, "Keeper") -- Keeper + Abaddon
|
||||
|
||||
-- Item Synergies
|
||||
EID:AddSynergyConditional(7, 34); EID:AddCollectibleConditional("5.300.16", 7) -- Martyr + Book of Belial/The Devil
|
||||
EID:AddSynergyConditional(316, 260) -- Black Candle + Cursed Eye
|
||||
EID:AddCollectibleConditional("5.300.48", 286, nil, {lineColor = "ColorSilver"}) -- Blank Card + ? Card
|
||||
|
||||
-- Overridden by Brimstone
|
||||
-- Haven't done it yet but I'm sure preparing the system for it
|
||||
-- Remember most of these will be AB+ only (not EID.isRepentance)
|
||||
|
||||
|
||||
if EID.isRepentance then
|
||||
-- General conditions
|
||||
EID:AddCollectibleConditional("5.100", 706, nil, {locTable = "abyssSynergies", lineColor = "ColorRed"}, false) -- Abyss (no item reminder)
|
||||
EID:AddCollectibleConditional("5.100", 59, nil, {locTable = "bookOfBelialBuffs"}) -- Belial Birthright
|
||||
EID:AddCollectibleConditional("5.100", 664, nil, {locTable = "bingeEaterBuffs"}) -- Binge Eater
|
||||
|
||||
-- Co-op friendly items
|
||||
-- todo (yum heart, extension cord)
|
||||
|
||||
-- Tainted characters reviving as themselves
|
||||
EID:AddPlayerConditional({161, "5.350.28"}, 25, "Tainted Revive") -- Ankh, Broken Ankh
|
||||
EID:AddPlayerConditional(311, 24, "Tainted Revive") -- Judas's Shadow
|
||||
EID:AddPlayerConditional(332, {29, 38}, "Tainted Revive") -- Lazarus's Rags
|
||||
EID:AddPlayerConditional("5.350.23", 31, "Tainted Revive") -- Sacrifice Poster
|
||||
|
||||
-- Specific character synergies/changes
|
||||
EID:AddPlayerConditional("5.350.1", 14, "Keeper 0-1") -- Keeper + Swallowed Penny
|
||||
EID:AddPlayerConditional(188, 2) -- Cain + Abel
|
||||
EID:AddPlayerConditional(360, 13) -- Incubus + Lilith
|
||||
EID:AddPlayerConditional({240, 644}, 21) -- Tainted Isaac + Experimental Treatment, Consolation Prize
|
||||
EID:AddPlayerConditional({642, 694}, 10) -- Lost + Magic Skin, Heartbreak
|
||||
EID:AddPlayerConditional("5.350.156", 14) -- Keeper + Mother's Kiss
|
||||
EID:AddPlayerConditional(230, 18, "Bethany", nil, false) -- Bethany + Abaddon
|
||||
EID:AddPlayerConditional(230, 36, "Tainted Bethany") -- Tainted Bethany + Abaddon
|
||||
EID:AddPlayerConditional(245, 14, "Keeper") -- 20/20 + Keeper
|
||||
EID:AddPlayerConditional(705, {12, 24}) -- Dark Arts + Dark/Tainted Judas
|
||||
|
||||
-- Item Synergies
|
||||
EID:AddCollectibleConditional(201, 147) -- Iron Bar refills Notched Axe
|
||||
EID:AddCollectibleConditional("5.350.172", 260) -- Black Candle + Cursed Penny
|
||||
EID:AddCollectibleConditional(501, 416) -- Greed's Gullet + Deep Pockets
|
||||
EID:AddSynergyConditional(245, {2, 153, 169}, nil, "20/20") -- 20/20 + Mutant Spider, The Inner Eye, Polyphemus
|
||||
EID:AddSynergyConditional(330, 561, "Overridden", "Overrides") -- Soy+Almond Milk
|
||||
end
|
||||
|
||||
----- Evaluation Functions -----
|
||||
|
||||
function EID:ConditionalCharCheck(playerType, includeTainted)
|
||||
-- We don't want to display irrelevant item info inside the Item Reminder
|
||||
if EID.InsideItemReminder then
|
||||
local player = EID:ItemReminderGetAllPlayers()[EID.ItemReminderSelectedPlayer + 1] or EID.player
|
||||
if player:GetPlayerType() == playerType then return true
|
||||
elseif includeTainted and EID.isRepentance and Isaac.GetPlayerTypeByName(player:GetName()) == playerType then return true
|
||||
else return false end
|
||||
else
|
||||
return EID:PlayersHaveCharacter(playerType, includeTainted)
|
||||
end
|
||||
end
|
||||
function EID:ConditionalCollCheck(collectibleID, checkInReminder)
|
||||
-- We don't want to display irrelevant item info inside the Item Reminder
|
||||
if EID.InsideItemReminder then
|
||||
if not checkInReminder then return false end
|
||||
local player = EID:ItemReminderGetAllPlayers()[EID.ItemReminderSelectedPlayer + 1] or EID.player
|
||||
if player:HasCollectible(collectibleID) then return true end
|
||||
-- Check for the item being inside the Item Reminder player's Void (not sure if this is ever relevant...)
|
||||
if player:HasCollectible(477) then
|
||||
local playerID = EID:getPlayerID(player)
|
||||
if EID.absorbedItems[tostring(playerID)] and EID.absorbedItems[tostring(playerID)][tostring(collectibleID)] then
|
||||
return true
|
||||
end
|
||||
end
|
||||
else
|
||||
return EID.collectiblesOwned[collectibleID] or EID.collectiblesAbsorbed[collectibleID]
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function EID:IsGreedMode()
|
||||
return game:IsGreedMode()
|
||||
end
|
||||
@@ -32,10 +225,15 @@ end
|
||||
|
||||
-- Check if we have any characters that can't have Red Health, to print additions to descs like Dead Cat
|
||||
function EID:CheckForNoRedHealthPlayer()
|
||||
for i = 0, game:GetNumPlayers() - 1 do
|
||||
local player = Isaac.GetPlayer(i)
|
||||
if EID.NoRedHeartsPlayerIDs[player:GetPlayerType()] then
|
||||
return true
|
||||
if EID.InsideItemReminder then
|
||||
local player = EID:ItemReminderGetAllPlayers()[EID.ItemReminderSelectedPlayer + 1] or EID.player
|
||||
return EID.NoRedHeartsPlayerIDs[player:GetPlayerType()]
|
||||
else
|
||||
for i = 0, game:GetNumPlayers() - 1 do
|
||||
local player = Isaac.GetPlayer(i)
|
||||
if EID.NoRedHeartsPlayerIDs[player:GetPlayerType()] then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
@@ -66,53 +264,8 @@ function EID:HaveNotUnlockedAchievement(achID)
|
||||
return not EID:HaveUnlockedAchievement(achID)
|
||||
end
|
||||
|
||||
--EID:PlayersHaveCharacter is already in the api to use for things like Swallowed Penny
|
||||
|
||||
|
||||
|
||||
--[[ (The conditions table has to be down here so that the functions exist)
|
||||
|
||||
func: The function that will be called to check if the condition is true
|
||||
vars: A table of values that will be passed into func
|
||||
type: A string denoting what kind of description change this is
|
||||
"append": Add new lines to the end of the description (default)
|
||||
"replaceAll": The entire description is replaced with a new one
|
||||
"findReplace": Find a phrase and replace it with a new one (the text in the localization file will be a table)
|
||||
repOnly: Don't check this on Afterbirth+ (not always necessary, because AB+ won't have the text anyway)
|
||||
abpOnly: Don't check this on Repentance
|
||||
modifierText: Text to add to find a specific string in the localization file (for items with multiple modifiers)
|
||||
|
||||
Due to co-op, it's best for replacing text in descriptions to only be used for things like Greed/Hard Mode
|
||||
Otherwise, appending is better so that players not affected by the change can still see what it will be for them
|
||||
]]
|
||||
EID.DescriptionConditions = {
|
||||
-- No Red HP
|
||||
["5.100.81"] = {func = EID.CheckForNoRedHealthPlayer}, -- Dead Cat
|
||||
["5.100.442"] = {func = EID.CheckForNoRedHealthPlayer}, -- Dark Prince's Crown
|
||||
["5.100.676"] = {func = EID.CheckForNoRedHealthPlayer}, -- Empty Heart
|
||||
|
||||
-- Keeper
|
||||
["5.100.135"] = { -- IV Bag is complicated
|
||||
{func = EID.PlayersHaveCollectible, vars = {75}, modifierText = "PHD"},
|
||||
{func = EID.PlayersHaveCharacter, vars = {14, true}, modifierText = "Keeper"},
|
||||
{func = EID.IsHardMode, type = "findReplace", modifierText = "Hard Mode"}, },
|
||||
["5.350.1"] = {func = EID.PlayersHaveCharacter, vars = {14, true}}, -- Swallowed Penny
|
||||
|
||||
-- Revives
|
||||
["5.100.161"] = {func = EID.PlayersHaveCharacter, vars = {25}}, -- Ankh
|
||||
["5.350.28"] = {func = EID.PlayersHaveCharacter, vars = {25}}, -- Broken Ankh
|
||||
["5.100.311"] = {func = EID.PlayersHaveCharacter, vars = {24}}, -- Judas's Shadow
|
||||
["5.100.332"] = {func = EID.PlayersHaveCharacter, vars = {29}}, -- Lazarus's Rags
|
||||
["5.350.23"] = { -- Missing Poster (revive, plus Unlock The Lost text if he's not unlocked)
|
||||
{func = EID.PlayersHaveCharacter, vars = {31}, modifierText = "Tainted Lost"},
|
||||
{func = EID.HaveNotUnlockedAchievement, vars = {82} } },
|
||||
|
||||
-- Greed Mode
|
||||
["5.100.241"] = {func = EID.IsGreedMode}, -- Contract From Below
|
||||
["5.300.15"] = {func = EID.IsGreedMode, type = "replaceAll"}, -- Temperance: spawns beggar in greed mode
|
||||
["5.300.15 (Tarot)"] = {func = EID.IsGreedMode, type = "replaceAll"}, -- Temperance + Tarot Cloth + Greed Mode
|
||||
|
||||
}
|
||||
----- Apply Conditionals -----
|
||||
|
||||
-- thing to fix find/replace pairs with hyphens (like "1-2") breaking because hyphen is a special char
|
||||
-- https://stackoverflow.com/questions/29072601/lua-string-gsub-with-a-hyphen
|
||||
@@ -121,51 +274,81 @@ local function replace(str, what, with, count)
|
||||
with = string.gsub(with, "[%%]", "%%%%") -- escape replacement
|
||||
return string.gsub(str, what, with, count)
|
||||
end
|
||||
-- super simple table concatenation: https://www.tutorialspoint.com/concatenation-of-tables-in-lua-programming
|
||||
local function TableConcat(t1,t2)
|
||||
for i=1,#t2 do
|
||||
t1[#t1+1] = t2[i]
|
||||
end
|
||||
return t1
|
||||
end
|
||||
|
||||
function EID:applyConditionals(descObj, modifierText)
|
||||
local typeVarSub = descObj.ObjType.."."..descObj.ObjVariant.."."..descObj.ObjSubType
|
||||
if modifierText then typeVarSub = typeVarSub .. " (" .. modifierText .. ")" end
|
||||
function EID:applyConditionals(descObj)
|
||||
EID:CheckPlayersCollectibles()
|
||||
|
||||
local conds = EID.DescriptionConditions[typeVarSub]
|
||||
if not conds then return descObj end
|
||||
|
||||
-- Check every condition we need to check for this item (usually 1)
|
||||
if #conds == 0 then conds = { conds } end
|
||||
local typeVar = descObj.ObjType.."."..descObj.ObjVariant -- for general conditions (Tarot Cloth, Book of Virtues)
|
||||
local typeVarSub = descObj.fullItemString -- for specific conditions
|
||||
-- Combine general+specific conditions into one table
|
||||
local conds = {}
|
||||
if EID.DescriptionConditions[typeVar] then TableConcat(conds, EID.DescriptionConditions[typeVar]) end
|
||||
if EID.DescriptionConditions[typeVarSub] then TableConcat(conds, EID.DescriptionConditions[typeVarSub]) end
|
||||
-- Check every condition we need to check for this item
|
||||
for _, cond in ipairs(conds) do
|
||||
local tvs = typeVarSub
|
||||
if cond.modifierText then tvs = tvs .. " (" .. cond.modifierText .. ")" end
|
||||
-- Don't fall back to English if the current language doesn't have the entry
|
||||
local text = EID:getDescriptionEntry("ConditionalDescs", tvs, true)
|
||||
if (text ~= nil) and (not repOnly or REPENTANCE) and (not abpOnly or not REPENTANCE) then
|
||||
-- is there a way to pass all a table's values into a function aside from this? it's fine for now...
|
||||
cond.vars = cond.vars or {}
|
||||
if cond.func(EID, cond.vars[1], cond.vars[2], cond.vars[3], cond.vars[4]) then
|
||||
if (cond.type == "append" or cond.type == nil) then
|
||||
descObj.Description = descObj.Description .. "#" .. text
|
||||
elseif (cond.type == "replaceAll") then
|
||||
descObj.Description = text
|
||||
elseif (cond.type == "findReplace") then
|
||||
-- Entry 1 is replaced with entry 2, entry 3 is replaced with entry 4, etc.
|
||||
local pos = 1
|
||||
while pos < #text do
|
||||
local toFind = text[pos]
|
||||
local replaceWith = text[pos+1]
|
||||
|
||||
--"%d*%.?%d+" will grab every number group (1, 10, 0.5), this will allow us to not replace the "1" in "10" erroneously
|
||||
if (type(toFind) == "number") then
|
||||
local count = 0
|
||||
descObj.Description = string.gsub(descObj.Description, "%d*%.?%d+", function(s)
|
||||
if (s == tostring(toFind) and count == 0) then
|
||||
count = count + 1
|
||||
return replaceWith
|
||||
end
|
||||
end)
|
||||
-- Basic find+replace for non-numbers
|
||||
else
|
||||
descObj.Description = replace(descObj.Description, tostring(toFind), replaceWith, 1)
|
||||
end
|
||||
pos = pos + 2
|
||||
-- Search for the localization string; "S" (for generals) or "T.V.S" or "T.V.S (Modifier)" or "Modifier"
|
||||
local locTable = cond.locTable or "ConditionalDescs"
|
||||
local text = nil
|
||||
|
||||
if cond.noTable then
|
||||
text = EID:getDescriptionEntry(cond.modifierText, nil, cond.noFallback)
|
||||
elseif cond.general then
|
||||
text = EID:getDescriptionEntry(locTable, descObj.ObjSubType, cond.noFallback)
|
||||
elseif cond.modifierText then
|
||||
text = EID:getDescriptionEntry(locTable, typeVarSub .. " (" .. cond.modifierText .. ")", cond.noFallback)
|
||||
if text == nil then text = EID:getDescriptionEntry(locTable, cond.modifierText, cond.noFallback) end
|
||||
else
|
||||
text = EID:getDescriptionEntry(locTable, typeVarSub, cond.noFallback)
|
||||
end
|
||||
|
||||
-- If we find the localization string for this condition, and it passes the test, modify the description text
|
||||
if text ~= nil and cond.func() then
|
||||
local variableText = type(cond.variableText) == "function" and cond.variableText(descObj) or cond.variableText
|
||||
local variableText2 = type(cond.variableText2) == "function" and cond.variableText2(descObj) or cond.variableText2
|
||||
|
||||
-- String = append
|
||||
if type(text) == "string" then
|
||||
text = EID:ReplaceVariableStr(text, 1, variableText)
|
||||
text = EID:ReplaceVariableStr(text, 2, variableText2)
|
||||
local iconStr = "#"
|
||||
if cond.bulletpoint then iconStr = iconStr .. "{{" .. cond.bulletpoint .. "}} " end
|
||||
if cond.lineColor then iconStr = iconStr .. "{{" .. cond.lineColor .. "}}" end
|
||||
EID:appendToDescription(descObj, iconStr..text:gsub("#",iconStr))
|
||||
|
||||
-- Table with 1 entry = replace
|
||||
elseif #text == 1 then
|
||||
descObj.Description = EID:ReplaceVariableStr(EID:ReplaceVariableStr(text[1], 1, variableText), 2, variableText2)
|
||||
|
||||
-- Table with 2+ entries = find and replace pairs
|
||||
-- Entry 1 is replaced with entry 2, entry 3 is replaced with entry 4, etc.
|
||||
else
|
||||
local pos = 1
|
||||
while pos < #text do
|
||||
local toFind = text[pos]
|
||||
local replaceWith = EID:ReplaceVariableStr(text[pos+1], 1, variableText)
|
||||
replaceWith = EID:ReplaceVariableStr(replaceWith, 2, variableText2)
|
||||
if cond.replaceColor then replaceWith = "{{" .. cond.replaceColor .. "}}" .. replaceWith .. "{{CR}}" end
|
||||
--"%d*%.?%d+" will grab every number group (1, 10, 0.5), this will allow us to not replace the "1" in "10" erroneously
|
||||
if (type(toFind) == "number") then
|
||||
local count = 0
|
||||
descObj.Description = string.gsub(descObj.Description, "%d*%.?%d+", function(s)
|
||||
if (s == tostring(toFind) and count == 0) then
|
||||
count = count + 1
|
||||
return replaceWith
|
||||
end
|
||||
end)
|
||||
-- Basic find+replace for non-numbers
|
||||
else
|
||||
descObj.Description = replace(descObj.Description, tostring(toFind), replaceWith, 1)
|
||||
end
|
||||
pos = pos + 2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+13
-7
@@ -918,6 +918,14 @@ EID.LocalModePositionOffset = {
|
||||
-- Items that dont have an effect with BFFS! item
|
||||
EID.BFFSNoSynergy = {[11] = true, [81] = true, [238] = true, [239] = true, [243] = true, [265] = true, [268] = true, [269] = true, [278] = true, [280] = true, [281] = true, [387] = true, [404] = true, [405] = true, [431] = true, [436] = true, [469] = true, [472] = true, [492] = true, [516] = true, [528] = true, [542] = true, [543] = true }
|
||||
|
||||
-- todo: this table is wrong, for instance brown nugget didnt have one and then got one
|
||||
if REPENTANCE then
|
||||
EID.BFFSNoSynergy[504] = true -- Brown Nugget
|
||||
EID.BFFSNoSynergy[567] = true -- Paschal Candle
|
||||
EID.BFFSNoSynergy[651] = true -- Star of Bethlehem
|
||||
EID.BFFSNoSynergy[697] = true -- Vanishing Twin
|
||||
end
|
||||
|
||||
-- Character IDs that aren't allowed to have Red Health: ???, The Lost, The Soul
|
||||
EID.NoRedHeartsPlayerIDs = { [4] = true, [10] = true, [17] = true }
|
||||
if REPENTANCE then
|
||||
@@ -925,12 +933,10 @@ if REPENTANCE then
|
||||
EID.NoRedHeartsPlayerIDs = { [4] = true, [10] = true, [12] = true, [17] = true, [24] = true, [25] = true, [31] = true, [35] = true, [36] = true, [40] = true }
|
||||
end
|
||||
|
||||
if REPENTANCE then
|
||||
EID.BFFSNoSynergy[504] = true -- Brown Nugget
|
||||
EID.BFFSNoSynergy[567] = true -- Paschal Candle
|
||||
EID.BFFSNoSynergy[651] = true -- Star of Bethlehem
|
||||
EID.BFFSNoSynergy[697] = true -- Vanishing Twin
|
||||
end
|
||||
-- Cards that don't work with Blank Card in Repentance (Note: ? Card is blacklisted here, don't use this for determining what is a card)
|
||||
EID.blankCardHidden = {[32]=true,[33]=true,[34]=true,[35]=true,[36]=true,[37]=true,[38]=true,[39]=true,[40]=true,[41]=true,[48]=true,[49]=true,[50]=true,[55]=true,[78]=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,}
|
||||
-- Cards that are treated as runes
|
||||
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,}
|
||||
|
||||
|
||||
|
||||
@@ -1104,4 +1110,4 @@ EID.BoC.ComponentShifts = {
|
||||
{0x00000011, 0x0000000F, 0x00000014},
|
||||
{0x00000011, 0x0000000F, 0x00000017},
|
||||
{0x00000011, 0x0000000F, 0x0000001A}
|
||||
}
|
||||
}
|
||||
@@ -28,11 +28,11 @@ for _,lang in ipairs(languageFilesToCheck) do
|
||||
if not table2[k] then
|
||||
print(" Table '" .. prevKey .. "' does not contain key: " .. k)
|
||||
progress[2] = progress[2] + 1
|
||||
elseif type(table2[k]) ~= type(table1[k]) then
|
||||
print("Type mismatch in table '" .. prevKey .. "', key: " .. k)
|
||||
progress[2] = progress[2] + 1
|
||||
elseif type(table2[k]) == "table" then
|
||||
if type(table1[k]) ~= "table" then
|
||||
print("Type mismatch in table '" .. prevKey .. "', key: " .. k)
|
||||
progress[2] = progress[2] + 1
|
||||
else EID:compareTables(table1[k], table2[k], k, progress) end
|
||||
EID:compareTables(table1[k], table2[k], k, progress) end
|
||||
else
|
||||
-- check for broken markup stuff
|
||||
local filteredText = EID:replaceShortMarkupStrings(table2[k])
|
||||
|
||||
@@ -170,9 +170,9 @@ function EID:Teleport1Prediction(rng)
|
||||
end
|
||||
|
||||
-- Teleport 2 Destination Prediction --
|
||||
local teleport2Order = { 1,5,8,2,4,13,21,12,10,6,11,18,19,9,20,24,7,1025,666,3 }
|
||||
local teleport2Order = { 1,1024,5,8,2,4,13,21,12,10,6,11,18,19,9,20,24,7,1025,666,3 }
|
||||
local teleport2GreedOrder = { 1,5,2,4,10,23,8,666,3 }
|
||||
local teleport2Icons = { [1025] = "{{RedRoom}}", [666] = "{{AngelDevilChance}}" }
|
||||
local teleport2Icons = { [1024] = "{{RedRoom}}", [1025] = "{{RedRoom}}", [666] = "{{AngelDevilChance}}" }
|
||||
|
||||
function EID:Teleport2Prediction()
|
||||
local level = game:GetLevel()
|
||||
@@ -186,8 +186,10 @@ function EID:Teleport2Prediction()
|
||||
local gridIndex = room.SafeGridIndex
|
||||
local roomDesc = level:GetRoomByIdx(gridIndex, curDimension)
|
||||
if roomDesc.ListIndex == i and not room.Clear then
|
||||
-- Check for Special Red Rooms, which get ordered differently than their non-red version
|
||||
if EID.isRepentance and room.Data.Type ~= 1 and room.Flags & 1024 == 1024 then unclearedTypes[1025] = true
|
||||
-- Check for Red Rooms and Special Red Rooms, which get ordered differently than their non-red version
|
||||
if EID.isRepentance and room.Flags & 1024 == 1024 then
|
||||
if room.Data.Type ~= 1 then unclearedTypes[1025] = true
|
||||
else unclearedTypes[1024] = true end
|
||||
else unclearedTypes[room.Data.Type] = true end
|
||||
end
|
||||
end
|
||||
|
||||
+28
-154
@@ -7,38 +7,37 @@ EID.inModifierPreview = false
|
||||
EID.TabDescThisFrame = false
|
||||
|
||||
-- List of collectible IDs for us to check if a player owns them; feel free to add to this in mods that add description modifiers!
|
||||
EID.collectiblesToCheck = { CollectibleType.COLLECTIBLE_VOID, CollectibleType.COLLECTIBLE_CAR_BATTERY, CollectibleType.COLLECTIBLE_BFFS }
|
||||
EID.collectiblesToCheck[CollectibleType.COLLECTIBLE_VOID] = true
|
||||
EID.collectiblesToCheck[CollectibleType.COLLECTIBLE_BFFS] = true
|
||||
local maxSlot = 1
|
||||
-- Repentance modifiers
|
||||
if EID.isRepentance then
|
||||
maxSlot = 3
|
||||
--include the AB+ collectiblesToCheck in this table! (wish there was an easy way to merge two tables)
|
||||
EID.collectiblesToCheck = { CollectibleType.COLLECTIBLE_VOID,
|
||||
CollectibleType.COLLECTIBLE_BINGE_EATER, CollectibleType.COLLECTIBLE_BOOK_OF_VIRTUES, CollectibleType.COLLECTIBLE_SPINDOWN_DICE,
|
||||
CollectibleType.COLLECTIBLE_TAROT_CLOTH, CollectibleType.COLLECTIBLE_MOMS_BOX, 59, --Birthright Belial
|
||||
CollectibleType.COLLECTIBLE_BLANK_CARD, CollectibleType.COLLECTIBLE_CLEAR_RUNE, CollectibleType.COLLECTIBLE_PLACEBO,
|
||||
CollectibleType.COLLECTIBLE_FALSE_PHD, CollectibleType.COLLECTIBLE_ABYSS, CollectibleType.COLLECTIBLE_FLIP, CollectibleType.COLLECTIBLE_CAR_BATTERY,
|
||||
CollectibleType.COLLECTIBLE_GLOWING_HOUR_GLASS, CollectibleType.COLLECTIBLE_BFFS
|
||||
}
|
||||
EID.collectiblesToCheck[CollectibleType.COLLECTIBLE_BOOK_OF_VIRTUES] = true
|
||||
EID.collectiblesToCheck[CollectibleType.COLLECTIBLE_SPINDOWN_DICE] = true
|
||||
EID.collectiblesToCheck[CollectibleType.COLLECTIBLE_MOMS_BOX] = true
|
||||
EID.collectiblesToCheck[CollectibleType.COLLECTIBLE_BLANK_CARD] = true
|
||||
EID.collectiblesToCheck[CollectibleType.COLLECTIBLE_CLEAR_RUNE] = true
|
||||
EID.collectiblesToCheck[CollectibleType.COLLECTIBLE_PLACEBO] = true
|
||||
EID.collectiblesToCheck[CollectibleType.COLLECTIBLE_FALSE_PHD] = true
|
||||
EID.collectiblesToCheck[CollectibleType.COLLECTIBLE_FLIP] = true
|
||||
EID.collectiblesToCheck[CollectibleType.COLLECTIBLE_GLOWING_HOUR_GLASS] = true
|
||||
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,[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,}
|
||||
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,}
|
||||
EID.blackFeatherItems = {[215]=true,[216]=true,[230]=true,[260]=true,[262]=true,[339]=true,[344]=true,[654]=true,}
|
||||
EID.blackFeatherTrinkets = {[17]=true,[22]=true}
|
||||
|
||||
local lastCheck = 0
|
||||
|
||||
EID.LastCollectibleCheck = 0
|
||||
function EID:CheckPlayersCollectibles()
|
||||
-- recheck the players' owned collectibles periodically, not every frame
|
||||
-- (has to be checked regularly due to mechanics like D4 / Tainted Eden)
|
||||
if EID.GameUpdateCount >= lastCheck + 15 then
|
||||
lastCheck = EID.GameUpdateCount
|
||||
if EID.GameUpdateCount >= EID.LastCollectibleCheck + 15 then
|
||||
EID.LastCollectibleCheck = EID.GameUpdateCount
|
||||
local numPlayers = game:GetNumPlayers()
|
||||
local players = {}; for i = 0, numPlayers - 1 do players[i] = Isaac.GetPlayer(i) end
|
||||
for _,v in ipairs(EID.collectiblesToCheck) do
|
||||
for v,_ in pairs(EID.collectiblesToCheck) do
|
||||
EID.collectiblesOwned[v] = false
|
||||
EID.collectiblesAbsorbed[v] = false
|
||||
for i = 0, numPlayers - 1 do
|
||||
@@ -230,45 +229,6 @@ local function SacrificeRoomCallback(descObj)
|
||||
return descObj
|
||||
end
|
||||
|
||||
-- Handle Car Battery description addition
|
||||
local function CarBatteryCallback(descObj)
|
||||
local carBatteryBuff = EID:getDescriptionEntry("carBattery", descObj.ObjSubType)
|
||||
if carBatteryBuff ~= nil then
|
||||
-- String = append
|
||||
if type(carBatteryBuff) == "string" then
|
||||
local iconStr = "#{{Collectible356}} "
|
||||
EID:appendToDescription(descObj, iconStr..carBatteryBuff:gsub("#",iconStr))
|
||||
-- Table with 1 entry = replace
|
||||
elseif #carBatteryBuff == 1 then
|
||||
descObj.Description = carBatteryBuff[1]
|
||||
-- Table with 2+ entries = find and replace
|
||||
-- Entry 1 is replaced with entry 2, entry 3 is replaced with entry 4, etc.
|
||||
else
|
||||
local pos = 1
|
||||
while pos < #carBatteryBuff do
|
||||
local toFind = carBatteryBuff[pos]
|
||||
local replaceWith = carBatteryBuff[pos+1]
|
||||
|
||||
--"%d*%.?%d+" will grab every number group (1, 10, 0.5), this will allow us to not replace the "1" in "10" erroneously
|
||||
if (type(toFind) == "number") then
|
||||
local count = 0
|
||||
descObj.Description = string.gsub(descObj.Description, "%d*%.?%d+", function(s)
|
||||
if (s == tostring(toFind) and count == 0) then
|
||||
count = count + 1
|
||||
return "{{BlinkYellowGreen}}" .. replaceWith .. "{{CR}}"
|
||||
end
|
||||
end)
|
||||
-- Basic find+replace for non-numbers
|
||||
else
|
||||
descObj.Description = string.gsub(descObj.Description, tostring(toFind), "{{BlinkYellowGreen}}" .. replaceWith .. "{{CR}}", 1)
|
||||
end
|
||||
pos = pos + 2
|
||||
end
|
||||
end
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
|
||||
local function BlackFeatherCallback(descObj)
|
||||
local itemCounter = 0
|
||||
for itemID, _ in pairs(EID.blackFeatherItems) do
|
||||
@@ -339,27 +299,6 @@ if EID.isRepentance then
|
||||
return descObj
|
||||
end
|
||||
|
||||
|
||||
-- Handle Bingeeater description addition
|
||||
local function BingeEaterCallback(descObj)
|
||||
local bingeBuff = EID:getDescriptionEntry("bingeEaterBuffs", descObj.ObjSubType)
|
||||
if bingeBuff ~= nil then
|
||||
local iconStr = "#{{Collectible664}} "
|
||||
EID:appendToDescription(descObj, iconStr..bingeBuff:gsub("#",iconStr))
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
|
||||
-- Handle Book of Belial description for Judas' Birthright addition
|
||||
local function BookOfBelialCallback(descObj)
|
||||
local belialBuff = EID:getDescriptionEntry("bookOfBelialBuffs", descObj.ObjSubType)
|
||||
if belialBuff ~= nil then
|
||||
local iconStr = "#{{Collectible34}} "
|
||||
EID:appendToDescription(descObj, iconStr..belialBuff:gsub("#",iconStr))
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
|
||||
-- Handle Book of Virtues description addition
|
||||
local function BookOfVirtuesCallback(descObj)
|
||||
-- Display players' current active item's wisp effect when looking at a Book of Virtues pedestal
|
||||
@@ -515,45 +454,6 @@ if EID.isRepentance then
|
||||
return descObj
|
||||
end
|
||||
|
||||
-- Handle Tarot Cloth description addition
|
||||
local function TarotClothCallback(descObj)
|
||||
local clothBuff = EID:getDescriptionEntry("tarotClothBuffs", descObj.ObjSubType)
|
||||
if clothBuff ~= nil then
|
||||
-- String = append
|
||||
if type(clothBuff) == "string" then
|
||||
local iconStr = "#{{Collectible451}} "
|
||||
EID:appendToDescription(descObj, iconStr..clothBuff:gsub("#",iconStr))
|
||||
-- Table with 1 entry = replace
|
||||
elseif #clothBuff == 1 then
|
||||
descObj.Description = clothBuff[1]
|
||||
-- Table with 2+ entries = find and replace
|
||||
-- Entry 1 is replaced with entry 2, entry 3 is replaced with entry 4, etc.
|
||||
else
|
||||
local pos = 1
|
||||
while pos < #clothBuff do
|
||||
local toFind = clothBuff[pos]
|
||||
local replaceWith = clothBuff[pos+1]
|
||||
|
||||
--"%d*%.?%d+" will grab every number group (1, 10, 0.5), this will allow us to not replace the "1" in "10" erroneously
|
||||
if (type(toFind) == "number") then
|
||||
local count = 0
|
||||
descObj.Description = string.gsub(descObj.Description, "%d*%.?%d+", function(s)
|
||||
if (s == tostring(toFind) and count == 0) then
|
||||
count = count + 1
|
||||
return "{{ColorShinyPurple}}" .. replaceWith .. "{{CR}}"
|
||||
end
|
||||
end)
|
||||
-- Basic find+replace for non-numbers
|
||||
else
|
||||
descObj.Description = string.gsub(descObj.Description, tostring(toFind), "{{ColorShinyPurple}}" .. replaceWith .. "{{CR}}", 1)
|
||||
end
|
||||
pos = pos + 2
|
||||
end
|
||||
end
|
||||
end
|
||||
return EID:applyConditionals(descObj,"Tarot")
|
||||
end
|
||||
|
||||
|
||||
local hasBox = false
|
||||
local isGolden = false
|
||||
@@ -640,48 +540,37 @@ if EID.isRepentance then
|
||||
|
||||
local hasTarot = false
|
||||
|
||||
|
||||
local function VariableCharge(descObj, metadata, collID, chargeText)
|
||||
local text = EID:getDescriptionEntry(chargeText or "VariableCharge")
|
||||
if text ~= nil and metadata ~= nil and metadata.mimiccharge and metadata.mimiccharge ~= -1 then
|
||||
text = EID:ReplaceVariableStr(text, 1, "{{NameOnlyC" .. collID .. "}}")
|
||||
EID:appendToDescription(descObj, "#{{ColorSilver}}{{Collectible" .. collID .. "}} " .. text .. " {{"..metadata.mimiccharge.."}}{{Battery}}")
|
||||
end
|
||||
end
|
||||
|
||||
-- Handle Blank Card description addition
|
||||
local function BlankCardCallback(descObj)
|
||||
local text = EID:getDescriptionEntry("BlankCardCharge")
|
||||
local charge = EID.cardMetadata[descObj.ObjSubType]
|
||||
local iconStr = "#{{Collectible286}} {{ColorSilver}}"
|
||||
if text ~= nil and charge ~= nil and charge.mimiccharge and charge.mimiccharge ~= -1 then
|
||||
if descObj.ObjSubType == 48 then -- ? card
|
||||
text = EID:getDescriptionEntry("BlankCardQCard")
|
||||
EID:appendToDescription(descObj, iconStr..text:gsub("#",iconStr))
|
||||
else
|
||||
EID:appendToDescription(descObj, iconStr..text.." {{"..charge.mimiccharge.."}}{{Battery}}")
|
||||
end
|
||||
end
|
||||
VariableCharge(descObj, EID.cardMetadata[descObj.ObjSubType], 286, "BlankCardCharge")
|
||||
-- If the player has Tarot Cloth and Blank Card, display additional text
|
||||
if hasTarot then
|
||||
text = EID:getDescriptionEntry("BlankCardEffect")
|
||||
local buffText = EID:getDescriptionEntry("tarotClothBlankCardBuffs", descObj.ObjSubType)
|
||||
if buffText then EID:appendToDescription(descObj, iconStr .. text .. " " .. buffText) end
|
||||
if buffText then EID:appendToDescription(descObj, "#{{ColorSilver}}{{Collectible286}} " .. text .. " " .. buffText) end
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
|
||||
-- Handle Clear Rune description addition
|
||||
local function ClearRuneCallback(descObj)
|
||||
local text = EID:getDescriptionEntry("ClearRuneCharge")
|
||||
local charge = EID.cardMetadata[descObj.ObjSubType]
|
||||
if text ~= nil and charge ~= nil and charge.mimiccharge and charge.mimiccharge ~= -1 then
|
||||
local iconStr = "#{{Collectible263}} {{ColorSilver}}"
|
||||
EID:appendToDescription(descObj, iconStr..text.." {{"..charge.mimiccharge.."}}{{Battery}}")
|
||||
end
|
||||
VariableCharge(descObj, EID.cardMetadata[descObj.ObjSubType], 263, "ClearRuneCharge")
|
||||
return descObj
|
||||
end
|
||||
|
||||
-- Handle Placebo description addition
|
||||
local function PlaceboCallback(descObj)
|
||||
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 and charge.mimiccharge and charge.mimiccharge ~= -1 then
|
||||
local iconStr = "#{{Collectible348}} {{ColorSilver}}"
|
||||
EID:appendToDescription(descObj, iconStr..text.." {{"..charge.mimiccharge.."}}{{Battery}}")
|
||||
end
|
||||
VariableCharge(descObj, EID.pillMetadata[adjustedID-1], 348, "PlaceboCharge")
|
||||
return descObj
|
||||
end
|
||||
|
||||
@@ -811,16 +700,6 @@ if EID.isRepentance then
|
||||
return descObj
|
||||
end
|
||||
|
||||
-- Handle Abyss description addition
|
||||
local function AbyssCallback(descObj)
|
||||
local text = EID:getDescriptionEntry("abyssSynergies", descObj.ObjSubType)
|
||||
if text ~= nil then
|
||||
local iconStr = "#{{Collectible706}} {{ColorRed}}"
|
||||
EID:appendToDescription(descObj, iconStr..text)
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
|
||||
-- Handle Flip description addition
|
||||
local function FlipCallback(descObj)
|
||||
local flipItemID = EID:getEntityData(descObj.Entity, "EID_FlipItemID")
|
||||
@@ -866,10 +745,7 @@ if EID.isRepentance then
|
||||
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
|
||||
if EID.collectiblesOwned[59] then table.insert(callbacks, BookOfBelialCallback) end
|
||||
if EID.collectiblesOwned[584] or descObj.ObjSubType == 584 then table.insert(callbacks, BookOfVirtuesCallback) end
|
||||
if EID.collectiblesOwned[706] or EID.collectiblesAbsorbed[706] then table.insert(callbacks, AbyssCallback) end
|
||||
|
||||
if EID.collectiblesOwned[711] and EID:getEntityData(descObj.Entity, "EID_FlipItemID") then table.insert(callbacks, FlipCallback) end
|
||||
if EID.Config["SpindownDiceResults"] > 0 and (EID.collectiblesOwned[723] or EID.collectiblesAbsorbed[723]) and descObj.ObjSubType ~= 668 then table.insert(callbacks, SpindownDiceCallback) end
|
||||
@@ -877,7 +753,6 @@ if EID.isRepentance then
|
||||
-- Card / Rune Callbacks
|
||||
elseif descObj.ObjVariant == PickupVariant.PICKUP_TAROTCARD then
|
||||
hasTarot = EID.collectiblesOwned[451]
|
||||
if hasTarot then table.insert(callbacks, TarotClothCallback) 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
|
||||
@@ -926,7 +801,6 @@ local function EIDConditionsAB(descObj)
|
||||
if EID.collectiblesOwned[477] then table.insert(callbacks, VoidCallback) end
|
||||
if EID.blackRuneOwned then table.insert(callbacks, BlackRuneCallback) end
|
||||
end
|
||||
if EID.collectiblesOwned[356] then table.insert(callbacks, CarBatteryCallback) end
|
||||
|
||||
-- BFF Synergy check
|
||||
if EID.collectiblesOwned[247] then
|
||||
|
||||
Reference in new issue
Block a user