Salvage modifier + misc (#717)

* Add a Tainted Cain pedestal salvage modifier
* Add more Tainted Bethany conditionals for outliers like Isaac's Fork
* Prevent learning recipes before making them when Curse of the Blind is active
* Fix Dice Room co-op conditionals (forgot to test them, subtype needed offsetting by 1)
* Fix the health up modifier not saying when item has different effect for non-red players
* Fix a couple MCM demo desc bugs, and irrelevant spaces/text on AB+
* Fix French's textbox width not being applied by default
* Add some Azazel Brimstone conditionals
* Improve Glitched Crown co-op / salvage interactions
* Fix more cases of recipes being previewed when they shouldn't in Learned Recipe List
This commit is contained in:
Buurazu authored and GitHub committed 2024-09-06 17:39:21 +02:00
1 parent b1efbb0ca4
commit af0c95b8bb
9 files changed
+253 -82

No files matched your search

+8 -1
View File
@@ -422,7 +422,8 @@ function EID:getDescriptionObj(Type, Variant, SubType, entity, checkModifiers)
description.Quality = EID:getObjectQuality(description)
description.Icon = EID:getObjectIcon(description)
EID:getObjectItemTypeAndCharge(description)
EID.DifferentEffectPlayers = {}
if checkModifiers ~= false then
description = EID:applyConditionals(description)
description = EID:applyDescriptionModifier(description, SubType)
@@ -1655,6 +1656,12 @@ end
function EID:fixDefinedFont(forceRefresh)
local curLang = EID:getLanguage()
local curFont = EID.Config["FontType"]
-- If the textbox width is set to the default, make it match the selected language's default
-- Fixes language selection not respecting the language's textbox width, although it also prevents 130 from being used as the width with those languages
if EID.Config["TextboxWidth"] == EID.DefaultConfig["TextboxWidth"] then
EID.Config["TextboxWidth"] = EID.descriptions[curLang].fonts[1].textboxWidth or EID.DefaultConfig["TextboxWidth"]
end
-- If our currently loaded font is still valid, we don't need to reset values
for _, v in ipairs(EID.descriptions[curLang].fonts) do
+11 -4
View File
@@ -219,6 +219,8 @@ function EID:learnBagOfCrafting(componentsTable)
local componentsAsString = table.concat(components, ",")
local recipe = REPENTOGON and EID.bagPlayer:GetBagOfCraftingOutput() or EID:calculateBagOfCrafting(componentsTable)
if REPENTOGON and recipe == 0 then recipe = EID:calculateBagOfCrafting(componentsTable) end
if (EID.BoC.LearnedRecipes[componentsAsString] ~= recipe) then newRecipeLearned = true end
EID.BoC.LearnedRecipes[componentsAsString] = recipe;
end
@@ -477,6 +479,7 @@ function EID:BoCTrackBagHolding()
else
if isCardHold and holdCounter >= 30 and (string.match(animationName, "Walk") and not string.match(animationName, "Pickup") or (EID.bagPlayer:GetCollectibleCount() ~= icount)) then
holdCounter = 0
EID:learnBagOfCrafting(EID.BoC.BagItems)
EID.BoC.BagItems = {}
EID:UpdateAllPlayerPassiveItems()
else
@@ -597,7 +600,8 @@ local function getFloorItemsString(showPreviews, roomItems)
local floorString = ""
local bagItems = EID.BoC.BagItemsOverride or EID.BoC.BagItems
if #bagItems >0 then
if showPreviews and #bagItems == 8 then
-- Don't show an item preview in Learned Recipe List if Curse of the Blind is active
if showPreviews and #bagItems == 8 and (EID.Config["BagOfCraftingDisplayRecipesMode"] == "Recipe List" or not EID:hasCurseBlind() or not EID.Config["DisableOnCurse"]) then
local recipe = REPENTOGON and EID.bagPlayer:GetBagOfCraftingOutput() or EID:calculateBagOfCrafting(bagItems)
-- when using REPENTOGON, MCM needs to think its bag is full
if EID.BoC.BagItemsOverride then recipe = EID:calculateBagOfCrafting(bagItems) end
@@ -608,7 +612,8 @@ local function getFloorItemsString(showPreviews, roomItems)
end
local curRoomItems = EID.BoC.RoomOverride or roomItems
if #curRoomItems >0 then
if showPreviews and #curRoomItems == 8 then
-- Don't show a room/floor item preview in Learned Recipe List mode
if showPreviews and #curRoomItems == 8 and EID.Config["BagOfCraftingDisplayRecipesMode"] == "Recipe List" then
local recipe = EID:calculateBagOfCrafting(curRoomItems)
floorString = floorString .. "{{Collectible"..recipe.."}} "
end
@@ -617,7 +622,8 @@ local function getFloorItemsString(showPreviews, roomItems)
end
local floorQuery = EID.BoC.FloorOverride or EID.BoC.FloorQuery
if #floorQuery >0 and #curRoomItems ~= #floorQuery then
if showPreviews and #floorQuery == 8 then
-- Don't show a room/floor item preview in Learned Recipe List mode
if showPreviews and #floorQuery == 8 and EID.Config["BagOfCraftingDisplayRecipesMode"] == "Recipe List" then
local recipe = EID:calculateBagOfCrafting(floorQuery)
floorString = floorString .. "{{Collectible"..recipe.."}} "
end
@@ -761,6 +767,7 @@ local function MCMLearnedRecipeList()
local recipe = EID:calculateBagOfCrafting({15,15,5,1,10,8,8,9})
table.insert(sortedResults[recipe], {{15,15,5,1,10,8,8,9}, recipe})
currentRecipesList = sortedResults
numResults = 1
bagOfCraftingOffset = 0
bagOfCraftingRefreshes = 0
isRefresh = false
@@ -825,7 +832,7 @@ function EID:handleBagOfCraftingUpdating()
end
end
-- Save the result of the 8 items in our bag
if #EID.BoC.BagItems == 8 then
if #EID.BoC.BagItems == 8 and (not EID:hasCurseBlind() or not EID.Config["DisableOnCurse"]) then
EID:learnBagOfCrafting(EID.BoC.BagItems)
end
+28 -5
View File
@@ -87,10 +87,10 @@ local SoulBlackChars = EID:ConcatTables(EID.SpecialHeartPlayers["Soul"],EID.Spec
------ NO RED HEALTH PLAYERS ------
EID:AddConditional(81, EID.CheckForNoRedHealthPlayer) -- Dead Cat
EID:AddClosestPlayerConditional({133, 442, 487, "5.350.46", "5.350.107", "5.350.119"}, SoulBlackChars, "No Effect Replace", nil, false) -- Dark Prince's Crown, Crow Heart, Stem Cell, Isaac's Fork, Guppy's Paw, Potato Peeler
EID:AddClosestPlayerConditional({133, 442, 487, "5.350.46", "5.350.107", "5.350.119"}, SoulBlackChars, "No Effect Replace", {layer = 5000}, false) -- Dark Prince's Crown, Crow Heart, Stem Cell, Isaac's Fork, Guppy's Paw, Potato Peeler
if EID.isRepentance then
EID:AddClosestPlayerConditional({569, 671, 676}, SoulBlackChars, "No Effect Replace", nil, false) -- Blood Oath, Candy Heart, Empty Heart
EID:AddClosestPlayerConditional(676, 16, "No Effect Replace", nil, false) -- Empty Heart + Forgotten (not Tainted)
EID:AddClosestPlayerConditional({569, 671, 676}, SoulBlackChars, "No Effect Replace", {layer = 5000}, false) -- Blood Oath, Candy Heart, Empty Heart
EID:AddClosestPlayerConditional(676, 16, "No Effect Replace", {layer = 5000}, false) -- Empty Heart + Forgotten (not Tainted)
EID:AddClosestPlayerConditional("5.350.156", 14, "Mother's Kiss Coin") -- Mother's Kiss + Keeper
EID:AddClosestPlayerConditional("5.350.156", SoulBlackChars, "Mother's Kiss Soul", nil, false) -- Mother's Kiss + Soul/Black (both give a Soul Heart)
@@ -152,11 +152,17 @@ if EID.isRepentance then
EID:AddPlayerConditional(205, 22, "Tainted Magdalene")-- Tainted Magdalene + Sharp Plug
EID:AddPlayerConditional({"5.350.100", "5.350.101"}, 18, "Bethany", nil, false) -- Bethany + Vibrant/Dim Bulb
EID:AddPlayerConditional({"5.350.100", "5.350.101"}, 36, "Tainted Bethany") -- Tainted Bethany + Vibrant/Dim Bulb
EID:AddPlayerConditional("5.300.26", 36, "2 of Hearts Blood Charges") -- Tainted Bethany + 2 of Hearts
EID:AddClosestPlayerConditional(62, 36, "Vampire Blood Charges")
EID:AddClosestPlayerConditional("5.350.46", 36, "Fork Blood Charges")
EID:AddClosestPlayerConditional("5.350.119", 36, "Stem Cell Blood Charges")
EID:AddClosestPlayerConditional(722, 37) -- TJacob Anima Sola
EID:AddClosestPlayerConditional(713, 26) -- TEve Sumptorium
EID:AddPlayerConditional(711, 29) -- TLaz Flip
EID:AddClosestPlayerConditional(710, 23) -- Tcain Bag of Crafting
EID:AddPlayerConditional({"5.350.34", "5.350.36", "5.350.41", "5.350.44", "5.350.45"}, 23, "Salvaging Bonus") -- Tcain Safety Cap et al. bonus pickup chance
EID:AddPlayerConditional("5.350.42", 23, "Salvaging Lucky Toe") -- Tcain Lucky Toe bonus pickup chance
end
@@ -187,15 +193,25 @@ EID:AddSynergyConditional({52, 69, 104, 132, 222, 224, 233, 316, 329, 369, 379,
EID:AddOneSidedSynergyConditional(168, 118, "Epic Fetus Brimstone", {layer = 900, checkLayers = true})
EID:AddOneSidedSynergyConditional(168, 114, "Epic Fetus Mom's Knife", {layer = 900, checkLayers = true})
EID:AddOneSidedSynergyConditional(168, 330, "Epic Fetus Soy Milk", {layer = 900, checkLayers = true})
EID:AddPlayerConditional(168, 7, "Overrides", {layer = 890, checkLayers = true, variableText = "{{NameOnlyC118}}"}) -- Epic Fetus overrides Azazel
EID:AddSynergyConditional({69, 132, 222, 316, 369, 379, 410, 440, 453, 459, 461, 494, 524, 532, 533, }, 52, "Overridden", "Overrides", {layer = 800, checkLayers = true}) -- Dr. Fetus
EID:AddSynergyConditional(462, 52, "Eye of Belial Dr. Fetus", nil, {layer = 800, checkLayers = true})
EID:AddPlayerConditional(52, 7, "Overrides", {layer = 790, checkLayers = true, variableText = "{{NameOnlyC118}}"}) -- Dr. Fetus overrides Azazel
EID:AddSynergyConditional({5, 69, 132, 221, 224, 316, 379, 401, 410, 459, 461, 462, 529, 532, 533, }, 114, "Overridden", "Overrides", {layer = 700, checkLayers = true}) -- Mom's Knife
EID:AddOneSidedSynergyConditional(114, 118, "Brimstone Mom's Knife", {layer = 700, checkLayers = true})
EID:AddPlayerConditional(114, 7, "Overrides", {layer = 690, checkLayers = true, variableText = "{{NameOnlyC118}}"}) -- Mom's Knife overrides Azazel
EID:AddOneSidedSynergyConditional(531, 118, "Haemolacria Brimstone", {layer = 675, checkLayers = true})
EID:AddPlayerConditional(531, 7, "Overrides", {layer = 656, checkLayers = true, variableText = "{{NameOnlyC118}}"}) -- Haemolacria overrides Azazel
EID:AddSynergyConditional({316, 379, 410, 440, 453, 461, 462, 524, 533, 540, }, 118, "Overridden", "Overrides", {layer = 666, checkLayers = true}) -- Brimstone
EID:AddSynergyConditional(118, 149, "Brimstone Ipecac", nil, {layer = 666, checkLayers = true})
EID:AddPlayerConditional(149, 7, "Brimstone Ipecac", nil, {layer = 656, checkLayers = true})
EID:AddSynergyConditional(118, 261, "Brimstone Proptosis", nil, {layer = 666, checkLayers = true})
EID:AddPlayerConditional(261, 7, "Brimstone Proptosis", nil, {layer = 656, checkLayers = true})
EID:AddPlayerConditional({316, 379, 410, 440, 453, 461, 462, 524, 533, 540, }, 7, "Overridden", {layer = 656, checkLayers = true, variableText = "{{NameOnlyC118}}"}) -- Azazel overrides the same stuff
EID:AddSynergyConditional({5, 69, 104, 233, 316, 329, 379, 397, 410, 453, 461, 524, 529, 532, 533, 540, "5.350.26"}, 395, "Overridden", "Overrides", {layer = 600, checkLayers = true}) -- Tech X
EID:AddSynergyConditional(149, 395, "Technology Ipecac", nil, {layer = 600, checkLayers = true}) -- Tech X + Ipecac
@@ -207,10 +223,12 @@ EID:AddSynergyConditional({69, 222, 224, 316, 394, 397, 410, 532}, 329, "Overrid
EID:AddSynergyConditional(149, 329, "Ludovico Ipecac", nil, {layer = 300, checkLayers = true}) -- Ludovico + Ipecac
if not EID.isRepentance then
-- AB+ exclusive overrides
EID:AddSynergyConditional({374, 429, }, 168, "Overridden", "Overrides", {layer = 900, checkLayers = true}) -- Epic Fetus
EID:AddSynergyConditional({374, 401, 429, 444, 461}, 52, "Overridden", "Overrides", {layer = 800, checkLayers = true}) -- Dr. Fetus
EID:AddSynergyConditional({104, 150, 374, 394, 443, 453, 463, 494, 496, 503, }, 114, "Overridden", "Overrides", {layer = 700, checkLayers = true}) -- Mom's Knife
EID:AddSynergyConditional({104, 224, 369, 374, 394, 401, 429, 444, 459, 463, 494, 532, }, 118, "Overridden", "Overrides", {layer = 666, checkLayers = true}) -- Brimstone
EID:AddPlayerConditional({104, 224, 369, 374, 394, 401, 429, 444, 459, 463, 494, 532, }, 7, "Overridden", {layer = 656, checkLayers = true, variableText = "{{NameOnlyC118}}"}) -- Azazel overrides the same stuff
EID:AddSynergyConditional({55, 87, 150, 221, 374, 394, 401, 429, 443, 444, 463, 494, 496, 503, "5.350.96"}, 395, "Overridden", "Overrides", {layer = 600, checkLayers = true}) -- Tech X
EID:AddSynergyConditional({69, 104, 222, 224, 245, 316, 369, 374, 394, 429, 494, }, 68, "Overridden", "Overrides", {layer = 400, checkLayers = true}) -- Technology
@@ -223,15 +241,20 @@ if EID.isRepentance then
EID:AddOneSidedSynergyConditional(579, 114, "Spirit Sword Mom's Knife", {layer = 1000, checkLayers = true}) -- Spirit Sword + Mom's Knife
EID:AddOneSidedSynergyConditional(579, 68, "Spirit Sword Technology", {layer = 1000, checkLayers = true}) -- Spirit Sword + Technology
EID:AddOneSidedSynergyConditional(579, 149, "Spirit Sword Ipecac", {layer = 1000, checkLayers = true}) -- Spirit Sword + Ipecac
EID:AddPlayerConditional(579, 7, "Overrides", {layer = 990, checkLayers = true, variableText = "{{NameOnlyC118}}"}) -- Spirit Sword overrides Azazel
EID:AddSynergyConditional({553, 572, 678, "5.350.144"}, 168, "Overridden", "Overrides", {layer = 900, checkLayers = true}) -- Epic Fetus
EID:AddOneSidedSynergyConditional(561, 168, "Epic Fetus Soy Milk", {layer = 900, checkLayers = true}) -- Epic Fetus + Almond Milk
EID:AddSynergyConditional({69, 229, 316, 329, 397, 410, 533, 572, 597, }, 678, "Overridden", "Overrides", {layer = 850, checkLayers = true}) -- C Section
EID:AddSynergyConditional({68, 118, 572, 597, 637, "5.350.144"}, 52, "Overridden", "Overrides", {layer = 800, checkLayers = true}) -- Dr. Fetus
EID:AddSynergyConditional({52, 572, 597}, 114, "Overridden", "Overrides", {layer = 700, checkLayers = true}) -- Mom's Knife
EID:AddSynergyConditional({597}, 118, "Overridden", "Overrides", {layer = 666, checkLayers = true}) -- Brimstone
EID:AddSynergyConditional({597}, 118, "Overridden", "Overrides", {layer = 666, checkLayers = true}) -- Brimstone overrides
EID:AddPlayerConditional({597}, 7, "Overridden", {layer = 656, checkLayers = true, variableText = "{{NameOnlyC118}}"}) -- Azazel overrides the same stuff
EID:AddOneSidedSynergyConditional({529, 532}, 118, "Brimstone Pop!", {layer = 666, checkLayers = true}) -- Brimstone + Pop!/Lachryphagy
EID:AddPlayerConditional(529, 7, "Brimstone Pop!", {layer = 656, checkLayers = true, variableText = "{{NameOnlyC529}}"}) -- Azazel + Pop/Lachryphagy
EID:AddPlayerConditional(532, 7, "Brimstone Pop!", {layer = 656, checkLayers = true, variableText = "{{NameOnlyC532}}"}) -- Azazel + Pop/Lachryphagy
EID:AddSynergyConditional(572, 118, "Eye of the Occult Beam", nil, {layer = 666}) -- Brimstone + Eye of the Occult
EID:AddPlayerConditional(572, 7, "Eye of the Occult Beam", {layer = 656, checkLayers = true, bulletpoint = "Collectible118"}) -- Azazel + Eye of the Occult
EID:AddSynergyConditional({572, 597, "5.350.144"}, 395, "Overridden", "Overrides", {layer = 600, checkLayers = true}) -- Tech X
EID:AddSynergyConditional({597}, 68, "Overridden", "Overrides", {layer = 400, checkLayers = true}) -- Technology
EID:AddSynergyConditional(572, 68, "Eye of the Occult Beam", nil, {layer = 400}) -- Technology + Eye of the Occult
@@ -351,7 +374,7 @@ end
if EID.isRepentance then
-- Co-op friendly items
EID:AddConditional({45, "5.350.125"}, EID.MultiplePlayerCharacters) -- Yum Heart, Extension Cord
EID:AddConditional({"1000.76.0", "1000.76.5"}, EID.MultiplePlayerCharacters) -- Dice Room 1 and 6
EID:AddConditional({"1000.76.1", "1000.76.6"}, EID.MultiplePlayerCharacters) -- Dice Room 1 and 6
-- Item Synergies
EID:AddItemConditional(201, 147) -- Iron Bar refills Notched Axe
+8
View File
@@ -775,6 +775,10 @@ EID.InlineColors = {
["ColorShinyPurple"] = function(_)
return SwagColors({KColor(0.812, 0.627, 1, 1), KColor(0.62, 0.251, 1, 1)}, 40)
end,
-- Blink between the two shades of tan on Birthright
["BlinkBirthright"] = function(_)
return SwagColors({KColor(0.831, 0.725, 0.604, 1), KColor(0.671, 0.557, 0.443, 1)})
end,
-- Text will blink frequently
["ColorBlink"] = function(color)
local maxAnimTime = 40
@@ -1098,6 +1102,10 @@ end
if not EID.isRepentance then return end
EID.SalvageTrinkets = { [34] = "5.10", [36] = "5.30", [41] = "5.40", [44] = "5.70", [45] = "5.300" }
EID.SalvageRoomTypes = { [3] = "5.10.6", [19] = "5.10.6", [4] = "5.10.4", [20] = "5.10.4", [5] = "5.10.11", [22] = "5.10.11", [9] = "5.300.78", [12] = "5.10.12", [21] = "5.10.12", [26] = "5.301" }
EID.PickupStartsWithVowel = { ["5.10.4"] = true } -- this is just for Eternal Heart in salvage descriptions right now...
EID.BoC = {}
EID.BoC.PickupValues = {
+19 -9
View File
@@ -388,13 +388,13 @@ if MCMLoaded then
-- Simple toggles of what descriptions the user wants displayed
EID:AddBooleanSetting("Display", "DisableStartOfRunWarnings", "Start of Run Warnings", {displayingTab = "", offText = "Enabled", onText = "Disabled",
EID:AddBooleanSetting("Display", "DisableStartOfRunWarnings", "Start of Run Warnings", {offText = "Enabled", onText = "Disabled",
repOnly = true, infoText = "Toggles warnings for achievements being disabled, the game being outdated, and modded crafting recipes."})
MCM.AddSpace("EID", "Display")
if EID.isRepentance then MCM.AddSpace("EID", "Display") end
MCM.AddText("EID", "Display", "Gameplay")
EID:AddBooleanSetting("Display", "HideInBattle", "Hide in Battle", {infoText = "Hides descriptions when enemies are present."})
EID:AddBooleanSetting("Display", "HideInBattle", "Hide in Battle", {displayingTab = "", infoText = "Hides descriptions when enemies are present."})
EID:AddBooleanSetting("Display", "InitiallyHidden", "Is Initially Hidden", {infoText = "Hides descriptions by default. Press the Toggle key to show them again."})
MCM.AddSpace("EID", "Display")
@@ -450,10 +450,11 @@ if MCMLoaded then
local diceSteps = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
-- Spindown Dice Settings
if EID.isRepentance then MCM.AddSpace("EID", "Display") end
MCM.AddText("EID", "Display", "Spindown Dice")
if EID.isRepentance then
MCM.AddSpace("EID", "Display")
MCM.AddText("EID", "Display", "Spindown Dice")
end
EID:AddScrollSetting("Display", "SpindownDiceResults", "Preview rerolls", diceSteps, {repOnly = true, label = " Items",
infoText = "Number of item previews to display when holding Spindown Dice."})
@@ -466,7 +467,16 @@ if MCMLoaded then
-- Spindown Dice skip locked items
EID:AddBooleanSetting("Display", "SpindownDiceSkipLocked", "Skip Locked Items",
{repOnly = true, infoText = {"The preview skips locked items, like the dice does.", "(The unlock status check is not perfect and may be wrong)"}})
MCM.AddSpace("EID", "Display")
MCM.AddText("EID", "Display", "Dynamic Descriptions")
EID:AddBooleanSetting("Display", "DynamicHealthUps", "Dynamic Health Up Text",
{infoText = "Changes Health Ups and removes healing effect text when playing as a character that can't have red health"})
EID:AddBooleanSetting("Display", "DynamicSalvageResult", "Show Tainted Cain Salvage Result",
{repOnly = true, infoText = "As Tainted Cain, replaces pedestal descriptions with what they will turn into"})
--------Obstruction---------
MCM.AddSpace("EID", "Display")
MCM.AddText("EID", "Display", "Unreachable items")
@@ -883,7 +893,7 @@ if MCMLoaded then
else
MCM.AddSpace("EID", "Save Game")
MCM.AddSpace("EID", "Save Game")
MCM.AddText("EID", "Save Game", "To enable savegame related features,")
MCM.AddText("EID", "Save Game", function() EID.MCMCompat_isDisplayingEIDTab = ""; return "To enable savegame related features," end)
MCM.AddText("EID", "Save Game", "please run \"scripts\\savegame_reader.exe\"")
MCM.AddText("EID", "Save Game", "found in the EID mod folder.")
end
+131 -47
View File
@@ -311,6 +311,7 @@ end
-- Handle changing health up text for non-red HP players
local function HealthUpCallback(descObj)
if not EID.Config["DynamicHealthUps"] then return descObj end
local adjustedSubtype = EID:getAdjustedSubtype(descObj.ObjType, descObj.ObjVariant, descObj.ObjSubType)
if descObj.ObjVariant == 70 and descObj.ObjSubType > 2048 then adjustedSubtype = adjustedSubtype + 2048 end -- horsepill exception
local typeVarSub = descObj.ObjType.."."..descObj.ObjVariant.."."..adjustedSubtype
@@ -318,36 +319,36 @@ local function HealthUpCallback(descObj)
local closestPlayer = EID:ClosestPlayerTo(descObj.Entity)
local playerType = closestPlayer:GetPlayerType()
local heartType = EID.CharacterToHeartType[playerType] or "Red"
if heartType == "Red" then return descObj end
-- find/replace Health Up lines
local numHearts = EID.HealthUpData[typeVarSub] or 1
local text = EID:getDescriptionEntry("RedToX", "Red to " .. heartType)
local plural = ""; if numHearts ~= 1 and numHearts ~= -1 then plural = EID:getDescriptionEntry("Pluralize") end
local pos = 1
while pos <= #text do
-- replace {1} with the number of hearts and {2} with the plural character
local toFind = EID:ReplaceVariableStr(text[pos], {numHearts, plural})
if text[pos + 1] then
local replaceWith = EID:ReplaceVariableStr(text[pos + 1], {numHearts, plural})
descObj.Description = EID:SimpleReplace(descObj.Description, tostring(toFind), replaceWith, 1)
if heartType ~= "Red" then
-- find/replace Health Up lines
local numHearts = EID.HealthUpData[typeVarSub] or 1
local text = EID:getDescriptionEntry("RedToX", "Red to " .. heartType)
local plural = ""; if numHearts ~= 1 and numHearts ~= -1 then plural = EID:getDescriptionEntry("Pluralize") end
local pos = 1
while pos <= #text do
-- replace {1} with the number of hearts and {2} with the plural character
local toFind = EID:ReplaceVariableStr(text[pos], {numHearts, plural})
if text[pos + 1] then
local replaceWith = EID:ReplaceVariableStr(text[pos + 1], {numHearts, plural})
descObj.Description = EID:SimpleReplace(descObj.Description, tostring(toFind), replaceWith, 1)
end
pos = pos + 2
end
-- remove HealingRed lines entirely for Soul/Black/None health chars
descObj.Description = descObj.Description .. "#" -- gsub finds final lines better if the desc ends with a line break
if heartType == "Soul" or heartType == "Black" or heartType == "None" then
-- Find any lines containing {{HealingRed}} or {{HealingHalfRed}} and remove the line
descObj.Description = descObj.Description:gsub("{{HealingRed}}(.-)#", "")
descObj.Description = descObj.Description:gsub("{{HealingHalfRed}}(.-)#", "")
end
-- check if we just made the description blank
if descObj.Description:gsub("#", "") == "" then
local noEffectStr = EID:getDescriptionEntry("ConditionalDescs", "No Effect")
descObj.Description = "{{Player" .. playerType .. "}} " .. EID:ReplaceVariableStr(noEffectStr, "{{NameOnlyI" .. playerType .. "}}")
end
pos = pos + 2
end
-- remove HealingRed lines entirely for Soul/Black/None health chars
descObj.Description = descObj.Description .. "#" -- gsub finds final lines better if the desc ends with a line break
if heartType == "Soul" or heartType == "Black" or heartType == "None" then
-- Find any lines containing {{HealingRed}} or {{HealingHalfRed}} and remove the line
descObj.Description = descObj.Description:gsub("{{HealingRed}}(.-)#", "")
descObj.Description = descObj.Description:gsub("{{HealingHalfRed}}(.-)#", "")
end
-- check if we just made the description blank
if descObj.Description:gsub("#", "") == "" then
local noEffectStr = EID:getDescriptionEntry("ConditionalDescs", "No Effect")
descObj.Description = "{{Player" .. playerType .. "}} " .. EID:ReplaceVariableStr(noEffectStr, "{{NameOnlyI" .. playerType .. "}}")
end
-- test the other players for if they have a different effect
@@ -366,16 +367,30 @@ if EID.isRepentance then
-- Handle Birthright
local function BirthrightCallback(descObj)
descObj.Description = ""
if EID.InsideItemReminder then
local player = EID.ItemReminderPlayerEntity
local playerID = player:GetPlayerType()
local birthrightDesc = EID:getDescriptionEntry("birthright", playerID+1)
if birthrightDesc ~= nil then
local playerName = birthrightDesc[1] or player:GetName()
EID:appendToDescription(descObj, EID:GetPlayerIcon(playerID) .. " {{ColorIsaac}}"..playerName.."{{CR}}#"..birthrightDesc[3].."#")
end
return descObj
end
local describedPlayerTypes = {}
for i = 1, #EID.coopAllPlayers do
local player = EID.coopAllPlayers[i]
local playerID = player:GetPlayerType()
if not player:IsSubPlayer() and player:GetMainTwin( ):GetPlayerType() == playerID and not describedPlayerTypes[playerID] then
describedPlayerTypes[playerID] = true
local birthrightDesc = EID:getDescriptionEntry("birthright", playerID+1)
if birthrightDesc ~=nil then
local playerName = birthrightDesc[1] or player:GetName()
EID:appendToDescription(descObj, EID:GetPlayerIcon(playerID) .. " {{ColorGray}}"..playerName.."{{CR}}#"..birthrightDesc[3].."#")
if descObj.Entity and playerID == PlayerType.PLAYER_CAIN_B and not EID.isDeathCertRoom then
-- Don't add a description if Tainted Cain is looking at a Birthright pedestal, he can't get it...
else
if not player:IsSubPlayer() and player:GetMainTwin( ):GetPlayerType() == playerID and not describedPlayerTypes[playerID] then
describedPlayerTypes[playerID] = true
local birthrightDesc = EID:getDescriptionEntry("birthright", playerID+1)
if birthrightDesc ~= nil then
local playerName = birthrightDesc[1] or player:GetName()
EID:appendToDescription(descObj, EID:GetPlayerIcon(playerID) .. " {{ColorIsaac}}"..playerName.."{{CR}}#"..birthrightDesc[3].."#")
end
end
end
end
@@ -820,12 +835,72 @@ if EID.isRepentance then
return descObj
end
-- Handle Tainted Cain pedestals
local function TaintedCainPedestalCallback(descObj)
if EID.isDeathCertRoom or not descObj.Entity or not EID.Config["DynamicSalvageResult"] then return descObj end
local item = EID.itemConfig:GetCollectible(descObj.ObjSubType)
if (item.Tags and item.Tags & ItemConfig.TAG_QUEST == ItemConfig.TAG_QUEST) then return descObj end
local closestPlayer = EID:ClosestPlayerTo(descObj.Entity)
local playerType = closestPlayer:GetPlayerType()
if playerType == PlayerType.PLAYER_CAIN_B then
-- Construct the Salvage description
local hasBirthright = closestPlayer:HasCollectible(619)
local salvageDesc = hasBirthright and EID:getDescriptionEntry("TaintedCainPedestalBaseBirthright") or EID:getDescriptionEntry("TaintedCainPedestalBase")
local pickupNames = EID:getDescriptionEntry("PickupNames")
-- Guaranteed items from room type
local roomType = game:GetLevel():GetCurrentRoomDesc().Data.Type
local roomPool = game:GetItemPool():GetPoolForRoom(roomType, 69)
if roomType ~= RoomType.ROOM_ERROR and EID.SalvageRoomTypes[roomPool] then
local newLine = EID.RoomTypeToMarkup[roomType] .. " " .. EID:getDescriptionEntry("TaintedCainPedestalGuaranteed")
newLine = EID:ReplaceVariableStr(newLine, 1, pickupNames[EID.SalvageRoomTypes[roomPool]]:gsub("{{[.-}}]+ ", ""))
newLine = EID:ReplaceVariableStr(newLine, "n", EID.PickupStartsWithVowel[EID.SalvageRoomTypes[roomPool]] and "n" or "")
salvageDesc = salvageDesc .. "#" .. newLine
end
-- Bonus items from trinkets
for trinketID,pickupID in pairs(EID.SalvageTrinkets) do
if closestPlayer:HasTrinket(trinketID) then
local newLine = "{{Trinket" .. trinketID .. "}} " .. EID:getDescriptionEntry("TaintedCainPedestalBonus")
newLine = EID:ReplaceVariableStr(newLine, 1, pickupNames[pickupID]:gsub("{{[.-}}]+ ", ""))
salvageDesc = salvageDesc .. "#" .. newLine
end
end
-- Bonus item from Lucky Toe
if closestPlayer:HasTrinket(42) then
local newLine = "{{Trinket42}} " .. (hasBirthright and EID:getDescriptionEntry("TaintedCainPedestalLuckyToeBirthright") or EID:getDescriptionEntry("TaintedCainPedestalLuckyToe"))
salvageDesc = salvageDesc .. "#" .. newLine
end
-- Daemon's Tail reduces hearts
if closestPlayer:HasTrinket(22) then
local newLine = "{{Trinket22}} " .. EID:getDescriptionEntry("TaintedCainPedestalDaemonsTail")
salvageDesc = salvageDesc .. "#" .. newLine
end
descObj.Description = salvageDesc
for i = 1, #EID.coopAllPlayers do
local t = EID.coopAllPlayers[i]:GetPlayerType()
if t ~= PlayerType.PLAYER_CAIN_B then
table.insert(EID.DifferentEffectPlayers, t)
end
end
else
table.insert(EID.DifferentEffectPlayers, PlayerType.PLAYER_CAIN_B)
end
return descObj
end
-- Handle Glitched Crown style pedestals
local currentSelection = {} -- keep track of which description we're looking at for a given pedestal
local goingToSpindown = false
local inGlitchedCrown = false
local function GlitchedCrownCallback(descObj)
if not descObj.Entity then return descObj end
if not descObj.Entity or inGlitchedCrown then return descObj end
local entity = descObj.Entity
local curRoomIndex = game:GetLevel():GetCurrentRoomDesc().ListIndex
@@ -845,6 +920,7 @@ if EID.isRepentance then
if #sortedItems < 5 then return descObj end
table.sort(sortedItems, function(a, b) return a[2] < b[2] end)
inGlitchedCrown = true
currentSelection[pedestalID] = currentSelection[pedestalID] or 0
-- watch for Tab being pressed to advance our selection by 1
@@ -859,14 +935,16 @@ if EID.isRepentance then
descObj = EID:getDescriptionObj(5, 100, 689, nil, false)
descObj.Description = ""
for _, item in ipairs(sortedItems) do
descObj.Description = descObj.Description .. "#{{NameC" .. item[1] .. "}}"
descObj.Description = descObj.Description .. "{{Collectible" .. item[1] .. "}} {{NameOnlyC" .. item[1] .. "}}#"
end
-- display a specific description
-- don't replace the desc if the pedestal's already showing the correct item
-- display a specific description
else
descObj = EID:getDescriptionObj(5, 100, sortedItems[currentSelection[pedestalID]][1])
end
descObj.Entity = entity
local nextIcon = "{{Collectible689}}"
if currentSelection[pedestalID] + 1 <= #sortedItems then nextIcon = "{{Collectible" ..
sortedItems[currentSelection[pedestalID] + 1][1] .. "}}" end
@@ -874,10 +952,14 @@ if EID.isRepentance then
"#{{Blank}} " .. EID:ReplaceVariableStr(EID:getDescriptionEntry("GlitchedCrownToggleInfo"), 1, nextIcon))
-- manually apply Flip; changing the description's item stops future callbacks to avoid infinite loops, but we want Flip still, it works fine
descObj.Entity = entity
if EID.collectiblesOwned[711] and descObj.ObjSubType ~= entity.SubType then descObj = FlipCallback(descObj) end
if descObj.ObjSubType ~= entity.SubType then
if EID.collectiblesOwned[711] then descObj = FlipCallback(descObj) end
-- manually apply Tainted Cain
if EID:PlayersHaveCharacter(PlayerType.PLAYER_CAIN_B) then descObj = TaintedCainPedestalCallback(descObj) end
end
end
inGlitchedCrown = false
return descObj
end
@@ -902,18 +984,19 @@ if EID.isRepentance then
-- Check Birthright first because it overwrites the description instead of appending to it
if descObj.ObjSubType == 619 then table.insert(callbacks, BirthrightCallback) end
if EID.collectiblesOwned[689] then table.insert(callbacks, GlitchedCrownCallback) 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[584] or descObj.ObjSubType == 584 then table.insert(callbacks, BookOfVirtuesCallback) end
if EID:PlayersHaveCharacter(PlayerType.PLAYER_CAIN_B) then table.insert(callbacks, TaintedCainPedestalCallback) 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
goingToSpindown = true
table.insert(callbacks, SpindownDiceCallback)
else goingToSpindown = false end
-- Card / Rune Callbacks
elseif descObj.ObjVariant == PickupVariant.PICKUP_TAROTCARD then
hasTarot = EID.collectiblesOwned[451]
@@ -999,6 +1082,7 @@ local function CoopDifferentEffectCallback(descObj)
end
displayedChars[v] = true
end
EID.DifferentEffectPlayers = {} -- avoid appending this twice
return descObj
end
local function CoopDifferentEffectConditions(_)