Health Up modifier for non-red characters + misc (#710)
* Health up / different effect modifiers
* ClosestPlayerTo, move utility functions
* ClosestPlayer adds to DifferentEffectPlayers table
* More data tables for Health Ups
* useless Lost items, comment the health mod atm
* HealingRed, RedToX
* HealingRed added
* Moving Pluralize
* oops
* Move Pluralize
* Move Pluralize
* allow choosing the position of modifiers in the table
* default layer to 0
* Changes to no red char conditions
* Support healing items in the modifier
* tweaks to health up data
* Support {1} in Result Header
* {1} in ResultHeader
* Tweak binge eater wording
* reword comment
This commit is contained in:
1 parent
9d8a2ae730
commit
e271302f69
29 files changed
+355
-230
No files matched your search
+39
-2
@@ -1167,7 +1167,8 @@ end
|
||||
|
||||
-- Adds Description object modifiers.
|
||||
-- Used for altering descriptions. Example: Spindown dice, Tarot Cloth, ...
|
||||
function EID:addDescriptionModifier(modifierName, condition, callback)
|
||||
function EID:addDescriptionModifier(modifierName, condition, callback, position)
|
||||
position = position or #EID.DescModifiers + 1
|
||||
for _,v in ipairs(EID.DescModifiers) do
|
||||
if v["name"] == modifierName then
|
||||
v["condition"] = condition
|
||||
@@ -1175,7 +1176,7 @@ function EID:addDescriptionModifier(modifierName, condition, callback)
|
||||
return
|
||||
end
|
||||
end
|
||||
table.insert(EID.DescModifiers, {
|
||||
table.insert(EID.DescModifiers, position, {
|
||||
name = modifierName,
|
||||
condition = condition,
|
||||
callback = callback
|
||||
@@ -2411,6 +2412,21 @@ function EID:CopyTable(orig)
|
||||
end
|
||||
return copy
|
||||
end
|
||||
-- super simple table concatenation: https://www.tutorialspoint.com/concatenation-of-tables-in-lua-programming
|
||||
function EID:ConcatTables(t1, t2)
|
||||
for i = 1, #t2 do
|
||||
t1[#t1 + 1] = t2[i]
|
||||
end
|
||||
return t1
|
||||
end
|
||||
|
||||
-- thing to fix find/replace pairs with hyphens (like "1-2") or pluses (like +1 Health) breaking because of special characters
|
||||
-- https://stackoverflow.com/questions/29072601/lua-string-gsub-with-a-hyphen
|
||||
function EID:SimpleReplace(str, what, with, count)
|
||||
what = string.gsub(what, "[%(%)%.%+%-%*%?%[%]%^%$%%]", "%%%1") -- escape pattern
|
||||
with = string.gsub(with, "[%%]", "%%%%") -- escape replacement
|
||||
return string.gsub(str, what, with, count)
|
||||
end
|
||||
|
||||
-- simple decimal rounding, instead of just floor or ceil
|
||||
function EID:SimpleRound(num, dp)
|
||||
@@ -2425,3 +2441,24 @@ function EID:ArrayContains(t, value)
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
-- Find the closest player to the given entity
|
||||
function EID:ClosestPlayerTo(entity)
|
||||
local closestDist = 9999999
|
||||
local closestPlayer = EID.player
|
||||
local numPlayers = game:GetNumPlayers()
|
||||
if EID.InsideItemReminder then return EID.ItemReminderPlayerEntity end
|
||||
if entity == nil or numPlayers == 1 then return closestPlayer end
|
||||
|
||||
for i = 1, #EID.coopAllPlayers do
|
||||
local player = EID.coopAllPlayers[i]
|
||||
local dist = player.Position:Distance(entity.Position)
|
||||
if dist < closestDist then
|
||||
closestDist = dist
|
||||
closestPlayer = player
|
||||
end
|
||||
end
|
||||
|
||||
return closestPlayer
|
||||
end
|
||||
@@ -1,8 +1,11 @@
|
||||
local game = Game()
|
||||
|
||||
EID.DescriptionConditions = {}
|
||||
-- table of collectible IDs to periodically check if the players own. used by eid_modifiers.lua
|
||||
-- table of collectible IDs to periodically check if the players own. used by eid_modifiers.lua too
|
||||
EID.collectiblesToCheck = {}
|
||||
-- co-op players that have a substantially different effect than the closest player are tracked in this table, to append "Different effect for X"
|
||||
-- added to and applied by eid_modifiers.lua
|
||||
EID.DifferentEffectPlayers = {}
|
||||
|
||||
require("features.eid_conditionals_funcs")
|
||||
|
||||
@@ -51,6 +54,7 @@ if EID.isRepentance then
|
||||
EID:AddItemConditional("5.100", 706, nil, { locTable = "abyssSynergies", lineColor = "ColorRed" }, false) -- Abyss (no item reminder)
|
||||
EID:AddItemConditional("5.100", 59, nil, { locTable = "bookOfBelialBuffs" }) -- Belial Birthright
|
||||
EID:AddItemConditional("5.100", 664, nil, { locTable = "bingeEaterBuffs" }) -- Binge Eater
|
||||
EID:AddItemConditional({22, 23, 24, 25, 26, 346, 456, 707}, 664, "Binge Eater Healing") -- Binge Eater (Heals 2 hearts)
|
||||
end
|
||||
|
||||
|
||||
@@ -79,32 +83,30 @@ EID:AddConditional("5.350.23", function() return EID:HaveNotUnlockedAchievement(
|
||||
EID:AddConditional(297, function() return not EID:HaveNotUnlockedAchievement(366) end) -- Pandora's Box unlocking Moving Box
|
||||
|
||||
|
||||
local SoulBlackChars = EID:ConcatTables(EID.SpecialHeartPlayers["Soul"],EID.SpecialHeartPlayers["Black"])
|
||||
------ NO RED HEALTH PLAYERS ------
|
||||
EID:AddConditional({442, "5.350.107", "5.350.119"}, EID.CheckForNoRedHealthPlayer, "No Red") -- Dark Prince's Crown, Crow Heart, Stem Cell
|
||||
EID:AddClosestPlayerConditional({442, "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
|
||||
EID:AddConditional(81, EID.CheckForNoRedHealthPlayer) -- Dead Cat
|
||||
if EID.isRepentance then
|
||||
EID:AddConditional({569, 671, 676}, EID.CheckForNoRedHealthPlayer, "No Red") -- Blood Oath, Candy Heart, Empty Heart
|
||||
EID:AddPlayerConditional({671, 676}, 14, "No Effect") -- Candy Heart / Empty Heart + Keeper
|
||||
EID:AddPlayerConditional(676, 16, "No Effect", nil, false) -- Empty Heart + Forgotten (not Tainted)
|
||||
EID:AddClosestPlayerConditional({569, 671, 676}, SoulBlackChars, "No Effect Replace", nil, false) -- Blood Oath, Candy Heart, Empty Heart
|
||||
EID:AddClosestPlayerConditional({671, 676}, 14, "No Effect Replace") -- Candy Heart / Empty Heart + Keeper
|
||||
EID:AddClosestPlayerConditional(676, 16, "No Effect Replace", nil, 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)
|
||||
EID:AddClosestPlayerConditional("5.350.156", {16, 17}, "Mother's Kiss Bone", {layer = -1}, false) -- Mother's Kiss + Forgotten (including The Soul)
|
||||
end
|
||||
|
||||
for heartName, chars in pairs(EID.SpecialHeartPlayers) do
|
||||
local c = {}
|
||||
for charID,_ in pairs(chars) do table.insert(c, charID) end -- convert the lookup table into an array
|
||||
for itemID, hearts in pairs(EID.HealthUpData) do
|
||||
if itemID == 92 and (heartName == "Soul" or heartName == "Black") then
|
||||
EID:AddClosestPlayerConditional(92, c, "Super Bandage " .. heartName, nil, false)
|
||||
elseif itemID == 226 and (heartName == "Soul" or heartName == "Black") then
|
||||
EID:AddClosestPlayerConditional(226, c, "Black Lotus " .. heartName, nil, false)
|
||||
else
|
||||
EID:AddClosestPlayerConditional(itemID, c, "Red to " .. heartName, nil, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
EID:AddClosestPlayerConditional(92, EID.SpecialHeartPlayers["Soul"], "Super Bandage Soul", nil, false)
|
||||
EID:AddClosestPlayerConditional(92, EID.SpecialHeartPlayers["Black"], "Super Bandage Black", nil, false)
|
||||
EID:AddClosestPlayerConditional(226, EID.SpecialHeartPlayers["Soul"], "Black Lotus Soul", nil, false)
|
||||
EID:AddClosestPlayerConditional(226, EID.SpecialHeartPlayers["Black"], "Black Lotus Black", nil, false)
|
||||
|
||||
if EID.isRepentance then
|
||||
for itemID,charges in pairs(EID.BloodUpData) do
|
||||
EID:AddPlayerConditional(itemID, 36, "Health Up Blood Charges", {variableText = charges})
|
||||
end
|
||||
-- todo: some blood ups (cards with tarot cloth) should be increased
|
||||
end
|
||||
|
||||
|
||||
@@ -117,6 +119,12 @@ EID:AddPlayerConditional(501, 14) -- Keeper + Greed's Gullet
|
||||
EID:AddPlayerConditional(230, 14, "Keeper") -- Keeper + Abaddon
|
||||
EID:AddPlayerConditional(152, 2, "Technology 2 One Eye") -- Cain + Technology 2
|
||||
EID:AddPlayerConditional(122, 5, nil, nil, false) -- Eve + Whore of Babylon
|
||||
|
||||
EID:AddClosestPlayerConditional({15, 16, 20, 22, 23, 24, 25, 26, 45, 60, 92, 142, 159, 173, 179, 184, 185, 218, 226, 312, 334, 346, 428, 456, 487, 501, "5.350.14", "5.350.46", "5.350.55", "5.350.56", "5.350.107", "5.350.128"}, 10, "No Effect Replace", {layer = 10000}) -- Useless Lost items
|
||||
if EID.isRepentance then
|
||||
EID:AddClosestPlayerConditional({569, 671, 676, 707, "5.350.156", "5.350.168"}, 10, "No Effect Replace", {layer = 10000}) -- Useless Lost items
|
||||
end
|
||||
|
||||
if EID.isRepentance then
|
||||
-- Tainted characters reviving as themselves
|
||||
EID:AddPlayerConditional({ 161, "5.350.28" }, 25, "Tainted Revive") -- Ankh, Broken Ankh
|
||||
@@ -133,7 +141,6 @@ if EID.isRepentance then
|
||||
EID:AddClosestPlayerConditional(642, 10) -- Lost + Magic Skin
|
||||
EID:AddPlayerConditional(694, 14, "Keeper", nil, false) -- Keeper + Heartbreak
|
||||
EID:AddPlayerConditional(694, 33, "Tainted Keeper") -- Tainted Keeper + Heartbreak
|
||||
EID:AddPlayerConditional("5.350.156", 14) -- Keeper + Mother's Kiss
|
||||
EID:AddPlayerConditional(230, 18, "Bethany", nil, false) -- Bethany + Abaddon
|
||||
EID:AddPlayerConditional(230, 36, "Tainted Bethany") -- Tainted Bethany + Abaddon
|
||||
EID:AddPlayerConditional(245, 14, "Keeper") -- 20/20 + Keeper
|
||||
|
||||
@@ -161,7 +161,7 @@ end
|
||||
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}
|
||||
useResult: If true, use the result from the conditional function to find the localization string
|
||||
layer: A number used in determining the order that conditionals should be checked in, default -1
|
||||
layer: A number used in determining the order that conditionals should be checked in, default 0
|
||||
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
|
||||
]]
|
||||
@@ -175,7 +175,7 @@ function EID:AddConditional(IDs, funcText, modText, extraTable)
|
||||
if modText == "" then modText = nil end
|
||||
extraTable = extraTable or {}
|
||||
if extraTable.noFallback == nil then extraTable.noFallback = true end
|
||||
extraTable.layer = extraTable.layer or -1
|
||||
extraTable.layer = extraTable.layer or 0
|
||||
for _, id in ipairs(IDs) do
|
||||
if type(id) ~= "string" then id = "5.100." .. id end
|
||||
EID.DescriptionConditions[id] = EID.DescriptionConditions[id] or {}
|
||||
@@ -288,25 +288,33 @@ end
|
||||
function EID:ClosestCharCheck(modifierText, playerTypes, includeTainted)
|
||||
if EID.InsideItemReminder or not EID.CurrentConditionalDescObj.Entity then return modifierText end
|
||||
if type(playerTypes) ~= "table" then playerTypes = {playerTypes} end
|
||||
local closestDist = 9999999
|
||||
local closestPlayer = EID.player
|
||||
|
||||
for i = 0, game:GetNumPlayers() - 1 do
|
||||
local player = Isaac.GetPlayer(i)
|
||||
local dist = player.Position:Distance(EID.CurrentConditionalDescObj.Entity.Position)
|
||||
if dist < closestDist then
|
||||
closestDist = dist
|
||||
closestPlayer = player
|
||||
local closestPlayer = EID:ClosestPlayerTo(EID.CurrentConditionalDescObj.Entity)
|
||||
|
||||
if EID:ArrayContains(playerTypes, closestPlayer:GetPlayerType()) or (includeTainted and EID:ArrayContains(playerTypes, EID.TaintedToRegularID[closestPlayer:GetPlayerType()])) then
|
||||
-- The closest player applies the modifier; check for players that don't get this modifier
|
||||
for i = 1, #EID.coopAllPlayers do
|
||||
local t = EID.coopAllPlayers[i]:GetPlayerType()
|
||||
if not (EID:ArrayContains(playerTypes, t) or (includeTainted and EID:ArrayContains(playerTypes, EID.TaintedToRegularID[t]))) then
|
||||
table.insert(EID.DifferentEffectPlayers, t)
|
||||
end
|
||||
end
|
||||
return modifierText
|
||||
end
|
||||
|
||||
if EID:ArrayContains(playerTypes, closestPlayer:GetPlayerType()) or (includeTainted and EID:ArrayContains(playerTypes, EID.TaintedToRegularID[closestPlayer:GetPlayerType()])) then return modifierText end
|
||||
return "Different Effect"
|
||||
-- The closest player does not apply the modifier; check for players that do get this modifier
|
||||
for i = 1, #EID.coopAllPlayers do
|
||||
local t = EID.coopAllPlayers[i]:GetPlayerType()
|
||||
if EID:ArrayContains(playerTypes, t) or (includeTainted and EID:ArrayContains(playerTypes, EID.TaintedToRegularID[t])) then
|
||||
table.insert(EID.DifferentEffectPlayers, t)
|
||||
end
|
||||
end
|
||||
return "N/A"
|
||||
end
|
||||
|
||||
function EID:PlayersHaveGoldenBomb()
|
||||
for i = 0, game:GetNumPlayers() - 1 do
|
||||
local player = Isaac.GetPlayer(i)
|
||||
for i = 1, #EID.coopAllPlayers do
|
||||
local player = EID.coopAllPlayers[i]
|
||||
if player:HasGoldenBomb() then
|
||||
return true
|
||||
end
|
||||
@@ -349,8 +357,8 @@ function EID:CheckForNoRedHealthPlayer()
|
||||
local player = EID.ItemReminderPlayerEntity
|
||||
return EID.NoRedHeartsPlayerIDs[player:GetPlayerType()]
|
||||
else
|
||||
for i = 0, game:GetNumPlayers() - 1 do
|
||||
local player = Isaac.GetPlayer(i)
|
||||
for i = 1, #EID.coopAllPlayers do
|
||||
local player = EID.coopAllPlayers[i]
|
||||
if EID.NoRedHeartsPlayerIDs[player:GetPlayerType()] then
|
||||
return true
|
||||
end
|
||||
@@ -364,8 +372,8 @@ function EID:CheckForTaintedPlayer()
|
||||
local player = EID.ItemReminderPlayerEntity
|
||||
return EID.TaintedIDs[player:GetPlayerType()]
|
||||
else
|
||||
for i = 0, game:GetNumPlayers() - 1 do
|
||||
local player = Isaac.GetPlayer(i)
|
||||
for i = 1, #EID.coopAllPlayers do
|
||||
local player = EID.coopAllPlayers[i]
|
||||
if EID.TaintedIDs[player:GetPlayerType()] then
|
||||
return true
|
||||
end
|
||||
@@ -382,8 +390,8 @@ function EID:CheckForMultipleActives(descObj, onlyChargeablePockets)
|
||||
local id = player:GetPlayerType()
|
||||
if EID.isRepentance and (EID.PocketActivePlayerIDs[id] == 0 or (not onlyChargeablePockets and EID.PocketActivePlayerIDs[id])) then return player:GetActiveItem(2) end
|
||||
else
|
||||
for i = 0, game:GetNumPlayers() - 1 do
|
||||
local player = Isaac.GetPlayer(i)
|
||||
for i = 1, #EID.coopAllPlayers do
|
||||
local player = EID.coopAllPlayers[i]
|
||||
if player:HasCollectible(534) then return 534 end
|
||||
local id = player:GetPlayerType()
|
||||
if EID.isRepentance and (EID.PocketActivePlayerIDs[id] == 0 or (not onlyChargeablePockets and EID.PocketActivePlayerIDs[id])) then return player:GetActiveItem(2) end
|
||||
@@ -401,8 +409,8 @@ function EID:CheckForPocketActives()
|
||||
local player = EID.ItemReminderPlayerEntity
|
||||
return EID.PocketActivePlayerIDs[player:GetPlayerType()]
|
||||
else
|
||||
for i = 0, game:GetNumPlayers() - 1 do
|
||||
local player = Isaac.GetPlayer(i)
|
||||
for i = 1, #EID.coopAllPlayers do
|
||||
local player = EID.coopAllPlayers[i]
|
||||
if EID.PocketActivePlayerIDs[player:GetPlayerType()] then return true end
|
||||
end
|
||||
end
|
||||
@@ -473,9 +481,7 @@ function EID:CheckPlayersForActiveChargeType(maxCharge, chargeType, checkPockets
|
||||
if EID.InsideItemReminder then
|
||||
players[1] = EID:ItemReminderGetAllPlayers()[EID.ItemReminderSelectedPlayer + 1] or EID.player
|
||||
else
|
||||
for i = 0, game:GetNumPlayers() - 1 do
|
||||
table.insert(players, Isaac.GetPlayer(i))
|
||||
end
|
||||
players = EID.coopAllPlayers
|
||||
end
|
||||
local maxSlot = EID.isRepentance and 1 or 0
|
||||
if EID.isRepentance and checkPockets then maxSlot = 3 end
|
||||
@@ -506,9 +512,9 @@ function EID:CheckActiveChargeType(itemID, maxCharge, chargeType, requiredCollec
|
||||
return false
|
||||
end
|
||||
|
||||
-- Check for multiple players existing for items like Yum Heart and Extension Cord, includes J&E (but does it include Forgotten?)
|
||||
-- Check for multiple players existing for items like Yum Heart and Extension Cord, includes J&E and Strawmen
|
||||
function EID:MultiplePlayerCharacters()
|
||||
return #EID.coopAllPlayers > 1
|
||||
return game:GetNumPlayers() > 1
|
||||
end
|
||||
|
||||
-- Check the bestiary/character list if we have REPENTOGON, to help avoid spoilers. Otherwise just return true
|
||||
@@ -535,24 +541,10 @@ end
|
||||
|
||||
----- Apply Conditionals -----
|
||||
|
||||
-- thing to fix find/replace pairs with hyphens (like "1-2") breaking because hyphen is a special char
|
||||
-- https://stackoverflow.com/questions/29072601/lua-string-gsub-with-a-hyphen
|
||||
local function replace(str, what, with, count)
|
||||
what = string.gsub(what, "[%(%)%.%+%-%*%?%[%]%^%$%%]", "%%%1") -- escape pattern
|
||||
with = string.gsub(with, "[%%]", "%%%%") -- escape replacement
|
||||
return string.gsub(str, what, with, count)
|
||||
end
|
||||
EID.testReplace = replace
|
||||
-- super simple table concatenation: https://www.tutorialspoint.com/concatenation-of-tables-in-lua-programming
|
||||
local function TableConcat(t1, t2)
|
||||
for i = 1, #t2 do
|
||||
t1[#t1 + 1] = t2[i]
|
||||
end
|
||||
return t1
|
||||
end
|
||||
EID.CurrentConditionalDescObj = nil
|
||||
function EID:applyConditionals(descObj)
|
||||
EID.CurrentConditionalDescObj = descObj
|
||||
EID.DifferentEffectPlayers = {}
|
||||
EID:CheckPlayersCollectibles()
|
||||
local adjustedSubtype = EID:getAdjustedSubtype(descObj.ObjType, descObj.ObjVariant, descObj.ObjSubType)
|
||||
local typeVar = descObj.ObjType.."."..descObj.ObjVariant -- for general conditions (Tarot Cloth, Book of Virtues)
|
||||
@@ -562,8 +554,8 @@ function EID:applyConditionals(descObj)
|
||||
|
||||
-- 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
|
||||
if EID.DescriptionConditions[typeVarSub] then EID:ConcatTables(conds, EID.DescriptionConditions[typeVarSub]) end
|
||||
if EID.DescriptionConditions[typeVar] then EID:ConcatTables(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
|
||||
@@ -616,7 +608,7 @@ function EID:applyConditionals(descObj)
|
||||
-- Table with 1 entry = replace
|
||||
elseif #text == 1 then
|
||||
descObj.Description = EID:ReplaceVariableStr(text[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
|
||||
@@ -636,9 +628,9 @@ function EID:applyConditionals(descObj)
|
||||
return replaceWith
|
||||
end
|
||||
end)
|
||||
-- Basic find+replace for non-numbers
|
||||
-- Basic find+replace for non-numbers
|
||||
else
|
||||
descObj.Description = replace(descObj.Description, tostring(toFind), replaceWith, 1)
|
||||
descObj.Description = EID:SimpleReplace(descObj.Description, tostring(toFind), replaceWith, 1)
|
||||
end
|
||||
else
|
||||
toFind = EID:ReplaceVariableStr(toFind, variableText)
|
||||
|
||||
+24
-13
@@ -1028,18 +1028,25 @@ EID.TaintedIDs = {}; for i = 21, 40 do EID.TaintedIDs[i] = true end
|
||||
EID.NoRedHeartsPlayerIDs = { [4] = true, [10] = true, [17] = true }
|
||||
-- More separated table for more exact data
|
||||
EID.SpecialHeartPlayers = {}
|
||||
EID.SpecialHeartPlayers["Soul"] = { [4] = true, [17] = true }
|
||||
EID.SpecialHeartPlayers["Soul"] = { 4, 17 }
|
||||
EID.SpecialHeartPlayers["Black"] = {}
|
||||
EID.SpecialHeartPlayers["Coin"] = { [14] = true }
|
||||
EID.SpecialHeartPlayers["Bone"] = { [16] = true }
|
||||
EID.SpecialHeartPlayers["None"] = { [10] = true }
|
||||
EID.SpecialHeartPlayers["Coin"] = { 14 }
|
||||
EID.SpecialHeartPlayers["Bone"] = { 16 }
|
||||
EID.SpecialHeartPlayers["None"] = { 10 }
|
||||
-- Lookup table for the type of health each player has
|
||||
EID.CharacterToHeartType = {}; for i = 0, 17 do EID.CharacterToHeartType[i] = "Red" end
|
||||
EID.CharacterToHeartType[4] = "Soul"; EID.CharacterToHeartType[10] = "None"; EID.CharacterToHeartType[14] = "Coin"; EID.CharacterToHeartType[16] = "Bone"; EID.CharacterToHeartType[17] = "Soul"
|
||||
|
||||
if EID.isRepentance then
|
||||
-- ???, The Lost, Black Judas, The Soul, Tainted Judas, Tainted ???, Tainted Lost, Tainted Forgotten, Tainted Bethany, Tainted Soul
|
||||
EID.NoRedHeartsPlayerIDs = { [4] = true, [10] = true, [12] = true, [17] = true, [24] = true, [25] = true, [31] = true, [35] = true, [36] = true, [40] = true }
|
||||
EID.SpecialHeartPlayers["Soul"] = { [4] = true, [17] = true, [25] = true, [35] = true, [36] = true, [40] = true }
|
||||
EID.SpecialHeartPlayers["Black"] = { [12] = true, [24] = true }
|
||||
EID.SpecialHeartPlayers["Coin"][33] = true
|
||||
EID.SpecialHeartPlayers["None"][31] = true
|
||||
EID.SpecialHeartPlayers["Soul"] = { 4, 17, 25, 35, 36, 40 }
|
||||
EID.SpecialHeartPlayers["Black"] = { 12, 24 }
|
||||
EID.SpecialHeartPlayers["Coin"] = { 14, 33 }
|
||||
EID.SpecialHeartPlayers["None"] = { 10, 31 }
|
||||
|
||||
for i = 18, 40 do EID.CharacterToHeartType[i] = "Red" end
|
||||
EID.CharacterToHeartType[12] = "Black"; EID.CharacterToHeartType[24] = "Black"; EID.CharacterToHeartType[25] = "Soul"; EID.CharacterToHeartType[31] = "None"; EID.CharacterToHeartType[33] = "Coin"; EID.CharacterToHeartType[35] = "Soul"; EID.CharacterToHeartType[36] = "Soul"; EID.CharacterToHeartType[40] = "Soul";
|
||||
end
|
||||
|
||||
-- Character IDs that have a pocket active (0 = normal, 1 = timed, 2 = special)
|
||||
@@ -1063,14 +1070,18 @@ if EID.isRepentance then
|
||||
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
|
||||
|
||||
-- Number of Soul Hearts a character will get from a Health Up item
|
||||
-- Number of Health Ups you get from a Health Up item
|
||||
-- (Pill ID is off by 1 because of EID one-indexed pill effects)
|
||||
EID.HealthUpData = {["5.70.8"] = 1, ["5.70.10"] = 1, [12] = 1, [15] = 1, [16] = 2, [22] = 1, [23] = 1, [24] = 1, [25] = 1, [26] = 1, [92] = 1, [101] = 1, [119] = 1, [121] = 1, [129] = 2, [138] = 1, [176] = 1, [182] = 1, [184] = 1, [189] = 1, [193] = 1, [218] = 1, [219] = 1, [226] = 1, [253] = 1, [307] = 1, [312] = 1, [314] = 1, [334] = 3, [342] = 1, [346] = 1, [354] = 1, [456] = 1 }
|
||||
EID.HealthUpData = {["5.70.8"] = 1, ["5.70.10"] = 1, ["5.100.12"] = 1, ["5.100.15"] = 1, ["5.100.16"] = 2, ["5.100.22"] = 1, ["5.100.23"] = 1, ["5.100.24"] = 1, ["5.100.25"] = 1, ["5.100.26"] = 1, ["5.100.92"] = 1, ["5.100.101"] = 1, ["5.100.119"] = 1, ["5.100.121"] = 1, ["5.100.129"] = 2, ["5.100.138"] = 1, ["5.100.176"] = 1, ["5.100.182"] = 1, ["5.100.184"] = 1, ["5.100.189"] = 1, ["5.100.193"] = 1, ["5.100.218"] = 1, ["5.100.219"] = 1, ["5.100.226"] = 1, ["5.100.253"] = 1, ["5.100.307"] = 1, ["5.100.312"] = 1, ["5.100.314"] = 1, ["5.100.334"] = 3, ["5.100.342"] = 1, ["5.100.346"] = 1, ["5.100.354"] = 1, ["5.100.456"] = 1, ["5.300.12"] = 1 }
|
||||
-- Items with a healing effect that can have the healing line removed for non-red HP characters
|
||||
-- Pyromaniac skipped, its healing line says how it prevents explosion damage
|
||||
EID.HealingItemData = {["5.100.45"] = true, ["5.100.62"] = true, ["5.100.75"] = true, ["5.100.93"] = true, ["5.100.217"] = true, ["5.100.270"] = true, ["5.100.428"] = true, ["5.350.8"] = true, ["5.350.46"] = true, ["5.350.53"] = true, ["5.350.87"] = true, ["5.350.119"] = true, ["5.300.20"] = true, ["5.300.26"] = true, ["5.70.6"] = true, ["5.70.37"] = true }
|
||||
if EID.isRepentance then
|
||||
EID.HealthUpData["5.350.156"] = 1; EID.HealthUpData[573] = 1; EID.HealthUpData[591] = 1; EID.HealthUpData[594] = 2
|
||||
EID.HealthUpData[614] = 1; EID.HealthUpData[664] = 1; EID.HealthUpData[669] = 1; EID.HealthUpData[707] = 1
|
||||
EID.HealthUpData["5.100.573"] = 1; EID.HealthUpData["5.100.591"] = 1; EID.HealthUpData["5.100.594"] = 2; EID.HealthUpData["5.300.59"] = 2
|
||||
EID.HealthUpData["5.100.614"] = 1; EID.HealthUpData["5.100.664"] = 1; EID.HealthUpData["5.100.669"] = 1; EID.HealthUpData["5.100.707"] = 1
|
||||
EID.HealingItemData["5.100.621"] = true; EID.HealingItemData["5.70.46"] = true;
|
||||
|
||||
EID.BloodUpData = {["5.70.10"] = 2, ["5.350.156"] = 2, ["5.300.12"] = 2, ["5.300.59"] = 4, [12] = 12, [15] = 12, [16] = 12, [22] = 4, [23] = 4, [24] = 4, [25] = 4, [26] = 4, [75] = 4, [92] = 4, [101] = 4, [119] = 10, [121] = 2, [129] = 4, [138] = 4, [176] = 4, [182] = 12, [184] = 4, [189] = 12, [193] = 4, [218] = 4, [226] = 4, [253] = 4, [307] = 4, [312] = 4, [314] = 4, [334] = 6, [342] = 4, [346] = 4, [354] = 4, [428] = 12, [456] = 4, [573] = 12, [591] = 4, [594] = 1, [614] = 10, [621] = 12, [664] = 12, [669] = 12, [707] = 4 }
|
||||
EID.BloodUpData = {["5.70.10"] = 2, ["5.350.156"] = 2, ["5.300.12"] = 2, ["5.300.59"] = 4, [12] = 12, [15] = 12, [16] = 12, [22] = 4, [23] = 4, [24] = 4, [25] = 4, [26] = 4, [75] = 4, [92] = 4, [101] = 4, [119] = 10, [121] = 2, [129] = 4, [138] = 4, [176] = 4, [182] = 12, [184] = 4, [189] = 12, [193] = 4, [217] = 2, [218] = 4, [226] = 4, [253] = 4, [307] = 4, [312] = 4, [314] = 4, [334] = 6, [342] = 4, [346] = 4, [354] = 4, [428] = 12, [456] = 4, [535] = 2, [573] = 12, [591] = 4, [594] = 1, [614] = 10, [621] = 12, [664] = 12, [669] = 12, [707] = 4 }
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -424,18 +424,22 @@ end
|
||||
|
||||
-- Adds a formatted "Result" text to the item name
|
||||
function EID:ItemReminderAddResultHeaderSuffix(descObj, newName)
|
||||
local resultHeader = EID:getDescriptionEntry("ItemReminder", "ResultHeader")
|
||||
if not string.find(resultHeader, "{1}") then resultHeader = "{1}" .. resultHeader end
|
||||
if newName then
|
||||
local iconString = EID:GetIconStringByDescriptionObject(descObj)
|
||||
descObj.Name = newName ..
|
||||
" (" .. iconString .. " " .. descObj.Name .. EID:getDescriptionEntry("ItemReminder", "ResultHeader") .. ")"
|
||||
" (" .. iconString .. " " .. EID:ReplaceVariableStr(resultHeader, descObj.Name) .. ")"
|
||||
else
|
||||
descObj.Name = descObj.Name .. EID:getDescriptionEntry("ItemReminder", "ResultHeader")
|
||||
descObj.Name = descObj.Name .. EID:ReplaceVariableStr(resultHeader, descObj.Name)
|
||||
end
|
||||
end
|
||||
-- Adds a formatted "Result" text appended to the item description
|
||||
function EID:ItemReminderAddResultAppend(descObj, newText)
|
||||
local iconString = EID:GetIconStringByDescriptionObject(descObj)
|
||||
descObj.Description = descObj.Description .. "#" .. iconString .. " {{ColorObjName}}" .. descObj.Name .. EID:getDescriptionEntry("ItemReminder", "ResultHeader") .. "#" .. newText
|
||||
local resultHeader = EID:getDescriptionEntry("ItemReminder", "ResultHeader")
|
||||
if not string.find(resultHeader, "{1}") then resultHeader = "{1}" .. resultHeader end
|
||||
descObj.Description = descObj.Description .. "#" .. iconString .. " {{ColorObjName}}" .. EID:ReplaceVariableStr(resultHeader, descObj.Name) .. "#" .. newText
|
||||
end
|
||||
-- Helper function for modifiers that want to replace the description in the overview, but append to the description otherwise
|
||||
function EID:ItemReminderAddResult(descObj, newText, inOverview)
|
||||
|
||||
@@ -309,13 +309,65 @@ local function LuckChanceCallback(descObj)
|
||||
return descObj
|
||||
end
|
||||
|
||||
-- Handle changing health up text for non-red HP players
|
||||
local function HealthUpCallback(descObj)
|
||||
local adjustedSubtype = EID:getAdjustedSubtype(descObj.ObjType, descObj.ObjVariant, descObj.ObjSubType)
|
||||
local typeVarSub = descObj.ObjType.."."..descObj.ObjVariant.."."..adjustedSubtype
|
||||
|
||||
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 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
|
||||
|
||||
-- test the other players for if they have a different effect
|
||||
-- todo: this simple check could have false positives (i.e. Yum Heart is identical for Soul and Black, but this thinks they'll be different)
|
||||
for i = 1, #EID.coopAllPlayers do
|
||||
local t = EID.coopAllPlayers[i]:GetPlayerType()
|
||||
if EID.CharacterToHeartType[t] ~= heartType then
|
||||
table.insert(EID.DifferentEffectPlayers, t)
|
||||
end
|
||||
end
|
||||
|
||||
return descObj
|
||||
end
|
||||
|
||||
if EID.isRepentance then
|
||||
-- Handle Birthright
|
||||
local function BirthrightCallback(descObj)
|
||||
descObj.Description = ""
|
||||
local describedPlayerTypes = {}
|
||||
for i = 0,game:GetNumPlayers() - 1 do
|
||||
local player = Isaac.GetPlayer(i)
|
||||
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
|
||||
@@ -904,6 +956,9 @@ local function EIDConditionsAB(descObj)
|
||||
local callbacks = {}
|
||||
|
||||
if EID.LuckFormulas[descObj.fullItemString] then table.insert(callbacks, LuckChanceCallback) end
|
||||
local adjustedSubtype = EID:getAdjustedSubtype(descObj.ObjType, descObj.ObjVariant, descObj.ObjSubType)
|
||||
local typeVarSub = descObj.ObjType.."."..descObj.ObjVariant.."."..adjustedSubtype
|
||||
if EID.HealthUpData[typeVarSub] or EID.HealingItemData[typeVarSub] then table.insert(callbacks, HealthUpCallback) 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
|
||||
@@ -922,7 +977,7 @@ local function EIDConditionsAB(descObj)
|
||||
end
|
||||
return callbacks
|
||||
end
|
||||
EID:addDescriptionModifier("EID Afterbirth+", EIDConditionsAB, nil)
|
||||
EID:addDescriptionModifier("EID Afterbirth+", EIDConditionsAB, nil, 1)
|
||||
|
||||
-- should this be done differently so that mods can add tab previews? (tab conditions is done last, but would be done before callbacks mods add, maybe tab should be checked in EID:getDescriptionObj
|
||||
local function TabConditions(_)
|
||||
@@ -930,5 +985,22 @@ local function TabConditions(_)
|
||||
EID.TabPreviewID = 0
|
||||
return false
|
||||
end
|
||||
|
||||
EID:addDescriptionModifier("EID Tab Previews", TabConditions, TabCallback)
|
||||
|
||||
-- If an item has a radically different effect for 2 players, show the effect for the closest player, then append what chars have a different effect here
|
||||
-- This is the final change made to the desc, after all other conditionals and modifiers
|
||||
local function CoopDifferentEffectCallback(descObj)
|
||||
local displayedChars = {}
|
||||
local differentEffectText = EID:getDescriptionEntry("ConditionalDescs", "Different Effect")
|
||||
for _,v in ipairs(EID.DifferentEffectPlayers) do
|
||||
if not displayedChars[v] then
|
||||
descObj.Description = descObj.Description .. "#{{Player" .. v .. "}} " .. EID:ReplaceVariableStr(differentEffectText, "{{NameOnlyI" .. v .. "}}")
|
||||
end
|
||||
displayedChars[v] = true
|
||||
end
|
||||
return descObj
|
||||
end
|
||||
local function CoopDifferentEffectConditions(_)
|
||||
return #EID.DifferentEffectPlayers > 0
|
||||
end
|
||||
EID:addDescriptionModifier("EID Different Effect Players", CoopDifferentEffectConditions, CoopDifferentEffectCallback)
|
||||
@@ -30,11 +30,12 @@ local function entityToName(Type, Variant, plural)
|
||||
local eWithZero = string.gsub(e, "-1", "0")
|
||||
|
||||
local localizedNames = EID:getDescriptionEntry("GlitchedItemText")
|
||||
local pluralize = EID:getDescriptionEntry("Pluralize")
|
||||
local name = localizedNames[e] or localizedNames[eWithZero] or EID:GetEntityXMLName(Type, Variant, 0) or e
|
||||
|
||||
--print out entities with no name yet
|
||||
if name == e then Isaac.DebugString("No name found for " .. e .. " (could be modded)")
|
||||
elseif plural then name = name .. localizedNames["pluralize"] end
|
||||
elseif plural then name = name .. pluralize end
|
||||
|
||||
return name
|
||||
end
|
||||
@@ -53,6 +54,7 @@ function EID:CheckGlitchedItemConfig(id)
|
||||
|
||||
local localizedNames = EID:getDescriptionEntry("GlitchedItemText")
|
||||
local localizedNamesEnglish = EID:getDescriptionEntryEnglish("GlitchedItemText")
|
||||
local pluralize = EID:getDescriptionEntry("Pluralize")
|
||||
local attributes = "#"
|
||||
|
||||
-- Check the base item config for the Hearts/Bombs/Coins/Keys this item adds,
|
||||
@@ -83,7 +85,7 @@ function EID:CheckGlitchedItemConfig(id)
|
||||
local prefix = "↑ "
|
||||
if val > 0 then s = "+" .. s else prefix = "↓ " end
|
||||
attributes = attributes .. prefix .. EID:ReplaceVariableStr(localizedNames[v] or localizedNamesEnglish[v], 1, s)
|
||||
if val ~= 1 and val ~= -1 then attributes = attributes .. localizedNames["pluralize"] or localizedNamesEnglish["pluralize"] end
|
||||
if val ~= 1 and val ~= -1 then attributes = attributes .. pluralize end
|
||||
attributes = attributes .. "#"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user