diff --git a/descriptions/ab+/en_us.lua b/descriptions/ab+/en_us.lua index c4c65b81..9fdfd635 100644 --- a/descriptions/ab+/en_us.lua +++ b/descriptions/ab+/en_us.lua @@ -239,7 +239,7 @@ EID.descriptions[languageCode].collectibles={ {"216", "Ceremonial Robes", "↑ {{Damage}} +1 Damage#{{BlackHeart}} +3 Black Hearts"}, -- Ceremonial Robes {"217", "Mom's Wig", "{{Heart}} Heals 1 heart#5% chance to spawn a blue spider when shooting tears#{{Luck}} 100% chance at 10 luck"}, -- Mom's Wig {"218", "Placenta", "↑ {{Heart}} +1 Health#{{HalfHeart}} 50% chance to heal half a heart every minute"}, -- Placenta - {"219", "Old Bandage", "↑ {{EmptyHeart}} +1 Empty heart container#{{Heart}} Taking damage has a chance to spawn a Red Heart"}, -- Old Bandage + {"219", "Old Bandage", "↑ {{EmptyHeart}} +1 Empty heart container#{{Heart}} Taking damage has a 10% chance to spawn a Red Heart"}, -- Old Bandage {"220", "Sad Bombs", "{{Bomb}} +5 Bombs#Isaac's bombs shoot 10 tears in a circle when they explode"}, -- Sad Bombs {"221", "Rubber Cement", "Isaac's tears bounce off enemies and obstacles"}, -- Rubber Cement {"222", "Anti-Gravity", "↑ {{Tears}} -2 Tear delay#Holding the fire buttons causes tears to hover in midair#Releasing the fire buttons shoots them in the direction they were fired"}, -- Anti-Gravity @@ -505,7 +505,7 @@ EID.descriptions[languageCode].collectibles={ {"480", "Compost", "Converts pickups into blue flies or spiders#Doubles all blue flies and spiders#Spawns 1 blue fly or spider if Isaac has none"}, -- Compost {"481", "Dataminer", "↑ Random stat up#↓ Random stat down#{{Timer}} Random tear effects for the room#{{Blank}} Corrupts all sprites and music in the room"}, -- Dataminer {"482", "Clicker", "Changes your character to a random character#Removes the most recent item collected"}, -- Clicker - {"483", "Mama Mega!", "{{Warning}} SINGLE USE {{Warning}}#Affects the whole floor#Explodes all objects#Deals 200 damage to all enemies#Opens the door to Boss Rush, Hush and all secret rooms#Having a golden bomb when using the item consumes it and allows for another use of Mama Mega"}, -- Mama Mega! + {"483", "Mama Mega!", "{{Warning}} SINGLE USE {{Warning}}#Affects the whole floor#Explodes all objects#Deals 200 damage to all enemies#Opens secret rooms#Opens Boss Rush and Hush regardless of time"}, -- Mama Mega! {"484", "Wait What?", "Upon use, pushes enemies away and spawns a rock wave around Isaac#The rock wave can open rooms and break rocks"}, -- Wait What? {"485", "Crooked Penny", "50% chance to double all items, pickups and chests in room#50% chance to remove items / pickups in room and spawn 1 coin"}, -- Crooked Penny {"486", "Dull Razor", "Hurts Isaac without removing health#Triggers any on-hit item effects"}, -- Dull Razor @@ -1100,6 +1100,11 @@ EID.descriptions[languageCode].VoidNames = {"{1} Speed", "{1} Tears", "{1} Damag EID.descriptions[languageCode].PurityBoosts = {[0] = "↑ {{Damage}} +4 Damage", "↑ {{Tears}} -4 Tear delay", "↑ {{Speed}} +0.5 Speed", "↑ {{Range}} +7.5 Range#↑ +1 Tear height"} +EID.descriptions[languageCode].CrookedPennyHeads = "Heads" +EID.descriptions[languageCode].CrookedPennyTails = "Tails" + +EID.descriptions[languageCode].LuckModifier = "{1}% chance at {2} luck" + EID.descriptions[languageCode].CollectionPageInfo = "This item needs to be picked up for the collection page!" EID.descriptions[languageCode].BlackFeatherInformation = "{{ColorLime}}{1}{{CR}} items currently held (+{2} Damage)" @@ -1284,6 +1289,7 @@ EID.descriptions[languageCode].ConditionalDescs = { ["White Poop"] = "Spawns White Poop instead", ["White Poop Chance"] = "Chance to spawn White Poop", ["Golden Poop Chance"] = "Chance to spawn Golden Poop", + ["5.100.483"] = "{{GoldenBomb}} Having a golden bomb when using the item consumes it and allows for another use of Mama Mega", ["5.300.5"] = {"{{BossRoom}} Teleports Isaac to a random Boss Room"}, -- IV - The Emperor (in The Void) ["5.300.18"] = "Teleports Isaac to a random room if there's no Treasure Room", -- XVII - The Stars (Womb and below) diff --git a/descriptions/rep/en_us.lua b/descriptions/rep/en_us.lua index d2845805..0917a7f5 100644 --- a/descriptions/rep/en_us.lua +++ b/descriptions/rep/en_us.lua @@ -95,6 +95,7 @@ local repCollectibles={ [211] = {"211", "Spiderbaby", "Taking damage spawns 3-5 blue spiders"}, -- Spiderbaby [214] = {"214", "Anemic", "↑ {{Range}} +1.5 Range#{{Timer}} When taking damage Isaac leaves a trail of blood creep for the room#The creep deals 6 damage per second"}, -- Anemic [218] = {"218", "Placenta", "↑ {{Heart}} +1 Health#{{Heart}} Heals 1 heart#{{HalfHeart}} 50% chance to heal half a heart every minute"}, -- Placenta + [219] = {"219", "Old Bandage", "↑ {{EmptyHeart}} +1 Empty heart container#{{Heart}} Taking damage has a 20% chance to spawn a Red Heart"}, -- Old Bandage [222] = {"222", "Anti-Gravity", "↑ {{Tears}} +1 Fire rate#Holding the fire buttons causes tears to hover in mid-air#Releasing the fire buttons shoots them in the direction they were fired"}, -- Anti-Gravity [223] = {"223", "Pyromaniac", "{{Bomb}} +5 Bombs#{{HalfHeart}} Getting hit by explosions heals half a heart instead of damaging Isaac#{{Burning}} Fire immunity (except projectiles)"}, -- Pyromaniac [224] = {"224", "Cricket's Body", "↑ {{Tears}} +0.5 Fire rate#↓ {{Range}} x0.8 Range multiplier#Tears split in 4 on hit#Split tears deal half damage"}, -- Cricket's Body @@ -788,9 +789,9 @@ local repTrinkets={ [33] = {"33", "Umbilical Cord", "{{HalfHeart}} Having half a Red Heart or less grants {{Collectible100}} Little Steven#{{Collectible318}} Taking damage has a high chance to spawn a Gemini familiar for the room"}, -- Umbilical Cord [39] = {"39", "Cancer", "↑ {{Tears}} +1 Fire rate"}, -- Cancer [48] = {"48", "A Missing Page", "Taking damage has a 5% chance to deal 80 damage to all enemies in the room#{{Collectible35}} Black Hearts and Necronomicon-like effects deal double damage"}, -- A Missing Page - [49] = {"49", "Bloody Penny", "{{HalfHeart}} Picking up a coin has a 25% chance to spawn a half Red Heart"}, -- Bloody Penny - [50] = {"50", "Burnt Penny", "{{Bomb}} Picking up a coin has a 25% chance to spawn a bomb"}, -- Burnt Penny - [51] = {"51", "Flat Penny", "{{Key}} Picking up a coin has a 25% chance to spawn a key"}, -- Flat Penny + [49] = {"49", "Bloody Penny", "{{HalfHeart}} Picking up a coin has a 25% chance to spawn a half Red Heart#Higher chance from nickels and dimes"}, -- Bloody Penny + [50] = {"50", "Burnt Penny", "{{Bomb}} Picking up a coin has a 25% chance to spawn a bomb#Higher chance from nickels and dimes"}, -- Burnt Penny + [51] = {"51", "Flat Penny", "{{Key}} Picking up a coin has a 25% chance to spawn a key#Higher chance from nickels and dimes"}, -- Flat Penny [65] = {"65", "Tape Worm", "↑ {{Range}} +3 Range"}, -- Tape Worm [66] = {"66", "Lazy Worm", "↓ {{Shotspeed}} -0.5 Shot speed"}, -- Lazy Worm [67] = {"67", "Cracked Dice", "Taking damage has a 50% chance to trigger one of these effects:#{{Collectible105}} D6#{{Collectible406}} D8#{{Collectible285}} D10#{{Collectible386}} D12#{{Collectible166}} D20"}, -- Cracked Dice @@ -808,7 +809,7 @@ local repTrinkets={ [128] = {"128", "Finger Bone", "{{EmptyBoneHeart}} Taking damage has a 4% chance to grant a Bone Heart"}, -- Finger Bone [129] = {"129", "Jawbreaker", "{{Damage}} 10% chance to shoot teeth that deal 3.2x Isaac's damage#{{Luck}} 100% chance at 9 luck"}, -- Jawbreaker [130] = {"130", "Chewed Pen", "{{Slow}} 10% chance to shoot slowing tears#{{Luck}} 100% chance at 18 luck"}, -- Chewed Pen - [131] = {"131", "Blessed Penny", "{{HalfSoulHeart}} Picking up a coin has a 17% chance to spawn a half Soul Heart"}, -- Blessed Penny + [131] = {"131", "Blessed Penny", "{{HalfSoulHeart}} Picking up a coin has a 17% chance to spawn a half Soul Heart#Higher chance from nickels and dimes"}, -- Blessed Penny [132] = {"132", "Broken Syringe", "25% chance to get a random syringe effect each room"}, -- Broken Syringe [133] = {"133", "Short Fuse", "Isaac's bombs explode faster"}, -- Short Fuse [134] = {"134", "Gigante Bean", "Increases fart size"}, -- Gigante Bean @@ -824,7 +825,7 @@ local repTrinkets={ [144] = {"144", "Brain Worm", "Tears turn 90 degrees to target enemies that they may have missed"}, -- Brain Worm [145] = {"145", "Perfection", "↑ {{Luck}} +10 Luck up#Taking damage destroys the trinket"}, -- Perfection [146] = {"146", "Devil's Crown", "{{RedTreasureRoom}} Treasure Room items are replaced with devil deals"}, -- Devil's Crown - [147] = {"147", "Charged Penny", "{{Battery}} Picking up a coin has a 17% chance to add 1 charge to the active item"}, -- Charged Penny + [147] = {"147", "Charged Penny", "{{Battery}} Picking up a coin has a 17% chance to add 1 charge to the active item#Higher chance from nickels and dimes"}, -- Charged Penny [148] = {"148", "Friendship Necklace", "All familiars orbit around Isaac"}, -- Friendship Necklace [149] = {"149", "Panic Button", "Right before taking damage, uses the active item if it is charged"}, -- Panic Button [150] = {"150", "Blue Key", "Locked doors can be opened for free, but Isaac has to clear a room from the Hush floor before accessing the room behind them"}, -- Blue Key diff --git a/features/eid_conditionals.lua b/features/eid_conditionals.lua index f05d93d7..e1e5a46e 100644 --- a/features/eid_conditionals.lua +++ b/features/eid_conditionals.lua @@ -302,6 +302,7 @@ if EID.isRepentance then EID:AddSynergyConditional(720, 543, "White Poop Jar") EID:AddSynergyConditional(720, 202, "Golden Poop Jar") end +EID:AddConditional(483, EID.PlayersHaveGoldenBomb) -- AB+ only misc conditionals if not EID.isRepentance then diff --git a/features/eid_conditionals_funcs.lua b/features/eid_conditionals_funcs.lua index 8bc54a72..21acec80 100644 --- a/features/eid_conditionals_funcs.lua +++ b/features/eid_conditionals_funcs.lua @@ -275,6 +275,16 @@ function EID:ConditionalCharCheck(playerType, includeTainted) end end +function EID:PlayersHaveGoldenBomb() + for i = 0, game:GetNumPlayers() - 1 do + local player = Isaac.GetPlayer(i) + if player:HasGoldenBomb() then + return true + end + end + return false +end + function EID:IsGreedMode() return game:IsGreedMode() end diff --git a/features/eid_data.lua b/features/eid_data.lua index fface589..e537c558 100644 --- a/features/eid_data.lua +++ b/features/eid_data.lua @@ -745,6 +745,11 @@ EID.InlineColors = { ["BlinkBlue"] = function(_) return SwagColors({KColor(0.341, 0.529, 0.906, 1), KColor(0.592, 0.717, 0.937, 1)}) end, + -- Subtle glow between green from Luck Clover and from the Quality 1 shield + ["BlinkGreen"] = function(_) + local c = EID.InlineColors + return SwagColors({KColor(0.404, 0.663, 0.306, 1), KColor(0.443, 0.765, 0.247, 1)}) + end, -- Shiny purple color effect ["ColorShinyPurple"] = function(_) return SwagColors({KColor(0.812, 0.627, 1, 1), KColor(0.62, 0.251, 1, 1)}, 40) @@ -1027,6 +1032,14 @@ EID.blackFeatherItems = {[215]=true,[216]=true,[230]=true,[260]=true,[262]=true, if EID.isRepentance then EID.blackFeatherItems[654] = true end EID.blackFeatherTrinkets = {[17]=true,[22]=true} +-- Luck formulas +EID.LuckFormulas = {} +EID.LuckFormulas["5.100.219"] = function(luck) return math.min(100 / (10 - math.floor(luck*0.3)), 50) end -- Old Bandage: Base 10%, 50% at 26.67 Luck +if EID.isRepentance then + EID.LuckFormulas["5.100.219"] = function(luck) return (20 + luck) end -- Old Bandage: Base 20%, 100% at 80 Luck + EID.LuckFormulas["5.100.576"] = function(luck) return math.min(luck*0.5 + 6.25, 10) end -- Dirty Mind: Base 6.25%, 10% at 7.5 Luck +end + ---------------- BAG OF CRAFTING DATA ------------------ diff --git a/features/eid_holdmapdesc.lua b/features/eid_holdmapdesc.lua index 93ac40f0..dd842a3b 100644 --- a/features/eid_holdmapdesc.lua +++ b/features/eid_holdmapdesc.lua @@ -95,10 +95,7 @@ EID.ItemReminderDescriptionModifier = { modifierFunction = function(descObj, player) local zodiacItem = player:GetZodiacEffect() if zodiacItem > 0 then - local demoDescObj = EID:getDescriptionObj(5, 100, zodiacItem) - EID:ItemReminderAddResultHeaderSuffix(descObj, demoDescObj.Name) - descObj.Icon = demoDescObj.Icon - descObj.Description = demoDescObj.Description + descObj = EID:ItemReminderReplaceWithResult(descObj, zodiacItem) return true end end @@ -269,24 +266,25 @@ EID.ItemReminderDescriptionModifier = { end end }, + ["5.100.485"] = { -- Crooked Penny + isCheat = true, + modifierFunction = function(descObj, player, inOverview) + EID:ItemReminderAddResult(descObj, EID:CrookedPennyPrediction(EID:GetItemSeed(player, 485), player:HasCollectible(356)), inOverview) + return true + end + }, ["5.100.488"] = { -- Metronome isCheat = true, modifierFunction = function(descObj, player) local predictionItem = EID:MetronomePrediction(EID:GetItemSeed(player, 488)) - local demoDescObj = EID:getDescriptionObj(5, 100, predictionItem) - EID:ItemReminderAddResultHeaderSuffix(descObj, demoDescObj.Name) - descObj.Icon = demoDescObj.Icon - descObj.Description = demoDescObj.Description + descObj = EID:ItemReminderReplaceWithResult(descObj, predictionItem) return true end }, ["5.100.489"] = { -- D Infinity modifierFunction = function(descObj, player) local predictionItem = EID:CurrentDInfinity(EID:GetItemSeed(player, 489), player) - local demoDescObj = EID:getDescriptionObj(5, 100, predictionItem) - EID:ItemReminderAddResultHeaderSuffix(descObj, demoDescObj.Name) - descObj.Icon = demoDescObj.Icon - descObj.Description = demoDescObj.Description + descObj = EID:ItemReminderReplaceWithResult(descObj, predictionItem) return true end }, @@ -337,16 +335,23 @@ EID.ItemReminderDescriptionModifier = { end end }, + ["5.350.32"] = { -- Liberty Cap + isHiddenInfo = true, + modifierFunction = function(descObj, _) + local result = EID:LibertyCapPrediction(player) + if result then + descObj = EID:ItemReminderReplaceWithResult(descObj, result) + return true + end + end + }, ["5.350.64"] = { -- Rainbow Worm isHiddenInfo = true, modifierFunction = function(descObj, _) -- Rainbow Worm's trinket IDs it grants, in order local rainbowWormEffects = { [0] = 9, 11, 65, 27, 10, 12, 26, 66, 96, 144 } local trinketID = rainbowWormEffects[math.floor(game.TimeCounter / 30 / 3) % (EID.isRepentance and 10 or 8)] - local demoDescObj = EID:getDescriptionObj(5, 350, trinketID) - EID:ItemReminderAddResultHeaderSuffix(descObj, demoDescObj.Name) - descObj.Icon = demoDescObj.Icon - descObj.Description = demoDescObj.Description + descObj = EID:ItemReminderReplaceWithResult(descObj, trinketID, 350) return true end }, @@ -355,14 +360,30 @@ EID.ItemReminderDescriptionModifier = { modifierFunction = function(descObj, player) local seed = game:GetLevel():GetCurrentRoom():GetSpawnSeed() local result = EID:RNGNext(seed, 2, 7, 25) % (EID.isRepentance and 189 or 128) + 1 - - local demoDescObj = EID:getDescriptionObj(5, 350, result) - EID:ItemReminderAddResultHeaderSuffix(descObj, demoDescObj.Name) - descObj.Icon = demoDescObj.Icon - descObj.Description = demoDescObj.Description + descObj = EID:ItemReminderReplaceWithResult(descObj, result, 350) return true end }, + ["5.350.132"] = { -- Broken Syringe + isHiddenInfo = true, + modifierFunction = function(descObj, _) + local result = EID:BrokenSyringePrediction(player) + if result then + descObj = EID:ItemReminderReplaceWithResult(descObj, result) + return true + end + end + }, + ["5.350.153"] = { -- Mom's Lock + isHiddenInfo = true, + modifierFunction = function(descObj, _) + local result = EID:MomsLockPrediction(player) + if result then + descObj = EID:ItemReminderReplaceWithResult(descObj, result) + return true + end + end + }, ["5.350.166"] = { -- Modeling Clay isRepentance = true, modifierFunction = function(descObj, player) @@ -370,10 +391,7 @@ EID.ItemReminderDescriptionModifier = { if EID.Config["ItemReminderShowHiddenInfo"] or player:GetTrinket(0) == 166 or player:GetTrinket(1) == 166 then local modelingClayItem = player:GetModelingClayEffect() if modelingClayItem > 0 then - local demoDescObj = EID:getDescriptionObj(5, 100, modelingClayItem) - EID:ItemReminderAddResultHeaderSuffix(descObj, demoDescObj.Name) - descObj.Icon = "{{Collectible" .. modelingClayItem .. "}}" - descObj.Description = demoDescObj.Description + descObj = EID:ItemReminderReplaceWithResult(descObj, modelingClayItem) return true end end @@ -420,6 +438,14 @@ function EID:ItemReminderAddResult(descObj, newText, inOverview) EID:ItemReminderAddResultAppend(descObj, newText) end end +-- Helper function for modifiers like Modeling Clay / Liberty Cap that replace their description with the temporary item's description +function EID:ItemReminderReplaceWithResult(descObj, result, resultVariant) + local demoDescObj = EID:getDescriptionObj(5, resultVariant or 100, result) + EID:ItemReminderAddResultHeaderSuffix(descObj, demoDescObj.Name) + descObj.Icon = "{{" .. EID:GetIconNameByVariant(resultVariant or 100) .. result .. "}}" + descObj.Description = demoDescObj.Description + return true +end -- Add item description for a given entity to the reminder. Also tries to apply special modifiers if present function EID:ItemReminderAddDescription(player, entityType, variant, subType, extraIcon) diff --git a/features/eid_itemprediction.lua b/features/eid_itemprediction.lua index 8285ae9b..97be3407 100644 --- a/features/eid_itemprediction.lua +++ b/features/eid_itemprediction.lua @@ -1,10 +1,28 @@ -- This file is for various functions that are able to calculate the result effect that an item will have local game = Game() - local variantToName = { [70] = "Pill", [100] = "Collectible", [300] = "Card", [350] = "Trinket" } + +-- XOR table used for RNG: https://www.jstatsoft.org/article/view/v008i14/xorshift.pdf +local xortable = { +[0]={ 1, 3,10},{ 1, 5,16},{ 1, 5,19},{ 1, 9,29},{ 1,11, 6},{ 1,11,16},{ 1,19, 3},{ 1,21,20},{ 1,27,27}, + { 2, 5,15},{ 2, 5,21},{ 2, 7, 7},{ 2, 7, 9},{ 2, 7,25},{ 2, 9,15},{ 2,15,17},{ 2,15,25},{ 2,21, 9}, + { 3, 1,14},{ 3, 3,26},{ 3, 3,28},{ 3, 3,29},{ 3, 5,20},{ 3, 5,22},{ 3, 5,25},{ 3, 7,29},{ 3,13, 7}, + { 3,23,25},{ 3,25,24},{ 3,27,11},{ 4, 3,17},{ 4, 3,27},{ 4, 5,15},{ 5, 3,21},{ 5, 7,22},{ 5, 9,7 }, + { 5, 9,28},{ 5, 9,31},{ 5,13, 6},{ 5,15,17},{ 5,17,13},{ 5,21,12},{ 5,27, 8},{ 5,27,21},{ 5,27,25}, + { 5,27,28},{ 6, 1,11},{ 6, 3,17},{ 6,17, 9},{ 6,21, 7},{ 6,21,13},{ 7, 1, 9},{ 7, 1,18},{ 7, 1,25}, + { 7,13,25},{ 7,17,21},{ 7,25,12},{ 7,25,20},{ 8, 7,23},{ 8,9,23 },{ 9, 5,1 },{ 9, 5,25},{ 9,11,19}, + { 9,21,16},{10, 9,21},{10, 9,25},{11, 7,12},{11, 7,16},{11,17,13},{11,21,13},{12, 9,23},{13, 3,17}, + {13, 3,27},{13, 5,19},{13,17,15},{14, 1,15},{14,13,15},{15, 1,29},{17,15,20},{17,15,23},{17,15,26} +} + -- reimplementation of RNG:Next() --- Default RNG shift values for many things are 5, 9, 7 +-- Default RNG shift values for many things are 5, 9, 7 (xor table #35) function EID:RNGNext(rngNum, shift1, shift2, shift3) + if shift1 and not shift2 then + shift3 = xortable[shift1][3] + shift2 = xortable[shift1][2] + shift1 = xortable[shift1][1] + end rngNum = rngNum ~ ((rngNum >> (shift1 or 5)) & 4294967295) rngNum = rngNum ~ ((rngNum << (shift2 or 9)) & 4294967295) rngNum = rngNum ~ ((rngNum >> (shift3 or 7)) & 4294967295) @@ -17,6 +35,7 @@ function EID:SeedToFloat(seed) return seed * multi; end + -- D Infinity -- local dinfinityList = { [0] = 105, 166, 284, 283, 285, 406, 386 } -- Repentance's D Infinity order: D1, D4, D6, Eternal D6, D7, D8, D10, D12, D20, D100 @@ -396,3 +415,43 @@ function EID:GlyphOfBalancePrediction(player) return pickupNames[fullID] or EID:GetEntityXMLNameByString(fullID) or fullID end +--- Crooked Penny --- +function EID:CrookedPennyPrediction(rng, carBattery) + local rng = EID:RNGNext(rng) + local seed = rng + -- Repentance makes a new seed by XORing the room's decoration seed + if EID.isRepentance then + local roomSeed = game:GetLevel():GetCurrentRoom():GetDecorationSeed() + seed = seed ~ roomSeed + if seed == 0 then seed = 1 end + seed = EID:RNGNext(seed, 4) -- xorshift #4 + end + + local result = "" + if seed % 2 == 0 then + result = EID:getDescriptionEntry("CrookedPennyHeads") + else + result = EID:getDescriptionEntry("CrookedPennyTails") + -- failures advance crooked penny's RNG an additional time to give the pity penny a seed value + rng = EID:RNGNext(rng) + end + + if carBattery then return result .. "#{{Collectible356}} " .. EID:CrookedPennyPrediction(rng) + else return result end +end + +-- Liberty Cap, Broken Syringe, Mom's Lock (extremely similar, simple RNG modulos) -- +local libertyItems = {[0] = 21, 71, 120, 121} +if EID.isRepentance then libertyItems = {[0] = 12, 71, 120, 121, 342, 398} end +local syringeItems = {[0] = 13, 14, 240, 70, 143, 345, 493, 496} +local momItems = {[0] = 29, 30, 31, 55, 110, 114, 199, 200, 217, 228, 355, 508, 732} + +function EID:TemporaryEffectPrediction(player, rng, itemTable) + local tempItem = itemTable[rng % #itemTable] + if player:GetEffects():HasCollectibleEffect(tempItem) then return tempItem else return false end +end + +function EID:LibertyCapPrediction(player) return EID:TemporaryEffectPrediction(player, player:GetTrinketRNG(32):GetSeed(), libertyItems) end +function EID:BrokenSyringePrediction(player) return EID:TemporaryEffectPrediction(player, player:GetTrinketRNG(132):GetSeed(), syringeItems) end +function EID:MomsLockPrediction(player) return EID:TemporaryEffectPrediction(player, player:GetTrinketRNG(153):GetSeed(), momItems) end +-- dont forget to actually add these to hold map desc; remember these are Hidden Information diff --git a/features/eid_modifiers.lua b/features/eid_modifiers.lua index 2ca7497c..7b44457f 100644 --- a/features/eid_modifiers.lua +++ b/features/eid_modifiers.lua @@ -222,31 +222,36 @@ local function SacrificeRoomCallback(descObj) end -- Handle Black Feather dynamic damage up text --- TODO: Make this co-op friendly, add conditionals to the black feather items local function BlackFeatherCallback(descObj) - local itemCounter = 0 - for itemID, _ in pairs(EID.blackFeatherItems) do - itemCounter = itemCounter + EID.player:GetCollectibleNum(itemID) - end - for trinketID, _ in pairs(EID.blackFeatherTrinkets) do - if EID.isRepentance then - itemCounter = itemCounter + EID.player:GetTrinketMultiplier(trinketID) - else - if EID.player:HasTrinket(trinketID) then itemCounter = itemCounter + 1 end + for i = 1,#EID.coopAllPlayers do + local player = EID.coopAllPlayers[i] + local playerType = player:GetPlayerType() + + local itemCounter = 0 + for itemID, _ in pairs(EID.blackFeatherItems) do + itemCounter = itemCounter + player:GetCollectibleNum(itemID) end + for trinketID, _ in pairs(EID.blackFeatherTrinkets) do + if EID.isRepentance then + itemCounter = itemCounter + player:GetTrinketMultiplier(trinketID) + else + if player:HasTrinket(trinketID) then itemCounter = itemCounter + 1 end + end + end + + local hasBox = player:HasCollectible(439) + local isGolden = EID.isRepentance and ((descObj.ObjSubType & TrinketType.TRINKET_GOLDEN_FLAG) == TrinketType.TRINKET_GOLDEN_FLAG) + local base = EID.isRepentance and 0.5 or 0.2 + local damageMultiplied = base * itemCounter * (hasBox and 2 or 1) * (isGolden and 2 or 1) + local dmgColor = itemCounter == 0 and "CR" or (hasBox or isGolden) and "ColorGold" or "BlinkGray" + + local description = EID:getDescriptionEntry("BlackFeatherInformation") + description, _ = EID:ReplaceVariableStr(description, 1, tostring(itemCounter)) + description, _ = EID:ReplaceVariableStr(description, 2, "{{"..dmgColor.."}}"..damageMultiplied.."{{CR}}") + if #EID.coopAllPlayers > 1 then description = EID:GetPlayerIcon(playerType, "P" .. i .. ":") .. " " .. description end + + EID:appendToDescription(descObj, "# "..description) end - - local hasBox = EID.player:HasCollectible(439) - local isGolden = EID.isRepentance and ((descObj.ObjSubType & TrinketType.TRINKET_GOLDEN_FLAG) == TrinketType.TRINKET_GOLDEN_FLAG) - local base = EID.isRepentance and 0.5 or 0.2 - local damageMultiplied = base * itemCounter * (hasBox and 2 or 1) * (isGolden and 2 or 1) - local dmgColor = itemCounter == 0 and "CR" or (hasBox or isGolden) and "ColorGold" or "BlinkGray" - - local description = EID:getDescriptionEntry("BlackFeatherInformation") - description, _ = EID:ReplaceVariableStr(description, 1, tostring(itemCounter)) - description, _ = EID:ReplaceVariableStr(description, 2, "{{"..dmgColor.."}}"..damageMultiplied.."{{CR}}") - - EID:appendToDescription(descObj, "# "..description) return descObj end @@ -284,6 +289,26 @@ local function VurpCallback(descObj) return descObj end +-- Handle dynamic Luck chance modifiers +local function LuckChanceCallback(descObj) + for i = 1,#EID.coopAllPlayers do + local player = EID.coopAllPlayers[i] + if player.Luck ~= 0 then + local playerType = player:GetPlayerType() + + local result = math.max(math.min(EID.LuckFormulas[descObj.fullItemString](player.Luck), 100), 0) + local luckLine = EID:getDescriptionEntry("LuckModifier") + luckLine = EID:ReplaceVariableStr(luckLine, 1, string.format("%.3g", result)) + luckLine = EID:ReplaceVariableStr(luckLine, 2, "{{BlinkGreen}}" .. string.format("%.3g", player.Luck) .. "{{CR}}") + + if #EID.coopAllPlayers == 1 then EID:appendToDescription(descObj, "#{{Luck}} ") + else EID:appendToDescription(descObj, "#" .. EID:GetPlayerIcon(playerType, "P" .. i .. ":") .. " ") end + EID:appendToDescription(descObj, "{{NoLB}}" .. luckLine) + end + end + return descObj +end + if EID.isRepentance then -- Handle Birthright local function BirthrightCallback(descObj) @@ -304,21 +329,21 @@ if EID.isRepentance then return descObj end - -- Handle Glowing Hourglass changed back into Hourglass description - local function GlowingHourglassCallback(descObj) - if REPENTOGON and EID.collectiblesOwned[422] then - local transformedText = EID:getDescriptionEntry("GlowingHourglassTransformed") - local numUses = Isaac.GetPlayer(EID.collectiblesOwned[422]):GetActiveItemDesc().VarData - if numUses == 3 then - -- Replace with the description of The Hourglass - descObj.Description = EID:getDescriptionObj(5, 100, 66).Description - if transformedText ~= nil then - EID:appendToDescription(descObj, "#{{Warning}} "..transformedText) - end - end - end - return descObj - end + -- Handle Glowing Hourglass changed back into Hourglass description + local function GlowingHourglassCallback(descObj) + if REPENTOGON and EID.collectiblesOwned[422] then + local transformedText = EID:getDescriptionEntry("GlowingHourglassTransformed") + local numUses = Isaac.GetPlayer(EID.collectiblesOwned[422]):GetActiveItemDesc().VarData + if numUses == 3 then + -- Replace with the description of The Hourglass + descObj.Description = EID:getDescriptionObj(5, 100, 66).Description + if transformedText ~= nil then + EID:appendToDescription(descObj, "#{{Warning}} "..transformedText) + end + end + end + return descObj + end -- Handle Book of Virtues description addition local function BookOfVirtuesCallback(descObj) @@ -872,6 +897,7 @@ local function EIDConditionsAB(descObj) local callbacks = {} + if EID.LuckFormulas[descObj.fullItemString] then table.insert(callbacks, LuckChanceCallback) end -- Collectible Pedestal Callbacks if descObj.ObjVariant == PickupVariant.PICKUP_COLLECTIBLE then if EID.Config["ItemCollectionIndicator"] and EID:requiredForCollectionPage(descObj.ObjSubType) then table.insert(callbacks, ItemCollectionPageCallback) end