Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Mod = RegisterMod("betterkeybum", 1)
- local game = Game()
- -- BumsKeys = 0 -- gobal variable which keeps track on how many keys Key Bum picked up
- local DadsKey = nil
- local BumsKeys = 0
- local KBumExtra = 0
- function Mod:onInit(player)
- if game:GetFrameCount() == 1 then
- -- spawn in if you want to
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_PAPER_CLIP, Vector(150, 250), Vector(0,0), player)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_STORE_KEY, Vector(250, 250), Vector(0,0), player)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_SKELETON_KEY, Vector(350, 250), Vector(0,0), player)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_LATCH_KEY, Vector400, 250), Vector(0,0), player)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_MOMS_KEY, Vector(350, 250), Vector(0,0), player)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_DADS_KEY, Vector(300, 250), Vector(0,0), player)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_KEY_BUM, Vector(300, 200), Vector(0,0), player)
- -- check for Dads Key
- DadsKey = false
- end
- end
- Mod:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, Mod.onInit)
- local function SkeletonKey(KBum, keyone)
- local player = Isaac.GetPlayer(0)
- -- tables which contain the items Key Bum can pull from
- -- Item tables
- local SkeItemPool = {175,199,343} -- 175 = Dads Key, 199 = Moms Key, 343 = Latch Key
- local BackItemPool = {175,199,343}
- -- Trinket tables
- local SkeTrinketPool = {19,83} -- 19 = Paper Clip, 83 = Store Key
- local BackTrinketPool = {19,83}
- if player:HasCollectible(17) then -- 17 = Skeleton Key
- if keyone < 50 then
- -- check if the player has an item and remove it from the table. It is removed from the "pool"
- if player:HasCollectible(343) then
- table.remove(SkeItemPool, 3)
- end
- if player:HasCollectible(199) then
- table.remove(SkeItemPool, 2)
- end
- if DadsKey == true then
- table.remove(SkeItemPool, 1)
- end
- -- make sure the table is not empty
- if SkeItemPool[1] ~= 175
- and SkeItemPool[1] ~= 199
- and SkeItemPool[1] ~= 343 then
- -- Breakfasting, if the table is empty
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
- else
- local pickitem = math.random(#SkeItemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, SkeItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
- if SkeItemPool[pickitem] == 175 then
- DadsKey = true
- end
- -- after spawning the Item you have to reset the table
- SkeItemPool = BackItemPool
- end
- else
- -- check if the player has a trinket and remove it from the table. It is removed from the "pool"
- if player:GetTrinket(0) == TrinketType.TRINKET_STORE_KEY
- or player:GetTrinket(1) == TrinketType.TRINKET_STORE_KEY then
- table.remove(SkeTrinketPool, 2)
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_PAPER_CLIP
- or player:GetTrinket(1) == TrinketType.TRINKET_PAPER_CLIP then
- table.remove(SkeTrinketPool, 1)
- end
- -- make sure the table is not empty
- if SkeTrinketPool[1] ~= 19
- and SkeTrinketPool[1] ~= 83 then
- -- if the table is empty, then Key Bum will spawn an item
- if player:HasCollectible(343) then
- table.remove(SkeItemPool, 3)
- end
- if player:HasCollectible(199) then
- table.remove(SkeItemPool, 2)
- end
- if player:HasCollectible(175) then
- table.remove(SkeItemPool, 1)
- end
- if SkeItemPool[1] ~= 175
- and SkeItemPool[1] ~= 199
- and SkeItemPool[1] ~= 343 then
- -- Breakfasting
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
- else
- local pickitem = math.random(#SkeItemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, SkeItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
- if SkeItemPool[pickitem] == 175 then
- DadsKey = true
- end
- SkeItemPool = BackItemPool
- end
- else
- local picktrinket = math.random(#SkeTrinketPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, SkeTrinketPool[picktrinket], KBum.Position, Vector(0,0), KBum)
- -- reset the Trinket "pool"
- SkeTrinketPool = BackTrinketPool
- end
- end
- else
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_SKELETON_KEY, KBum.Position, Vector(0,0), KBum)
- end
- end
- local function MomKey(KBum, keytwo)
- local player = Isaac.GetPlayer(0)
- -- tables which contain the items Key Bum can pull from
- -- Item tables
- local MomItemPool = {17,175,343} -- 17 = Skeleton Key, 175 = Dads Key, 343 = Latch Key
- local BackMomItemPool = {17,175,343}
- -- Trinket tables
- local MomTrinketPool = {19,83} -- 19 = Paper Clip, 83 = Store Key
- local BackMomTrinketPool = {19,83}
- if player:HasCollectible(199) then -- 199 = Moms Key
- if keytwo < 50 then
- if player:HasCollectible(343) then
- table.remove(MomItemPool, 3)
- end
- if DadsKey == true then
- table.remove(MomItemPool, 2)
- end
- if player:HasCollectible(17) then
- table.remove(MomItemPool, 1)
- end
- if MomItemPool[1] ~= 17
- and MomItemPool[1] ~= 175
- and MomItemPool[1] ~= 343 then
- -- Breakfasting
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
- else
- local pickitem = math.random(#MomItemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, MomItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
- if MomItemPool[pickitem] == 175 then
- DadsKey = true
- end
- MomItemPool = BackMomItemPool
- end
- else
- if player:GetTrinket(0) == TrinketType.TRINKET_STORE_KEY
- or player:GetTrinket(1) == TrinketType.TRINKET_STORE_KEY then
- table.remove(MomTrinketPool, 2)
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_PAPER_CLIP
- or player:GetTrinket(1) == TrinketType.TRINKET_PAPER_CLIP then
- table.remove(MomTrinketPool, 1)
- end
- if MomTrinketPool[1] ~= 19
- and MomTrinketPool[1] ~= 83 then
- if player:HasCollectible(343) then
- table.remove(MomItemPool, 3)
- end
- if DadsKey == true then
- table.remove(MomItemPool, 2)
- end
- if player:HasCollectible(17) then
- table.remove(MomItemPool, 1)
- end
- if MomItemPool[1] ~= 17
- and MomItemPool[1] ~= 175
- and MomItemPool[1] ~= 343 then
- -- Breakfasting
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
- else
- local pickitem = math.random(#MomItemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, MomItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
- if MomItemPool[pickitem] == 175 then
- DadsKey = true
- end
- MomItemPool = BackMomItemPool
- end
- else
- local picktrinket = math.random(#MomTrinketPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, MomTrinketPool[picktrinket], KBum.Position, Vector(0,0), KBum)
- MomTrinketPool = BackMomTrinketPool
- end
- end
- else
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_MOMS_KEY, KBum.Position, Vector(0,0), KBum)
- end
- end
- local function DadKey(KBum, keythree)
- local player = Isaac.GetPlayer(0)
- -- tables which contain the items Key Bum can pull from
- -- Item tables
- local DadItemPool = {17,199,343} -- 17 = Skeleton Key, 199 = Moms Key, 343 = Latch Key
- local BackDadItemPool = {17,199,343}
- -- Trinket tables
- local DadTrinketPool = {19,83} -- 19 = Paper Clip, 83 = Store Key
- local BackDadTrinketPool = {19,83}
- if DadsKey == true then
- if keythree < 50 then
- if player:HasCollectible(343) then
- table.remove(DadItemPool, 3)
- end
- if player:HasCollectible(199) then
- table.remove(DadItemPool, 2)
- end
- if player:HasCollectible(17) then
- table.remove(DadItemPool, 1)
- end
- if DadItemPool[1] ~= 17
- and DadItemPool[1] ~= 199
- and DadItemPool[1] ~= 343 then
- -- Breakfasting
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
- else
- local pickitem = math.random(#DadItemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, DadItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
- DadItemPool = BackDadItemPool
- end
- else
- if player:GetTrinket(0) == TrinketType.TRINKET_STORE_KEY
- or player:GetTrinket(1) == TrinketType.TRINKET_STORE_KEY then
- table.remove(DadTrinketPool, 2)
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_PAPER_CLIP
- or player:GetTrinket(1) == TrinketType.TRINKET_PAPER_CLIP then
- table.remove(DadTrinketPool, 1)
- end
- if DadTrinketPool[1] ~= 19
- and DadTrinketPool[1] ~= 83 then
- if player:HasCollectible(343) then
- table.remove(DadItemPool, 3)
- end
- if DadsKey == true then
- table.remove(DadItemPool, 2)
- end
- if player:HasCollectible(17) then
- table.remove(DadItemPool, 1)
- end
- if DadItemPool[1] ~= 17
- and DadItemPool[1] ~= 199
- and DadItemPool[1] ~= 343 then
- -- Breakfasting
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
- else
- local pickitem = math.random(#DadItemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, DadItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
- DadItemPool = BackDadItemPool
- end
- else
- local picktrinket = math.random(#DadTrinketPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET,DadTrinketPool[picktrinket], KBum.Position, Vector(0,0), KBum)
- DadTrinketPool = BackDadTrinketPool
- end
- end
- else
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_DADS_KEY, KBum.Position, Vector(0,0), KBum)
- DadsKey = true
- end
- end
- local function LatchKey(KBum, keyfour)
- local player = Isaac.GetPlayer(0)
- -- tables which contain the items Key Bum can pull from
- -- Item tables
- local LatchItemPool = {17,175,199} -- 17 = Skeleton Key, 175 = Dads Key, 199 = Moms Key
- local BackLatchItemPool = {17,175,199}
- -- Trinket tables
- local LatchTrinketPool = {19,83} -- 19 = Paper Clip, 83 = Store Key
- local BackLatchTrinketPool = {19,83}
- if player:HasCollectible(343) then -- 343 = Latch Key
- if keyfour < 50 then
- if player:HasCollectible(199) then
- table.remove(LatchItemPool, 3)
- end
- if DadsKey == true then
- table.remove(LatchItemPool, 2)
- end
- if player:HasCollectible(17) then
- table.remove(LatchItemPool, 1)
- end
- if LatchItemPool[1] ~= 17
- and LatchItemPool[1] ~= 175
- and LatchItemPool[1] ~= 199 then
- -- Breakfasting
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
- else
- local pickitem = math.random(#LatchItemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, LatchItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
- if LatchItemPool[pickitem] == 175 then
- DadsKey = true
- end
- LatchItemPool = BackLatchItemPool
- end
- else
- if player:GetTrinket(0) == TrinketType.TRINKET_STORE_KEY
- or player:GetTrinket(1) == TrinketType.TRINKET_STORE_KEY then
- table.remove(LatchTrinketPool, 2)
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_PAPER_CLIP
- or player:GetTrinket(1) == TrinketType.TRINKET_PAPER_CLIP then
- table.remove(LatchTrinketPool, 1)
- end
- if LatchTrinketPool[1] ~= 19
- and LatchTrinketPool[1] ~= 83 then
- if player:HasCollectible(199) then
- table.remove(LatchItemPool, 3)
- end
- if DadsKey == true then
- table.remove(LatchItemPool, 2)
- end
- if player:HasCollectible(17) then
- table.remove(LatchItemPool, 1)
- end
- if LatchItemPool[1] ~= 17
- and LatchItemPool[1] ~= 175
- and LatchItemPool[1] ~= 199 then
- -- Breakfasting
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
- else
- local pickitem = math.random(#LatchItemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, LatchItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
- if LatchItemPool[pickitem] == 175 then
- DadsKey = true
- end
- LatchItemPool = BackLatchItemPool
- end
- else
- local picktrinket = math.random(#LatchTrinketPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, LatchTrinketPool[picktrinket], KBum.Position, Vector(0,0), KBum)
- LatchTrinketPool = BackLatchTrinketPool
- end
- end
- else
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_LATCH_KEY, KBum.Position, Vector(0,0), KBum)
- end
- end
- local function PaperKey(KBum, keyfive)
- local player = Isaac.GetPlayer(0)
- -- tables which contain the items Key Bum can pull from
- -- Item tables
- local PaperItemPool = {17,175,199,343} -- 17 = Skeleton Key, 175 = Dads Key, 199 = Moms Key, 343 = Latch Key
- local BackPaperItemPool = {17,175,199,343}
- -- Trinket tables
- local PaperTrinketPool = {83} -- 83 = Store Key
- local BackPaperTrinketPool = {83}
- if player:GetTrinket(0) == TrinketType.TRINKET_PAPER_CLIP
- or player:GetTrinket(1) == TrinketType.TRINKET_PAPER_CLIP then -- 19 = Paper Clip
- if keyfive < 50 then
- if player:HasCollectible(343) then
- table.remove(PaperItemPool, 4)
- end
- if player:HasCollectible(199) then
- table.remove(PaperItemPool, 3)
- end
- if DadsKey == true then
- table.remove(PaperItemPool, 2)
- end
- if player:HasCollectible(17) then
- table.remove(PaperItemPool, 1)
- end
- if PaperItemPool[1] ~= 17
- and PaperItemPool[1] ~= 175
- and PaperItemPool[1] ~= 199
- and PaperItemPool[1] ~= 343 then
- -- Breakfasting
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
- else
- local pickitem = math.random(#PaperItemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, PaperItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
- if PaperItemPool[pickitem] == 175 then
- DadsKey = true
- end
- PaperItemPool = BackPaperItemPool
- end
- else
- if player:GetTrinket(0) == TrinketType.TRINKET_STORE_KEY
- or player:GetTrinket(1) == TrinketType.TRINKET_STORE_KEY then
- table.remove(PaperTrinketPool, 1)
- end
- if PaperTrinketPool[1] ~= 83 then
- if player:HasCollectible(343) then
- table.remove(PaperItemPool, 4)
- end
- if player:HasCollectible(199) then
- table.remove(PaperItemPool, 3)
- end
- if DadsKey == true then
- table.remove(PaperItemPool, 2)
- end
- if player:HasCollectible(17) then
- table.remove(PaperItemPool, 1)
- end
- if PaperItemPool[1] ~= 17
- and PaperItemPool[1] ~= 175
- and PaperItemPool[1] ~= 199
- and PaperItemPool[1] ~= 343 then
- -- Breakfasting
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
- else
- local pickitem = math.random(#PaperItemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, PaperItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
- if PaperItemPool[pickitem] == 175 then
- DadsKey = true
- end
- PaperItemPool = BackPaperItemPool
- end
- else
- local picktrinket = math.random(#PaperTrinketPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, PaperTrinketPool[picktrinket], KBum.Position, Vector(0,0), KBum)
- PaperTrinketPool = BackPaperTrinketPool
- end
- end
- else
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_PAPER_CLIP, KBum.Position, Vector(0,0), KBum)
- end
- end
- local function StoreKey(KBum, keysix)
- local player = Isaac.GetPlayer(0)
- -- tables which contain the items Key Bum can pull from
- -- Item tables
- local StoreItemPool = {17,175,199,343} -- 17 = Skeleton Key, 175 = Dads Key, 199 = Moms Key, 343 = Latch Key
- local BackStoreItemPool = {17,175,199,343}
- -- Trinket tables
- local StoreTrinketPool = {19} -- 19 = Paper Clip
- local BackStoreTrinketPool = {19}
- if player:GetTrinket(0) == TrinketType.TRINKET_STORE_KEY
- or player:GetTrinket(1) == TrinketType.TRINKET_STORE_kEY then
- if keysix < 50 then
- if player:HasCollectible(343) then
- table.remove(StoreItemPool, 4)
- end
- if player:HasCollectible(199) then
- table.remove(StoreItemPool, 3)
- end
- if DadsKey == true then
- table.remove(StoreItemPool, 2)
- end
- if player:HasCollectible(17) then
- table.remove(StoreItemPool, 1)
- end
- if StoreItemPool[1] ~= 17
- and StoreItemPool[1] ~= 175
- and StoreItemPool[1] ~= 199
- and StoreItemPool[1] ~= 343 then
- -- Breakfasting
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
- else
- local pickitem = math.random(#StoreItemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, StoreItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
- if StoreItemPool[pickitem] == 175 then
- DadsKey = true
- end
- StoreItemPool = BackStoreItemPool
- end
- else
- if player:GetTrinket(0) == TrinketType.TRINKET_PAPER_CLIP
- or player:GetTrinket(1) == TrinketType.TRINKET_PAPER_CLIP then
- table.remove(StoreTrinketPool, 1)
- end
- if StoreTrinketPool[1] ~= 83 then
- if player:HasCollectible(343) then
- table.remove(StoreItemPool, 4)
- end
- if player:HasCollectible(199) then
- table.remove(StoreItemPool, 3)
- end
- if DadsKey == true then
- table.remove(StoreItemPool, 2)
- end
- if player:HasCollectible(17) then
- table.remove(StoreItemPool, 1)
- end
- if StoreItemPool[1] ~= 17
- and StoreItemPool[1] ~= 175
- and StoreItemPool[1] ~= 199
- and StoreItemPool[1] ~= 343 then
- -- Breakfasting
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
- else
- local pickitem = math.random(#StoreItemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, StoreItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
- if StoreItemPool[pickitem] == 175 then
- DadsKey = true
- end
- StoreItemPool = BackStoreItemPool
- end
- else
- local picktrinket = math.random(#StoreTrinketPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, StoreTrinketPool[picktrinket], KBum.Position, Vector(0,0), KBum)
- StoreTrinketPool = BackStoreTrinketPool
- end
- end
- else
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_STORE_KEY, KBum.Position, Vector(0,0), KBum)
- end
- end
- function Mod:onPickup(KBum)
- local player = Isaac.GetPlayer(0)
- local entities = Isaac.GetRoomEntities()
- if player:HasCollectible(CollectibleType.COLLECTIBLE_KEY_BUM) then
- local rng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_KEY_BUM)
- local roll = rng:RandomInt(100)
- -- RNG of the synergie items
- local rngone = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_SKELETON_KEY)
- local keyone = rngone:RandomInt(100)
- local rngtwo = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_MOMS_KEY)
- local keytwo = rngtwo:RandomInt(100)
- local rngthree = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_DADS_KEY)
- local keythree = rngthree:RandomInt(100)
- local rngfour = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_LATCH_KEY)
- local keyfour = rngfour:RandomInt(100)
- local rngfive = player:GetCollectibleRNG(TrinketType.TRINKET_PAPER_CLIP)
- local keyfive = rngfive:RandomInt(100)
- local rngsix = player:GetCollectibleRNG(TrinketType.TRINKET_STORE_KEY)
- local keysix = rngsix:RandomInt(100)
- -- we check all entities in the room
- for j = 1, #entities do
- -- collision detection
- if entities[j].Type == EntityType.ENTITY_PICKUP
- and KBum.Position:Distance(entities[j].Position) <= 150
- then
- if entities[j]:GetSprite():IsPlaying("Collect")
- and entities[j]:GetData().Picked == nil then
- entities[j]:GetData().Picked = true
- -- pickup specific action
- if entities[j].Variant == PickupVariant.PICKUP_KEY then
- if entities[j].SubType == KeySubType.KEY_NORMAL
- or entities[j].SubType == KeySubType.KEY_CHARGED then
- -- key counter
- BumsKeys = BumsKeys + 1
- -- if BumsKeys == 1 then
- -- Isaac.DebugString("BumsKeys + 1")
- -- depending on how high the key counter Key Bum can spawn different things
- if BumsKeys == 7 then
- if player:HasCollectible(CollectibleType.COLLECTIBLE_SKELETON_KEY)
- and player:HasCollectible(CollectibleType.COLLECTIBLE_MOMS_KEY)
- and player:HasCollectible(CollectibleType.COLLECTIBLE_LATCH_KEY)
- and DadsKey == true then
- if roll < 98 then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_GOLDEN, entities[j].Position, Vector(0,0), KBum)
- BumsKeys = 0 -- reset the counter to 0
- Mod:SaveData(BumsKeys)
- else
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_LOCKEDCHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
- BumsKeys = 0 -- reset the counter to 0
- Mod:SaveData(BumsKeys)
- end
- else
- if roll < 50 then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_GOLDEN, entities[j].Position, Vector(0,0), KBum)
- BumsKeys = 0 -- reset the counter to 0
- Mod:SaveData(BumsKeys)
- end
- end
- elseif BumsKeys >= 12 then
- -- the chance to drop something increases with every key picked up
- if BumsKeys == 12 then
- KBumExtra = 0
- Mod:SaveData(KBumExtra)
- elseif BumsKeys == 13 then
- KBumExtra = KBumExtra + 10
- Mod:SaveData(KBumExtra)
- elseif BumsKeys == 14 then
- KBumExtra = KBumExtra + 10
- Mod:SaveData(KBumExtra)
- elseif BumsKeys == 15 then
- KBumExtra = KBumExtra + 15
- Mod:SaveData(KBumExtra)
- elseif BumsKeys == 16 then
- KBumExtra = KBumExtra + 15
- Mod:SaveData(KBumExtra)
- elseif BumsKeys == 17 then
- KBumExtra = KBumExtra + 15
- Mod:SaveData(KBumExtra)
- end
- if roll < (35 + KBumExtra) then
- local rolltwo = rng:RandomInt(120)
- if rolltwo < 10 then
- SkeletonKey(KBum, keyone)
- BumsKeys = 0
- Mod:SaveData(BumsKeys)
- elseif rolltwo < 30 then
- MomKey(KBum, keytwo)
- BumsKeys = 0
- Mod:SaveData(BumsKeys)
- elseif rolltwo < 50 then
- DadKey(KBum, keythree)
- BumsKeys = 0
- Mod:SaveData(BumsKeys)
- DadsKey = true
- elseif rolltwo < 70 then
- LatchKey(KBum, keyfour)
- BumsKeys = 0
- Mod:SaveData(BumsKeys)
- elseif rolltwo < 95 then
- PaperKey(KBum, keyfive)
- BumsKeys = 0
- Mod:SaveData(BumsKeys)
- else
- StoreKey(KBum, keysix)
- BumsKeys = 0
- Mod:SaveData(BumsKeys)
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- Mod:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, Mod.onPickup, FamiliarVariant.KEY_BUM)
Advertisement
Add Comment
Please, Sign In to add comment