Josh64

Better Bums Mod Pack

Mar 6th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 70.00 KB | None | 0 0
  1. local Mod = RegisterMod("betterbums", 1)
  2. local game = Game()
  3.  
  4. -- different counters
  5. local HeartCounter = 0 -- tracks down the number of hearts Super Bum or Dark Bum stole from the player
  6. local KeyCounter = 0
  7. local ExtraLuck = 0 -- keeps track of the keys Super Bum and Key Bum collected
  8. local Extra = 0 -- chance to spawn an item
  9. local minusKeys = 0 -- number which will be subtracted from KeyCount if Super Bum spawns an item or trinket
  10. local trinketCounter = 0 -- keeps track of the key themed trinkets
  11. local bumChance = 0 -- counter which increases when the player has a bum
  12.  
  13. -- variables/tables for Key Bum's effect
  14. local has = {
  15. AllItems = nil, -- does the player has all key themed items
  16. DadsKey = nil, -- did Super Bum or Key Bum spawned Dads Key?
  17. PaperClip = nil, -- = true when the player has Paper Clip
  18. RustedKey = nil, -- = true when the player has Rusted Key
  19. StoreKey = nil -- = true when the player has Store Key
  20. }
  21.  
  22. -- variables for Dark Bum's effect
  23. local darkbum = {
  24. Alt = false, -- allows the player to switch between the two steal animaions
  25. INIT = true, -- prevent Super Bum functionality
  26. SPAWNED = false, -- checks if Dark Bum can spawn something
  27. PAYOUT = nil, -- checks if Dark Bum should spawn something
  28. BUM = nil -- registers Dark Bum
  29. }
  30.  
  31.  
  32. -- variables for Super Bum's effect
  33. local superbum = {
  34. Init = false, -- keeps track if the player has Super Bum
  35. CoinSpawned = false, -- keeps track if Super Bum has already spawned a coin
  36. CoinPayout = false, -- keeps track if Super Bum should payout with a coin
  37. KeySpawned = false, -- keeps track if Super Bum has already spawned a key themed item or trinket
  38. KeyPayout = false, -- keeps track if Super Bum should payout with a key themed item or trinket
  39. GoldenKeySpawned = false, -- keeps track if Super Bum has already spawned a golden key
  40. GoldenKeyPayout = false, -- keeps track if Super Bum should payout with a golden key
  41. Bum = nil -- stores Super Bum as a familiar
  42. }
  43.  
  44. -- variables to costumize Super Bum's abilities and the other bums
  45. local functionality = {
  46. DarkBum = true, -- used to activate or deactive the ability from Dark Bum
  47. KeyBum = true, -- used to activate or deactive the ability from Key Bum
  48. BumFriend = true, -- used to activate or deactive the ability from Bum Friend
  49. SuperDarkBum = true, -- used to activate or deactive Super Bum's Heart ability from Dark Bum
  50. SuperKeyBum = true, -- used to activate or deactive Super Bum's Key ability from Key Bum
  51. ModFriend = true, -- used to activate or deactive Super Bum's Coin ability from Bum Friend
  52. MoreBums = true, -- if true then the player will have higher chance to find classic bums
  53. BonusAnimation = false -- used to activate or deactivate the bonus and alt animations (ThumbUp, AltSteal, AltSpawnItem)
  54. }
  55.  
  56. -- tables for item and trinket pools
  57. -- for Super Bum
  58. local resetItemPool = {17,175,199,343} -- table which is used to restore itemPool?
  59. local resetTrinketPool = {19,36,83} -- table which is used to restore trinketPool?
  60.  
  61. -- to find more bums
  62. local backBumPool = {144,278,388} -- table which is used to restore bumPool?
  63.  
  64. -- 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}
  65. -- local secretPool = {94,131,271,321,389,405}
  66. -- local devilPool = {67,113,163,187,268,269,275,360,412,417,431,433,468,519}
  67.  
  68.  
  69. -- Key Item Pool
  70. local function KeyItemPool(spawner, keyrolltwo)
  71. local player = Isaac.GetPlayer(0)
  72. -- item & trinket pool
  73. local itemPool = {17,175,199,343} -- 17 = Skeleton Key, 175 = Dad's Key, 199 = Mom's Key, 343 = Latch Key
  74. local trinketPool = {19,36,83} -- 19 = Paper Clip, 36 = Rusted Key, 83 = Store Key
  75.  
  76. -- empty the item pool table
  77. if player:HasCollectible(343) then -- Latch Key
  78. table.remove(itemPool, 4) -- remove the item from the table/pool
  79. end
  80. if player:HasCollectible(199) then -- Mom's Key
  81. table.remove(itemPool, 3)
  82. end
  83. if player:HasCollectible(175) -- Dad's Key
  84. or has.DadsKey == true then
  85. table.remove(itemPool, 2)
  86. end
  87. if player:HasCollectible(17) then -- Skeleton Key
  88. table.remove(itemPool, 1)
  89. end
  90.  
  91. -- empty the trinket pool table
  92. if player:GetTrinket(0) == TrinketType.TRINKET_STORE_KEY
  93. or player:GetTrinket(1) == TrinketType.TRINKET_STORE_KEY then
  94. table.remove(trinketPool, 3) -- remove the trinket from the table/pool
  95. trinketCounter = trinketCounter + 1 -- increase the trinket counter
  96. Mod:SaveData(trinketCounter)
  97. end
  98. if player:GetTrinket(0) == TrinketType.TRINKET_RUSTED_KEY
  99. or player:GetTrinket(1) == TrinketType.TRINKET_RUSTED_KEY then
  100. table.remove(trinketPool, 2)
  101. trinketCounter = trinketCounter + 1
  102. Mod:SaveData(trinketCounter)
  103. end
  104. if player:GetTrinket(0) == TrinketType.TRINKET_PAPER_CLIP
  105. or player:GetTrinket(1) == TrinketType.TRINKET_PAPER_CLIP then
  106. table.remove(trinketPool, 1)
  107. trinketCounter = trinketCounter + 1
  108. Mod:SaveData(trinketCounter)
  109. end
  110.  
  111. -- now we check which item should be spawned
  112. if keyrolltwo < 10 then
  113. -- get the collectible rng
  114. local rngone = player:GetCollectibleRNG(17) -- 17 = Skeleton Key
  115. local keyone = rngone:RandomInt(100)
  116.  
  117. if player:HasCollectible(17) then
  118. -- if the player has the item then we spawn another item or trinket
  119. if keyone < 50 then -- we spawn an item
  120. if has.AllItems == true then -- the player has all key items
  121. -- we "breakfast"
  122. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
  123. else
  124. -- spawn an item which is left in the pool
  125. local pickItem = math.random(#itemPool)
  126. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
  127. -- check for Dad's Key
  128. if itemPool[pickItem] == 175 then
  129. has.DadsKey = true
  130. end
  131. end
  132. else
  133. -- we should spawn a trinket
  134. if trinketCounter >= 2 then -- check if the player doesn't have two Key themed trinkets and then spawn an other item
  135. if has.AllItems == true then -- the player has all key items
  136. -- we "breakfast"
  137. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
  138. else
  139. -- spawn an item which is left in the pool
  140. local pickItem = math.random(#itemPool)
  141. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
  142. -- check for Dad's Key
  143. if itemPool[pickItem] == 175 then
  144. has.DadsKey = true
  145. end
  146. end
  147. else -- we spawn a trinket
  148. local pickTrinket = math.random(#trinketPool)
  149. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketPool[pickTrinket], spawner.Position, Vector(0,0), spawner)
  150. end
  151. end
  152. else
  153. -- spawn Skeleton Key
  154. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_SKELETON_KEY, spawner.Position, Vector(0,0), spawner)
  155. end
  156. elseif keyrolltwo < 30 then
  157. -- get the collectible rng
  158. local rngtwo = player:GetCollectibleRNG(175) -- 175 = Dad's Key
  159. local keytwo = rngtwo:RandomInt(100)
  160.  
  161. if player:HasCollectible(175)
  162. or has.DadsKey == true then
  163. -- if the player has the item then we spawn another item or trinket
  164. if keytwo < 50 then -- we spawn an item
  165. if has.AllItems == true then -- the player has all key items
  166. -- we "breakfast"
  167. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
  168. else
  169. -- spawn an item which is left in the pool
  170. local pickItem = math.random(#itemPool)
  171. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
  172. end
  173. else
  174. -- Super Bum should spawn a trinket
  175. if trinketCounter >= 2 then -- check if the player doesn't have two Key themed trinkets and then spawn an other item
  176. if has.AllItems == true then -- the player has all key items
  177. -- we "breakfast"
  178. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
  179. else
  180. -- spawn an item which is left in the pool
  181. local pickItem = math.random(#itemPool)
  182. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
  183. end
  184. else -- he spawns a trinket
  185. local pickTrinket = math.random(#trinketPool)
  186. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketPool[pickTrinket], spawner.Position, Vector(0,0), spawner)
  187. end
  188. end
  189. else
  190. -- spawn Dad's Key
  191. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_DADS_KEY, spawner.Position, Vector(0,0), spawner)
  192. has.DadsKey = true
  193. end
  194. elseif keyrolltwo < 50 then
  195. -- get the collectible rng
  196. local rngthree = player:GetCollectibleRNG(199) -- 199 = Mom's Key
  197. local keythree = rngthree:RandomInt(100)
  198.  
  199. if player:HasCollectible(199) then
  200. -- if the player has the item then we spawn another item or trinket
  201. if keythree < 50 then -- we spawn an item
  202. if has.AllItems == true then -- the player has all key items
  203. -- we "breakfast"
  204. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
  205. else
  206. -- spawn an item which is left in the pool
  207. local pickItem = math.random(#itemPool)
  208. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
  209. -- check for Dad's Key
  210. if itemPool[pickItem] == 175 then
  211. has.DadsKey = true
  212. end
  213. end
  214. else
  215. -- Super Buh should spawn a trinket
  216. if trinketCounter >= 2 then -- check if the player doesn't have two Key themed trinkets and then spawn an other item
  217. if has.AllItems == true then -- the player has all key items
  218. -- we "breakfast"
  219. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
  220. else
  221. -- spawn an item which is left in the pool
  222. local pickItem = math.random(#itemPool)
  223. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
  224. -- check for Dad's Key
  225. if itemPool[pickItem] == 175 then
  226. has.DadsKey = true
  227. end
  228. end
  229. else -- we spawns a trinket
  230. local pickTrinket = math.random(#trinketPool)
  231. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketPool[pickTrinket], spawner.Position, Vector(0,0), spawner)
  232. end
  233. end
  234. else
  235. -- spawn Mom's Key
  236. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_MOMS_KEY, spawner.Position, Vector(0,0), spawner)
  237. end
  238. elseif keyrolltwo < 70 then
  239. -- get the collectible rng
  240. local rngfour = player:GetCollectibleRNG(343) -- 343 = Latch Key
  241. local keyfour = rngfour:RandomInt(100)
  242.  
  243. if player:HasCollectible(343) then
  244. -- if the player has the item then we spawn another item or trinket
  245. if keyfour < 50 then -- we spawn an item
  246. if has.AllItems == true then -- the player has all key items
  247. -- we "breakfast"
  248. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
  249. else
  250. -- spawn an item which is left in the pool
  251. local pickItem = math.random(#itemPool)
  252. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
  253. -- check for Dad's Key
  254. if itemPool[pickItem] == 175 then
  255. has.DadsKey = true
  256. end
  257. end
  258. else
  259. -- we should spawn a trinket
  260. if trinketCounter >= 2 then -- check if the player doesn't have two Key themed trinkets and then spawn an other item
  261. if has.AllItems == true then -- the player has all key items
  262. -- we "breakfast"
  263. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
  264. else
  265. -- spawn an item which is left in the pool
  266. local pickItem = math.random(#itemPool)
  267. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
  268. -- check for Dad's Key
  269. if itemPool[pickItem] == 175 then
  270. has.DadsKey = true
  271. end
  272. end
  273. else -- we spawn a trinket
  274. local pickTrinket = math.random(#trinketPool)
  275. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketPool[pickTrinket], spawner.Position, Vector(0,0), spawner)
  276. end
  277. end
  278. else
  279. -- spawn Latch Key
  280. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_LATCH_KEY, spawner.Position, Vector(0,0), spawner)
  281. end
  282. end
  283. -- reset the item and trinket pools?
  284. itemPool = resetItemPool
  285. trinketPool = resetTrinketPool
  286.  
  287. trinketCounter = 0
  288. Mod:SaveData(trinketCounter)
  289. end
  290.  
  291. local function KeyTrinketPool(spawner, keyrolltwo)
  292. local player = Isaac.GetPlayer(0)
  293. -- item & trinket pools
  294. local itemPool = {17,175,199,343} -- 17 = Skeleton Key, 175 = Dad's Key, 199 = Mom's Key, 343 = Latch Key
  295. local trinketPool = {19,36,83} -- 19 = Paper Clip, 36 = Rusted Key, 83 = Store Key
  296. -- variables
  297. local spawned = false -- keeps track if Super Bum has spawned a trinket
  298.  
  299. -- check if the player has a key themed trinket and empty the trinket pool
  300. if player:GetTrinket(0) == TrinketType.TRINKET_STORE_KEY
  301. or player:GetTrinket(1) == TrinketType.TRINKET_STORE_KEY then
  302. table.remove(trinketPool, 3)
  303. trinketCounter = trinketCounter + 1
  304. Mod:SaveData(trinketCounter)
  305. has.StoreKey = true -- player has the Store Key trinket
  306. else
  307. has.StoreKey = false
  308. end
  309. if player:GetTrinket(0) == TrinketType.TRINKET_RUSTED_KEY
  310. or player:GetTrinket(1) == TrinketType.TRINKET_RUSTED_KEY then
  311. table.remove(trinketPool, 2)
  312. trinketCounter = trinketCounter + 1
  313. Mod:SaveData(trinketCounter)
  314. has.RustedKey = true -- player has the Rusted Key trinket
  315. else
  316. has.RustedKey = false
  317. end
  318. if player:GetTrinket(0) == TrinketType.TRINKET_PAPER_CLIP
  319. or player:GetTrinket(1) == TrinketType.TRINKET_PAPER_CLIP then
  320. table.remove(trinketPool, 1)
  321. trinketCounter = trinketCounter + 1
  322. Mod:SaveData(trinketCounter)
  323. has.PaperClip = true -- player has the Paper Clip trinket
  324. else
  325. has.PaperClip = false
  326. end
  327.  
  328. -- empty the item pool table
  329. if player:HasCollectible(343) then -- Latch Key
  330. table.remove(itemPool, 4) -- remove the item from the table/pool
  331. end
  332. if player:HasCollectible(199) then -- Mom's Key
  333. table.remove(itemPool, 3)
  334. end
  335. if player:HasCollectible(175) -- Dad's Key
  336. or has.DadsKey == true then
  337. table.remove(itemPool, 2)
  338. end
  339. if player:HasCollectible(17) then -- Skeleton Key
  340. table.remove(itemPool, 1)
  341. end
  342.  
  343. -- different actions depending on the amount of trinkets
  344. if trinketCounter == 2 then
  345. -- Isaac.ConsoleOutput("trinketCounter = 2")
  346. -- we spawn an item
  347. if has.AllItems == true then
  348. -- "breakfast"
  349. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
  350. else
  351. -- spawn an item from the pool
  352. local pickItem = math.random(#itemPool)
  353. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
  354. -- check for Dad's Key
  355. if itemPool[pickItem] == 175 then
  356. has.DadsKey = true
  357. end
  358. end
  359. spawned = true
  360. end
  361. if trinketCounter == 1 then -- there's a chamce to spawn an item
  362. -- Isaac.ConsoleOutput("trinketCounter = 1")
  363. -- check which key themed trinket the player has
  364. -- does he has the Store Key
  365. if has.StoreKey == true then
  366. -- get the RNG
  367. local rngfive = player:GetTrinketRNG(TrinketType.TRINKET_STORE_KEY)
  368. local keyfive = rngfive:RandomInt(100)
  369. if keyfive < 50 then
  370. -- spawn item
  371. if has.AllItems == true then
  372. -- "breakfast"
  373. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
  374. else
  375. -- spawn an item from the pool
  376. local pickItem = math.random(#itemPool)
  377. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
  378. -- check for Dad's Key
  379. if itemPool[pickItem] == 175 then
  380. has.DadsKey = true
  381. end
  382. end
  383. else
  384. -- 50% chance to spawn a different trinket
  385. local pickTrinket = math.random(#trinketPool)
  386. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketPool[pickTrinket], spawner.Position, Vector(0,0), spawner)
  387. end
  388. spawned = true
  389. -- does he has the Rusted Key
  390. elseif has.RustedKey == true then
  391. -- get the RNG
  392. local rngsix = player:GetTrinketRNG(TrinketType.TRINKET_RUSTED_KEY)
  393. local keysix = rngsix:RandomInt(100)
  394. if keysix < 50 then
  395. -- spawn item
  396. if has.AllItems == true then
  397. -- "breakfast"
  398. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
  399. else
  400. -- spawn an item from the pool
  401. local pickItem = math.random(#itemPool)
  402. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
  403. -- check for Dad's Key
  404. if itemPool[pickItem] == 175 then
  405. has.DadsKey = true
  406. end
  407. end
  408. else
  409. -- 50% chance to spawn a different trinket
  410. local pickTrinket = math.random(#trinketPool)
  411. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketPool[pickTrinket], spawner.Position, Vector(0,0), spawner)
  412. end
  413. spawned = true
  414. -- does he has the Paper Clip
  415. elseif has.PaperClip == true then
  416. -- get the RNG
  417. local rngseven = player:GetTrinketRNG(TrinketType.TRINKET_PAPER_CLIP)
  418. local keyseven = rngseven:RandomInt(100)
  419. if keyseven < 50 then
  420. -- spawn item
  421. if has.AllItems == true then
  422. -- "breakfast"
  423. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, spawner.Position, Vector(0,0), spawner)
  424. else
  425. -- spawn an item from the pool
  426. local pickItem = math.random(#itemPool)
  427. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], spawner.Position, Vector(0,0), spawner)
  428. -- check for Dad's Key
  429. if itemPool[pickItem] == 175 then
  430. has.DadsKey = true
  431. end
  432. end
  433. else
  434. -- 50% chance to spawn a different trinket
  435. local pickTrinket = math.random(#trinketPool)
  436. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketPool[pickTrinket], spawner.Position, Vector(0,0), spawner)
  437. end
  438. spawned = true
  439. end
  440. else
  441. if spawned == false then
  442. -- Isaac.ConsoleOutput("trinketCounter = 0")
  443. --spawn a key themed trinket
  444. if keyrolltwo < 86 then
  445. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_PAPER_CLIP, spawner.Position, Vector(0,0), spawner)
  446. elseif keyrolltwo < 103 then
  447. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_RUSTED_KEY, spawner.Position, Vector(0,0), spawner)
  448. else
  449. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_STORE_KEY, spawner.Position, Vector(0,0), spawner)
  450. end
  451. end
  452. end
  453.  
  454. -- reset the item and trinket pools?
  455. itemPool = resetItemPool
  456. trinketPool = resetTrinketPool
  457.  
  458. spawned = false
  459. trinketCounter = 0
  460. Mod:SaveData(trinketCounter)
  461. end
  462.  
  463.  
  464.  
  465. -- console commands
  466. function Mod:costumizeBum(consol,para)
  467. if consol == "bonusAnimation" then
  468. if functionality.BonusAnimation == false then
  469. functionality.BonusAnimation = true
  470. Isaac.ConsoleOutput("bonus animation will be used")
  471. else
  472. functionality.BonusAnimation = false
  473. Isaac.ConsoleOutput("bonus animation won't be used")
  474. end
  475. elseif consol == "moreBums" then
  476. if functionality.MoreBums == false then
  477. functionality.MoreBums = true
  478. Isaac.ConsoleOutput("high chance to find other bums")
  479. else
  480. functionality.MoreBums = false
  481. Isaac.ConsoleOutput("normal chance to find other bums")
  482. end
  483. elseif consol == "darkAbility" then
  484. if functionality.DarkBum == false then
  485. functionality.DarkBum = true
  486. Isaac.ConsoleOutput("Dark Bum's ability will be used")
  487. else
  488. functionality.DarkBum = false
  489. Isaac.ConsoleOutput("Dark Bum's ability won't be used")
  490. end
  491.  
  492. elseif consol == "keyAbility" then
  493. if functionality.KeyBum == false then
  494. functionality.KeyBum = true
  495. Isaac.ConsoleOutput("Key Bum's ability will be used")
  496. else
  497. functionality.KeyBum = false
  498. Isaac.ConsoleOutput("Key Bum's ability wont be used")
  499.  
  500. end
  501.  
  502. elseif consol == "friendAbility" then
  503. if functionality.BumFriend == false then
  504. functionality.BumFriend = true
  505. Isaac.ConsoleOutput("Bum Friend's ability will be used")
  506. else
  507. functionality.BumFriend = false
  508. Isaac.ConsoleOutput("Bum Friend's ability wont be used")
  509. end
  510. end
  511. end
  512. Mod:AddCallback(ModCallbacks.MC_EXECUTE_CMD, Mod.costumizeBum)
  513.  
  514. -- post peffect update
  515. function Mod:onNewEvent(player)
  516. local entities = Isaac.GetRoomEntities()
  517. local entity = Mod.Bum
  518.  
  519.  
  520. -- stuff which happens on Frame 1
  521. if game:GetFrameCount() == 1 then
  522. -- spawn in if you want to
  523. -- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_BUM_FRIEND, Vector(250, 200), Vector(0,0), player)
  524. -- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_DARK_BUM, Vector(325, 200), Vector(0,0), player)
  525. -- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_KEY_BUM, Vector(400, 200), Vector(0,0), player)
  526.  
  527. -- set variables back to zero
  528. HeartCounter = 0
  529. KeyCounter = 0
  530. Extra = 0
  531. ExtraLuck = 0
  532. Mod:SaveData(ExtraLuck)
  533. has.DadsKey = false
  534. end
  535.  
  536. -- check if the player has Mod
  537. if player:HasCollectible(388)
  538. and player:HasCollectible(278)
  539. and player:HasCollectible(144) then
  540. superbum.Init = true -- player has Super Bum
  541. else
  542. superbum.Init = false -- player doesn't have Super Bum
  543. end
  544.  
  545. -- check if Mod spawned every item
  546. if superbum.Init == true then
  547. if player:HasCollectible(343)
  548. and player:HasCollectible(199)
  549. and player:HasCollectible(17) then
  550. if has.DadsKey == true
  551. or player:GetActiveItem() == CollectibleType.COLLECTIBLE_DADS_KEY then
  552. has.AllItems = true -- we set has.AllItems to true
  553. else
  554. has.AllItems = false -- we set has.AllItems to false
  555. end
  556. else
  557. has.AllItems = false -- we set has.AllItems to false
  558. end
  559. end
  560.  
  561. -- keep track of Super Bum
  562. if superbum.Init == true then -- if the player has Super Bum
  563. for a = 1, #entities do -- we go through all entites in the room
  564. local bum = entities[a]
  565. if bum.Type == EntityType.ENTITY_FAMILIAR then
  566. if bum.Variant == FamiliarVariant.SUPER_BUM then
  567. entity = bum
  568. end
  569. end
  570. end
  571.  
  572.  
  573. -- Dark Bum's extra effect
  574. if player:GetPlayerType() == PlayerType.PLAYER_KEEPER
  575. and functionality.DarkBum == true then
  576.  
  577. -- if the player is the Keeper then we look for red hearts
  578. for b = 1, #entities do
  579. local toSteal = entities[b] -- variable which keeps track of all the hearts Super Bum can steal
  580. if toSteal.Type == EntityType.ENTITY_PICKUP
  581. and toSteal.Variant == PickupVariant.PICKUP_HEART then
  582.  
  583. -- look for all kinds of red hearts
  584. if toSteal.SubType == HeartSubType.HEART_HALF
  585. and (not toSteal:ToPickup():IsShopItem()) then
  586. toSteal:Remove() -- remove the heart before it gets turned into a blue fly
  587. entity:GetSprite():Play("Steal", true) -- play steal animation
  588. if entity:GetSprite():IsPlaying("Steal") then
  589. -- increase the heart counter
  590. HeartCounter = HeartCounter + 1
  591. Mod:SaveData(HeartCounter)
  592. -- check if he should spawn coins
  593. if HeartCounter >= 5 then -- pay out at 2,5 red hearts
  594. superbum.CoinPayout = true -- allows Super Bum to spawn coins
  595. end
  596. end
  597. elseif toSteal.SubType == HeartSubType.HEART_FULL
  598. and (not toSteal:ToPickup():IsShopItem()) then
  599. toSteal:Remove() -- remove the heart before it gets turned into a blue fly
  600. entity:GetSprite():Play("Steal", true)
  601. if entity:GetSprite():IsPlaying("Steal") then
  602. -- increase the heart counter
  603. HeartCounter = HeartCounter + 2
  604. Mod:SaveData(HeartCounter)
  605. -- Isaac.ConsoleOutput("Heart Counter")
  606.  
  607. -- check if he should spawn coins
  608. if HeartCounter >= 5 then
  609. superbum.CoinPayout = true -- allows Super Bum to spawn coins
  610. end
  611. end
  612. elseif toSteal.SubType == HeartSubType.HEART_SCARED
  613. and (not toSteal:ToPickup():IsShopItem()) then
  614. toSteal:Remove() -- remove the heart before it gets turned into a blue fly
  615. entity:GetSprite():Play("Steal", true)
  616. if entity:GetSprite():IsPlaying("Steal") then
  617. -- increase the heart counter
  618. HeartCounter = HeartCounter + 2
  619. Mod:SaveData(HeartCounter)
  620. -- check if he should spawn coins
  621. if HeartCounter >= 5 then
  622. superbum.CoinPayout = true -- allows Super Bum to spawn coins
  623. end
  624. end
  625. elseif toSteal.SubType == HeartSubType.HEART_DOUBLEPACK
  626. and (not toSteal:ToPickup():IsShopItem()) then
  627. toSteal:Remove() -- remove the heart before it gets turned into a blue fly
  628. entity:GetSprite():Play("Steal", true)
  629. if entity:GetSprite():IsPlaying("Steal") then
  630. -- increase the heart counter
  631. HeartCounter = HeartCounter + 4
  632. Mod:SaveData(HeartCounter)
  633. -- check if he should spawn coins
  634. if HeartCounter >= 5 then
  635. superbum.CoinPayout = true -- allows Super Bum to spawn coins
  636. end
  637. end
  638. end
  639. end
  640. end
  641. end
  642.  
  643. -- check Super Bums position
  644. if entity.Position:Distance(player.Position) <= 95 -- if he is close to the player
  645. and (not entity:GetSprite():IsPlaying("PreSpawn")) -- don't interfier with the normal spawn
  646. and (not entity:GetSprite():IsPlaying("Spawn")) then
  647. -- Isaac.ConsoleOutput("Close")
  648. local Sprite = entity:GetSprite()
  649.  
  650. if functionality.DarkBum == true then -- Super Bum has Dark Bums ability
  651. if player:GetPlayerType() == PlayerType.PLAYER_KEEPER then
  652. if superbum.CoinSpawned == false -- Super Bum hasn't spawned a coin yet,
  653. and superbum.CoinPayout == true then -- but he can payout with one
  654. superbum.CoinSpawned = true -- confirms that he spawned a coin
  655. Sprite:Play("PreSpawnCoin", true) -- triggers the spawn function for coins in the familiar update callback
  656. end
  657. end
  658. end
  659. if functionality.KeyBum == true then -- Super Bum has Key Bums ability
  660. if superbum.GoldenKeySpawned == false -- Super Bum hasn't spawned a golden key yet,
  661. and superbum.GoldenKeyPayout == true then -- but he can payout with one
  662. superbum.GoldenKeySpawned = true -- confirms that he spawned a golden key
  663. Sprite:Play("PreSpawnKey", true) -- triggers the spawn function for golden keys in the familiar update callback
  664.  
  665. end
  666. if superbum.KeySpawned == false -- Super Bum hasn't spawned a key themed item or trinket yet,
  667. and superbum.KeyPayout == true then -- but he can payout with one
  668. superbum.KeySpawned = true -- confirms that he spawned an item or trinket
  669. Sprite:Play("PreSpawnItem", true) -- triggers the spawn function for items and trinkets in the familiar update callback
  670.  
  671. end
  672. end
  673. end
  674. end
  675. end
  676. Mod:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, Mod.onNewEvent)
  677.  
  678. -- evalute cache
  679. function Mod:onCache(player, cacheFlag)
  680. local entities = Isaac.GetRoomEntities()
  681.  
  682. if player:HasCollectible(144)
  683. and functionality.BumFriend == true then
  684. player.Luck = player.Luck + ExtraLuck
  685. end
  686. end
  687. Mod:AddCallback(ModCallbacks.MC_EVALUATE_CACHE, Mod.onCache)
  688. -- on familiar update
  689.  
  690. -- Key Bum
  691. function Mod:onKeyPickup(KBum)
  692. local player = Isaac.GetPlayer(0)
  693. local entities = Isaac.GetRoomEntities()
  694. local rng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_KEY_BUM)
  695. local roll = rng:RandomInt(100)
  696.  
  697. if player:HasCollectible(CollectibleType.COLLECTIBLE_KEY_BUM) then
  698. -- we check all entities in the room
  699. for c = 1, #entities do
  700. -- collision detection
  701. local entity = entities[c]
  702. if entity.Type == EntityType.ENTITY_PICKUP
  703. and KBum.Position:Distance(entity.Position) <= 10
  704. and (not (player.Position:Distance(entity.Position) <= 40))
  705. then
  706. if entity:GetSprite():IsPlaying("Collect")
  707. and entity:GetData().Picked == nil then
  708. entity:GetData().Picked = true
  709. -- pickup specific action
  710. if entity.Variant == PickupVariant.PICKUP_KEY then
  711. if entity.SubType == KeySubType.KEY_NORMAL then
  712. -- key counter
  713. KeyCounter = KeyCounter + 1
  714. Mod:SaveData(KeyCounter)
  715. -- if BumsKeys == 1 then
  716. end
  717. if entity.SubType == KeySubType.KEY_CHARGED then
  718. -- key counter
  719. KeyCounter = KeyCounter + 1
  720. Mod:SaveData(KeyCounter)
  721.  
  722. -- we charge the active item
  723. if player:NeedsCharge() then
  724. -- dont forget Mega Blast
  725. if player:GetActiveItem() == CollectibleType.COLLECTIBLE_MEGA_SATANS_BREATH then
  726. player:FullCharge(3)
  727. else
  728. player:FullCharge(12)
  729. end
  730. end
  731. end
  732.  
  733. -- depending on how high the key counter Key Bum can spawn different things
  734. if KeyCounter == 7 then
  735. if player:HasCollectible(CollectibleType.COLLECTIBLE_SKELETON_KEY)
  736. and player:HasCollectible(CollectibleType.COLLECTIBLE_MOMS_KEY)
  737. and player:HasCollectible(CollectibleType.COLLECTIBLE_LATCH_KEY)
  738. and DadsKey == true then
  739. if roll < 98 then
  740. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_GOLDEN, entity.Position, Vector(0,0), KBum)
  741. KeyCounter = 0 -- reset the counter to 0
  742. Mod:SaveData(KeyCounter)
  743. else
  744. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_LOCKEDCHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
  745. KeyCounter = 0 -- reset the counter to 0
  746. Mod:SaveData(KeyCounter)
  747. end
  748. else
  749. if roll < 50 then
  750. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_GOLDEN, entity.Position, Vector(0,0), KBum)
  751. KeyCounter = 0 -- reset the counter to 0
  752. Mod:SaveData(KeyCounter)
  753. end
  754. end
  755. elseif KeyCounter >= 12 then
  756. -- the chance to drop something increases with every key picked up
  757. if KeyCounter == 12 then
  758. Extra = 35
  759. elseif KeyCounter == 13 then
  760. Extra = 45
  761. elseif KeyCounter == 14 then
  762. Extra = 55
  763. elseif KeyCounter == 15 then
  764. Extra = 70
  765. elseif KeyCounter == 16 then
  766. Extra = 85
  767. elseif KeyCounter == 17 then
  768. Extra = 100
  769. end
  770. if roll < Extra then
  771. local rolltwo = rng:RandomInt(120)
  772. if rolltwo < 70 then
  773. local spawner = KBum
  774. KeyItemPool(spawner, keyrolltwo)
  775. else
  776. local spawner = KBum
  777. KeyTrinketPool(spawner, keyrolltwo)
  778. end
  779. -- reset Extra
  780. Extra = 0
  781. end
  782. end
  783. end
  784. end
  785. end
  786. end
  787. end
  788. end
  789.  
  790. Mod:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, Mod.onKeyPickup, FamiliarVariant.KEY_BUM)
  791.  
  792. -- Bum Friend
  793. function Mod:onCoinPickup(Bum)
  794. local player = Isaac.GetPlayer(0)
  795. local entities = Isaac.GetRoomEntities()
  796. local rng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_BUM_FRIEND)
  797. local roll = rng:RandomInt(100)
  798.  
  799.  
  800. if player:HasCollectible(CollectibleType.COLLECTIBLE_BUM_FRIEND)
  801. and functionality.BumFriend == true then
  802. -- we check all entities in the room
  803. for d = 1, #entities do
  804. -- collision detection
  805. local entity = entities[d]
  806. if entity.Type == EntityType.ENTITY_PICKUP
  807. and (Bum.Position - entity.Position):Length() < Bum.Size + entity.Size
  808. then
  809. if entity:GetSprite():IsPlaying("Collect")
  810. and entity:GetData().Picked == nil then
  811. entity:GetData().Picked = true
  812. -- pickup specific action
  813. if entity.Variant == PickupVariant.PICKUP_COIN then
  814. if entity.SubType == CoinSubType.COIN_PENNY then
  815. -- Penny Trinkets synergies
  816. if player:GetTrinket(0) == TrinketType.TRINKET_BLOODY_PENNY
  817. or player:GetTrinket(1) == TrinketType.TRINKET_BLOODY_PENNY then
  818. if roll < 50 then
  819. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_HEART, HeartSubType.HEART_HALF, entity.Position, Vector(0,0), Bum)
  820. end
  821. end
  822. if player:GetTrinket(0) == TrinketType.TRINKET_BURNT_PENNY
  823. or player:GetTrinket(1) == TrinketType.TRINKET_BURNT_PENNY then
  824. if roll < 50 then
  825. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_BOMB, BombSubType.BOMB_NORMAL, entity.Position, Vector(0,0), Bum)
  826. end
  827. end
  828. if player:GetTrinket(0) == TrinketType.TRINKET_FLAT_PENNY
  829. or player:GetTrinket(1) == TrinketType.TRINKET_FLAT_PENNY then
  830. if roll < 50 then
  831. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_NORMAL, entity.Position, Vector(0,0), Bum)
  832. end
  833. end
  834. if player:GetTrinket(0) == TrinketType.TRINKET_BUTT_PENNY
  835. or player:GetTrinket(1) == TrinketType.TRINKET_BUTT_PENNY then
  836. if roll < 50 then
  837. Isaac.GridSpawn(GridEntityType.GRID_POOP, 0, entity.Position, true)
  838. end
  839. end
  840. if player:GetTrinket(0) == TrinketType.TRINKET_ROTTEN_PENNY
  841. or player:GetTrinket(1) == TrinketType.TRINKET_ROTTEN_PENNY then
  842. if roll < 50 then
  843. Isaac.Spawn(EntityType.ENTITY_FAMILIAR, FamiliarVariant.BLUE_FLY, 0, entity.Position, Vector(0,0), Bum)
  844. end
  845. end
  846. if player:GetTrinket(0) == TrinketType.TRINKET_COUNTERFEIT_PENNY
  847. or player:GetTrinket(1) == TrinketType.TRINKET_COUNTERFEIT_PENNY then
  848. if roll < 50 then
  849. player:AddCoins(1)
  850. end
  851. end
  852. end
  853. if entity.SubType == CoinSubType.COIN_NICKEL then
  854. -- Penny Trinkets synergies
  855. if player:GetTrinket(0) == TrinketType.TRINKET_BLOODY_PENNY
  856. or player:GetTrinket(1) == TrinketType.TRINKET_BLOODY_PENNY then
  857. if roll < 75 then
  858. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_HEART, HeartSubType.HEART_HALF, entity.Position, Vector(0,0), Bum)
  859. end
  860. end
  861. if player:GetTrinket(0) == TrinketType.TRINKET_BURNT_PENNY
  862. or player:GetTrinket(1) == TrinketType.TRINKET_BURNT_PENNY then
  863. if roll < 75 then
  864. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_BOMB, BombSubType.BOMB_NORMAL, entity.Position, Vector(0,0), Bum)
  865. end
  866. end
  867. if player:GetTrinket(0) == TrinketType.TRINKET_FLAT_PENNY
  868. or player:GetTrinket(1) == TrinketType.TRINKET_FLAT_PENNY then
  869. if roll < 75 then
  870. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_NORMAL, entity.Position, Vector(0,0), Bum)
  871. end
  872. end
  873. if player:GetTrinket(0) == TrinketType.TRINKET_BUTT_PENNY
  874. or player:GetTrinket(1) == TrinketType.TRINKET_BUTT_PENNY then
  875. if roll < 75 then
  876. Isaac.GridSpawn(GridEntityType.GRID_POOP, 0, entity.Position, true)
  877. end
  878. end
  879. if player:GetTrinket(0) == TrinketType.TRINKET_ROTTEN_PENNY
  880. or player:GetTrinket(1) == TrinketType.TRINKET_ROTTEN_PENNY then
  881. Isaac.Spawn(EntityType.ENTITY_FAMILIAR, FamiliarVariant.BLUE_FLY, 0, entity.Position, Vector(0,0), Bum)
  882. end
  883. end
  884. if entity.SubType == CoinSubType.COIN_DIME then
  885. -- Penny Trinkets synergies
  886. if player:GetTrinket(0) == TrinketType.TRINKET_BLOODY_PENNY
  887. or player:GetTrinket(1) == TrinketType.TRINKET_BLOODY_PENNY then
  888. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_HEART, HeartSubType.HEART_HALF, entity.Position, Vector(0,0), Bum)
  889. end
  890. if player:GetTrinket(0) == TrinketType.TRINKET_BURNT_PENNY
  891. or player:GetTrinket(1) == TrinketType.TRINKET_BURNT_PENNY then
  892. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_BOMB, BombSubType.BOMB_NORMAL, entity.Position, Vector(0,0), Bum)
  893. end
  894. if player:GetTrinket(0) == TrinketType.TRINKET_FLAT_PENNY
  895. or player:GetTrinket(1) == TrinketType.TRINKET_FLAT_PENNY then
  896. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_NORMAL, entity.Position, Vector(0,0), Bum)
  897. end
  898. if player:GetTrinket(0) == TrinketType.TRINKET_BUTT_PENNY
  899. or player:GetTrinket(1) == TrinketType.TRINKET_BUTT_PENNY then
  900. Isaac.GridSpawn(GridEntityType.GRID_POOP, 0, entity.Position, true)
  901. end
  902. if player:GetTrinket(0) == TrinketType.TRINKET_ROTTEN_PENNY
  903. or player:GetTrinket(1) == TrinketType.TRINKET_ROTTEN_PENNY then
  904. Isaac.Spawn(EntityType.ENTITY_FAMILIAR, FamiliarVariant.BLUE_FLY, 0, entity.Position, Vector(0,0), Bum)
  905. end
  906. end
  907. if entity.SubType == CoinSubType.COIN_LUCKYPENNY then
  908. ExtraLuck = ExtraLuck + 1
  909. player.Luck = player.Luck + 1
  910. end
  911. end
  912. end
  913. end
  914. end
  915. end
  916. end
  917. Mod:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, Mod.onCoinPickup, FamiliarVariant.BUM_FRIEND)
  918.  
  919. -- Dark Bum
  920. function Mod:onHeartPickup(DaBum)
  921. local player = Isaac.GetPlayer(0)
  922. local entities = Isaac.GetRoomEntities() -- all entities in the room
  923. local entity = DaBum
  924. local Sprite = entity:GetSprite()
  925. local rng = player:GetCollectibleRNG(278) -- 278 = Dark Bum
  926. local numCoins = (rng:RandomInt(2)) + 2 -- number of coins Dark Bum spawns if you play as the Keeper
  927.  
  928. if player:HasCollectible(CollectibleType.COLLECTIBLE_DARK_BUM) then
  929.  
  930. -- if you play as the Lost
  931. if player:GetPlayerType() == PlayerType.PLAYER_THELOST then
  932. if Sprite:IsPlaying("Spawn") then
  933. if Sprite:GetFrame() == 1 then
  934. for e = 1, #entities do
  935. local entitis = entities[e]
  936. if entitis.Type == EntityType.ENTITY_PICKUP
  937. and entitis.Variant == PickupVariant.PICKUP_HEART
  938. and entitis.SubType == HeartSubType.HEART_SOUL then
  939. if entitis.SpawnerType == EntityType.ENTITY_FAMILIAR
  940. and entitis.SpawnerVariant == FamiliarVariant.DARK_BUM then
  941. entitis:Remove()
  942. local numBlueSpider = 2 -- number of spiders Dark Bum will spawn
  943. for k = 1, numBlueSpider do
  944. player:ThrowBlueSpider(entity.Position, player.Position)
  945. end
  946. end
  947. end
  948. end
  949. end
  950. end
  951. end
  952.  
  953. -- if you play as the Keeper
  954. if Sprite:IsFinished("PreCoin") then
  955. HeartCounter = HeartCounter - 5
  956. Mod:SaveData(HeartCounter)
  957. Sprite:Play("SpawnCoin", true)
  958. for f = 1, numCoins do
  959. angle = math.random(math.floor(360/numCoins)) -- get the angle
  960. angleVector = Vector.FromAngle(angle + (f-1)*(math.floor(360/numCoins))) -- this distributes the coins equally around Dark Bum
  961. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COIN, CoinSubType.COIN_PENNY, entity.Position, angleVector, entity)
  962. end
  963. end
  964. if Sprite:IsFinished("SpawnCoin") then
  965. if HeartCounter < 5 then
  966. DarkBum.PAYOUT = false
  967. DarkBum.SPAWNED = false
  968. else
  969. DarkBum.PAYOUT = true
  970. DarkBum.SPAWNED = false
  971. end
  972. end
  973.  
  974. if Sprite:IsFinished("SpawnCoin") or Sprite:IsFinished("Steal") or Sprite:IsFinished("AltSteal") then
  975. Sprite:Play("FloatDown", true)
  976. end
  977. end
  978. end
  979. Mod:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, Mod.onHeartPickup, FamiliarVariant.DARK_BUM)
  980.  
  981. -- Super Bum
  982. function Mod:onConsumablePickup(SBum) -- SBum is the variable for the familiar Super Bum
  983.  
  984. local player = Isaac.GetPlayer(0)
  985. local entities = Isaac.GetRoomEntities()
  986. local Sprite = SBum:GetSprite()
  987. local numCoins
  988.  
  989. -- make global if needed
  990.  
  991. local rng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_BUM_FRIEND)
  992. local roll = rng:RandomInt(100)
  993. local keybumrng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_KEY_BUM)
  994. local keyroll = keybumrng:RandomInt(100)
  995. local keyrolltwo = keybumrng:RandomInt(120)
  996. local coinrng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_DARK_BUM)
  997. local numCoins = (coinrng:RandomInt(2)) + 2 -- number of coins Dark Bum spawns if you play as the Keeper
  998.  
  999.  
  1000.  
  1001. -- first we check all entities in the room
  1002. for j = 1, #entities do
  1003. local entity = entities[j]
  1004. if entity.Type == EntityType.ENTITY_PICKUP then
  1005.  
  1006. -- the collision detection depends on the type pickup
  1007. -- first key collision code
  1008. if SBum.Position:Distance(entity.Position) <= 10
  1009. and (not(player.Position:Distance(entity.Position) <= 40)) then
  1010. if entity.Variant == PickupVariant.PICKUP_KEY
  1011. and functionality.KeyBum == true then -- we check if Super Bum should have Key Bums ability
  1012.  
  1013.  
  1014. if entity:GetSprite():IsPlaying("Collect")
  1015. and entity:GetData().Picked == nil then
  1016. entity:GetData().Picked = true
  1017.  
  1018. -- Sub type specific actions
  1019. if entity.SubType == KeySubType.KEY_NORMAL then -- normal keys
  1020. -- increase the key counter
  1021. KeyCounter = KeyCounter + 1
  1022. Mod:SaveData(KeyCounter)
  1023.  
  1024. elseif entity.SubType == KeySubType.KEY_CHARGED then -- charged keys
  1025. -- increase the key counter
  1026. KeyCounter = KeyCounter + 1
  1027. Mod:SaveData(KeyCounter)
  1028.  
  1029. -- charge the active item
  1030. if player:NeedsCharge() then -- if the active item could be charged
  1031. if player:GetActiveItem() == CollectibleType.COLLECTIBLE_MEGA_SATANS_BREATH then -- don't forget Mega Blast
  1032. player:FullCharge(3) -- Mega Blast only gets three charges from a battery
  1033. else
  1034. player:FullCharge(12) -- this covers every active item
  1035. end
  1036. end
  1037. end
  1038. -- check the amount of keys and set up animation if needed
  1039.  
  1040. -- first we check the amount of keys
  1041. if KeyCounter == 7 then
  1042. if has.AllItems == true then -- if the player has all key items and/or Super Bum spawned Dads Key
  1043. if superbum.GoldenKeyPayout == false then --if he shouldn't spawn one already
  1044. -- we set the variables to allow a payout
  1045. superbum.GoldenKeyPayout = true -- lets Super Bum spawn a key
  1046. superbum.GoldenKeySpawned = false
  1047.  
  1048. -- we substract 7 from KeyCounter
  1049. KeyCounter = KeyCounter - 7
  1050. Mod:SaveData(KeyCounter)
  1051. -- Isaac.ConsoleOutput("Spawn Golden Key")
  1052. end
  1053. else -- if the player hasn't all the key items
  1054. -- we flip a coin
  1055. if keyroll < 50 then -- 0 for testing
  1056. if superbum.GoldenKeyPayout == false then -- if he shouldn't spawn a key already
  1057. -- for testing purpose we spawn a golden key
  1058. -- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_GOLDEN, entity.Position, Vector(0,0), SBum)
  1059.  
  1060. -- animation has to be set up
  1061. superbum.GoldenKeyPayout = true -- lets Super Bum spawn a Key
  1062. superbum.GoldenKeySpawned = false
  1063.  
  1064. -- we substract 7 from KeyCounter
  1065. KeyCounter = KeyCounter - 7
  1066. Mod:SaveData(KeyCounter)
  1067. end
  1068. end
  1069. end
  1070. elseif KeyCounter >= 12 -- the amount needed to have a chance to spawn an item/trinket
  1071. and has.AllItems == false then
  1072. -- check if he shouldn't already spawn a item/trinket
  1073. if superbum.KeyPayout == false then
  1074. -- set up Extra and minusKeys
  1075. if KeyCounter == 12 then
  1076. Extra = 35
  1077. minusKeys = 12
  1078. elseif KeyCounter == 13 then
  1079. Extra = 45
  1080. minusKeys = 13
  1081. elseif KeyCounter == 14 then
  1082. Extra = 55
  1083. minusKeys = 14
  1084. elseif KeyCounter == 15 then
  1085. Extra = 70
  1086. minusKeys = 15
  1087. elseif KeyCounter == 16 then
  1088. Extra = 85
  1089. minusKeys = 16
  1090. elseif KeyCounter == 17 then
  1091. Extra = 100
  1092. minusKeys = 17
  1093. end
  1094.  
  1095. -- check if he has a chance to spawn an item/trinket
  1096. if keyroll < Extra then -- testing
  1097. -- set the variables
  1098. superbum.KeyPayout = true -- allows Super Bum to spawn an item
  1099. superbum.KeySpawned = false -- truns true if Super Bum spawned an item
  1100.  
  1101. -- substract 'minusKeys' from 'KeyCounter'
  1102. KeyCounter = KeyCounter - minusKeys
  1103. Mod:SaveData(KeyCounter)
  1104.  
  1105. -- reset Exrta and minusKeys
  1106. Extra = 0
  1107. minusKeys = 0
  1108. -- Isaac.ConsoleOutput("Reset")
  1109. end
  1110. end
  1111. end
  1112. end
  1113. end
  1114. end
  1115. -- second coin collision code
  1116. if (SBum.Position - entity.Position):Length() < SBum.Size + entity.Size then
  1117. -- Isaac.ConsoleOutput("SPAWN INIT")
  1118. if functionality.BumFriend == true then -- we check if Super Bum should have Bum Friends ability
  1119.  
  1120. if entity:GetSprite():IsPlaying("Collect")
  1121. and entity:GetData().Picked == nil then
  1122. entity:GetData().Picked = true
  1123.  
  1124. -- Sub type specific actions
  1125. if entity.Variant == PickupVariant.PICKUP_COIN then
  1126. if entity.SubType == CoinSubType.COIN_PENNY then
  1127. -- Penny Trinkets synergies
  1128. if player:GetTrinket(0) == TrinketType.TRINKET_BLOODY_PENNY
  1129. or player:GetTrinket(1) == TrinketType.TRINKET_BLOODY_PENNY then
  1130. if roll < 50 then
  1131. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_HEART, HeartSubType.HEART_HALF, entity.Position, Vector(0,0), SBum)
  1132. end
  1133. end
  1134. if player:GetTrinket(0) == TrinketType.TRINKET_BURNT_PENNY
  1135. or player:GetTrinket(1) == TrinketType.TRINKET_BURNT_PENNY then
  1136. if roll < 50 then
  1137. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_BOMB, BombSubType.BOMB_NORMAL, entity.Position, Vector(0,0), SBum)
  1138. end
  1139. end
  1140. if player:GetTrinket(0) == TrinketType.TRINKET_FLAT_PENNY
  1141. or player:GetTrinket(1) == TrinketType.TRINKET_FLAT_PENNY then
  1142. if roll < 50 then
  1143. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_NORMAL, entity.Position, Vector(0,0), SBum)
  1144. end
  1145. end
  1146. if player:GetTrinket(0) == TrinketType.TRINKET_BUTT_PENNY
  1147. or player:GetTrinket(1) == TrinketType.TRINKET_BUTT_PENNY then
  1148. if roll < 50 then
  1149. Isaac.GridSpawn(GridEntityType.GRID_POOP, 0, entity.Position, true)
  1150. end
  1151. end
  1152. if player:GetTrinket(0) == TrinketType.TRINKET_ROTTEN_PENNY
  1153. or player:GetTrinket(1) == TrinketType.TRINKET_ROTTEN_PENNY then
  1154. if roll < 50 then
  1155. Isaac.Spawn(EntityType.ENTITY_FAMILIAR, FamiliarVariant.BLUE_FLY, 0, entity.Position, Vector(0,0), SBum)
  1156. end
  1157. end
  1158. if player:GetTrinket(0) == TrinketType.TRINKET_COUNTERFEIT_PENNY
  1159. or player:GetTrinket(1) == TrinketType.TRINKET_COUNTERFEIT_PENNY then
  1160. if roll < 50 then
  1161. player:AddCoins(1)
  1162. end
  1163. end
  1164. elseif entity.SubType == CoinSubType.COIN_NICKEL then
  1165. -- Penny Trinkets synergies
  1166. if player:GetTrinket(0) == TrinketType.TRINKET_BLOODY_PENNY
  1167. or player:GetTrinket(1) == TrinketType.TRINKET_BLOODY_PENNY then
  1168. if roll < 75 then
  1169. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_HEART, HeartSubType.HEART_HALF, entity.Position, Vector(0,0), SBum)
  1170. end
  1171. end
  1172. if player:GetTrinket(0) == TrinketType.TRINKET_BURNT_PENNY
  1173. or player:GetTrinket(1) == TrinketType.TRINKET_BURNT_PENNY then
  1174. if roll < 75 then
  1175. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_BOMB, BombSubType.BOMB_NORMAL, entity.Position, Vector(0,0), SBum)
  1176. end
  1177. end
  1178. if player:GetTrinket(0) == TrinketType.TRINKET_FLAT_PENNY
  1179. or player:GetTrinket(1) == TrinketType.TRINKET_FLAT_PENNY then
  1180. if roll < 75 then
  1181. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_NORMAL, entity.Position, Vector(0,0), SBum)
  1182. end
  1183. end
  1184. if player:GetTrinket(0) == TrinketType.TRINKET_BUTT_PENNY
  1185. or player:GetTrinket(1) == TrinketType.TRINKET_BUTT_PENNY then
  1186. if roll < 75 then
  1187. Isaac.GridSpawn(GridEntityType.GRID_POOP, 0, entity.Position, true)
  1188. end
  1189. end
  1190. if player:GetTrinket(0) == TrinketType.TRINKET_ROTTEN_PENNY
  1191. or player:GetTrinket(1) == TrinketType.TRINKET_ROTTEN_PENNY then
  1192. if roll < 75 then
  1193. Isaac.Spawn(EntityType.ENTITY_FAMILIAR, FamiliarVariant.BLUE_FLY, 0, entity.Position, Vector(0,0), SBum)
  1194. end
  1195. end
  1196. if player:GetTrinket(0) == TrinketType.TRINKET_COUNTERFEIT_PENNY
  1197. or player:GetTrinket(1) == TrinketType.TRINKET_COUNTERFEIT_PENNY then
  1198. if roll < 75 then
  1199. player:AddCoins(1)
  1200. end
  1201. end
  1202. elseif entity.SubType == CoinSubType.COIN_DIME then
  1203. -- Penny Trinkets synergies
  1204. if player:GetTrinket(0) == TrinketType.TRINKET_BLOODY_PENNY
  1205. or player:GetTrinket(1) == TrinketType.TRINKET_BLOODY_PENNY then
  1206. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_HEART, HeartSubType.HEART_HALF, entity.Position, Vector(0,0), SBum)
  1207. end
  1208. if player:GetTrinket(0) == TrinketType.TRINKET_BURNT_PENNY
  1209. or player:GetTrinket(1) == TrinketType.TRINKET_BURNT_PENNY then
  1210. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_BOMB, BombSubType.BOMB_NORMAL, entity.Position, Vector(0,0), SBum)
  1211. end
  1212. if player:GetTrinket(0) == TrinketType.TRINKET_FLAT_PENNY
  1213. or player:GetTrinket(1) == TrinketType.TRINKET_FLAT_PENNY then
  1214. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_NORMAL, entity.Position, Vector(0,0), SBum)
  1215. end
  1216. if player:GetTrinket(0) == TrinketType.TRINKET_BUTT_PENNY
  1217. or player:GetTrinket(1) == TrinketType.TRINKET_BUTT_PENNY then
  1218. Isaac.GridSpawn(GridEntityType.GRID_POOP, 0, entity.Position, true)
  1219. end
  1220. if player:GetTrinket(0) == TrinketType.TRINKET_ROTTEN_PENNY
  1221. or player:GetTrinket(1) == TrinketType.TRINKET_ROTTEN_PENNY then
  1222. Isaac.Spawn(EntityType.ENTITY_FAMILIAR, FamiliarVariant.BLUE_FLY, 0, entity.Position, Vector(0,0), SBum)
  1223. end
  1224. if player:GetTrinket(0) == TrinketType.TRINKET_COUNTERFEIT_PENNY
  1225. or player:GetTrinket(1) == TrinketType.TRINKET_COUNTERFEIT_PENNY then
  1226. player:AddCoins(1)
  1227. end
  1228. elseif entity.SubType == CoinSubType.COIN_LUCKYPENNY then
  1229. if functionality.BonusAnimation == true then
  1230. SBum:GetSprite():Play("ThumbUp", true)
  1231.  
  1232. if SBum:GetSprite():IsPlaying("ThumbUp") then
  1233. player.Luck = player.Luck + 1
  1234. end
  1235. else
  1236. player.Luck = player.Luck + 1
  1237. end
  1238. end
  1239. end
  1240. end
  1241. end
  1242. end
  1243. end
  1244. end
  1245.  
  1246. -- spawn functions
  1247.  
  1248. -- Super/Dark Bums extra ability if you are the Lost
  1249. if player:GetPlayerType() == PlayerType.PLAYER_THELOST
  1250. and functionality.DarkBum == true then
  1251.  
  1252. if Sprite:IsPlaying("Spawn") then
  1253. if Sprite:GetFrame() == 1 then
  1254. for p = 1, #entities do
  1255. local entitis = entities[p]
  1256. if entitis.Type == EntityType.ENTITY_PICKUP
  1257. and entitis.Variant == PickupVariant.PICKUP_HEART then
  1258. if entitis.SubType == HeartSubType.HEART_SOUL
  1259. or entitis.SubType == HeartSubType.HEART_BLACK then
  1260. if entitis.SpawnerType == EntityType.ENTITY_FAMILIAR
  1261. and entitis.SpawnerVariant == FamiliarVariant.SUPER_BUM then
  1262. entitis:Remove()
  1263. local numBlueSpider = 2 -- number of spiders Dark Bum will spawn
  1264. for k = 1, numBlueSpider do
  1265. player:ThrowBlueSpider(SBum.Position, player.Position)
  1266. end
  1267. end
  1268. end
  1269. end
  1270. end
  1271. end
  1272. end
  1273. end
  1274.  
  1275. -- Super/Dark Bums extra ability if you are the Keeper
  1276. if Sprite:IsFinished("PreSpawnCoin") then -- "PreSpawnCoin" can only be played if you are the Keeper
  1277. HeartCounter = HeartCounter - 5 -- reduce the heart counter
  1278. Mod:SaveData(HeartCounter)
  1279. Sprite:Play("SpawnCoin", true)
  1280.  
  1281. -- spawn the coins equally around Super Bum
  1282. for e = 1, numCoins do
  1283. angle = math.random(math.floor(360/numCoins)) -- get the angle
  1284. angleVector = Vector.FromAngle(angle + (e-1)*(math.floor(360/numCoins))) -- this distributes the coins equally around Super Bum
  1285. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COIN, CoinSubType.COIN_PENNY, SBum.Position, angleVector, SBum)
  1286. end
  1287. end
  1288. if Sprite:IsFinished("SpawnCoin") then
  1289. -- check if Super Bum shouldn't spawn more coins
  1290. if HeartCounter < 5 then
  1291. superbum.CoinPayout = false -- prevents that Super Bum spawns an other coin
  1292. superbum.CoinSpawned = false
  1293. else
  1294. superbum.CoinPayout = true -- allows Mod to spawn another coin
  1295. superbum.CoinSpawned = false
  1296. end
  1297.  
  1298. -- make Super Bum floats after he spawned something
  1299. Sprite:Play("FloatDown", true)
  1300. end
  1301.  
  1302. -- play float
  1303. if Sprite:IsFinished("Steal")
  1304. or SBum:GetSprite():IsFinished("ThumbUp") then
  1305. Sprite:Play("FloatDown", true)
  1306. end
  1307.  
  1308. -- Key Bums extra ability
  1309. -- Golden keys
  1310. if Sprite:IsFinished("PreSpawnKey") then -- no need to check for the functionality.KeyBum
  1311. -- play spawn animation
  1312. Sprite:Play("SpawnGoldenKey", true)
  1313. -- spawn a golden key
  1314. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_GOLDEN, SBum.Position, Vector(0,0), SBum)
  1315. end
  1316. -- Key themed items/trinkets
  1317. if Sprite:IsFinished("PreSpawnItem") then
  1318. -- play spawn animation
  1319. Sprite:Play("SpawnItem", true)
  1320. -- decide if Super Bum will spawn an item or a trinket
  1321. if keyrolltwo < 70 then -- we spawn an item -- o testing
  1322. local spawner = SBum
  1323. KeyItemPool(spawner, keyrolltwo)
  1324.  
  1325. else -- we spawn a trinket
  1326. local spawner = SBum
  1327. KeyTrinketPool(spawner, keyrolltwo)
  1328. end
  1329. end
  1330.  
  1331. -- After Super Bum finished the 'SpawnGoldenKey' or 'SpawnItem' we check if he could spawn more
  1332. if Sprite:IsFinished("SpawnGoldenKey")
  1333. or Sprite:IsFinished("SpawnItem") then
  1334. if has.AllItems == true then -- he spawned every possible items
  1335. if KeyCounter >= 7 then -- if the key counter is over 7
  1336. superbum.GoldenKeyPayout = true -- he can still spawn a golden Key
  1337. superbum.GoldenKeySpawned = false -- so he can spawn a golden key again
  1338. -- we substract 7 from KeyCounter
  1339. KeyCounter = KeyCounter - 7
  1340. superbum:SaveData(KeyCounter)
  1341. else
  1342. -- we stop him from paying out
  1343. superbum.GoldenKeyPayout = false
  1344. superbum.GoldenKeySpawned = false
  1345.  
  1346. -- just in case Super Bum didn't spawned Dad's Key
  1347. superbum.KeyPayout = false
  1348. superbum.KeySpawned = false
  1349. end
  1350. else
  1351. if KeyCounter == 7 then -- there is a chacne to spawn a golden key
  1352. if keyroll < 50 then -- we flip a coin
  1353. superbum.GoldenKeyPayout = true -- spawn an other key
  1354. superbum.GoldenKeySpawned = false
  1355. -- we substract 7 from KeyCounter
  1356. KeyCounter = KeyCounter - 7
  1357. Mod:SaveData(KeyCounter)
  1358. else
  1359. -- prevent him from spawning another key
  1360. superbum.GoldenKeyPayout = false
  1361. superbum.GoldenKeySpawned = false
  1362. end
  1363.  
  1364. elseif KeyCounter >= 12 then -- there is a chance to spawn an item
  1365. if KeyCounter == 12 then
  1366. Extra = 35
  1367. minusKeys = 12
  1368. elseif KeyCounter == 13 then
  1369. Extra = 45
  1370. minusKeys = 13
  1371. elseif KeyCounter == 14 then
  1372. Extra = 55
  1373. minusKeys = 14
  1374. elseif KeyCounter == 15 then
  1375. Extra = 70
  1376. minusKeys = 15
  1377. elseif KeyCounter == 16 then
  1378. Extra = 85
  1379. minusKeys = 16
  1380. elseif KeyCounter >= 17 then -- there is a possiblity that Super Bum picked up more then 17 keys
  1381. Extra = 100
  1382. minusKeys = 17
  1383. end
  1384.  
  1385. -- after getting sBExtra and minusKeys check if Super Bum could spawn an item
  1386. if keyroll < sBExtra then
  1387. superbum.KeyPayout = true -- he should spawn another item
  1388. superbum.KeySpawned = false -- allows Super Bum to spawn an other item
  1389. -- we substract minusKeys from KeyCounter
  1390. KeyCounter = KeyCounter - minusKeys
  1391. Mod:SaveData(KeyCounter)
  1392. else
  1393. superbum.KeyPayout = false
  1394. superbum.KeySpawned = false
  1395. end
  1396. -- reset sBExrta and minusKeys
  1397. Extra = 0
  1398. minusKeys = 0
  1399. -- Isaac.ConsoleOutput("Reset")
  1400.  
  1401. else
  1402. -- if nothing can happen set the variables back
  1403. -- golden key
  1404. superbum.GoldenKeyPayout = false
  1405. superbum.GoldenKeySpawned = false
  1406. -- items
  1407. superbum.KeyPayout = false
  1408. superbum.KeySpawned = false
  1409. end
  1410. end
  1411.  
  1412. -- make Super Bum float after he spawned something
  1413. Sprite:Play("FloatDown", true)
  1414. end
  1415.  
  1416.  
  1417.  
  1418. -- play float animation
  1419. if Sprite:IsFinished("ThumbUp") then
  1420. Sprite:Play("FloatDown", true)
  1421. end
  1422. end
  1423.  
  1424. Mod:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, Mod.onConsumablePickup, FamiliarVariant.SUPER_BUM)
  1425.  
  1426. -- on new room
  1427. function Mod:onNewRoom(_)
  1428. local player = Isaac.GetPlayer(0)
  1429. local entities = Isaac.GetRoomEntities()
  1430. local roomType = game:GetRoom():GetType()
  1431. local bumPool = {144,278,388}
  1432.  
  1433.  
  1434. if game:GetRoom():IsFirstVisit() == true then
  1435.  
  1436. -- get bumChance
  1437. if Mod.Init == false then -- if the player hasn't Super Bum
  1438. -- the chance increases if the player has a bum
  1439. if player:HasCollectible(388) then
  1440. table.remove(bumPool, 3)
  1441. bumChance = bumChance + 10
  1442. end
  1443. if player:HasCollectible(278) then
  1444. table.remove(bumPool, 2)
  1445. bumChance = bumChance + 10
  1446. end
  1447. if player:HasCollectible(144) then
  1448. table.remove(bumPool, 1)
  1449. bumChance = bumChance + 10
  1450. end
  1451. end
  1452.  
  1453. -- room specific action
  1454. if functionality.MoreBums == true then
  1455. if roomType == RoomType.ROOM_TREASURE then
  1456. 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}
  1457. for w = 1, #entities do
  1458. local entity = entities[w]
  1459. if entity.Type == EntityType.ENTITY_PICKUP
  1460. and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE then
  1461. -- look for a familiar from the treasure pool
  1462. for r = 1, #treasurePool do
  1463. if entity.SubType == treasurePool[r]
  1464. and entity:GetData().Rerolled == nil then
  1465. entity:GetData().Rerolled = true
  1466. local itemRng = player:GetCollectibleRNG(treasurePool[r])
  1467. local bumRoll = itemRng:RandomInt(100)
  1468. if bumRoll < bumChance then
  1469. -- spaen a random bum
  1470. local pickBum = math.random(#bumPool)
  1471. entity:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, bumPool[pickBum], true)
  1472. end
  1473. end
  1474. end
  1475. end
  1476. end
  1477.  
  1478. elseif roomType == RoomType.ROOM_SECRET then
  1479. local secretPool = {94,131,271,321,389,405}
  1480. for v = 1, #entities do
  1481. local entity = entities[v]
  1482. if entity.Type == EntityType.ENTITY_PICKUP
  1483. and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE then
  1484. -- look for a familiar from the secret pool
  1485. for g = 1, #secretPool do
  1486. if entity.SubType == secretPool[g]
  1487. and entity:GetData().Rerolled == nil then
  1488. entity:GetData().Rerolled = true
  1489. local itemRng = player:GetCollectibleRNG(secretPool[g])
  1490. local bumRoll = itemRng:RandomInt(100)
  1491. if bumRoll < bumChance then
  1492. -- spawn a key bum
  1493. entity:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_KEY_BUM, true)
  1494. end
  1495. end
  1496. end
  1497. end
  1498. end
  1499.  
  1500.  
  1501. elseif roomType == RoomType.ROOM_DEVIL then
  1502. local devilPool = {67,113,163,187,268,269,275,360,412,417,431,433,468,519}
  1503. for z = 1, #entities do
  1504. local entity = entities[z]
  1505. if entity.Type == EntityType.ENTITY_PICKUP
  1506. and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE then
  1507. -- look for a familiar from the devil pool
  1508. for t = 1, #devilPool do
  1509. if entity.SubType == devilPool[t]
  1510. and entity:GetData().Rerolled == nil then
  1511. entity:GetData().Rerolled = true
  1512. local itemRng = player:GetCollectibleRNG(devilPool[t])
  1513. local bumRoll = itemRng:RandomInt(100)
  1514. if bumRoll < bumChance then
  1515. -- spawn a dark bum
  1516. entity:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_DARK_BUM, true)
  1517. end
  1518. end
  1519. end
  1520. end
  1521. end
  1522.  
  1523. end
  1524. -- reset bumChance and bumPool
  1525. bumChance = 0
  1526. bumPool = backBumPool
  1527. end
  1528. end
  1529.  
  1530. end
  1531. Mod:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, Mod.onNewRoom)
  1532.  
  1533. -- on reroll
  1534. function Mod:onReroll(_)
  1535. local player = Isaac.GetPlayer(0)
  1536. local entities = Isaac.GetRoomEntities()
  1537. local roomType = game:GetRoom():GetType()
  1538. local bumPool = {144,278,388}
  1539.  
  1540.  
  1541.  
  1542. -- get bumChance
  1543. if Mod.Init == false then -- if the player hasn't Super Bum
  1544. -- the chance increases if the player has a bum
  1545. if player:HasCollectible(388) then
  1546. table.remove(bumPool, 3)
  1547. bumChance = bumChance + 10
  1548. end
  1549. if player:HasCollectible(278) then
  1550. table.remove(bumPool, 2)
  1551. bumChance = bumChance + 10
  1552. end
  1553. if player:HasCollectible(144) then
  1554. table.remove(bumPool, 1)
  1555. bumChance = bumChance + 10
  1556. end
  1557. end
  1558.  
  1559. if player:GetActiveItem() == CollectibleType.COLLECTIBLE_D6 then
  1560. -- room specific action
  1561. if functionality.MoreBums == true then
  1562. if roomType == RoomType.ROOM_TREASURE then
  1563. 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}
  1564. for w = 1, #entities do
  1565. local entity = entities[w]
  1566. if entity.Type == EntityType.ENTITY_PICKUP
  1567. and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE then
  1568. -- look for a familiar from the treasure pool
  1569. for i = 1, #treasurePool do
  1570. if entity.SubType == treasurePool[i] then
  1571. local itemRng = player:GetCollectibleRNG(treasurePool[i])
  1572. local bumRoll = itemRng:RandomInt(100)
  1573. if bumRoll < bumChance then
  1574. -- spaen a random bum
  1575. local pickBum = math.random(#bumPool)
  1576. entity:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, bumPool[pickBum], true)
  1577. end
  1578. end
  1579. end
  1580. end
  1581. end
  1582. elseif roomType == RoomType.ROOM_SECRET then
  1583. local secretPool = {94,131,271,321,389,405}
  1584. for v = 1, #entities do
  1585. local entity = entities[v]
  1586. if entity.Type == EntityType.ENTITY_PICKUP
  1587. and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE then
  1588. -- look for a familiar from the secret pool
  1589. for h = 1, #secretPool do
  1590. if entity.SubType == secretPool[h] then
  1591. local itemRng = player:GetCollectibleRNG(secretPool[h])
  1592. local bumRoll = itemRng:RandomInt(100)
  1593. if bumRoll < bumChance then
  1594. -- spawn a key bum
  1595. entity:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_KEY_BUM, true)
  1596. end
  1597. end
  1598. end
  1599. end
  1600. end
  1601. elseif roomType == RoomType.ROOM_DEVIL then
  1602. local devilPool = {67,113,163,187,268,269,275,360,412,417,431,433,468,519}
  1603. for z = 1, #entities do
  1604. local entity = entities[z]
  1605. if entity.Type == EntityType.ENTITY_PICKUP
  1606. and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE then
  1607. -- look for a familiar from the devil pool
  1608. for x = 1, #devilPool do
  1609. if entity.SubType == devilPool[x] then
  1610. local itemRng = player:GetCollectibleRNG(devilPool[x])
  1611. local bumRoll = itemRng:RandomInt(100)
  1612. if bumRoll < bumChance then
  1613. -- spawn a dark bum
  1614. entity:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_DARK_BUM, true)
  1615. end
  1616. end
  1617. end
  1618. end
  1619. end
  1620.  
  1621. end
  1622. -- reset bumChance and bumPool
  1623. bumChance = 0
  1624. bumPool = backBumPool
  1625. end
  1626. end
  1627. end
  1628. Mod:AddCallback(ModCallbacks.MC_USE_ITEM, Mod.onReroll)
Advertisement
Add Comment
Please, Sign In to add comment