Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Mod:onCollectibleSpawn(pickup)
- local player = Isaac.GetPlayer(0)
- local roomType = game:GetRoom():GetType()
- local hasEffect = player:GetEffects()
- -- check if the player plays the challenge
- if game.Challenge == Challenges.CHALLENGE_ONLY_TRINKETS then
- if pickup.Variant == PickupVariant.PICKUP_COLLECTIBLE then -- look for items
- -- Isaac.ConsoleOutput("Yeahhh")
- local item = pickup
- -- check if a beggar spawned an item
- if waitForBeggar == true -- a beggar spawned an item
- and morphItem == false then -- item hasn't morphed yet
- -- Isaac.ConsoleOutput("Wait!! ")
- if collectible.Beggar == true then
- -- get the beggar trinket "pool"
- local pool = {1,24,49,50,51,52,126} -- mostly the penny trinkets
- local poolBackwards = {126,52,51,50,49,24,1}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- collectible.Beggar = false
- Isaac.ConsoleOutput("Please? ")
- elseif collectible.DemonBeggar == true then
- -- get the devil beggar trinket "pool"
- local pool = {61,111} -- Left Hand, Bloody Crown
- local poolBackwards = {111,61}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- collectible.DemonBeggar = false
- elseif collectible.ShellGame == true then
- -- get the shell game trinket "pool"
- local pool = {2,93} -- Petrified Poop, Used Diaper
- local poolBackwards = {93,2}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- collectible.ShellGame = false
- -- Isaac.ConsoleOutput("Shell Game")
- elseif collectible.KeyBeggar == true then
- -- get the key master trinket "pool"
- local pool = {19,36,83,124} -- key related trinkets
- local poolBackwards = {124,83,36,19}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- collectible.KeyBeggar = false
- elseif collectible.BombBeggar == true then
- -- get the bomb beggar trinket "pool"
- local pool = {63,71,73} -- Bob's Bladder / bomb related trinkets
- local poolBackwards = {73,71,63}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- collectible.BombBeggar = false
- -- Isaac.ConsoleOutput("Kaboooom")
- end
- -- set waitForBeggar and morphItem
- waitForBeggar = false
- morphItem = true -- the item is already morphed
- end
- if morphItem == true then
- -- break
- -- morphItem = false
- end
- -- Look for specific items via the CollectibleType
- if (item.SubType == CollectibleType.COLLECTIBLE_LUMP_OF_COAL -- spawned from the Krampus fight
- or item.SubType == CollectibleType.COLLECTIBLE_KRAMPUS_HEAD) then
- -- possible needs room type?
- -- get krampu's trinket pool
- local pool = {35,95}
- local poolBackwards = {95,35}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- morphItem = true -- the item is already morphed
- elseif (item.SubType == CollectibleType.COLLECTIBLE_CUBE_OF_MEAT -- spawned by the horesman fight
- or item.SubType == CollectibleType.COLLECTIBLE_BALL_OF_BANDAGES
- or item.SubType == CollectibleType.COLLECTIBLE_WHITE_PONY) then -- spawned by Conquest
- -- get room data to see which horseman room it is
- if roomType == RoomType.ROOM_BOSS then -- first check the room type
- if roomContains.Famine == true then
- -- morph the item into a locust. This will always happen regardless if the player has it or not
- item:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_LOCUST_OF_FAMINE, false)
- -- reset the roomContains
- roomContains.Famine = false
- elseif roomContains.Pestilence == true then
- -- morph the item into a locust. This will always happen regardless if the player has it or not
- item:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_LOCUST_OF_PESTILENCE, false)
- -- reset the roomContains
- roomContains.Pestilence = false
- elseif roomContains.Death == true then
- -- morph the item into a locust. This will always happen regardless if the player has it or not
- item:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_LOCUST_OF_DEATH, false)
- -- reset the roomContains
- roomContains.Death = false
- elseif roomContains.War == true then
- -- morph the item into a locust. This will always happen regardless if the player has it or not
- item:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_LOCUST_OF_WRATH, false)
- -- reset the roomContains
- roomContains.War = false
- elseif roomContains.Conquest == true then
- -- morph the item into a locust. This will always happen regardless if the player has it or not
- item:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_LOCUST_OF_CONQUEST, false)
- -- reset the roomContains
- roomContains.Conquest = false
- end
- end
- morphItem = true -- the item is already morphed
- elseif (item.SubType == CollectibleType.COLLECTIBLE_POLAROID -- spawned from the Krampus fight
- or item.SubType == CollectibleType.COLLECTIBLE_NEGATIVE) then
- -- get mom's "pool"
- -- local pool = {69} -- Faded Polariod
- -- morph the item to the picked trinket
- item:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_FADED_POLAROID, false)
- morphItem = true -- the item is already morphed
- elseif item.SubType == CollectibleType.COLLECTIBLE_SKATOLE then -- shell game
- -- get the shell game trinket "pool"
- local pool = {2,93} -- Petrified Poop, Used Diaper
- local poolBackwards = {93,2}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- morphItem = true -- the item is already morphed
- elseif item.SubType == CollectibleType.COLLECTIBLE_DOLLAR then -- slot machine
- -- get the slot machine trinket "pool"
- -- local pool = 121
- -- morph the item to the picked trinket
- item:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_SILVER_DOLLAR, false)
- morphItem = true -- the item is already morphed
- elseif item.SubType == CollectibleType.COLLECTIBLE_BLOOD_BAG -- blood donation machine
- or item.SubType == CollectibleType.COLLECTIBLE_IV_BAG then
- -- get the blood donation trinket "pool"
- local pool = {34,40,87}
- local poolBackwards = {87,40,34}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- morphItem = true -- the item is already morphed
- elseif item.SubType == CollectibleType.COLLECTIBLE_CRYSTAL_BALL then -- fortune teller
- -- get the fortune teller trinket "pool"
- -- local pool = 102 -- Fragmented Card
- -- morph the item to the picked trinket
- item:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_FRAGMENTED_CARD, false)
- morphItem = true -- the item is already morphed
- elseif item.SubType == CollectibleType.COLLECTIBLE_PONY then
- -- get the headless trinket "pool"
- -- local pool = 54 -- Isaac's Head
- -- morph the item to the picked trinket
- item:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_ISAACS_HEAD, false)
- morphItem = true -- the item is already morphed
- elseif item.SubType == CollectibleType.COLLECTIBLE_KEY_PIECE_1
- or item.SubType == CollectibleType.COLLECTIBLE_KEY_PIECE_2 then
- local droppedFeather = false -- keeps track if the Filigree Feather is already in the room
- -- look for the feather
- for _, entity in pairs(Isaac.GetRoomEntities()) do
- if entity.Type == EntityType.ENTITY_PICKUP
- and entity.Variant == PickupVariant.PICKUP_TRINKET
- and entity.SubType == TrinketType.TRINKET_FILIGREE_FEATHERS then
- if droppedFeather == false then
- droppedFeather = true
- -- Isaac.ConsoleOutput("Kaboooom")
- end
- end
- end
- -- after searching decide in what the item is going to be morped
- if droppedFeather == true
- or player:HasTrinket(TrinketType.TRINKET_FILIGREE_FEATHERS)
- or hasEffect:HasTrinketEffect(TrinketType.TRINKET_FILIGREE_FEATHERS) then
- -- a random trinket from the angel trinket room pool
- -- get the angel room pool
- local pool = {7,18,38,85,87,92,100,110,121}
- local poolBackwards = {121,110,100,92,87,85,38,18,7}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- else
- item:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_FILIGREE_FEATHERS, false)
- end
- morphItem = true -- the item is already morphed
- end
- if morphItem == true then
- -- Isaac.ConsoleOutput("Kaboooom")
- end
- -- check the room pools
- if waitForBeggar == false -- the item wasn't spawned by a beggar
- and morphItem == false then -- item hasn't morphed yet
- -- go through the different room types
- if roomType == RoomType.ROOM_TREASURE
- or roomType == RoomType.ROOM_DUNGEON then
- -- get the treasure room pool
- local pool = {5,8,14,16,25,30,31,33,53,54,55,57,60,68,70,71,77,81,86,90,93,95,97,98,99,127}
- local poolBackwards = {127,99,98,97,95,93,90,86,81,77,71,70,68,60,57,55,54,53,33,31,30,25,16,14,8,5}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- elseif roomType == RoomType.ROOM_SHOP
- or roomType == RoomType.ROOM_BLACK_MARKET then
- -- get the shop room pool
- local pool = {3,29,34,36,41,44,59,62,63,72,73,74,76,78,82,89,94,103,106,109,120,125}
- local poolBackwards = {125,120,109,106,103,94,89,82,78,76,74,73,72,63,62,59,44,41,36,34,29,3}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- -- assign data to the entity to make it a shop item later down the line
- item:GetData().ShopTrinket = true
- item:GetData().NeedsNewPrize = true
- elseif roomType == RoomType.ROOM_LIBRARY then
- -- get the library room pool
- local pool = {9,10,11,12,21,23,26,27,45,48,64,65,66,96,102}
- local poolBackwards = {102,96,66,65,64,48,45,27,26,23,21,12,11,10,9}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- elseif roomType == RoomType.ROOM_BOSS
- or roomType == RoomType.ROOM_MINIBOSS then
- if roomContains.Fallen == true then -- the boss room contains the Fallen
- -- get the devil room pool
- local pool = {13,17,20,22,35,80,111,118}
- local poolBackwards = {118,111,80,35,22,20,17,13}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- roomContains.Fallen = false
- else
- -- get the boss room pool
- local pool = {37,39,42,46,58,101,104,105,108,119}
- local poolBackwards = {119,108,105,104,101,58,46,42,39,37}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- end
- elseif roomType == RoomType.ROOM_SECRET
- or roomType == RoomType.ROOM_SUPERSECRET then
- -- get the secret room pool
- local pool = {15,28,32,83,84,91}
- local poolBackwards = {91,84,83,32,28,15}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- elseif roomType == RoomType.ROOM_DEVIL then
- -- get the secret room pool
- local pool = {13,17,20,22,35,80,111,118}
- local poolBackwards = {118,111,80,35,22,20,17,13}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- elseif roomType == RoomType.ROOM_ANGEL
- or roomType == RoomType.ROOM_SACRIFICE then
- -- get the secret room pool
- local pool = {7,18,38,87,92,100,110,121}
- local poolBackwards = {121,110,100,92,87,38,18,7}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- elseif roomType == RoomType.ROOM_CURSE then
- -- get the secret room pool
- local pool = {40,43,61,107,128}
- local poolBackwards = {128,107,61,43,40}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- elseif roomType == RoomType.ROOM_ISAACS
- or roomType == RoomType.ROOM_BARREN then
- -- get the secret room pool
- local pool = {8,46,54,63,67,99}
- local poolBackwards = {99,67,63,54,46,8}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- elseif roomType == RoomType.ROOM_CHALLENGE then
- -- get the secret room pool
- local pool = {6,40,58}
- local poolBackwards = {58,40,6}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- elseif roomType == RoomType.ROOM_CHEST then
- -- get the secret room pool
- local pool = {29,54,55,56,57,58,59,60}
- local poolBackwards = {60,59,58,57,56,55,54,29}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- elseif roomType == RoomType.ROOM_ARCADE then
- -- get the secret room pool
- local pool = {8,45,67,76,112}
- local poolBackwards = {112,76,67,45,8}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- elseif roomType == RoomType.ROOM_ERROR then
- -- get the secret room pool
- local pool = {4,6,67,75,79,92}
- local poolBackwards = {92,79,75,67,6,4}
- -- trinket pool stuff
- TrinketPools(item, pool, poolBackwards)
- elseif roomType == RoomType.ROOM_BOSSRUSH
- or roomType == RoomType.ROOM_DEFAULT then
- -- Isaac.ConsoleOutput("s,rjzgqp")
- -- morph the item into a random trinket. This will always happen regardless if the player has it or not
- item:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_NULL, false)
- end
- end
- if morphItem == true then
- morphItem = false
- end
- end
- end
- end
- Mod:AddCallback(ModCallbacks.MC_POST_PICKUP_UPDATE, Mod.onCollectibleSpawn)
Advertisement
Add Comment
Please, Sign In to add comment