Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Mod = RegisterMod("betterbums", 1)
- local game = Game()
- -- different counters
- local HeartCounter = 0 -- tracks down the number of hearts Super Bum or Dark Bum stole from the player
- local KeyCounter = 0
- local ExtraLuck = 0 -- keeps track of the keys Super Bum and Key Bum collected
- local Extra = 0 -- chance to spawn an item
- local minusKeys = 0 -- number which will be subtracted from KeyCount if Super Bum spawns an item or trinket
- local trinketCounter = 0 -- keeps track of the key themed trinkets
- local bumChance = 0 -- counter which increases when the player has a bum
- -- variables/tables for Key Bum's effect
- local has = {
- AllItems = nil, -- does the player has all key themed items
- DadsKey = nil, -- did Super Bum or Key Bum spawned Dads Key?
- PaperClip = nil, -- = true when the player has Paper Clip
- RustedKey = nil, -- = true when the player has Rusted Key
- StoreKey = nil -- = true when the player has Store Key
- }
- -- variables for Dark Bum's effect
- local darkbum = {
- Alt = false, -- allows the player to switch between the two steal animaions
- INIT = true, -- prevent Super Bum functionality
- SPAWNED = false, -- checks if Dark Bum can spawn something
- PAYOUT = nil, -- checks if Dark Bum should spawn something
- BUM = nil -- registers Dark Bum
- }
- -- variables for Super Bum's effect
- local superbum = {
- Init = false, -- keeps track if the player has Super Bum
- CoinSpawned = false, -- keeps track if Super Bum has already spawned a coin
- CoinPayout = false, -- keeps track if Super Bum should payout with a coin
- KeySpawned = false, -- keeps track if Super Bum has already spawned a key themed item or trinket
- KeyPayout = false, -- keeps track if Super Bum should payout with a key themed item or trinket
- GoldenKeySpawned = false, -- keeps track if Super Bum has already spawned a golden key
- GoldenKeyPayout = false, -- keeps track if Super Bum should payout with a golden key
- Bum = nil -- stores Super Bum as a familiar
- }
- -- variables to costumize Super Bum's abilities and the other bums
- local functionality = {
- DarkBum = true, -- used to activate or deactive the ability from Dark Bum
- KeyBum = true, -- used to activate or deactive the ability from Key Bum
- BumFriend = true, -- used to activate or deactive the ability from Bum Friend
- SuperDarkBum = true, -- used to activate or deactive Super Bum's Heart ability from Dark Bum
- SuperKeyBum = true, -- used to activate or deactive Super Bum's Key ability from Key Bum
- ModFriend = true, -- used to activate or deactive Super Bum's Coin ability from Bum Friend
- MoreBums = true, -- if true then the player will have higher chance to find classic bums
- BonusAnimation = false -- used to activate or deactivate the bonus and alt animations (ThumbUp, AltSteal, AltSpawnItem)
- }
- -- tables for item and trinket pools
- -- for Super Bum
- local resetItemPool = {17,175,199,343} -- table which is used to restore itemPool?
- local resetTrinketPool = {19,36,83} -- table which is used to restore trinketPool?
- -- to find more bums
- local backBumPool = {144,278,388} -- table which is used to restore bumPool?
- -- local treasurePool = {8,67,88,94,95,96,98,99,100,113,117,131,155,163,167,170,174,178,188,264,265,266,267,268,269,270,271,272,273,275,276,277,280,281,319,320,321,322,361,362,364,365,384,389,390,404,405,426,430,431,435,436,467,469,470,471,473,491,492,508,509,511,537,539,543,544,548}
- -- local secretPool = {94,131,271,321,389,405}
- -- local devilPool = {67,113,163,187,268,269,275,360,412,417,431,433,468,519}
- -- Key Item Pool
- local function KeyItemPool(spawner, keyrolltwo)
- local player = Isaac.GetPlayer(0)
- -- item & trinket pool
- local itemPool = {17,175,199,343} -- 17 = Skeleton Key, 175 = Dad's Key, 199 = Mom's Key, 343 = Latch Key
- local trinketPool = {19,36,83} -- 19 = Paper Clip, 36 = Rusted Key, 83 = Store Key
- -- empty the item pool table
- if player:HasCollectible(343) then -- Latch Key
- table.remove(itemPool, 4) -- remove the item from the table/pool
- end
- if player:HasCollectible(199) then -- Mom's Key
- table.remove(itemPool, 3)
- end
- if player:HasCollectible(175) -- Dad's Key
- or has.DadsKey == true then
- table.remove(itemPool, 2)
- end
- if player:HasCollectible(17) then -- Skeleton Key
- table.remove(itemPool, 1)
- end
- -- empty the trinket pool table
- if player:GetTrinket(0) == TrinketType.TRINKET_STORE_KEY
- or player:GetTrinket(1) == TrinketType.TRINKET_STORE_KEY then
- table.remove(trinketPool, 3) -- remove the trinket from the table/pool
- trinketCounter = trinketCounter + 1 -- increase the trinket counter
- Mod:SaveData(trinketCounter)
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_RUSTED_KEY
- or player:GetTrinket(1) == TrinketType.TRINKET_RUSTED_KEY then
- table.remove(trinketPool, 2)
- trinketCounter = trinketCounter + 1
- Mod:SaveData(trinketCounter)
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_PAPER_CLIP
- or player:GetTrinket(1) == TrinketType.TRINKET_PAPER_CLIP then
- table.remove(trinketPool, 1)
- trinketCounter = trinketCounter + 1
- Mod:SaveData(trinketCounter)
- end
- -- now we check which item should be spawned
- if keyrolltwo < 10 then
- -- get the collectible rng
- local rngone = player:GetCollectibleRNG(17) -- 17 = Skeleton Key
- local keyone = rngone:RandomInt(100)
- if player:HasCollectible(17) then
- -- if the player has the item then we spawn another item or trinket
- if keyone < 50 then -- we spawn an item
- if has.AllItems == true then -- the player has all key items
- -- we "breakfast"
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
- else
- -- spawn an item which is left in the pool
- local pickItem = math.random(#itemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
- -- check for Dad's Key
- if itemPool[pickItem] == 175 then
- has.DadsKey = true
- end
- end
- else
- -- we should spawn a trinket
- if trinketCounter >= 2 then -- check if the player doesn't have two Key themed trinkets and then spawn an other item
- if has.AllItems == true then -- the player has all key items
- -- we "breakfast"
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
- else
- -- spawn an item which is left in the pool
- local pickItem = math.random(#itemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
- -- check for Dad's Key
- if itemPool[pickItem] == 175 then
- has.DadsKey = true
- end
- end
- else -- we spawn a trinket
- local pickTrinket = math.random(#trinketPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketPool[pickTrinket], spawner.Position, Vector(0,0), spawner)
- end
- end
- else
- -- spawn Skeleton Key
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_SKELETON_KEY, spawner.Position, Vector(0,0), spawner)
- end
- elseif keyrolltwo < 30 then
- -- get the collectible rng
- local rngtwo = player:GetCollectibleRNG(175) -- 175 = Dad's Key
- local keytwo = rngtwo:RandomInt(100)
- if player:HasCollectible(175)
- or has.DadsKey == true then
- -- if the player has the item then we spawn another item or trinket
- if keytwo < 50 then -- we spawn an item
- if has.AllItems == true then -- the player has all key items
- -- we "breakfast"
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
- else
- -- spawn an item which is left in the pool
- local pickItem = math.random(#itemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
- end
- else
- -- Super Bum should spawn a trinket
- if trinketCounter >= 2 then -- check if the player doesn't have two Key themed trinkets and then spawn an other item
- if has.AllItems == true then -- the player has all key items
- -- we "breakfast"
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
- else
- -- spawn an item which is left in the pool
- local pickItem = math.random(#itemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
- end
- else -- he spawns a trinket
- local pickTrinket = math.random(#trinketPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketPool[pickTrinket], spawner.Position, Vector(0,0), spawner)
- end
- end
- else
- -- spawn Dad's Key
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_DADS_KEY, spawner.Position, Vector(0,0), spawner)
- has.DadsKey = true
- end
- elseif keyrolltwo < 50 then
- -- get the collectible rng
- local rngthree = player:GetCollectibleRNG(199) -- 199 = Mom's Key
- local keythree = rngthree:RandomInt(100)
- if player:HasCollectible(199) then
- -- if the player has the item then we spawn another item or trinket
- if keythree < 50 then -- we spawn an item
- if has.AllItems == true then -- the player has all key items
- -- we "breakfast"
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
- else
- -- spawn an item which is left in the pool
- local pickItem = math.random(#itemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
- -- check for Dad's Key
- if itemPool[pickItem] == 175 then
- has.DadsKey = true
- end
- end
- else
- -- Super Buh should spawn a trinket
- if trinketCounter >= 2 then -- check if the player doesn't have two Key themed trinkets and then spawn an other item
- if has.AllItems == true then -- the player has all key items
- -- we "breakfast"
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
- else
- -- spawn an item which is left in the pool
- local pickItem = math.random(#itemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
- -- check for Dad's Key
- if itemPool[pickItem] == 175 then
- has.DadsKey = true
- end
- end
- else -- we spawns a trinket
- local pickTrinket = math.random(#trinketPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketPool[pickTrinket], spawner.Position, Vector(0,0), spawner)
- end
- end
- else
- -- spawn Mom's Key
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_MOMS_KEY, spawner.Position, Vector(0,0), spawner)
- end
- elseif keyrolltwo < 70 then
- -- get the collectible rng
- local rngfour = player:GetCollectibleRNG(343) -- 343 = Latch Key
- local keyfour = rngfour:RandomInt(100)
- if player:HasCollectible(343) then
- -- if the player has the item then we spawn another item or trinket
- if keyfour < 50 then -- we spawn an item
- if has.AllItems == true then -- the player has all key items
- -- we "breakfast"
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
- else
- -- spawn an item which is left in the pool
- local pickItem = math.random(#itemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
- -- check for Dad's Key
- if itemPool[pickItem] == 175 then
- has.DadsKey = true
- end
- end
- else
- -- we should spawn a trinket
- if trinketCounter >= 2 then -- check if the player doesn't have two Key themed trinkets and then spawn an other item
- if has.AllItems == true then -- the player has all key items
- -- we "breakfast"
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
- else
- -- spawn an item which is left in the pool
- local pickItem = math.random(#itemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
- -- check for Dad's Key
- if itemPool[pickItem] == 175 then
- has.DadsKey = true
- end
- end
- else -- we spawn a trinket
- local pickTrinket = math.random(#trinketPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketPool[pickTrinket], spawner.Position, Vector(0,0), spawner)
- end
- end
- else
- -- spawn Latch Key
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_LATCH_KEY, spawner.Position, Vector(0,0), spawner)
- end
- end
- -- reset the item and trinket pools?
- itemPool = resetItemPool
- trinketPool = resetTrinketPool
- trinketCounter = 0
- Mod:SaveData(trinketCounter)
- end
- local function KeyTrinketPool(spawner, keyrolltwo)
- local player = Isaac.GetPlayer(0)
- -- item & trinket pools
- local itemPool = {17,175,199,343} -- 17 = Skeleton Key, 175 = Dad's Key, 199 = Mom's Key, 343 = Latch Key
- local trinketPool = {19,36,83} -- 19 = Paper Clip, 36 = Rusted Key, 83 = Store Key
- -- variables
- local spawned = false -- keeps track if Super Bum has spawned a trinket
- -- check if the player has a key themed trinket and empty the trinket pool
- if player:GetTrinket(0) == TrinketType.TRINKET_STORE_KEY
- or player:GetTrinket(1) == TrinketType.TRINKET_STORE_KEY then
- table.remove(trinketPool, 3)
- trinketCounter = trinketCounter + 1
- Mod:SaveData(trinketCounter)
- has.StoreKey = true -- player has the Store Key trinket
- else
- has.StoreKey = false
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_RUSTED_KEY
- or player:GetTrinket(1) == TrinketType.TRINKET_RUSTED_KEY then
- table.remove(trinketPool, 2)
- trinketCounter = trinketCounter + 1
- Mod:SaveData(trinketCounter)
- has.RustedKey = true -- player has the Rusted Key trinket
- else
- has.RustedKey = false
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_PAPER_CLIP
- or player:GetTrinket(1) == TrinketType.TRINKET_PAPER_CLIP then
- table.remove(trinketPool, 1)
- trinketCounter = trinketCounter + 1
- Mod:SaveData(trinketCounter)
- has.PaperClip = true -- player has the Paper Clip trinket
- else
- has.PaperClip = false
- end
- -- empty the item pool table
- if player:HasCollectible(343) then -- Latch Key
- table.remove(itemPool, 4) -- remove the item from the table/pool
- end
- if player:HasCollectible(199) then -- Mom's Key
- table.remove(itemPool, 3)
- end
- if player:HasCollectible(175) -- Dad's Key
- or has.DadsKey == true then
- table.remove(itemPool, 2)
- end
- if player:HasCollectible(17) then -- Skeleton Key
- table.remove(itemPool, 1)
- end
- -- different actions depending on the amount of trinkets
- if trinketCounter == 2 then
- -- Isaac.ConsoleOutput("trinketCounter = 2")
- -- we spawn an item
- if has.AllItems == true then
- -- "breakfast"
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
- else
- -- spawn an item from the pool
- local pickItem = math.random(#itemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
- -- check for Dad's Key
- if itemPool[pickItem] == 175 then
- has.DadsKey = true
- end
- end
- spawned = true
- end
- if trinketCounter == 1 then -- there's a chamce to spawn an item
- -- Isaac.ConsoleOutput("trinketCounter = 1")
- -- check which key themed trinket the player has
- -- does he has the Store Key
- if has.StoreKey == true then
- -- get the RNG
- local rngfive = player:GetTrinketRNG(TrinketType.TRINKET_STORE_KEY)
- local keyfive = rngfive:RandomInt(100)
- if keyfive < 50 then
- -- spawn item
- if has.AllItems == true then
- -- "breakfast"
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
- else
- -- spawn an item from the pool
- local pickItem = math.random(#itemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
- -- check for Dad's Key
- if itemPool[pickItem] == 175 then
- has.DadsKey = true
- end
- end
- else
- -- 50% chance to spawn a different trinket
- local pickTrinket = math.random(#trinketPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketPool[pickTrinket], spawner.Position, Vector(0,0), spawner)
- end
- spawned = true
- -- does he has the Rusted Key
- elseif has.RustedKey == true then
- -- get the RNG
- local rngsix = player:GetTrinketRNG(TrinketType.TRINKET_RUSTED_KEY)
- local keysix = rngsix:RandomInt(100)
- if keysix < 50 then
- -- spawn item
- if has.AllItems == true then
- -- "breakfast"
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
- else
- -- spawn an item from the pool
- local pickItem = math.random(#itemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
- -- check for Dad's Key
- if itemPool[pickItem] == 175 then
- has.DadsKey = true
- end
- end
- else
- -- 50% chance to spawn a different trinket
- local pickTrinket = math.random(#trinketPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketPool[pickTrinket], spawner.Position, Vector(0,0), spawner)
- end
- spawned = true
- -- does he has the Paper Clip
- elseif has.PaperClip == true then
- -- get the RNG
- local rngseven = player:GetTrinketRNG(TrinketType.TRINKET_PAPER_CLIP)
- local keyseven = rngseven:RandomInt(100)
- if keyseven < 50 then
- -- spawn item
- if has.AllItems == true then
- -- "breakfast"
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
- else
- -- spawn an item from the pool
- local pickItem = math.random(#itemPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
- -- check for Dad's Key
- if itemPool[pickItem] == 175 then
- has.DadsKey = true
- end
- end
- else
- -- 50% chance to spawn a different trinket
- local pickTrinket = math.random(#trinketPool)
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketPool[pickTrinket], spawner.Position, Vector(0,0), spawner)
- end
- spawned = true
- end
- else
- if spawned == false then
- -- Isaac.ConsoleOutput("trinketCounter = 0")
- --spawn a key themed trinket
- if keyrolltwo < 86 then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_PAPER_CLIP, spawner.Position, Vector(0,0), spawner)
- elseif keyrolltwo < 103 then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_RUSTED_KEY, spawner.Position, Vector(0,0), spawner)
- else
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_STORE_KEY, spawner.Position, Vector(0,0), spawner)
- end
- end
- end
- -- reset the item and trinket pools?
- itemPool = resetItemPool
- trinketPool = resetTrinketPool
- spawned = false
- trinketCounter = 0
- Mod:SaveData(trinketCounter)
- end
- -- console commands
- function Mod:costumizeBum(consol,para)
- if consol == "bonusAnimation" then
- if functionality.BonusAnimation == false then
- functionality.BonusAnimation = true
- Isaac.ConsoleOutput("bonus animation will be used")
- else
- functionality.BonusAnimation = false
- Isaac.ConsoleOutput("bonus animation won't be used")
- end
- elseif consol == "moreBums" then
- if functionality.MoreBums == false then
- functionality.MoreBums = true
- Isaac.ConsoleOutput("high chance to find other bums")
- else
- functionality.MoreBums = false
- Isaac.ConsoleOutput("normal chance to find other bums")
- end
- elseif consol == "darkAbility" then
- if functionality.DarkBum == false then
- functionality.DarkBum = true
- Isaac.ConsoleOutput("Dark Bum's ability will be used")
- else
- functionality.DarkBum = false
- Isaac.ConsoleOutput("Dark Bum's ability won't be used")
- end
- elseif consol == "keyAbility" then
- if functionality.KeyBum == false then
- functionality.KeyBum = true
- Isaac.ConsoleOutput("Key Bum's ability will be used")
- else
- functionality.KeyBum = false
- Isaac.ConsoleOutput("Key Bum's ability wont be used")
- end
- elseif consol == "friendAbility" then
- if functionality.BumFriend == false then
- functionality.BumFriend = true
- Isaac.ConsoleOutput("Bum Friend's ability will be used")
- else
- functionality.BumFriend = false
- Isaac.ConsoleOutput("Bum Friend's ability wont be used")
- end
- end
- end
- Mod:AddCallback(ModCallbacks.MC_EXECUTE_CMD, Mod.costumizeBum)
- -- post peffect update
- function Mod:onNewEvent(player)
- local entities = Isaac.GetRoomEntities()
- local entity = Mod.Bum
- -- stuff which happens on Frame 1
- if game:GetFrameCount() == 1 then
- -- spawn in if you want to
- -- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_BUM_FRIEND, Vector(250, 200), Vector(0,0), player)
- -- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_DARK_BUM, Vector(325, 200), Vector(0,0), player)
- -- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_KEY_BUM, Vector(400, 200), Vector(0,0), player)
- -- set variables back to zero
- HeartCounter = 0
- KeyCounter = 0
- Extra = 0
- ExtraLuck = 0
- Mod:SaveData(ExtraLuck)
- has.DadsKey = false
- end
- -- check if the player has Mod
- if player:HasCollectible(388)
- and player:HasCollectible(278)
- and player:HasCollectible(144) then
- superbum.Init = true -- player has Super Bum
- else
- superbum.Init = false -- player doesn't have Super Bum
- end
- -- check if Mod spawned every item
- if superbum.Init == true then
- if player:HasCollectible(343)
- and player:HasCollectible(199)
- and player:HasCollectible(17) then
- if has.DadsKey == true
- or player:GetActiveItem() == CollectibleType.COLLECTIBLE_DADS_KEY then
- has.AllItems = true -- we set has.AllItems to true
- else
- has.AllItems = false -- we set has.AllItems to false
- end
- else
- has.AllItems = false -- we set has.AllItems to false
- end
- end
- -- keep track of Super Bum
- if superbum.Init == true then -- if the player has Super Bum
- for a = 1, #entities do -- we go through all entites in the room
- local bum = entities[a]
- if bum.Type == EntityType.ENTITY_FAMILIAR then
- if bum.Variant == FamiliarVariant.SUPER_BUM then
- entity = bum
- end
- end
- end
- -- Dark Bum's extra effect
- if player:GetPlayerType() == PlayerType.PLAYER_KEEPER
- and functionality.DarkBum == true then
- -- if the player is the Keeper then we look for red hearts
- for b = 1, #entities do
- local toSteal = entities[b] -- variable which keeps track of all the hearts Super Bum can steal
- if toSteal.Type == EntityType.ENTITY_PICKUP
- and toSteal.Variant == PickupVariant.PICKUP_HEART then
- -- look for all kinds of red hearts
- if toSteal.SubType == HeartSubType.HEART_HALF
- and (not toSteal:ToPickup():IsShopItem()) then
- toSteal:Remove() -- remove the heart before it gets turned into a blue fly
- entity:GetSprite():Play("Steal", true) -- play steal animation
- if entity:GetSprite():IsPlaying("Steal") then
- -- increase the heart counter
- HeartCounter = HeartCounter + 1
- Mod:SaveData(HeartCounter)
- -- check if he should spawn coins
- if HeartCounter >= 5 then -- pay out at 2,5 red hearts
- superbum.CoinPayout = true -- allows Super Bum to spawn coins
- end
- end
- elseif toSteal.SubType == HeartSubType.HEART_FULL
- and (not toSteal:ToPickup():IsShopItem()) then
- toSteal:Remove() -- remove the heart before it gets turned into a blue fly
- entity:GetSprite():Play("Steal", true)
- if entity:GetSprite():IsPlaying("Steal") then
- -- increase the heart counter
- HeartCounter = HeartCounter + 2
- Mod:SaveData(HeartCounter)
- -- Isaac.ConsoleOutput("Heart Counter")
- -- check if he should spawn coins
- if HeartCounter >= 5 then
- superbum.CoinPayout = true -- allows Super Bum to spawn coins
- end
- end
- elseif toSteal.SubType == HeartSubType.HEART_SCARED
- and (not toSteal:ToPickup():IsShopItem()) then
- toSteal:Remove() -- remove the heart before it gets turned into a blue fly
- entity:GetSprite():Play("Steal", true)
- if entity:GetSprite():IsPlaying("Steal") then
- -- increase the heart counter
- HeartCounter = HeartCounter + 2
- Mod:SaveData(HeartCounter)
- -- check if he should spawn coins
- if HeartCounter >= 5 then
- superbum.CoinPayout = true -- allows Super Bum to spawn coins
- end
- end
- elseif toSteal.SubType == HeartSubType.HEART_DOUBLEPACK
- and (not toSteal:ToPickup():IsShopItem()) then
- toSteal:Remove() -- remove the heart before it gets turned into a blue fly
- entity:GetSprite():Play("Steal", true)
- if entity:GetSprite():IsPlaying("Steal") then
- -- increase the heart counter
- HeartCounter = HeartCounter + 4
- Mod:SaveData(HeartCounter)
- -- check if he should spawn coins
- if HeartCounter >= 5 then
- superbum.CoinPayout = true -- allows Super Bum to spawn coins
- end
- end
- end
- end
- end
- end
- -- check Super Bums position
- if entity.Position:Distance(player.Position) <= 95 -- if he is close to the player
- and (not entity:GetSprite():IsPlaying("PreSpawn")) -- don't interfier with the normal spawn
- and (not entity:GetSprite():IsPlaying("Spawn")) then
- -- Isaac.ConsoleOutput("Close")
- local Sprite = entity:GetSprite()
- if functionality.DarkBum == true then -- Super Bum has Dark Bums ability
- if player:GetPlayerType() == PlayerType.PLAYER_KEEPER then
- if superbum.CoinSpawned == false -- Super Bum hasn't spawned a coin yet,
- and superbum.CoinPayout == true then -- but he can payout with one
- superbum.CoinSpawned = true -- confirms that he spawned a coin
- Sprite:Play("PreSpawnCoin", true) -- triggers the spawn function for coins in the familiar update callback
- end
- end
- end
- if functionality.KeyBum == true then -- Super Bum has Key Bums ability
- if superbum.GoldenKeySpawned == false -- Super Bum hasn't spawned a golden key yet,
- and superbum.GoldenKeyPayout == true then -- but he can payout with one
- superbum.GoldenKeySpawned = true -- confirms that he spawned a golden key
- Sprite:Play("PreSpawnKey", true) -- triggers the spawn function for golden keys in the familiar update callback
- end
- if superbum.KeySpawned == false -- Super Bum hasn't spawned a key themed item or trinket yet,
- and superbum.KeyPayout == true then -- but he can payout with one
- superbum.KeySpawned = true -- confirms that he spawned an item or trinket
- Sprite:Play("PreSpawnItem", true) -- triggers the spawn function for items and trinkets in the familiar update callback
- end
- end
- end
- end
- end
- Mod:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, Mod.onNewEvent)
- -- evalute cache
- function Mod:onCache(player, cacheFlag)
- local entities = Isaac.GetRoomEntities()
- if player:HasCollectible(144)
- and functionality.BumFriend == true then
- player.Luck = player.Luck + ExtraLuck
- end
- end
- Mod:AddCallback(ModCallbacks.MC_EVALUATE_CACHE, Mod.onCache)
- -- on familiar update
- -- Key Bum
- function Mod:onKeyPickup(KBum)
- local player = Isaac.GetPlayer(0)
- local entities = Isaac.GetRoomEntities()
- local rng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_KEY_BUM)
- local roll = rng:RandomInt(100)
- if player:HasCollectible(CollectibleType.COLLECTIBLE_KEY_BUM) then
- -- we check all entities in the room
- for c = 1, #entities do
- -- collision detection
- local entity = entities[c]
- if entity.Type == EntityType.ENTITY_PICKUP
- and KBum.Position:Distance(entity.Position) <= 10
- and (not (player.Position:Distance(entity.Position) <= 40))
- then
- if entity:GetSprite():IsPlaying("Collect")
- and entity:GetData().Picked == nil then
- entity:GetData().Picked = true
- -- pickup specific action
- if entity.Variant == PickupVariant.PICKUP_KEY then
- if entity.SubType == KeySubType.KEY_NORMAL then
- -- key counter
- KeyCounter = KeyCounter + 1
- Mod:SaveData(KeyCounter)
- -- if BumsKeys == 1 then
- end
- if entity.SubType == KeySubType.KEY_CHARGED then
- -- key counter
- KeyCounter = KeyCounter + 1
- Mod:SaveData(KeyCounter)
- -- we charge the active item
- if player:NeedsCharge() then
- -- dont forget Mega Blast
- if player:GetActiveItem() == CollectibleType.COLLECTIBLE_MEGA_SATANS_BREATH then
- player:FullCharge(3)
- else
- player:FullCharge(12)
- end
- end
- end
- -- depending on how high the key counter Key Bum can spawn different things
- if KeyCounter == 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, entity.Position, Vector(0,0), KBum)
- KeyCounter = 0 -- reset the counter to 0
- Mod:SaveData(KeyCounter)
- else
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_LOCKEDCHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
- KeyCounter = 0 -- reset the counter to 0
- Mod:SaveData(KeyCounter)
- end
- else
- if roll < 50 then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_GOLDEN, entity.Position, Vector(0,0), KBum)
- KeyCounter = 0 -- reset the counter to 0
- Mod:SaveData(KeyCounter)
- end
- end
- elseif KeyCounter >= 12 then
- -- the chance to drop something increases with every key picked up
- if KeyCounter == 12 then
- Extra = 35
- elseif KeyCounter == 13 then
- Extra = 45
- elseif KeyCounter == 14 then
- Extra = 55
- elseif KeyCounter == 15 then
- Extra = 70
- elseif KeyCounter == 16 then
- Extra = 85
- elseif KeyCounter == 17 then
- Extra = 100
- end
- if roll < Extra then
- local rolltwo = rng:RandomInt(120)
- if rolltwo < 70 then
- local spawner = KBum
- KeyItemPool(spawner, keyrolltwo)
- else
- local spawner = KBum
- KeyTrinketPool(spawner, keyrolltwo)
- end
- -- reset Extra
- Extra = 0
- end
- end
- end
- end
- end
- end
- end
- end
- Mod:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, Mod.onKeyPickup, FamiliarVariant.KEY_BUM)
- -- Bum Friend
- function Mod:onCoinPickup(Bum)
- local player = Isaac.GetPlayer(0)
- local entities = Isaac.GetRoomEntities()
- local rng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_BUM_FRIEND)
- local roll = rng:RandomInt(100)
- if player:HasCollectible(CollectibleType.COLLECTIBLE_BUM_FRIEND)
- and functionality.BumFriend == true then
- -- we check all entities in the room
- for d = 1, #entities do
- -- collision detection
- local entity = entities[d]
- if entity.Type == EntityType.ENTITY_PICKUP
- and (Bum.Position - entity.Position):Length() < Bum.Size + entity.Size
- then
- if entity:GetSprite():IsPlaying("Collect")
- and entity:GetData().Picked == nil then
- entity:GetData().Picked = true
- -- pickup specific action
- if entity.Variant == PickupVariant.PICKUP_COIN then
- if entity.SubType == CoinSubType.COIN_PENNY then
- -- Penny Trinkets synergies
- if player:GetTrinket(0) == TrinketType.TRINKET_BLOODY_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_BLOODY_PENNY then
- if roll < 50 then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_HEART, HeartSubType.HEART_HALF, entity.Position, Vector(0,0), Bum)
- end
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_BURNT_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_BURNT_PENNY then
- if roll < 50 then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_BOMB, BombSubType.BOMB_NORMAL, entity.Position, Vector(0,0), Bum)
- end
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_FLAT_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_FLAT_PENNY then
- if roll < 50 then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_NORMAL, entity.Position, Vector(0,0), Bum)
- end
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_BUTT_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_BUTT_PENNY then
- if roll < 50 then
- Isaac.GridSpawn(GridEntityType.GRID_POOP, 0, entity.Position, true)
- end
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_ROTTEN_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_ROTTEN_PENNY then
- if roll < 50 then
- Isaac.Spawn(EntityType.ENTITY_FAMILIAR, FamiliarVariant.BLUE_FLY, 0, entity.Position, Vector(0,0), Bum)
- end
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_COUNTERFEIT_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_COUNTERFEIT_PENNY then
- if roll < 50 then
- player:AddCoins(1)
- end
- end
- end
- if entity.SubType == CoinSubType.COIN_NICKEL then
- -- Penny Trinkets synergies
- if player:GetTrinket(0) == TrinketType.TRINKET_BLOODY_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_BLOODY_PENNY then
- if roll < 75 then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_HEART, HeartSubType.HEART_HALF, entity.Position, Vector(0,0), Bum)
- end
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_BURNT_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_BURNT_PENNY then
- if roll < 75 then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_BOMB, BombSubType.BOMB_NORMAL, entity.Position, Vector(0,0), Bum)
- end
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_FLAT_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_FLAT_PENNY then
- if roll < 75 then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_NORMAL, entity.Position, Vector(0,0), Bum)
- end
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_BUTT_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_BUTT_PENNY then
- if roll < 75 then
- Isaac.GridSpawn(GridEntityType.GRID_POOP, 0, entity.Position, true)
- end
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_ROTTEN_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_ROTTEN_PENNY then
- Isaac.Spawn(EntityType.ENTITY_FAMILIAR, FamiliarVariant.BLUE_FLY, 0, entity.Position, Vector(0,0), Bum)
- end
- end
- if entity.SubType == CoinSubType.COIN_DIME then
- -- Penny Trinkets synergies
- if player:GetTrinket(0) == TrinketType.TRINKET_BLOODY_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_BLOODY_PENNY then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_HEART, HeartSubType.HEART_HALF, entity.Position, Vector(0,0), Bum)
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_BURNT_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_BURNT_PENNY then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_BOMB, BombSubType.BOMB_NORMAL, entity.Position, Vector(0,0), Bum)
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_FLAT_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_FLAT_PENNY then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_NORMAL, entity.Position, Vector(0,0), Bum)
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_BUTT_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_BUTT_PENNY then
- Isaac.GridSpawn(GridEntityType.GRID_POOP, 0, entity.Position, true)
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_ROTTEN_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_ROTTEN_PENNY then
- Isaac.Spawn(EntityType.ENTITY_FAMILIAR, FamiliarVariant.BLUE_FLY, 0, entity.Position, Vector(0,0), Bum)
- end
- end
- if entity.SubType == CoinSubType.COIN_LUCKYPENNY then
- ExtraLuck = ExtraLuck + 1
- player.Luck = player.Luck + 1
- end
- end
- end
- end
- end
- end
- end
- Mod:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, Mod.onCoinPickup, FamiliarVariant.BUM_FRIEND)
- -- Dark Bum
- function Mod:onHeartPickup(DaBum)
- local player = Isaac.GetPlayer(0)
- local entities = Isaac.GetRoomEntities() -- all entities in the room
- local entity = DaBum
- local Sprite = entity:GetSprite()
- local rng = player:GetCollectibleRNG(278) -- 278 = Dark Bum
- local numCoins = (rng:RandomInt(2)) + 2 -- number of coins Dark Bum spawns if you play as the Keeper
- if player:HasCollectible(CollectibleType.COLLECTIBLE_DARK_BUM) then
- -- if you play as the Lost
- if player:GetPlayerType() == PlayerType.PLAYER_THELOST then
- if Sprite:IsPlaying("Spawn") then
- if Sprite:GetFrame() == 1 then
- for e = 1, #entities do
- local entitis = entities[e]
- if entitis.Type == EntityType.ENTITY_PICKUP
- and entitis.Variant == PickupVariant.PICKUP_HEART
- and entitis.SubType == HeartSubType.HEART_SOUL then
- if entitis.SpawnerType == EntityType.ENTITY_FAMILIAR
- and entitis.SpawnerVariant == FamiliarVariant.DARK_BUM then
- entitis:Remove()
- local numBlueSpider = 2 -- number of spiders Dark Bum will spawn
- for k = 1, numBlueSpider do
- player:ThrowBlueSpider(entity.Position, player.Position)
- end
- end
- end
- end
- end
- end
- end
- -- if you play as the Keeper
- if Sprite:IsFinished("PreCoin") then
- HeartCounter = HeartCounter - 5
- Mod:SaveData(HeartCounter)
- Sprite:Play("SpawnCoin", true)
- for f = 1, numCoins do
- angle = math.random(math.floor(360/numCoins)) -- get the angle
- angleVector = Vector.FromAngle(angle + (f-1)*(math.floor(360/numCoins))) -- this distributes the coins equally around Dark Bum
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COIN, CoinSubType.COIN_PENNY, entity.Position, angleVector, entity)
- end
- end
- if Sprite:IsFinished("SpawnCoin") then
- if HeartCounter < 5 then
- DarkBum.PAYOUT = false
- DarkBum.SPAWNED = false
- else
- DarkBum.PAYOUT = true
- DarkBum.SPAWNED = false
- end
- end
- if Sprite:IsFinished("SpawnCoin") or Sprite:IsFinished("Steal") or Sprite:IsFinished("AltSteal") then
- Sprite:Play("FloatDown", true)
- end
- end
- end
- Mod:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, Mod.onHeartPickup, FamiliarVariant.DARK_BUM)
- -- Super Bum
- function Mod:onConsumablePickup(SBum) -- SBum is the variable for the familiar Super Bum
- local player = Isaac.GetPlayer(0)
- local entities = Isaac.GetRoomEntities()
- local Sprite = SBum:GetSprite()
- local numCoins
- -- make global if needed
- local rng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_BUM_FRIEND)
- local roll = rng:RandomInt(100)
- local keybumrng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_KEY_BUM)
- local keyroll = keybumrng:RandomInt(100)
- local keyrolltwo = keybumrng:RandomInt(120)
- local coinrng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_DARK_BUM)
- local numCoins = (coinrng:RandomInt(2)) + 2 -- number of coins Dark Bum spawns if you play as the Keeper
- -- first we check all entities in the room
- for j = 1, #entities do
- local entity = entities[j]
- if entity.Type == EntityType.ENTITY_PICKUP then
- -- the collision detection depends on the type pickup
- -- first key collision code
- if SBum.Position:Distance(entity.Position) <= 10
- and (not(player.Position:Distance(entity.Position) <= 40)) then
- if entity.Variant == PickupVariant.PICKUP_KEY
- and functionality.KeyBum == true then -- we check if Super Bum should have Key Bums ability
- if entity:GetSprite():IsPlaying("Collect")
- and entity:GetData().Picked == nil then
- entity:GetData().Picked = true
- -- Sub type specific actions
- if entity.SubType == KeySubType.KEY_NORMAL then -- normal keys
- -- increase the key counter
- KeyCounter = KeyCounter + 1
- Mod:SaveData(KeyCounter)
- elseif entity.SubType == KeySubType.KEY_CHARGED then -- charged keys
- -- increase the key counter
- KeyCounter = KeyCounter + 1
- Mod:SaveData(KeyCounter)
- -- charge the active item
- if player:NeedsCharge() then -- if the active item could be charged
- if player:GetActiveItem() == CollectibleType.COLLECTIBLE_MEGA_SATANS_BREATH then -- don't forget Mega Blast
- player:FullCharge(3) -- Mega Blast only gets three charges from a battery
- else
- player:FullCharge(12) -- this covers every active item
- end
- end
- end
- -- check the amount of keys and set up animation if needed
- -- first we check the amount of keys
- if KeyCounter == 7 then
- if has.AllItems == true then -- if the player has all key items and/or Super Bum spawned Dads Key
- if superbum.GoldenKeyPayout == false then --if he shouldn't spawn one already
- -- we set the variables to allow a payout
- superbum.GoldenKeyPayout = true -- lets Super Bum spawn a key
- superbum.GoldenKeySpawned = false
- -- we substract 7 from KeyCounter
- KeyCounter = KeyCounter - 7
- Mod:SaveData(KeyCounter)
- -- Isaac.ConsoleOutput("Spawn Golden Key")
- end
- else -- if the player hasn't all the key items
- -- we flip a coin
- if keyroll < 50 then -- 0 for testing
- if superbum.GoldenKeyPayout == false then -- if he shouldn't spawn a key already
- -- for testing purpose we spawn a golden key
- -- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_GOLDEN, entity.Position, Vector(0,0), SBum)
- -- animation has to be set up
- superbum.GoldenKeyPayout = true -- lets Super Bum spawn a Key
- superbum.GoldenKeySpawned = false
- -- we substract 7 from KeyCounter
- KeyCounter = KeyCounter - 7
- Mod:SaveData(KeyCounter)
- end
- end
- end
- elseif KeyCounter >= 12 -- the amount needed to have a chance to spawn an item/trinket
- and has.AllItems == false then
- -- check if he shouldn't already spawn a item/trinket
- if superbum.KeyPayout == false then
- -- set up Extra and minusKeys
- if KeyCounter == 12 then
- Extra = 35
- minusKeys = 12
- elseif KeyCounter == 13 then
- Extra = 45
- minusKeys = 13
- elseif KeyCounter == 14 then
- Extra = 55
- minusKeys = 14
- elseif KeyCounter == 15 then
- Extra = 70
- minusKeys = 15
- elseif KeyCounter == 16 then
- Extra = 85
- minusKeys = 16
- elseif KeyCounter == 17 then
- Extra = 100
- minusKeys = 17
- end
- -- check if he has a chance to spawn an item/trinket
- if keyroll < Extra then -- testing
- -- set the variables
- superbum.KeyPayout = true -- allows Super Bum to spawn an item
- superbum.KeySpawned = false -- truns true if Super Bum spawned an item
- -- substract 'minusKeys' from 'KeyCounter'
- KeyCounter = KeyCounter - minusKeys
- Mod:SaveData(KeyCounter)
- -- reset Exrta and minusKeys
- Extra = 0
- minusKeys = 0
- -- Isaac.ConsoleOutput("Reset")
- end
- end
- end
- end
- end
- end
- -- second coin collision code
- if (SBum.Position - entity.Position):Length() < SBum.Size + entity.Size then
- -- Isaac.ConsoleOutput("SPAWN INIT")
- if functionality.BumFriend == true then -- we check if Super Bum should have Bum Friends ability
- if entity:GetSprite():IsPlaying("Collect")
- and entity:GetData().Picked == nil then
- entity:GetData().Picked = true
- -- Sub type specific actions
- if entity.Variant == PickupVariant.PICKUP_COIN then
- if entity.SubType == CoinSubType.COIN_PENNY then
- -- Penny Trinkets synergies
- if player:GetTrinket(0) == TrinketType.TRINKET_BLOODY_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_BLOODY_PENNY then
- if roll < 50 then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_HEART, HeartSubType.HEART_HALF, entity.Position, Vector(0,0), SBum)
- end
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_BURNT_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_BURNT_PENNY then
- if roll < 50 then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_BOMB, BombSubType.BOMB_NORMAL, entity.Position, Vector(0,0), SBum)
- end
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_FLAT_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_FLAT_PENNY then
- if roll < 50 then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_NORMAL, entity.Position, Vector(0,0), SBum)
- end
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_BUTT_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_BUTT_PENNY then
- if roll < 50 then
- Isaac.GridSpawn(GridEntityType.GRID_POOP, 0, entity.Position, true)
- end
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_ROTTEN_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_ROTTEN_PENNY then
- if roll < 50 then
- Isaac.Spawn(EntityType.ENTITY_FAMILIAR, FamiliarVariant.BLUE_FLY, 0, entity.Position, Vector(0,0), SBum)
- end
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_COUNTERFEIT_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_COUNTERFEIT_PENNY then
- if roll < 50 then
- player:AddCoins(1)
- end
- end
- elseif entity.SubType == CoinSubType.COIN_NICKEL then
- -- Penny Trinkets synergies
- if player:GetTrinket(0) == TrinketType.TRINKET_BLOODY_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_BLOODY_PENNY then
- if roll < 75 then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_HEART, HeartSubType.HEART_HALF, entity.Position, Vector(0,0), SBum)
- end
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_BURNT_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_BURNT_PENNY then
- if roll < 75 then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_BOMB, BombSubType.BOMB_NORMAL, entity.Position, Vector(0,0), SBum)
- end
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_FLAT_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_FLAT_PENNY then
- if roll < 75 then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_NORMAL, entity.Position, Vector(0,0), SBum)
- end
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_BUTT_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_BUTT_PENNY then
- if roll < 75 then
- Isaac.GridSpawn(GridEntityType.GRID_POOP, 0, entity.Position, true)
- end
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_ROTTEN_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_ROTTEN_PENNY then
- if roll < 75 then
- Isaac.Spawn(EntityType.ENTITY_FAMILIAR, FamiliarVariant.BLUE_FLY, 0, entity.Position, Vector(0,0), SBum)
- end
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_COUNTERFEIT_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_COUNTERFEIT_PENNY then
- if roll < 75 then
- player:AddCoins(1)
- end
- end
- elseif entity.SubType == CoinSubType.COIN_DIME then
- -- Penny Trinkets synergies
- if player:GetTrinket(0) == TrinketType.TRINKET_BLOODY_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_BLOODY_PENNY then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_HEART, HeartSubType.HEART_HALF, entity.Position, Vector(0,0), SBum)
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_BURNT_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_BURNT_PENNY then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_BOMB, BombSubType.BOMB_NORMAL, entity.Position, Vector(0,0), SBum)
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_FLAT_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_FLAT_PENNY then
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_NORMAL, entity.Position, Vector(0,0), SBum)
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_BUTT_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_BUTT_PENNY then
- Isaac.GridSpawn(GridEntityType.GRID_POOP, 0, entity.Position, true)
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_ROTTEN_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_ROTTEN_PENNY then
- Isaac.Spawn(EntityType.ENTITY_FAMILIAR, FamiliarVariant.BLUE_FLY, 0, entity.Position, Vector(0,0), SBum)
- end
- if player:GetTrinket(0) == TrinketType.TRINKET_COUNTERFEIT_PENNY
- or player:GetTrinket(1) == TrinketType.TRINKET_COUNTERFEIT_PENNY then
- player:AddCoins(1)
- end
- elseif entity.SubType == CoinSubType.COIN_LUCKYPENNY then
- if functionality.BonusAnimation == true then
- SBum:GetSprite():Play("ThumbUp", true)
- if SBum:GetSprite():IsPlaying("ThumbUp") then
- player.Luck = player.Luck + 1
- end
- else
- player.Luck = player.Luck + 1
- end
- end
- end
- end
- end
- end
- end
- end
- -- spawn functions
- -- Super/Dark Bums extra ability if you are the Lost
- if player:GetPlayerType() == PlayerType.PLAYER_THELOST
- and functionality.DarkBum == true then
- if Sprite:IsPlaying("Spawn") then
- if Sprite:GetFrame() == 1 then
- for p = 1, #entities do
- local entitis = entities[p]
- if entitis.Type == EntityType.ENTITY_PICKUP
- and entitis.Variant == PickupVariant.PICKUP_HEART then
- if entitis.SubType == HeartSubType.HEART_SOUL
- or entitis.SubType == HeartSubType.HEART_BLACK then
- if entitis.SpawnerType == EntityType.ENTITY_FAMILIAR
- and entitis.SpawnerVariant == FamiliarVariant.SUPER_BUM then
- entitis:Remove()
- local numBlueSpider = 2 -- number of spiders Dark Bum will spawn
- for k = 1, numBlueSpider do
- player:ThrowBlueSpider(SBum.Position, player.Position)
- end
- end
- end
- end
- end
- end
- end
- end
- -- Super/Dark Bums extra ability if you are the Keeper
- if Sprite:IsFinished("PreSpawnCoin") then -- "PreSpawnCoin" can only be played if you are the Keeper
- HeartCounter = HeartCounter - 5 -- reduce the heart counter
- Mod:SaveData(HeartCounter)
- Sprite:Play("SpawnCoin", true)
- -- spawn the coins equally around Super Bum
- for e = 1, numCoins do
- angle = math.random(math.floor(360/numCoins)) -- get the angle
- angleVector = Vector.FromAngle(angle + (e-1)*(math.floor(360/numCoins))) -- this distributes the coins equally around Super Bum
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COIN, CoinSubType.COIN_PENNY, SBum.Position, angleVector, SBum)
- end
- end
- if Sprite:IsFinished("SpawnCoin") then
- -- check if Super Bum shouldn't spawn more coins
- if HeartCounter < 5 then
- superbum.CoinPayout = false -- prevents that Super Bum spawns an other coin
- superbum.CoinSpawned = false
- else
- superbum.CoinPayout = true -- allows Mod to spawn another coin
- superbum.CoinSpawned = false
- end
- -- make Super Bum floats after he spawned something
- Sprite:Play("FloatDown", true)
- end
- -- play float
- if Sprite:IsFinished("Steal")
- or SBum:GetSprite():IsFinished("ThumbUp") then
- Sprite:Play("FloatDown", true)
- end
- -- Key Bums extra ability
- -- Golden keys
- if Sprite:IsFinished("PreSpawnKey") then -- no need to check for the functionality.KeyBum
- -- play spawn animation
- Sprite:Play("SpawnGoldenKey", true)
- -- spawn a golden key
- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_GOLDEN, SBum.Position, Vector(0,0), SBum)
- end
- -- Key themed items/trinkets
- if Sprite:IsFinished("PreSpawnItem") then
- -- play spawn animation
- Sprite:Play("SpawnItem", true)
- -- decide if Super Bum will spawn an item or a trinket
- if keyrolltwo < 70 then -- we spawn an item -- o testing
- local spawner = SBum
- KeyItemPool(spawner, keyrolltwo)
- else -- we spawn a trinket
- local spawner = SBum
- KeyTrinketPool(spawner, keyrolltwo)
- end
- end
- -- After Super Bum finished the 'SpawnGoldenKey' or 'SpawnItem' we check if he could spawn more
- if Sprite:IsFinished("SpawnGoldenKey")
- or Sprite:IsFinished("SpawnItem") then
- if has.AllItems == true then -- he spawned every possible items
- if KeyCounter >= 7 then -- if the key counter is over 7
- superbum.GoldenKeyPayout = true -- he can still spawn a golden Key
- superbum.GoldenKeySpawned = false -- so he can spawn a golden key again
- -- we substract 7 from KeyCounter
- KeyCounter = KeyCounter - 7
- superbum:SaveData(KeyCounter)
- else
- -- we stop him from paying out
- superbum.GoldenKeyPayout = false
- superbum.GoldenKeySpawned = false
- -- just in case Super Bum didn't spawned Dad's Key
- superbum.KeyPayout = false
- superbum.KeySpawned = false
- end
- else
- if KeyCounter == 7 then -- there is a chacne to spawn a golden key
- if keyroll < 50 then -- we flip a coin
- superbum.GoldenKeyPayout = true -- spawn an other key
- superbum.GoldenKeySpawned = false
- -- we substract 7 from KeyCounter
- KeyCounter = KeyCounter - 7
- Mod:SaveData(KeyCounter)
- else
- -- prevent him from spawning another key
- superbum.GoldenKeyPayout = false
- superbum.GoldenKeySpawned = false
- end
- elseif KeyCounter >= 12 then -- there is a chance to spawn an item
- if KeyCounter == 12 then
- Extra = 35
- minusKeys = 12
- elseif KeyCounter == 13 then
- Extra = 45
- minusKeys = 13
- elseif KeyCounter == 14 then
- Extra = 55
- minusKeys = 14
- elseif KeyCounter == 15 then
- Extra = 70
- minusKeys = 15
- elseif KeyCounter == 16 then
- Extra = 85
- minusKeys = 16
- elseif KeyCounter >= 17 then -- there is a possiblity that Super Bum picked up more then 17 keys
- Extra = 100
- minusKeys = 17
- end
- -- after getting sBExtra and minusKeys check if Super Bum could spawn an item
- if keyroll < sBExtra then
- superbum.KeyPayout = true -- he should spawn another item
- superbum.KeySpawned = false -- allows Super Bum to spawn an other item
- -- we substract minusKeys from KeyCounter
- KeyCounter = KeyCounter - minusKeys
- Mod:SaveData(KeyCounter)
- else
- superbum.KeyPayout = false
- superbum.KeySpawned = false
- end
- -- reset sBExrta and minusKeys
- Extra = 0
- minusKeys = 0
- -- Isaac.ConsoleOutput("Reset")
- else
- -- if nothing can happen set the variables back
- -- golden key
- superbum.GoldenKeyPayout = false
- superbum.GoldenKeySpawned = false
- -- items
- superbum.KeyPayout = false
- superbum.KeySpawned = false
- end
- end
- -- make Super Bum float after he spawned something
- Sprite:Play("FloatDown", true)
- end
- -- play float animation
- if Sprite:IsFinished("ThumbUp") then
- Sprite:Play("FloatDown", true)
- end
- end
- Mod:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, Mod.onConsumablePickup, FamiliarVariant.SUPER_BUM)
- -- on new room
- function Mod:onNewRoom(_)
- local player = Isaac.GetPlayer(0)
- local entities = Isaac.GetRoomEntities()
- local roomType = game:GetRoom():GetType()
- local bumPool = {144,278,388}
- if game:GetRoom():IsFirstVisit() == true then
- -- get bumChance
- if Mod.Init == false then -- if the player hasn't Super Bum
- -- the chance increases if the player has a bum
- if player:HasCollectible(388) then
- table.remove(bumPool, 3)
- bumChance = bumChance + 10
- end
- if player:HasCollectible(278) then
- table.remove(bumPool, 2)
- bumChance = bumChance + 10
- end
- if player:HasCollectible(144) then
- table.remove(bumPool, 1)
- bumChance = bumChance + 10
- end
- end
- -- room specific action
- if functionality.MoreBums == true then
- if roomType == RoomType.ROOM_TREASURE then
- local treasurePool = {8,67,88,94,95,96,98,99,100,113,117,131,155,163,167,170,174,178,188,264,265,266,267,268,269,270,271,272,273,275,276,277,280,281,319,320,321,322,361,362,364,365,384,389,390,404,405,426,430,431,435,436,467,469,470,471,473,491,492,508,509,511,537,539,543,544,548}
- for w = 1, #entities do
- local entity = entities[w]
- if entity.Type == EntityType.ENTITY_PICKUP
- and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE then
- -- look for a familiar from the treasure pool
- for r = 1, #treasurePool do
- if entity.SubType == treasurePool[r]
- and entity:GetData().Rerolled == nil then
- entity:GetData().Rerolled = true
- local itemRng = player:GetCollectibleRNG(treasurePool[r])
- local bumRoll = itemRng:RandomInt(100)
- if bumRoll < bumChance then
- -- spaen a random bum
- local pickBum = math.random(#bumPool)
- entity:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, bumPool[pickBum], true)
- end
- end
- end
- end
- end
- elseif roomType == RoomType.ROOM_SECRET then
- local secretPool = {94,131,271,321,389,405}
- for v = 1, #entities do
- local entity = entities[v]
- if entity.Type == EntityType.ENTITY_PICKUP
- and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE then
- -- look for a familiar from the secret pool
- for g = 1, #secretPool do
- if entity.SubType == secretPool[g]
- and entity:GetData().Rerolled == nil then
- entity:GetData().Rerolled = true
- local itemRng = player:GetCollectibleRNG(secretPool[g])
- local bumRoll = itemRng:RandomInt(100)
- if bumRoll < bumChance then
- -- spawn a key bum
- entity:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_KEY_BUM, true)
- end
- end
- end
- end
- end
- elseif roomType == RoomType.ROOM_DEVIL then
- local devilPool = {67,113,163,187,268,269,275,360,412,417,431,433,468,519}
- for z = 1, #entities do
- local entity = entities[z]
- if entity.Type == EntityType.ENTITY_PICKUP
- and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE then
- -- look for a familiar from the devil pool
- for t = 1, #devilPool do
- if entity.SubType == devilPool[t]
- and entity:GetData().Rerolled == nil then
- entity:GetData().Rerolled = true
- local itemRng = player:GetCollectibleRNG(devilPool[t])
- local bumRoll = itemRng:RandomInt(100)
- if bumRoll < bumChance then
- -- spawn a dark bum
- entity:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_DARK_BUM, true)
- end
- end
- end
- end
- end
- end
- -- reset bumChance and bumPool
- bumChance = 0
- bumPool = backBumPool
- end
- end
- end
- Mod:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, Mod.onNewRoom)
- -- on reroll
- function Mod:onReroll(_)
- local player = Isaac.GetPlayer(0)
- local entities = Isaac.GetRoomEntities()
- local roomType = game:GetRoom():GetType()
- local bumPool = {144,278,388}
- -- get bumChance
- if Mod.Init == false then -- if the player hasn't Super Bum
- -- the chance increases if the player has a bum
- if player:HasCollectible(388) then
- table.remove(bumPool, 3)
- bumChance = bumChance + 10
- end
- if player:HasCollectible(278) then
- table.remove(bumPool, 2)
- bumChance = bumChance + 10
- end
- if player:HasCollectible(144) then
- table.remove(bumPool, 1)
- bumChance = bumChance + 10
- end
- end
- if player:GetActiveItem() == CollectibleType.COLLECTIBLE_D6 then
- -- room specific action
- if functionality.MoreBums == true then
- if roomType == RoomType.ROOM_TREASURE then
- local treasurePool = {8,67,88,94,95,96,98,99,100,113,117,131,155,163,167,170,174,178,188,264,265,266,267,268,269,270,271,272,273,275,276,277,280,281,319,320,321,322,361,362,364,365,384,389,390,404,405,426,430,431,435,436,467,469,470,471,473,491,492,508,509,511,537,539,543,544,548}
- for w = 1, #entities do
- local entity = entities[w]
- if entity.Type == EntityType.ENTITY_PICKUP
- and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE then
- -- look for a familiar from the treasure pool
- for i = 1, #treasurePool do
- if entity.SubType == treasurePool[i] then
- local itemRng = player:GetCollectibleRNG(treasurePool[i])
- local bumRoll = itemRng:RandomInt(100)
- if bumRoll < bumChance then
- -- spaen a random bum
- local pickBum = math.random(#bumPool)
- entity:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, bumPool[pickBum], true)
- end
- end
- end
- end
- end
- elseif roomType == RoomType.ROOM_SECRET then
- local secretPool = {94,131,271,321,389,405}
- for v = 1, #entities do
- local entity = entities[v]
- if entity.Type == EntityType.ENTITY_PICKUP
- and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE then
- -- look for a familiar from the secret pool
- for h = 1, #secretPool do
- if entity.SubType == secretPool[h] then
- local itemRng = player:GetCollectibleRNG(secretPool[h])
- local bumRoll = itemRng:RandomInt(100)
- if bumRoll < bumChance then
- -- spawn a key bum
- entity:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_KEY_BUM, true)
- end
- end
- end
- end
- end
- elseif roomType == RoomType.ROOM_DEVIL then
- local devilPool = {67,113,163,187,268,269,275,360,412,417,431,433,468,519}
- for z = 1, #entities do
- local entity = entities[z]
- if entity.Type == EntityType.ENTITY_PICKUP
- and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE then
- -- look for a familiar from the devil pool
- for x = 1, #devilPool do
- if entity.SubType == devilPool[x] then
- local itemRng = player:GetCollectibleRNG(devilPool[x])
- local bumRoll = itemRng:RandomInt(100)
- if bumRoll < bumChance then
- -- spawn a dark bum
- entity:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_DARK_BUM, true)
- end
- end
- end
- end
- end
- end
- -- reset bumChance and bumPool
- bumChance = 0
- bumPool = backBumPool
- end
- end
- end
- Mod:AddCallback(ModCallbacks.MC_USE_ITEM, Mod.onReroll)
Advertisement
Add Comment
Please, Sign In to add comment