Compare commits

..
4 Commits
Author SHA1 Message Date
Wofsauge 000893987b chore: release 4.77 2024-06-28 21:11:12 +02:00
Buurazu 8ff9f7a262 More override/overridden conditionals (#692)
* Add layers and unique ID checks

* a bunch more overrides

* some overridey conditions

* shorten spirit sword, some conditions

* brimstone mom's knife

* reorganize + mom's knife brimstone
2024-06-28 19:30:33 +02:00
Buurazu 3b0c1165c0 API functions for adding conditionals + override/overridden part 1 (#690)
* some more conditionals

* brimstoney conditions

* add an empty table...

* overrides wip

* Add functions for modders

* more overriding

* Update en_us.lua

* Update en_us.lua

* fix typo
2024-06-27 18:23:50 +02:00
Buurazu 2b78661002 remove a leftover debug print 2024-06-26 21:46:54 -04:00
8 changed files with 290 additions and 97 deletions

No files matched your search

+14 -1
View File
@@ -1257,7 +1257,20 @@ EID.descriptions[languageCode].ConditionalDescs = {
["5.70.28"] = "Isaac shoots forward and to the sides instead", -- R U A Wizard + The Wiz
["5.100.523"] = "Counts as a passive item to {1}", -- Moving Box + Void
["Mongo Babies"] = "Can be copied by {1}", -- Mongo Baby + Baby Familiars
["Technology 2 One Eye"] = "With {1}, the laser replaces your tears entirely", -- Technology 2 + one eye
["Technology 2 One Eye"] = "With {1}, the laser replaces your tears entirely",
["Brimstone Proptosis"] = "Beams deal additional 2x damage at point blank range, decreasing with distance",
["Brimstone Ipecac"] = "Ipecac tears are fired while charging#The +40 damage applies to the laser",
["Proptosis Anti-Gravity"] = "Tears don't lose damage until they start moving",
["Epic Fetus Soy Milk"] = "Crosshair time is not shortened, but missile damage is drastically reduced",
["Eye of Belial Dr. Fetus"] = "Bombs pierce, but don't home or do additional damage",
["Epic Fetus Brimstone"] = "{1} has priority#Rockets shoot out 10 beams",
["Epic Fetus Mom's Knife"] = "{1} has priority#Rockets shoot out 10 knives",
["Brimstone Mom's Knife"] = "{1} has priority#A barrage of knives shoot out based on charge amount",
["Ludovico Ipecac"] = "The tear gets +4 damage but doesn't explode or poison",
["Technology Ipecac"] = "The laser gets +4 damage and poisons targets",
["Chocolate Milk Overrides"] = "↑ {{Tears}} x1.25 Tears multiplier",
["Chocolate Milk Marked"] = "Isaac automatically charges based on distance from the crosshair",
}
+13 -2
View File
@@ -268,7 +268,7 @@ local repCollectibles={
[576] = {"576", "Dirty Mind", "All Dip (small poop) enemies are friendly#Destroying poop spawns 1-4 Dips#Dip type depends on the poop type#Rocks may be replaced with poop"}, -- Dirty Mind
[577] = {"577", "Damocles", "{{Warning}} SINGLE USE {{Warning}}#Hangs a sword above Isaac's head, which doubles all pedestal items#Does not double items that have a price or come from chests#{{Warning}} After taking any damage, the sword has an extremely low chance to instantly kill Isaac every frame#Invincibility effects can prevent the death"}, -- Damocles
[578] = {"578", "Free Lemonade", "Creates a large pool of yellow creep#The creep deals 24 damage per second"}, -- Free Lemonade
[579] = {"579", "Spirit Sword", "Instead of shooting tears, Isaac swings a sword#{{Damage}} The sword deals 3x Isaac's damage +3.5 and swings as fast as the fire button is tapped#{{Chargeable}} Charging does a spin attack + projectile shot#Shoots projectiles with normal swings at full health#{{Tears}} Tears effect the charge time and how often a projectile is shot at full health"}, -- Spirit Sword
[579] = {"579", "Spirit Sword", "Instead of shooting tears, swing a sword#{{Damage}} The sword deals 3x Isaac's damage +3.5 and swings as fast as the fire button is tapped#{{Chargeable}} Charging does a spin attack + projectile shot#Shoots projectiles with swings at full health"}, -- Spirit Sword
[580] = {"580", "Red Key", "Creates a red room adjacent to a regular room, indicated by a door outline#Red Rooms can be special rooms#{{ErrorRoom}} Entering a room outside the 13x13 floor map teleports Isaac to the I AM ERROR room"}, -- Red Key
[581] = {"581", "Psy Fly", "Chases and deflects enemy projectiles#Deals 15 contact damage per second"}, -- Psy Fly
[582] = {"582", "Wavy Cap", "↑ {{Tears}} +0.75 Fire rate#↓ {{Speed}} -0.03 Speed#Distorts the screen#Takes longer to recharge each use#Leaving or clearing rooms reduces the effects"}, -- Wavy Cap
@@ -1100,7 +1100,7 @@ EID.descriptions[languageCode].horsepills={
{"41", "I'm Drowsy...", "{{Slow}} Slows Isaac and all enemies in the room"}, -- I'm Drowsy...
{"42", "I'm Excited!!", "Speeds up Isaac and all enemies in the room#Triggers again after 30 and 60 seconds"}, --I'm Excited!!
{"43", "Gulp!", "Consumes Isaac's trinket and grants its effects permanently"}, -- Gulp!
{"44", "Horf!", "{{Collectible149}} Shoots a cluster of ipecac tears"}, -- Horf!
{"44", "Horf!", "{{Collectible149}} Shoots a cluster of Ipecac tears"}, -- Horf!
{"45", "Feels like I'm walking on sunshine!", "{{Timer}} Receive for 6.5 seconds:#Invincibility#Isaac can't shoot but deals 40 contact damage per second#{{HalfHeart}} Eating 2 enemies heals half a heart#{{Fear}} Fears all enemies in the room"}, -- Feels like I'm walking on sunshine!
{"46", "Vurp!", "Spawns the last pill Isaac used as a horse pill"}, -- Vurp!
{"47", "Shot speed Down", "↓ {{Shotspeed}} -0.3 Shot speed"}, -- Shot speed Down
@@ -1408,6 +1408,17 @@ local repConditions = {
["4.5 Volt Multiple"] = "Secondary active items only gain charge if the primary active is fully charged", -- 4.5 Volt + Schoolbag/Pocket Actives
["Bulb Zero"] = "Actives with 0 max charges don't count", -- Vibrant/Dim Bulb + zero charge actives
["Brimstone Proptosis"] = "Beams deal 6x damage at point blank range, decreasing with distance",
["Brimstone Ipecac"] = "The laser gets +2 damage and explodes on enemies and obstacles",
["Brimstone Pop!"] = "Shorter beam that shoots {1} tears at the end",
["Eye of Belial Dr. Fetus"] = "Bombs pierce, doing 2.5x damage, but don't home or do additional blast damage",
["Spirit Sword C Section"] = "{1} has priority#Fetuses hold swords and do spin attacks",
["Spirit Sword Mom's Knife"] = "{1} has priority#The spin attack throws the sword forward",
["Spirit Sword Technology"] = "The sword becomes a lightsaber that can reflect enemy shots",
["Ludovico Ipecac"] = "The tear gets +2 damage but doesn't explode or poison",
["Technology Ipecac"] = "The laser gets +2 damage and explodes on targets",
["Eye of the Occult Beam"] = "Isaac automatically shoots with a crosshair that alters the beam's path",
}
EID:updateDescriptionsViaTable(repConditions, EID.descriptions[languageCode].ConditionalDescs)
+59 -6
View File
@@ -27,11 +27,11 @@ EID:AddItemConditional("5.100", 356, EID.CheckForCarBattery, {locTable = "carBat
EID:AddConditional(356, EID.CheckActivesForCarBattery, "No Effect") -- "No effect" text for Car Battery pedestal
-- BFFS! / Hive Mind
EID:AddItemConditional({"5.100","5.350.54","5.350.57"}, 247, EID.CheckForBFFS, {locTable = "BFFSSynergies", replaceColor = "BlinkPink", noFallback = false})
EID:AddItemConditional({"5.100","5.350.54","5.350.57"}, 247, EID.CheckForBFFS, {locTable = "BFFSSynergies", replaceColor = "BlinkPink", noFallback = false, uniqueID = "BFFS"})
EID:AddConditional(247, EID.CheckFamiliarsForBFFS, "No Effect") -- "No effect" text for BFFS pedestal
if EID.isRepentance then
EID:AddItemConditional({"5.300.96", "5.350.142", "5.350.176", "5.350.182", "5.350.186"}, 247, EID.CheckForBFFS, {locTable = "BFFSSynergies", replaceColor = "BlinkPink", noFallback = false}) -- BFFS! Repentance soulstone/trinkets
EID:AddItemConditional("5.100", 248, EID.CheckForHiveMind, {locTable = "BFFSSynergies", replaceColor = "BlinkBlue", noFallback = false}) -- Hive Mind
EID:AddItemConditional("5.100", 248, EID.CheckForHiveMind, {locTable = "BFFSSynergies", replaceColor = "BlinkBlue", noFallback = false, uniqueID = "BFFS"}) -- Hive Mind
EID:AddSynergyConditional(247, 248, "No Effect (Familiars)") -- Already having Hive Mind / BFFS!
end
@@ -131,10 +131,61 @@ end
------ OVERRIDES / OVERRIDDEN BY -----
-- huge TODO here, a lot of AB+ only ones too
-- TODO: Check Azazel and Forgotten's effects with these items, especially Brimstone overrides
-- Monstro's Lung might be worthy of this list too?
-- Is the layer order correct here? Would I be better off making a new function for adding these overrides that has its own pre-defined layer numbers for the problematic items, to clean up this mess some?
EID:AddSynergyConditional({52, 69, 104, 132, 222, 224, 233, 316, 329, 369, 379, 397, 401, 410, 440, 444, 453, 459, 461, 462, 494, 524, 532, 533, 540, }, 168, "Overridden", "Overrides", {layer = 900, checkLayers = true}) -- Epic Fetus
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: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: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: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: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
EID:AddSynergyConditional({410, 462, 524, 533, 540}, 68, "Overridden", "Overrides", {layer = 400, checkLayers = true}) -- Technology
EID:AddSynergyConditional(149, 68, "Technology Ipecac", nil, {layer = 400, checkLayers = true}) -- Technology + Ipecac
EID:AddSynergyConditional({69, 222, 224, 316, 394, 397, 410, 532}, 329, "Overridden", "Overrides", {layer = 300, checkLayers = true}) -- Ludovico
EID:AddSynergyConditional(149, 329, "Ludovico Ipecac", nil, {layer = 300, checkLayers = true}) -- Ludovico + Ipecac
if not EID.isRepentance then
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: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
EID:AddSynergyConditional({52, 68, 114, 118, 168, 329, 395}, 69, "Chocolate Milk Overrides", nil, {uniqueID = "choccy"}) -- Chocolate Milk providing fire rate (the override/overridden line happens too)
end
if EID.isRepentance then
EID:AddOneSidedSynergyConditional(678, 579, "Spirit Sword C Section", {layer = 1001, checkLayers = true}) -- C Section + Spirit Sword
EID:AddSynergyConditional({52, 69, 118, 168, 229, 316, 329, 379, 394, 395, 397, 440, 556, 597, }, 579, "Overridden", "Overrides", {layer = 1000, checkLayers = true}) -- Spirit Sword
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: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:AddOneSidedSynergyConditional({529, 532}, 118, "Brimstone Pop!", {layer = 666, checkLayers = true}) -- Brimstone + Pop!/Lachryphagy
EID:AddSynergyConditional(572, 118, "Eye of the Occult Beam", nil, {layer = 666}) -- Brimstone + 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
EID:AddSynergyConditional(330, 561, "Overridden", "Overrides") -- Soy Milk + Almond Milk
end
@@ -212,6 +263,8 @@ EID:AddItemConditional("5.70.28", 358) -- Wizard pill + The Wiz
EID:AddItemConditional(523, 477) -- Moving Box is a passive to Void
EID:AddItemConditional({8, 113, 163, 167, 99, 100, 174, 95, 268, 67}, 322, "Mongo Babies") -- Mongo Baby + Copiable familiars
if EID.isRepentance then EID:AddItemConditional(608, 322, "Mongo Babies") end
EID:AddSynergyConditional(261, 222, "Proptosis Anti-Gravity")
EID:AddSynergyConditional(394, 69, "Chocolate Milk Marked")
-- AB+ only misc conditionals
if not EID.isRepentance then
@@ -222,7 +275,6 @@ end
-- Rep only misc conditionals
if EID.isRepentance then
-- Co-op friendly items
-- todo: what items have a cool co-op synergy?
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
@@ -231,13 +283,12 @@ if EID.isRepentance then
EID:AddItemConditional("5.350.172", 260) -- Black Candle + Cursed Penny
EID:AddItemConditional(501, 416) -- Greed's Gullet + Deep Pockets
EID:AddSynergyConditional(245, { 2, 153, 169 }, nil, "20/20") -- 20/20 + The Inner Eye, Mutant Spider, Polyphemus
EID:AddSynergyConditional(596, {"5.350.118", 704, 62, "5.350.60", 520, 411, 621, "5.350.58", "5.350.189", 657}, "Ice Tears") -- Uranus + On Kill Effects
EID:AddPlayerConditional(596, 27, "Ice Tears") -- Uranus + Tainted Samson
EID:AddSynergyConditional(495, 616, "Both Peppers") -- Ghost Pepper + Bird's Eye
EID:AddSynergyConditional(726, {408, 646, 293, 679, 275, 399, 680, 441, 49, 533}, "Hemoptysis") -- Hemoptysis + Brimstone effects
-- eye drops + passives like brimstone go here but there's a lot of them
-- eye drops + chargeable passives like brimstone could go here but there's a lot of them
EID:AddPlayerConditional(600, {2, 7, 13, 16}) -- Eye Drops + Cain, Azazel, Lilith, Forgotten
EID:AddSynergyConditional(152, {708, 444}, "Technology 2 One Eye") -- Technology 2 + Stapler, Lead Pencil
end
@@ -258,6 +309,8 @@ Car Battery / BFFS whitelist for showing certain lines on the car/bffs pedestal,
Implement a system where similar texts don't get shown multiple times in one apply conditionals function (hive minds/bffs)
hallowed ground / midas touch + the poop / card against humanity / everything jar synergies
Add Void synergy information for some active items (which?) (warn on things like mom's box you don't get double trinket power?)
Damage multipliers that don't stack
Clicker only changes Tainteds into other Tainteds?
TODOS I'VE DECIDED NOT TODO RIGHT NOW:
Incubus effects; a lot are AB+ only; annoying to test; plus Lilith has to be added for all of them too
+199 -84
View File
@@ -1,4 +1,111 @@
local game = Game()
local modTextsAdded = 0
local function newModdedCondition(text, language)
if text == nil then return nil end
modTextsAdded = modTextsAdded + 1
EID.descriptions[language].ConditionalDescs["Modded Conditional " .. modTextsAdded] = text
return "Modded Conditional " .. modTextsAdded
end
------ FUNCTIONS FOR MODDERS TO ADD CONDITIONALS ------
-- You provide your own strings into these functions
-- Add text to a pedestal's description when you own a different item
-- ID and ownedID can be a collectible ID or a full item string (like "5.350.54")
-- ownedID can also be a function rather than just an ID; if it returns true, the text will be displayed
-- The text will be added as a new line, with the owned item's icon at the start
-- If you pass in replaceText, instead the text is found in the description and replaced with replaceText
-- For convenience, ID can be a table of IDs that will all get the condition applied
-- Optional parameters: replaceText, language, extraTable
-- Example usage: EID:addCondition(myDevilishItemID, EID.IsGreedMode, "{{GreedMode}} Reduces shop prices by 1 for each optional Nightmare wave completed")
function EID:addCondition(ID, ownedID, text, replaceText, language, extraTable)
language = language or "en_us"
if replaceText then text = {text, replaceText} end
local modifierText = newModdedCondition(text, language)
if type(ownedID) ~= "function" then
EID:AddItemConditional(ID, ownedID, modifierText, extraTable)
else
EID:AddConditional(ID, ownedID, modifierText, extraTable)
end
end
-- Shortcut function for when you have two items that have a synergy with each other
-- ID1 will have text1 added to its description if you own ID2
-- ID2 will have text2 (or text1, if text2 isn't given) added to its description if you own ID1
-- ID1 and ID2 can both be tables of IDs that will get the condition applied to each other
-- Optional parameters: text2, language, extraTable
-- Example usage: EID:addSynergyCondition(myHappyLittleItemID, {CollectibleType.COLLECTIBLE_BRIMSTONE, CollectibleType.COLLECTIBLE_SULFUR}, "Turns your laser into a smiley face that charms enemies")
function EID:addSynergyCondition(ID1, ID2, text1, text2, language, extraTable)
language = language or "en_us"
local modifierText1 = newModdedCondition(text1, language)
local modifierText2 = newModdedCondition(text2, language)
EID:AddSynergyConditional(ID1, ID2, modifierText1, modifierText2, extraTable)
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
-- Optional parameters: replaceText, language, extraTable
-- Example usage: EID:addPlayerCondition(myAngstyItemID, PlayerType.PLAYER_EVE, "Gives Eve extra mascara (2x Damage multiplier)")
function EID:addPlayerCondition(ID, playerID, text, replaceText, language, extraTable)
language = language or "en_us"
if replaceText then text = {text, replaceText} end
local modifierText = newModdedCondition(text, language)
EID:AddPlayerConditional(ID, playerID, modifierText, extraTable)
end
-- Shortcut function for tarotClothBuffs, tarotClothBuffsAB, carBattery, abyssSynergies, bookOfBelialBuffs, bingeEaterBuffs
-- Because these are general conditions that only match one item type, it's super easy to add to them
-- The text will be appended; numberToDouble will be found in the description and doubled, as that's the most frequent use case
-- or, if you provide newNumber, it changes numberToDouble to that (technically, it's just a find/replace pair, any strings work)
-- Example usage: EID:addToGeneralCondition(myVeryHealthyItemID, "bingeEaterBuffs", "↑ {{Speed}} +0.15 Speed#↓ {{Tears}} -0.5 Tears#↓ {{Damage}} -0.5 Damage")
function EID:addToGeneralCondition(ID, locTable, text, numberToDouble, newNumber, language)
language = language or "en_us"
if numberToDouble then
newNumber = newNumber or numberToDouble * 2
text = {numberToDouble, newNumber, text}
end
EID.descriptions[language][locTable][ID] = text
end
-- Shortcut function for adding BFFS conditions; this is slightly more complex since it supports trinkets
-- Example usage: EID:addBFFSCondition(myBasicFamiliarID, nil, 3.5)
function EID:addBFFSCondition(ID, text, numberToDouble, newNumber, language)
language = language or "en_us"
if numberToDouble then
newNumber = newNumber or numberToDouble * 2
text = {numberToDouble, newNumber, text}
end
if type(ID) ~= "string" then ID = "5.100." .. ID
else
-- We don't have to add a new condition for collectibles, because they're checked with a "5.100" condition
EID:AddItemConditional(ID, 247, EID.CheckForBFFS, {locTable = "BFFSSynergies", replaceColor = "BlinkPink", noFallback = false, uniqueID = "BFFS"})
end
EID.descriptions[language].BFFSSynergies[ID] = text
end
-- Shortcut function for adding Hive Mind conditions; by default, it will show with BFFS too, unless you pass in allowBFFS as false
function EID:addHiveMindCondition(ID, text, numberToDouble, newNumber, language, allowBFFS)
language = language or "en_us"
if allowBFFS == nil then allowBFFS = true end
EID.HiveMindFamiliars[ID] = true
if not allowBFFS then EID.BFFSIgnore[ID] = true end
if numberToDouble then
newNumber = newNumber or numberToDouble * 2
text = {numberToDouble, newNumber, text}
end
if type(ID) ~= "string" then ID = "5.100." .. ID
else
-- We don't have to add a new condition for collectibles, because they're checked with a "5.100" condition
EID:AddItemConditional(ID, 248, EID.CheckForHiveMind, {locTable = "BFFSSynergies", replaceColor = "BlinkBlue", noFallback = false, uniqueID = "BFFS"})
end
EID.descriptions[language].BFFSSynergies[ID] = text
end
------ FUNCTIONS FOR INTERNAL USE ------
-- These need to look up strings from the localization table, and are designed to reduce work needed by localizers. Of course, you can use these in mods if you want
-- They're simple to use in the simplest use case, while powerful enough to handle complicated needs
--[[
Argument 1: The item ID
@@ -22,18 +129,21 @@ local game = Game()
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
usePedestalName: If true, display the pedestal item's name in place of {1}
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
layer: A number used in determining the order that conditionals should be checked in, default -1
checkLayers: If true, don't print this condition if a higher layer condition was applied already
uniqueID: Only one conditional with the given unique ID will be printed
]]
local function CopyTable(t1)
local newTable = {}; for k, v in pairs(t1) do newTable[k] = v end
return newTable
end
function EID:AddConditional(IDs, funcText, modText, extraTable, insertPoint)
-- Every single add conditional function ends up calling this function eventually. This is THE place to define variables every condition MUST have.
function EID:AddConditional(IDs, funcText, modText, extraTable)
if type(IDs) ~= "table" then IDs = { IDs } end
if modText == "" then modText = nil end
extraTable = extraTable or {}
if extraTable.noFallback == nil then extraTable.noFallback = true end
extraTable.layer = extraTable.layer or -1
for _, id in ipairs(IDs) do
if type(id) ~= "string" then id = "5.100." .. id end
EID.DescriptionConditions[id] = EID.DescriptionConditions[id] or {}
@@ -44,20 +154,13 @@ function EID:AddConditional(IDs, funcText, modText, extraTable, insertPoint)
if newTable.usePedestalName then
newTable.variableText = "{{NameOnly" .. id .. "}}"
end
if insertPoint then
table.insert(EID.DescriptionConditions[id], insertPoint, newTable)
else
table.insert(EID.DescriptionConditions[id], newTable)
end
table.insert(EID.DescriptionConditions[id], newTable)
end
end
-- Easy to use functions for conditionals that rely on having a specific item/character
-- By default, they'll have a bulletpoint for the item/char, and {1} becomes the item/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:AddItemConditional(IDs, ownedIDs, modText, extraTable, checkInReminder)
if type(ownedIDs) ~= "table" then ownedIDs = { ownedIDs } end
if checkInReminder == nil then checkInReminder = true end
@@ -100,6 +203,7 @@ function EID:AddSelfConditional(ownedIDs, modText, extraTable, includeDiplopia)
end
end
-- For adding a conditional based on if a specific character is present
-- 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
@@ -114,7 +218,7 @@ function EID:AddPlayerConditional(IDs, charIDs, modText, extraTable, includeTain
end
----- Evaluation Functions -----
------ Evaluation Functions ------
function EID:ConditionalItemCheck(itemID, checkInReminder)
if EID.InsideItemReminder then
@@ -209,12 +313,14 @@ function EID:CheckActivesForCarBattery(descObj)
end
-- When we have BFFS/Hive Mind, change familiar pedestal descriptions
function EID:CheckForBFFS(descObj)
function EID:CheckForBFFS(descObj, hiveMind)
if EID.BFFSIgnore[descObj.ObjSubType] and not hiveMind then return "N/A" end
if descObj.ObjVariant == 100 and EID.BFFSNoSynergy[descObj.ObjSubType] then return "No Effect" end
return descObj.fullItemString
local adjustedSubtype = EID:getAdjustedSubtype(descObj.ObjType, descObj.ObjVariant, descObj.ObjSubType)
return descObj.ObjType.."."..descObj.ObjVariant.."."..adjustedSubtype
end
function EID:CheckForHiveMind(descObj)
if EID.HiveMindFamiliars[descObj.ObjSubType] then return EID:CheckForBFFS(descObj) end
if EID.HiveMindFamiliars[descObj.ObjSubType] then return EID:CheckForBFFS(descObj, true) end
return "N/A"
end
@@ -317,88 +423,97 @@ function EID:applyConditionals(descObj)
local adjustedSubtype = EID:getAdjustedSubtype(descObj.ObjType, descObj.ObjVariant, descObj.ObjSubType)
local typeVar = descObj.ObjType.."."..descObj.ObjVariant -- for general conditions (Tarot Cloth, Book of Virtues)
local typeVarSub = descObj.ObjType.."."..descObj.ObjVariant.."."..adjustedSubtype -- for specific conditions
local highestLayer = -999
local printedDescs = {}
-- Combine specific+generic conditions into one table (in that order)
local conds = {}
if EID.DescriptionConditions[typeVarSub] then TableConcat(conds, EID.DescriptionConditions[typeVarSub]) end
if EID.DescriptionConditions[typeVar] then TableConcat(conds, EID.DescriptionConditions[typeVar]) end
table.sort(conds, function(a, b) return a.layer > b.layer end)
-- Check every condition we need to check for this item
for _, cond in ipairs(conds) do
-- 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
local modifierText = type(cond.modifierText) == "function" and cond.modifierText(EID, descObj) or cond.modifierText
-- Find our string in the base localization table
if cond.noTable then
text = EID:getDescriptionEntry(modifierText, nil, cond.noFallback)
-- Find our string as either "Type.Var.Sub (Mod Text)" or "Mod Text"
elseif modifierText then
text = EID:getDescriptionEntry(locTable, typeVarSub .. " (" .. modifierText .. ")", cond.noFallback)
if text == nil then text = EID:getDescriptionEntry(locTable, modifierText, cond.noFallback) end
-- Find our string as either "Type.Var.Sub" or just the Subtype
else
text = EID:getDescriptionEntry(locTable, typeVarSub, cond.noFallback)
if text == nil then text = EID:getDescriptionEntry(locTable, descObj.ObjSubType, cond.noFallback) end
end
if not cond.checkLayers or highestLayer <= cond.layer then
local result = cond.func(EID, descObj)
if result then
-- 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
local modifierText = type(cond.modifierText) == "function" and cond.modifierText(EID, descObj) or cond.modifierText
-- Find our string in the base localization table
if cond.noTable then
text = EID:getDescriptionEntry(modifierText, nil, cond.noFallback)
-- Find our string as either "Type.Var.Sub (Mod Text)" or "Mod Text"
elseif modifierText then
text = EID:getDescriptionEntry(locTable, typeVarSub .. " (" .. modifierText .. ")", cond.noFallback)
if text == nil then text = EID:getDescriptionEntry(locTable, modifierText, cond.noFallback) end
-- Find our string as either "Type.Var.Sub" or just the Subtype
else
text = EID:getDescriptionEntry(locTable, typeVarSub, cond.noFallback)
if text == nil then text = EID:getDescriptionEntry(locTable, descObj.ObjSubType, cond.noFallback) end
end
-- If we find the localization string for this condition, and it passes the test, modify the description text
local result = cond.func(EID, descObj)
if text ~= nil and result then
local variableText, bulletpoint
-- If the condition returned a value, use that value
if result ~= true then
-- For the time being, we assume the result was a collectible number (will support more soon)
variableText = "{{NameOnlyC"..result.."}}"
bulletpoint = "Collectible"..result
else
variableText = type(cond.variableText) == "function" and cond.variableText(EID, descObj) or cond.variableText
bulletpoint = cond.bulletpoint
end
-- String = append
if type(text) == "string" then
text = EID:ReplaceVariableStr(text, 1, variableText)
local iconStr = "#"
if bulletpoint then iconStr = iconStr .. "{{" .. 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(text[1], 1, variableText)
-- Table with 2+ entries = find and replace pairs
-- Entry 1 is replaced with entry 2, entry 3 is replaced with entry 4, etc.
-- If there's an odd number of entries, the last one is appended
else
local pos = 1
while pos < #text do
local toFind = text[pos]
if text[pos + 1] then
local replaceWith = EID:ReplaceVariableStr(text[pos + 1], 1, variableText)
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
-- If we find the localization string for this condition, it passed the condition's test, and the layer is ok, modify the description text
if text ~= nil and (not cond.uniqueID or printedDescs[cond.uniqueID] == nil) then
if cond.layer > highestLayer then highestLayer = cond.layer end
if cond.uniqueID then printedDescs[cond.uniqueID] = true end
local variableText, bulletpoint
-- If the condition returned a value, use that value
if result ~= true then
-- For the time being, we assume the result was a collectible number (will support more soon)
variableText = "{{NameOnlyC"..result.."}}"
bulletpoint = "Collectible"..result
else
toFind = EID:ReplaceVariableStr(toFind, 1, variableText)
variableText = type(cond.variableText) == "function" and cond.variableText(EID, descObj) or cond.variableText
bulletpoint = cond.bulletpoint
end
-- String = append
if type(text) == "string" then
text = EID:ReplaceVariableStr(text, 1, variableText)
local iconStr = "#"
if bulletpoint then iconStr = iconStr .. "{{" .. bulletpoint .. "}} " end
if cond.lineColor then iconStr = iconStr .. "{{" .. cond.lineColor .. "}}" end
EID:appendToDescription(descObj, iconStr .. toFind:gsub("#", iconStr))
EID:appendToDescription(descObj, iconStr .. text:gsub("#", iconStr))
-- Table with 1 entry = replace
elseif #text == 1 then
descObj.Description = EID:ReplaceVariableStr(text[1], 1, variableText)
-- Table with 2+ entries = find and replace pairs
-- Entry 1 is replaced with entry 2, entry 3 is replaced with entry 4, etc.
-- If there's an odd number of entries, the last one is appended
else
local pos = 1
while pos <= #text do
local toFind = text[pos]
if text[pos + 1] then
local replaceWith = EID:ReplaceVariableStr(text[pos + 1], 1, variableText)
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
else
toFind = EID:ReplaceVariableStr(toFind, 1, variableText)
local iconStr = "#"
if bulletpoint then iconStr = iconStr .. "{{" .. bulletpoint .. "}} " end
if cond.lineColor then iconStr = iconStr .. "{{" .. cond.lineColor .. "}}" end
EID:appendToDescription(descObj, iconStr .. toFind:gsub("#", iconStr))
end
pos = pos + 2
end
end
pos = pos + 2
end
end
end
+2
View File
@@ -970,6 +970,8 @@ end
-- Familiars that count for Hive Mind in Repentance (although it could give them No Effect if it just increases size)
EID.HiveMindFamiliars = { [10] = true, [57] = true, [128] = true, [170] = true, [264] = true, [272] = true, [274] = true, [279] = true, [320] = true, [364] = true, [365] = true, [403] = true, [426] = true, [430] = true, [504] = true, [511] = true, [575] = true, [581] = true, [629] = true, [649] = true, [650] = true, [706] = true, }
-- Familiars that count for Hive Mind but should be ignored by BFFS (not used yet, maybe used by modded item conditionals)
EID.BFFSIgnore = {}
-- Tainted character's respective normal version ID, for conditionals that apply to both versions of the character
-- To help with other character pairs, Esau = Jacob, Dead Tainted Lazarus = Tainted Lazarus, Tainted Soul = Tainted Forgotten
-1
View File
@@ -122,7 +122,6 @@ function EID:CheckGlitchedItemConfig(id)
for i,func in ipairs(getFunctions) do
local val = item[func](item) * statMult[i]
if val ~= 0 then
if (i == 4) then print("range!") end
local s = string.format("%.2g",SimpleRound(val))
local prefix = "↑ "
if val > 0 then s = "+" .. s else prefix = "↓ " end
+2 -2
View File
@@ -10,8 +10,8 @@ EID.isRepentance = REPENTANCE -- REPENTANCE variable can be altered by any mod,
require("eid_config")
EID.Config = EID.UserConfig
EID.Config.Version = "3.2" -- note: changing this will reset everyone's settings to default!
EID.ModVersion = 4.76
EID.ModVersionCommit = "2ae651d"
EID.ModVersion = 4.77
EID.ModVersionCommit = "8ff9f7a"
EID.DefaultConfig.Version = EID.Config.Version
EID.isHidden = false
EID.player = nil -- The primary Player Entity of Player 1
+1 -1
View File
@@ -51,7 +51,7 @@ You are currently looking at the version for Afterbirth+ and Repentance.
[img]https://i.imgur.com/jrdGbna.png[/img]
[url=https://github.com/wofsauge/External-Item-Descriptions/blob/master/CREDITS.md]Check out the credits here[/url]
</description>
<version>4.76</version>
<version>4.77</version>
<visibility>Public</visibility>
<tag id="Lua"/>
<tag id="Items"/>