Closed MrLavender closed 1 year ago
Actually, even picking up the Halo Of Flies item itself makes the count = 2. It's counting the flies not the item itself. Not sure there's an easy fix to be honest.
This is my attempt at a fix. There may be better ways of doing this. There may be edge cases I haven't thought of. Feel free to use, modify, or completely ignore this code. :grin:
It is based on the following observations in AB+;
The value of GetCollectibleNum(10)
is unlimited. Taking 5 Pretty Fly pills + Halo Of Flies item = 5 + 2 = 7.
The only thing that changes the value by 2 in MC_EVALUATE_CACHE is obtaining the item (something like Placebo + Car Battery + Pretty Fly pill will add 1 twice).
diff --git a/eid_api.lua b/eid_api.lua
index 632d591..2835859 100755
--- a/eid_api.lua
+++ b/eid_api.lua
@@ -1727,6 +1727,13 @@ function EID:evaluateTransformationProgress(transformation)
if tonumber(eSubType) == 584 and player:GetActiveItem() == 584 then
EID.TransformationProgress[i][transformation] = EID.TransformationProgress[i][transformation] - 1
end
+
+ -- Fix Halo Of Flies count in AB+
+ if not EID.isRepentance and tonumber(eSubType) == 10 then
+ EID.TransformationProgress[i][transformation] = EID.TransformationProgress[i][transformation] - collCount
+ collCount = EID.PlayerItemInteractions[i].hasHaloOfFliesItem or 0
+ EID.TransformationProgress[i][transformation] = EID.TransformationProgress[i][transformation] + collCount
+ end
end
elseif tonumber(eVariant) == PickupVariant.PICKUP_TRINKET and player:HasTrinket(eSubType) then
EID.TransformationProgress[i][transformation] = EID.TransformationProgress[i][transformation] + player:GetTrinketMultiplier(eSubType)
@@ -1741,6 +1748,19 @@ function EID:evaluateTransformationProgress(transformation)
end
end
+-- Workaround to properly detect Halo Of Flies item (5.100.10) on AB+
+-- Only the item itself increases GetCollectibleNum() by 2 here
+EID:AddCallback(ModCallbacks.MC_EVALUATE_CACHE, function (_, player, _)
+ if EID.isRepentance then return end
+ local itemInteractions = EID.PlayerItemInteractions[EID:getPlayerID(player)]
+ if itemInteractions == nil then return end
+ local lastNum = itemInteractions.lastHaloOfFliesNum or 0
+ local num = player:GetCollectibleNum(10)
+ itemInteractions.lastHaloOfFliesNum = num
+ if num - lastNum == 2 then itemInteractions.hasHaloOfFliesItem = 1 end
+ --Isaac.DebugString("MC_EVALUATE_CACHE: Halo Of Flies = " .. lastNum .. "," .. num .. "," .. (itemInteractions.hasHaloOfFliesItem or 0))
+end, CacheFlag.CACHE_FAMILIARS)
+
-- Create a list of all grid entities in the room that have an EID description
function EID:CheckCurrentRoomGridEntities()
EID.CurrentRoomGridEntities = {}
Thank you for one of the best reports possible. I feel your solution is a little too much code and new variables for addressing a niche interaction in AB+. I've thought of a solution where Halo of Flies is treated like active items are, since active item transformation progress doesn't use the inaccurate GetCollectibleNum. This only requires a couple small additions. I'm guessing this would not count Halos obtained through D4 rerolls but transformation progress is already a nightmare with D4.
And while testing this in AB+, I also noticed that duplicate copies of a collectible don't count towards transformations, but we weren't tracking that. So I added a check that caps collectibles to only adding 1 to the transformation count in AB+.
The problem seems to be that
EntityPlayer:GetCollectibleNum()
doesn't have the secondOnlyCountTrueItems
parameter in AB+. So after using Pretty Fly pills, or obtaining orbital flies from a Slot Machine, they count asCOLLECTIBLE_HALO_OF_FLIES
(5.100.10) here;https://github.com/wofsauge/External-Item-Descriptions/blob/5894fc82329c9d53acab242ba2ece969df985e4b/eid_api.lua#L1720
E.g. I have Smart Fly, Friend Zone, and have used 3 Pretty Fly pills. The transformation count is 5/3 but should be 2/3 (I'm not yet transformed, that happens after collecting Distant Admiration).