Josh64

Better Bums with SetBumChance

Apr 23rd, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 76.65 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 = 5 -- 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. local steal = "Steal"
  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. local spawn = "AltSpawn"
  45.  
  46. -- variables to costumize Super Bum's abilities and the other bums
  47. local functionality = {
  48. DarkBum = true, -- used to activate or deactive the ability from Dark Bum
  49. KeyBum = true, -- used to activate or deactive the ability from Key Bum
  50. BumFriend = true, -- used to activate or deactive the ability from Bum Friend
  51. SuperDarkBum = true, -- used to activate or deactive Super Bum's Heart ability from Dark Bum
  52. SuperKeyBum = true, -- used to activate or deactive Super Bum's Key ability from Key Bum
  53. SuperFriend = true, -- used to activate or deactive Super Bum's Coin ability from Bum Friend
  54. MoreBums = true, -- if true then the player will have higher chance to find classic bums
  55. BonusAnimation = true, -- used to activate or deactivate the bonus and alt animations (ThumbUp, AltSteal)
  56. ExtraCharge = true, -- if true then Key Bum/ Super Bum will charge your Active item upon picking up a Charged Key
  57. OldBumChance = false -- if true sets the bumChance variable to 0. Default is bumChance = 5
  58. }
  59.  
  60. -- tables for item and trinket pools
  61. -- for Super Bum
  62. local resetItemPool = {17,175,199,343} -- table which is used to restore itemPool?
  63. local resetTrinketPool = {19,36,83} -- table which is used to restore trinketPool?
  64.  
  65. -- to find more bums
  66. local backBumPool = {144,278,388} -- table which is used to restore bumPool?
  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. -- "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. -- 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 -- 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 -- 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. steal = "Steal"
  471. Isaac.ConsoleOutput("bonus animation will be used")
  472. else
  473. functionality.BonusAnimation = false
  474. steal = "AltSteal"
  475. Isaac.ConsoleOutput("bonus animation won't be used")
  476. end
  477. elseif consol == "moreBums" then
  478. if functionality.MoreBums == false then
  479. functionality.MoreBums = true
  480. Isaac.ConsoleOutput("high chance to find other bums")
  481. else
  482. functionality.MoreBums = false
  483. Isaac.ConsoleOutput("normal chance to find other bums")
  484. end
  485. elseif consol == "extraCharge" then
  486. if functionality.ExtraCharge == false then
  487. functionality.ExtraCharge = true
  488. Isaac.ConsoleOutput("Key Bum can charge your active item with Charged Keys")
  489. else
  490. functionality.ExtraCharge = false
  491. Isaac.ConsoleOutput("No extra charge for Charged Keys")
  492. end
  493. elseif consol == "setBumChance" then
  494. if functionality.OldBumChance == false then
  495. functionality.OldBumChance = true
  496. Isaac.ConsoleOutput("Now the default extra chance to find the first bum is 0")
  497. else
  498. functionality.OldBumChance = false
  499. Isaac.ConsoleOutput("Now the default extra chance to find the first bum is 5")
  500. end
  501.  
  502. elseif consol == "darkAbility" then
  503. if functionality.SuperDarkBum == false then
  504. functionality.SuperDarkBum = true
  505. Isaac.ConsoleOutput("Super Bum's heart ability will be used")
  506. else
  507. functionality.SuperDarkBum = false
  508. Isaac.ConsoleOutput("Super Bum's heart ability won't be used")
  509. end
  510. elseif consol == "keyAbility" then
  511. if functionality.SuperKeyBum == false then
  512. functionality.SuperKeyBum = true
  513. Isaac.ConsoleOutput("Super Bum's key ability will be used")
  514. else
  515. functionality.SuperKeyBum = false
  516. Isaac.ConsoleOutput("Super Bum's key ability wont be used")
  517. end
  518. elseif consol == "friendAbility" then
  519. if functionality.SuperBumFriend == false then
  520. functionality.SuperBumFriend = true
  521. Isaac.ConsoleOutput("Super Bum's coin ability will be used")
  522. else
  523. functionality.SuperBumFriend = false
  524. Isaac.ConsoleOutput("Super Bum's coin ability wont be used")
  525. end
  526.  
  527. elseif consol == "darkbum" then
  528. if functionality.DarkBum == false then
  529. functionality.DarkBum = true
  530. Isaac.ConsoleOutput("Dark Bum will use his new ability")
  531. else
  532. functionality.DarkBum = false
  533. Isaac.ConsoleOutput("Dark Bum won't use his new ability")
  534. end
  535. elseif consol == "keybum" then
  536. if functionality.KeyBum == false then
  537. functionality.KeyBum = true
  538. Isaac.ConsoleOutput("Key Bum will use his new ability")
  539. else
  540. functionality.KeyBum = false
  541. Isaac.ConsoleOutput("Key Bum won't use his new ability")
  542. end
  543. elseif consol == "bumfriend" then
  544. if functionality.BumFriend == false then
  545. functionality.BumFriend = true
  546. Isaac.ConsoleOutput("Bum Friend will use his new ability")
  547. else
  548. functionality.BumFriend = false
  549. Isaac.ConsoleOutput("Bum Friend won't use his new ability")
  550. end
  551. end
  552. end
  553. Mod:AddCallback(ModCallbacks.MC_EXECUTE_CMD, Mod.costumizeBum)
  554.  
  555. -- post peffect update
  556. function Mod:onNewEvent(player)
  557. local entities = Isaac.GetRoomEntities()
  558. local entity = superbum.Bum
  559.  
  560.  
  561. -- stuff which happens on Frame 1
  562. if game:GetFrameCount() == 1 then
  563. -- spawn in if you want to
  564. -- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_BUM_FRIEND, Vector(250, 200), Vector(0,0), player)
  565. -- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_DARK_BUM, Vector(325, 200), Vector(0,0), player)
  566. -- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_KEY_BUM, Vector(400, 200), Vector(0,0), player)
  567.  
  568. -- set variables back to zero
  569. HeartCounter = 0
  570. Extra = 0
  571. if not player:HasCollectible(388) then -- Key Bum
  572. KeyCounter = 0
  573. end
  574. if not player:HasCollectible(144) then -- Bum Friend
  575. ExtraLuck = 0
  576. end
  577. has.DadsKey = false
  578. end
  579.  
  580. -- check if the player has Super Bum
  581. if player:HasCollectible(388)
  582. and player:HasCollectible(278)
  583. and player:HasCollectible(144) then
  584. superbum.Init = true -- player has Super Bum
  585. darkbum.Init = false
  586. else
  587. superbum.Init = false -- player doesn't have Super Bum
  588. if player:HasCollectible(278) then
  589. darkbum.Init = true
  590. else
  591. darkbum.Init = false
  592. end
  593. end
  594.  
  595. -- check if Super or Key Bum spawned every item
  596. if superbum.Init == true
  597. or player:HasCollectible(388) then -- Key Bum
  598. if player:HasCollectible(343)
  599. and player:HasCollectible(199)
  600. and player:HasCollectible(17) then
  601. if has.DadsKey == true
  602. or player:GetActiveItem() == CollectibleType.COLLECTIBLE_DADS_KEY then
  603. has.AllItems = true -- set has.AllItems to true
  604. -- Isaac.ConsoleOutput("All Items!!")
  605. else
  606. has.AllItems = false -- set has.AllItems to false
  607. end
  608. else
  609. has.AllItems = false -- set has.AllItems to false
  610. end
  611. end
  612.  
  613.  
  614.  
  615. -- keep track of Super Bum
  616. if superbum.Init == true then -- if the player has Super Bum
  617. for a = 1, #entities do -- go through all entites in the room
  618. local sbum = entities[a]
  619. if sbum.Type == EntityType.ENTITY_FAMILIAR then
  620. if sbum.Variant == FamiliarVariant.SUPER_BUM
  621. and not (sbum.Variant == FamiliarVariant.DARK_BUM) then
  622. superbum.Bum = sbum
  623.  
  624. end
  625. end
  626. end
  627.  
  628. local familiar = superbum.Bum
  629. local superSprite = superbum.Bum:GetSprite()
  630.  
  631. -- Dark Bum's extra effect
  632. if player:GetPlayerType() == PlayerType.PLAYER_KEEPER
  633. and functionality.SuperDarkBum == true then
  634.  
  635. -- if the player is the Keeper then we look for red hearts
  636. for b = 1, #entities do
  637. local toSteal = entities[b] -- variable which keeps track of all the hearts Super Bum can steal
  638. if toSteal.Type == EntityType.ENTITY_PICKUP
  639. and toSteal.Variant == PickupVariant.PICKUP_HEART then
  640.  
  641. -- look for all kinds of red hearts
  642. if toSteal.SubType == HeartSubType.HEART_HALF
  643. and (not toSteal:ToPickup():IsShopItem()) then
  644. toSteal:Remove() -- remove the heart before it gets turned into a blue fly
  645. superSprite:Play("Steal", true) -- play steal animation
  646. if superSprite:IsPlaying("Steal") then
  647. -- increase the heart counter
  648. HeartCounter = HeartCounter + 1
  649. Mod:SaveData(HeartCounter)
  650. -- check if he should spawn coins
  651. if HeartCounter >= 5 then -- pay out at 2,5 red hearts
  652. superbum.CoinPayout = true -- allows Super Bum to spawn coins
  653. end
  654. end
  655. elseif toSteal.SubType == HeartSubType.HEART_FULL
  656. and (not toSteal:ToPickup():IsShopItem()) then
  657. toSteal:Remove() -- remove the heart before it gets turned into a blue fly
  658. superSprite:Play("Steal", true)
  659. if superSprite:IsPlaying("Steal") then
  660. -- increase the heart counter
  661. HeartCounter = HeartCounter + 2
  662. Mod:SaveData(HeartCounter)
  663.  
  664. -- check if he should spawn coins
  665. if HeartCounter >= 5 then
  666. Isaac.ConsoleOutput("Spawn Coins")
  667. superbum.CoinPayout = true -- allows Super Bum to spawn coins
  668. end
  669. end
  670. elseif toSteal.SubType == HeartSubType.HEART_SCARED
  671. and (not toSteal:ToPickup():IsShopItem()) then
  672. toSteal:Remove() -- remove the heart before it gets turned into a blue fly
  673. superSprite:Play("Steal", true)
  674. if superSprite:IsPlaying("Steal") then
  675. -- increase the heart counter
  676. HeartCounter = HeartCounter + 2
  677. Mod:SaveData(HeartCounter)
  678. -- check if he should spawn coins
  679. if HeartCounter >= 5 then
  680. superbum.CoinPayout = true -- allows Super Bum to spawn coins
  681. end
  682. end
  683. elseif toSteal.SubType == HeartSubType.HEART_DOUBLEPACK
  684. and (not toSteal:ToPickup():IsShopItem()) then
  685. toSteal:Remove() -- remove the heart before it gets turned into a blue fly
  686. superSprite:Play("Steal", true)
  687. if superSprite:IsPlaying("Steal") then
  688. -- increase the heart counter
  689. HeartCounter = HeartCounter + 4
  690. Mod:SaveData(HeartCounter)
  691. -- check if he should spawn coins
  692. if HeartCounter >= 5 then
  693. superbum.CoinPayout = true -- allows Super Bum to spawn coins
  694. end
  695. end
  696. end
  697. end
  698. end
  699. end
  700.  
  701. -- check Super Bums position
  702. if familiar.Position:Distance(player.Position) <= 95 -- if he is close to the player
  703. and (not superSprite:IsPlaying("PreSpawn")) -- don't interfier with the normal spawn
  704. and (not superSprite:IsPlaying("Spawn")) then
  705. -- Isaac.ConsoleOutput("Close")
  706.  
  707. if functionality.SuperDarkBum == true then -- Super Bum has Dark Bums ability
  708. if player:GetPlayerType() == PlayerType.PLAYER_KEEPER then
  709. if superbum.CoinSpawned == false -- Super Bum hasn't spawned a coin yet,
  710. and superbum.CoinPayout == true then -- but he can payout with one
  711. superbum.CoinSpawned = true -- confirms that he spawned a coin
  712. superSprite:Play("PreSpawnSuperCoin", true) -- triggers the spawn function for coins in the familiar update callback
  713. end
  714. end
  715. end
  716. if functionality.SuperKeyBum == true then -- Super Bum has Key Bums ability
  717. if superbum.GoldenKeySpawned == false -- Super Bum hasn't spawned a golden key yet,
  718. and superbum.GoldenKeyPayout == true then -- but he can payout with one
  719. superbum.GoldenKeySpawned = true -- confirms that he spawned a golden key
  720. superSprite:Play("PreSpawnKey", true) -- triggers the spawn function for golden keys in the familiar update callback
  721.  
  722. end
  723. if superbum.KeySpawned == false -- Super Bum hasn't spawned a key themed item or trinket yet,
  724. and superbum.KeyPayout == true then -- but he can payout with one
  725. superbum.KeySpawned = true -- confirms that he spawned an item or trinket
  726. superSprite:Play("PreSpawnItem", true) -- triggers the spawn function for items and trinkets in the familiar update callback
  727.  
  728. end
  729. end
  730. end
  731. else -- superbum.Init == false
  732.  
  733. -- keep track of Dark Bum
  734. if functionality.DarkBum == true
  735. and player:GetPlayerType() == PlayerType.PLAYER_KEEPER
  736. and player:HasCollectible(278) -- Dark Bum
  737. and darkbum.Init == true then -- if the player has Dark Bum
  738. for a = 1, #entities do -- go through all entites in the room
  739. local bum = entities[a]
  740. if bum.Type == EntityType.ENTITY_FAMILIAR then
  741. if bum.Variant == FamiliarVariant.DARK_BUM
  742. and not (bum.Variant == FamiliarVariant.SUPER_BUM) then
  743. darkbum.Bum = bum
  744. end
  745. end
  746. end
  747.  
  748. local entity = darkbum.Bum
  749. local Sprite = entity:GetSprite()
  750.  
  751. -- Dark Bum's extra effect
  752. if functionality.DarkBum == true then
  753.  
  754. -- look for red hearts
  755. for b = 1, #entities do
  756. local toSteal = entities[b] -- variable which keeps track of all the hearts Super Bum can steal
  757. if toSteal.Type == EntityType.ENTITY_PICKUP
  758. and toSteal.Variant == PickupVariant.PICKUP_HEART then
  759.  
  760. -- look for all kinds of red hearts
  761. if toSteal.SubType == HeartSubType.HEART_HALF
  762. and (not toSteal:ToPickup():IsShopItem()) then
  763. toSteal:Remove() -- remove the heart before it gets turned into a blue fly
  764. Sprite:Play(steal, true) -- play steal animation
  765. if Sprite:IsPlaying(steal) then
  766. -- increase the heart counter
  767. HeartCounter = HeartCounter + 1
  768. Mod:SaveData(HeartCounter)
  769. -- check if he should spawn coins
  770. if HeartCounter >= 5 then -- pay out at 2,5 red hearts
  771. darkbum.Payout = true -- allows Super Bum to spawn coins
  772. end
  773. end
  774. elseif toSteal.SubType == HeartSubType.HEART_FULL
  775. and (not toSteal:ToPickup():IsShopItem()) then
  776. toSteal:Remove() -- remove the heart before it gets turned into a blue fly
  777. Sprite:Play(steal, true)
  778. if Sprite:IsPlaying(steal) then
  779. -- increase the heart counter
  780. HeartCounter = HeartCounter + 2
  781. Mod:SaveData(HeartCounter)
  782.  
  783. -- check if he should spawn coins
  784. if HeartCounter >= 5 then
  785. darkbum.Payout = true -- allows Super Bum to spawn coins
  786. end
  787. end
  788. elseif toSteal.SubType == HeartSubType.HEART_SCARED
  789. and (not toSteal:ToPickup():IsShopItem()) then
  790. toSteal:Remove() -- remove the heart before it gets turned into a blue fly
  791. Sprite:Play(steal, true)
  792. if Sprite:IsPlaying(steal) then
  793. -- increase the heart counter
  794. HeartCounter = HeartCounter + 2
  795. Mod:SaveData(HeartCounter)
  796. -- check if he should spawn coins
  797. if HeartCounter >= 5 then
  798. darkbum.Payout = true -- allows Super Bum to spawn coins
  799. end
  800. end
  801. elseif toSteal.SubType == HeartSubType.HEART_DOUBLEPACK
  802. and (not toSteal:ToPickup():IsShopItem()) then
  803. toSteal:Remove() -- remove the heart before it gets turned into a blue fly
  804. Sprite:Play(steal, true)
  805. if Sprite:IsPlaying(steal) then
  806. -- increase the heart counter
  807. HeartCounter = HeartCounter + 4
  808. Mod:SaveData(HeartCounter)
  809. -- check if he should spawn coins
  810. if HeartCounter >= 5 then
  811. darkbum.Payout = true -- allows Super Bum to spawn coins
  812. end
  813. end
  814. end
  815. end
  816. end
  817. end
  818. if entity.Position:Distance(player.Position) <= 95 then -- distance from the player
  819. if darkbum.Spawned == false
  820. and darkbum.Payout == true then -- 95
  821. darkbum.Spawned = true
  822. Sprite:Play("PreCoin", true)
  823. end
  824. end
  825. end
  826. end
  827. end
  828. Mod:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, Mod.onNewEvent)
  829.  
  830. -- evaluate cache
  831. function Mod:onCache(player, cacheFlag)
  832. local entities = Isaac.GetRoomEntities()
  833.  
  834. if player:HasCollectible(144)
  835. and functionality.BumFriend == true then
  836. player.Luck = player.Luck + ExtraLuck
  837. end
  838. end
  839. Mod:AddCallback(ModCallbacks.MC_EVALUATE_CACHE, Mod.onCache)
  840. -- on familiar update
  841.  
  842. -- Key Bum
  843. function Mod:onKeyPickup(KBum)
  844. local player = Isaac.GetPlayer(0)
  845. local entities = Isaac.GetRoomEntities()
  846. local rng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_KEY_BUM)
  847. local roll = rng:RandomInt(100)
  848.  
  849. if player:HasCollectible(CollectibleType.COLLECTIBLE_KEY_BUM)
  850. and functionality.KeyBum == true then
  851. -- we check all entities in the room
  852. for c = 1, #entities do
  853. -- collision detection
  854. local entity = entities[c]
  855. if entity.Type == EntityType.ENTITY_PICKUP
  856. and KBum.Position:Distance(entity.Position) <= 10
  857. and (not (player.Position:Distance(entity.Position) <= 40))
  858. then
  859. if entity:GetSprite():IsPlaying("Collect")
  860. and entity:GetData().Picked == nil then
  861. entity:GetData().Picked = true
  862. -- pickup specific action
  863. if entity.Variant == PickupVariant.PICKUP_KEY then
  864. if entity.SubType == KeySubType.KEY_NORMAL then
  865. -- key counter
  866. KeyCounter = KeyCounter + 1
  867. Mod:SaveData(KeyCounter)
  868. -- if BumsKeys == 1 then
  869. end
  870. if entity.SubType == KeySubType.KEY_CHARGED then
  871. -- key counter
  872. KeyCounter = KeyCounter + 1
  873. Mod:SaveData(KeyCounter)
  874.  
  875. -- we charge the active item
  876. if functionality.ExtraCharge == true then
  877. if player:NeedsCharge() then
  878. -- dont forget Mega Blast
  879. if player:GetActiveItem() == CollectibleType.COLLECTIBLE_MEGA_SATANS_BREATH then
  880. player:FullCharge(3)
  881. else
  882. player:FullCharge(12)
  883. end
  884. end
  885. end
  886. end
  887.  
  888. -- depending on how high the key counter Key Bum can spawn different things
  889. if KeyCounter == 7 then
  890. if has.AllItems == true then
  891. if roll < 98 then
  892. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_GOLDEN, entity.Position, Vector(0,0), KBum)
  893. KeyCounter = 0 -- reset the counter to 0
  894. Mod:SaveData(KeyCounter)
  895. else
  896. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_LOCKEDCHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
  897. KeyCounter = 0 -- reset the counter to 0
  898. Mod:SaveData(KeyCounter)
  899. end
  900. else
  901. if roll < 50 then
  902. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_GOLDEN, entity.Position, Vector(0,0), KBum)
  903. KeyCounter = 0 -- reset the counter to 0
  904. Mod:SaveData(KeyCounter)
  905. end
  906. end
  907. elseif KeyCounter >= 12 then
  908. -- the chance to drop something increases with every key picked up
  909. if KeyCounter == 12 then
  910. Extra = 35
  911. elseif KeyCounter == 13 then
  912. Extra = 45
  913. elseif KeyCounter == 14 then
  914. Extra = 55
  915. elseif KeyCounter == 15 then
  916. Extra = 70
  917. elseif KeyCounter == 16 then
  918. Extra = 85
  919. elseif KeyCounter == 17 then
  920. Extra = 100
  921. end
  922. if roll < Extra then
  923. local keyrolltwo = rng:RandomInt(120)
  924. if keyrolltwo < 70 then
  925. KBum:GetSprite():Play("SpawnKeyItem")
  926. local spawner = KBum
  927. KeyItemPool(spawner, keyrolltwo)
  928. else
  929. local spawner = KBum
  930. KeyTrinketPool(spawner, keyrolltwo)
  931. end
  932. -- reset KeyCounter and Extra
  933. Extra = 0
  934. KeyCounter = 0
  935. Mod:SaveData(KeyCounter)
  936. end
  937. end
  938. end
  939. end
  940. end
  941. end
  942. if KBum:GetSprite():IsFinished("SpawnKeyItem") then
  943. KBum:GetSprite():Play("FloatDown")
  944. end
  945. end
  946. end
  947.  
  948. Mod:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, Mod.onKeyPickup, FamiliarVariant.KEY_BUM)
  949.  
  950. -- Bum Friend
  951. function Mod:onCoinPickup(Bum)
  952. local player = Isaac.GetPlayer(0)
  953. local entities = Isaac.GetRoomEntities()
  954. local rng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_BUM_FRIEND)
  955. local roll = rng:RandomInt(100)
  956.  
  957.  
  958. if player:HasCollectible(CollectibleType.COLLECTIBLE_BUM_FRIEND)
  959. and functionality.BumFriend == true then
  960. -- we check all entities in the room
  961. for d = 1, #entities do
  962. -- collision detection
  963. local entity = entities[d]
  964. if entity.Type == EntityType.ENTITY_PICKUP
  965. and (Bum.Position - entity.Position):Length() < Bum.Size + entity.Size
  966. then
  967. if entity:GetSprite():IsPlaying("Collect")
  968. and entity:GetData().Picked == nil then
  969. entity:GetData().Picked = true
  970. -- pickup specific action
  971. if entity.Variant == PickupVariant.PICKUP_COIN then
  972. if entity.SubType == CoinSubType.COIN_PENNY then
  973. -- Penny Trinkets synergies
  974. if player:GetTrinket(0) == TrinketType.TRINKET_BLOODY_PENNY
  975. or player:GetTrinket(1) == TrinketType.TRINKET_BLOODY_PENNY then
  976. if roll < 50 then
  977. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_HEART, HeartSubType.HEART_HALF, entity.Position, Vector(0,0), Bum)
  978. end
  979. end
  980. if player:GetTrinket(0) == TrinketType.TRINKET_BURNT_PENNY
  981. or player:GetTrinket(1) == TrinketType.TRINKET_BURNT_PENNY then
  982. if roll < 50 then
  983. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_BOMB, BombSubType.BOMB_NORMAL, entity.Position, Vector(0,0), Bum)
  984. end
  985. end
  986. if player:GetTrinket(0) == TrinketType.TRINKET_FLAT_PENNY
  987. or player:GetTrinket(1) == TrinketType.TRINKET_FLAT_PENNY then
  988. if roll < 50 then
  989. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_NORMAL, entity.Position, Vector(0,0), Bum)
  990. end
  991. end
  992. if player:GetTrinket(0) == TrinketType.TRINKET_BUTT_PENNY
  993. or player:GetTrinket(1) == TrinketType.TRINKET_BUTT_PENNY then
  994. if roll < 50 then
  995. Isaac.GridSpawn(GridEntityType.GRID_POOP, 0, entity.Position, true)
  996. end
  997. end
  998. if player:GetTrinket(0) == TrinketType.TRINKET_ROTTEN_PENNY
  999. or player:GetTrinket(1) == TrinketType.TRINKET_ROTTEN_PENNY then
  1000. if roll < 50 then
  1001. Isaac.Spawn(EntityType.ENTITY_FAMILIAR, FamiliarVariant.BLUE_FLY, 0, entity.Position, Vector(0,0), Bum)
  1002. end
  1003. end
  1004. if player:GetTrinket(0) == TrinketType.TRINKET_COUNTERFEIT_PENNY
  1005. or player:GetTrinket(1) == TrinketType.TRINKET_COUNTERFEIT_PENNY then
  1006. if roll < 50 then
  1007. player:AddCoins(1)
  1008. end
  1009. end
  1010. end
  1011. if entity.SubType == CoinSubType.COIN_NICKEL then
  1012. -- Penny Trinkets synergies
  1013. if player:GetTrinket(0) == TrinketType.TRINKET_BLOODY_PENNY
  1014. or player:GetTrinket(1) == TrinketType.TRINKET_BLOODY_PENNY then
  1015. if roll < 75 then
  1016. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_HEART, HeartSubType.HEART_HALF, entity.Position, Vector(0,0), Bum)
  1017. end
  1018. end
  1019. if player:GetTrinket(0) == TrinketType.TRINKET_BURNT_PENNY
  1020. or player:GetTrinket(1) == TrinketType.TRINKET_BURNT_PENNY then
  1021. if roll < 75 then
  1022. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_BOMB, BombSubType.BOMB_NORMAL, entity.Position, Vector(0,0), Bum)
  1023. end
  1024. end
  1025. if player:GetTrinket(0) == TrinketType.TRINKET_FLAT_PENNY
  1026. or player:GetTrinket(1) == TrinketType.TRINKET_FLAT_PENNY then
  1027. if roll < 75 then
  1028. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_NORMAL, entity.Position, Vector(0,0), Bum)
  1029. end
  1030. end
  1031. if player:GetTrinket(0) == TrinketType.TRINKET_BUTT_PENNY
  1032. or player:GetTrinket(1) == TrinketType.TRINKET_BUTT_PENNY then
  1033. if roll < 75 then
  1034. Isaac.GridSpawn(GridEntityType.GRID_POOP, 0, entity.Position, true)
  1035. end
  1036. end
  1037. if player:GetTrinket(0) == TrinketType.TRINKET_ROTTEN_PENNY
  1038. or player:GetTrinket(1) == TrinketType.TRINKET_ROTTEN_PENNY then
  1039. Isaac.Spawn(EntityType.ENTITY_FAMILIAR, FamiliarVariant.BLUE_FLY, 0, entity.Position, Vector(0,0), Bum)
  1040. end
  1041. if player:GetTrinket(0) == TrinketType.TRINKET_COUNTERFEIT_PENNY
  1042. or player:GetTrinket(1) == TrinketType.TRINKET_COUNTERFEIT_PENNY then
  1043. if roll < 75 then
  1044. player:AddCoins(1)
  1045. end
  1046. end
  1047. end
  1048. if entity.SubType == CoinSubType.COIN_DIME then
  1049. -- Penny Trinkets synergies
  1050. if player:GetTrinket(0) == TrinketType.TRINKET_BLOODY_PENNY
  1051. or player:GetTrinket(1) == TrinketType.TRINKET_BLOODY_PENNY then
  1052. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_HEART, HeartSubType.HEART_HALF, entity.Position, Vector(0,0), Bum)
  1053. end
  1054. if player:GetTrinket(0) == TrinketType.TRINKET_BURNT_PENNY
  1055. or player:GetTrinket(1) == TrinketType.TRINKET_BURNT_PENNY then
  1056. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_BOMB, BombSubType.BOMB_NORMAL, entity.Position, Vector(0,0), Bum)
  1057. end
  1058. if player:GetTrinket(0) == TrinketType.TRINKET_FLAT_PENNY
  1059. or player:GetTrinket(1) == TrinketType.TRINKET_FLAT_PENNY then
  1060. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_NORMAL, entity.Position, Vector(0,0), Bum)
  1061. end
  1062. if player:GetTrinket(0) == TrinketType.TRINKET_BUTT_PENNY
  1063. or player:GetTrinket(1) == TrinketType.TRINKET_BUTT_PENNY then
  1064. Isaac.GridSpawn(GridEntityType.GRID_POOP, 0, entity.Position, true)
  1065. end
  1066. if player:GetTrinket(0) == TrinketType.TRINKET_ROTTEN_PENNY
  1067. or player:GetTrinket(1) == TrinketType.TRINKET_ROTTEN_PENNY then
  1068. Isaac.Spawn(EntityType.ENTITY_FAMILIAR, FamiliarVariant.BLUE_FLY, 0, entity.Position, Vector(0,0), Bum)
  1069. end
  1070. if player:GetTrinket(0) == TrinketType.TRINKET_COUNTERFEIT_PENNY
  1071. or player:GetTrinket(1) == TrinketType.TRINKET_COUNTERFEIT_PENNY then
  1072. player:AddCoins(1)
  1073. end
  1074. end
  1075. if entity.SubType == CoinSubType.COIN_LUCKYPENNY then
  1076. ExtraLuck = ExtraLuck + 1
  1077. player.Luck = player.Luck + 1
  1078. end
  1079. end
  1080. end
  1081. end
  1082. end
  1083. end
  1084. end
  1085. Mod:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, Mod.onCoinPickup, FamiliarVariant.BUM_FRIEND)
  1086.  
  1087. -- Dark Bum
  1088. function Mod:onHeartPickup(DaBum)
  1089. local player = Isaac.GetPlayer(0)
  1090. local entities = Isaac.GetRoomEntities() -- all entities in the room
  1091. local entity = DaBum
  1092. local Sprite = entity:GetSprite()
  1093. local rng = player:GetCollectibleRNG(278) -- 278 = Dark Bum
  1094. local numCoins = (rng:RandomInt(2)) + 2 -- number of coins Dark Bum spawns if you play as the Keeper
  1095.  
  1096. if player:HasCollectible(CollectibleType.COLLECTIBLE_DARK_BUM)
  1097. and functionality.DarkBum == true then
  1098.  
  1099. -- if you play as the Lost
  1100. if player:GetPlayerType() == PlayerType.PLAYER_THELOST then
  1101. if Sprite:IsPlaying("Spawn") then
  1102. if Sprite:GetFrame() == 1 then
  1103. for e = 1, #entities do
  1104. local entitis = entities[e]
  1105. if entitis.Type == EntityType.ENTITY_PICKUP
  1106. and entitis.Variant == PickupVariant.PICKUP_HEART then
  1107. if entitis.SubType == HeartSubType.HEART_SOUL then
  1108. if entitis.SpawnerType == EntityType.ENTITY_FAMILIAR
  1109. and entitis.SpawnerVariant == FamiliarVariant.DARK_BUM then
  1110. entitis:Remove()
  1111. local numBlueSpider = 2 -- number of spiders Dark Bum will spawn
  1112. for k = 1, numBlueSpider do
  1113. player:ThrowBlueSpider(entity.Position, player.Position)
  1114. end
  1115. end
  1116. end
  1117. end
  1118. end
  1119. end
  1120. end
  1121. end
  1122.  
  1123. -- if you play as the Keeper
  1124. if Sprite:IsFinished("PreCoin") then
  1125. HeartCounter = HeartCounter - 5
  1126. Mod:SaveData(HeartCounter)
  1127. Sprite:Play("SpawnCoin", true)
  1128. for f = 1, numCoins do
  1129. angle = math.random(math.floor(360/numCoins)) -- get the angle
  1130. angleVector = Vector.FromAngle(angle + (f-1)*(math.floor(360/numCoins))) -- this distributes the coins equally around Dark Bum
  1131. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COIN, CoinSubType.COIN_PENNY, entity.Position, angleVector, entity)
  1132. end
  1133. end
  1134. if Sprite:IsFinished("SpawnCoin") then
  1135. if HeartCounter < 5 then
  1136. darkbum.Payout = false
  1137. darkbum.Spawned = false
  1138. else
  1139. darkbum.Payout = true
  1140. darkbum.Spawned = false
  1141. end
  1142. end
  1143.  
  1144. if Sprite:IsFinished("SpawnCoin") or Sprite:IsFinished("Steal") or Sprite:IsFinished("AltSteal") then
  1145. Sprite:Play("FloatDown", true)
  1146. end
  1147. end
  1148. end
  1149. Mod:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, Mod.onHeartPickup, FamiliarVariant.DARK_BUM)
  1150.  
  1151. -- Super Bum
  1152. function Mod:onConsumablePickup(SBum) -- SBum is the variable for the familiar Super Bum
  1153.  
  1154. local player = Isaac.GetPlayer(0)
  1155. local entities = Isaac.GetRoomEntities()
  1156. local Sprite = SBum:GetSprite()
  1157. local numCoins
  1158.  
  1159. -- make global if needed
  1160.  
  1161. local rng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_BUM_FRIEND)
  1162. local roll = rng:RandomInt(100)
  1163. local keybumrng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_KEY_BUM)
  1164. local keyroll = keybumrng:RandomInt(100)
  1165. local keyrolltwo = keybumrng:RandomInt(120)
  1166. local coinrng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_DARK_BUM)
  1167. local numCoins = (coinrng:RandomInt(2)) + 2 -- number of coins Dark Bum spawns if you play as the Keeper
  1168.  
  1169.  
  1170.  
  1171. -- first we check all entities in the room
  1172. for j = 1, #entities do
  1173. local entity = entities[j]
  1174. if entity.Type == EntityType.ENTITY_PICKUP then
  1175.  
  1176. -- the collision detection depends on the type pickup
  1177. -- first key collision code
  1178. if SBum.Position:Distance(entity.Position) <= 10
  1179. and (not(player.Position:Distance(entity.Position) <= 40)) then
  1180. if entity.Variant == PickupVariant.PICKUP_KEY
  1181. and functionality.SuperKeyBum == true then -- we check if Super Bum should have Key Bums ability
  1182.  
  1183.  
  1184. if entity:GetSprite():IsPlaying("Collect")
  1185. and entity:GetData().Picked == nil then
  1186. entity:GetData().Picked = true
  1187.  
  1188. -- Sub type specific actions
  1189. if entity.SubType == KeySubType.KEY_NORMAL then -- normal keys
  1190. -- increase the key counter
  1191. KeyCounter = KeyCounter + 1
  1192. Mod:SaveData(KeyCounter)
  1193.  
  1194. elseif entity.SubType == KeySubType.KEY_CHARGED then -- charged keys
  1195. -- increase the key counter
  1196. KeyCounter = KeyCounter + 1
  1197. Mod:SaveData(KeyCounter)
  1198.  
  1199. -- charge the active item
  1200. if functionality.ExtraCharge == true then
  1201. if player:NeedsCharge() then -- if the active item could be charged
  1202. if player:GetActiveItem() == CollectibleType.COLLECTIBLE_MEGA_SATANS_BREATH then -- don't forget Mega Blast
  1203. player:FullCharge(3) -- Mega Blast only gets three charges from a battery
  1204. else
  1205. player:FullCharge(12) -- this covers every active item
  1206. end
  1207. end
  1208. end
  1209. end
  1210. -- check the amount of keys and set up animation if needed
  1211.  
  1212. -- first we check the amount of keys
  1213. if KeyCounter == 7 then
  1214. if has.AllItems == true then -- if the player has all key items and/or Super Bum spawned Dads Key
  1215. if superbum.GoldenKeyPayout == false then --if he shouldn't spawn one already
  1216. -- we set the variables to allow a payout
  1217. superbum.GoldenKeyPayout = true -- lets Super Bum spawn a key
  1218. superbum.GoldenKeySpawned = false
  1219.  
  1220. -- we substract 7 from KeyCounter
  1221. KeyCounter = KeyCounter - 7
  1222. Mod:SaveData(KeyCounter)
  1223. -- Isaac.ConsoleOutput("Spawn Golden Key")
  1224. end
  1225. else -- if the player hasn't all the key items
  1226. -- we flip a coin
  1227. if keyroll < 50 then -- 0 for testing
  1228. if superbum.GoldenKeyPayout == false then -- if he shouldn't spawn a key already
  1229. -- for testing purpose we spawn a golden key
  1230. -- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_GOLDEN, entity.Position, Vector(0,0), SBum)
  1231.  
  1232. -- animation has to be set up
  1233. superbum.GoldenKeyPayout = true -- lets Super Bum spawn a Key
  1234. superbum.GoldenKeySpawned = false
  1235.  
  1236. -- we substract 7 from KeyCounter
  1237. KeyCounter = KeyCounter - 7
  1238. Mod:SaveData(KeyCounter)
  1239. end
  1240. end
  1241. end
  1242. elseif KeyCounter >= 12 -- the amount needed to have a chance to spawn an item/trinket
  1243. and has.AllItems == false then
  1244. -- check if he shouldn't already spawn a item/trinket
  1245. if superbum.KeyPayout == false then
  1246. -- set up Extra and minusKeys
  1247. if KeyCounter == 12 then
  1248. Extra = 35
  1249. minusKeys = 12
  1250. elseif KeyCounter == 13 then
  1251. Extra = 45
  1252. minusKeys = 13
  1253. elseif KeyCounter == 14 then
  1254. Extra = 55
  1255. minusKeys = 14
  1256. elseif KeyCounter == 15 then
  1257. Extra = 70
  1258. minusKeys = 15
  1259. elseif KeyCounter == 16 then
  1260. Extra = 85
  1261. minusKeys = 16
  1262. elseif KeyCounter == 17 then
  1263. Extra = 100
  1264. minusKeys = 17
  1265. end
  1266.  
  1267. -- check if he has a chance to spawn an item/trinket
  1268. if keyroll < Extra then -- testing
  1269. -- set the variables
  1270. superbum.KeyPayout = true -- allows Super Bum to spawn an item
  1271. superbum.KeySpawned = false -- truns true if Super Bum spawned an item
  1272.  
  1273. -- substract 'minusKeys' from 'KeyCounter'
  1274. KeyCounter = KeyCounter - minusKeys
  1275. Mod:SaveData(KeyCounter)
  1276.  
  1277. -- reset Exrta and minusKeys
  1278. Extra = 0
  1279. minusKeys = 0
  1280. -- Isaac.ConsoleOutput("Reset")
  1281. end
  1282. end
  1283. end
  1284. end
  1285. end
  1286. end
  1287. -- second coin collision code
  1288. if (SBum.Position - entity.Position):Length() < SBum.Size + entity.Size then
  1289. -- Isaac.ConsoleOutput("SPAWN INIT")
  1290. if functionality.SuperBumFriend == true then -- we check if Super Bum should have Bum Friends ability
  1291.  
  1292. if entity:GetSprite():IsPlaying("Collect")
  1293. and entity:GetData().Picked == nil then
  1294. entity:GetData().Picked = true
  1295.  
  1296. -- Sub type specific actions
  1297. if entity.Variant == PickupVariant.PICKUP_COIN then
  1298. if entity.SubType == CoinSubType.COIN_PENNY then
  1299. -- Penny Trinkets synergies
  1300. if player:GetTrinket(0) == TrinketType.TRINKET_BLOODY_PENNY
  1301. or player:GetTrinket(1) == TrinketType.TRINKET_BLOODY_PENNY then
  1302. if roll < 50 then
  1303. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_HEART, HeartSubType.HEART_HALF, entity.Position, Vector(0,0), SBum)
  1304. end
  1305. end
  1306. if player:GetTrinket(0) == TrinketType.TRINKET_BURNT_PENNY
  1307. or player:GetTrinket(1) == TrinketType.TRINKET_BURNT_PENNY then
  1308. if roll < 50 then
  1309. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_BOMB, BombSubType.BOMB_NORMAL, entity.Position, Vector(0,0), SBum)
  1310. end
  1311. end
  1312. if player:GetTrinket(0) == TrinketType.TRINKET_FLAT_PENNY
  1313. or player:GetTrinket(1) == TrinketType.TRINKET_FLAT_PENNY then
  1314. if roll < 50 then
  1315. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_NORMAL, entity.Position, Vector(0,0), SBum)
  1316. end
  1317. end
  1318. if player:GetTrinket(0) == TrinketType.TRINKET_BUTT_PENNY
  1319. or player:GetTrinket(1) == TrinketType.TRINKET_BUTT_PENNY then
  1320. if roll < 50 then
  1321. Isaac.GridSpawn(GridEntityType.GRID_POOP, 0, entity.Position, true)
  1322. end
  1323. end
  1324. if player:GetTrinket(0) == TrinketType.TRINKET_ROTTEN_PENNY
  1325. or player:GetTrinket(1) == TrinketType.TRINKET_ROTTEN_PENNY then
  1326. if roll < 50 then
  1327. Isaac.Spawn(EntityType.ENTITY_FAMILIAR, FamiliarVariant.BLUE_FLY, 0, entity.Position, Vector(0,0), SBum)
  1328. end
  1329. end
  1330. if player:GetTrinket(0) == TrinketType.TRINKET_COUNTERFEIT_PENNY
  1331. or player:GetTrinket(1) == TrinketType.TRINKET_COUNTERFEIT_PENNY then
  1332. if roll < 50 then
  1333. player:AddCoins(1)
  1334. end
  1335. end
  1336. elseif entity.SubType == CoinSubType.COIN_NICKEL then
  1337. -- Penny Trinkets synergies
  1338. if player:GetTrinket(0) == TrinketType.TRINKET_BLOODY_PENNY
  1339. or player:GetTrinket(1) == TrinketType.TRINKET_BLOODY_PENNY then
  1340. if roll < 75 then
  1341. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_HEART, HeartSubType.HEART_HALF, entity.Position, Vector(0,0), SBum)
  1342. end
  1343. end
  1344. if player:GetTrinket(0) == TrinketType.TRINKET_BURNT_PENNY
  1345. or player:GetTrinket(1) == TrinketType.TRINKET_BURNT_PENNY then
  1346. if roll < 75 then
  1347. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_BOMB, BombSubType.BOMB_NORMAL, entity.Position, Vector(0,0), SBum)
  1348. end
  1349. end
  1350. if player:GetTrinket(0) == TrinketType.TRINKET_FLAT_PENNY
  1351. or player:GetTrinket(1) == TrinketType.TRINKET_FLAT_PENNY then
  1352. if roll < 75 then
  1353. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_NORMAL, entity.Position, Vector(0,0), SBum)
  1354. end
  1355. end
  1356. if player:GetTrinket(0) == TrinketType.TRINKET_BUTT_PENNY
  1357. or player:GetTrinket(1) == TrinketType.TRINKET_BUTT_PENNY then
  1358. if roll < 75 then
  1359. Isaac.GridSpawn(GridEntityType.GRID_POOP, 0, entity.Position, true)
  1360. end
  1361. end
  1362. if player:GetTrinket(0) == TrinketType.TRINKET_ROTTEN_PENNY
  1363. or player:GetTrinket(1) == TrinketType.TRINKET_ROTTEN_PENNY then
  1364. if roll < 75 then
  1365. Isaac.Spawn(EntityType.ENTITY_FAMILIAR, FamiliarVariant.BLUE_FLY, 0, entity.Position, Vector(0,0), SBum)
  1366. end
  1367. end
  1368. if player:GetTrinket(0) == TrinketType.TRINKET_COUNTERFEIT_PENNY
  1369. or player:GetTrinket(1) == TrinketType.TRINKET_COUNTERFEIT_PENNY then
  1370. if roll < 75 then
  1371. player:AddCoins(1)
  1372. end
  1373. end
  1374. elseif entity.SubType == CoinSubType.COIN_DIME then
  1375. -- Penny Trinkets synergies
  1376. if player:GetTrinket(0) == TrinketType.TRINKET_BLOODY_PENNY
  1377. or player:GetTrinket(1) == TrinketType.TRINKET_BLOODY_PENNY then
  1378. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_HEART, HeartSubType.HEART_HALF, entity.Position, Vector(0,0), SBum)
  1379. end
  1380. if player:GetTrinket(0) == TrinketType.TRINKET_BURNT_PENNY
  1381. or player:GetTrinket(1) == TrinketType.TRINKET_BURNT_PENNY then
  1382. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_BOMB, BombSubType.BOMB_NORMAL, entity.Position, Vector(0,0), SBum)
  1383. end
  1384. if player:GetTrinket(0) == TrinketType.TRINKET_FLAT_PENNY
  1385. or player:GetTrinket(1) == TrinketType.TRINKET_FLAT_PENNY then
  1386. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_NORMAL, entity.Position, Vector(0,0), SBum)
  1387. end
  1388. if player:GetTrinket(0) == TrinketType.TRINKET_BUTT_PENNY
  1389. or player:GetTrinket(1) == TrinketType.TRINKET_BUTT_PENNY then
  1390. Isaac.GridSpawn(GridEntityType.GRID_POOP, 0, entity.Position, true)
  1391. end
  1392. if player:GetTrinket(0) == TrinketType.TRINKET_ROTTEN_PENNY
  1393. or player:GetTrinket(1) == TrinketType.TRINKET_ROTTEN_PENNY then
  1394. Isaac.Spawn(EntityType.ENTITY_FAMILIAR, FamiliarVariant.BLUE_FLY, 0, entity.Position, Vector(0,0), SBum)
  1395. end
  1396. if player:GetTrinket(0) == TrinketType.TRINKET_COUNTERFEIT_PENNY
  1397. or player:GetTrinket(1) == TrinketType.TRINKET_COUNTERFEIT_PENNY then
  1398. player:AddCoins(1)
  1399. end
  1400. elseif entity.SubType == CoinSubType.COIN_LUCKYPENNY then
  1401. if functionality.BonusAnimation == true then
  1402. SBum:GetSprite():Play("ThumbUp", true)
  1403.  
  1404. if SBum:GetSprite():IsPlaying("ThumbUp") then
  1405. player.Luck = player.Luck + 1
  1406. end
  1407. else
  1408. player.Luck = player.Luck + 1
  1409. end
  1410. end
  1411. end
  1412. end
  1413. end
  1414. end
  1415. end
  1416. end
  1417.  
  1418. -- spawn functions
  1419.  
  1420. -- Super/Dark Bums extra ability if you are the Lost
  1421. if player:GetPlayerType() == PlayerType.PLAYER_THELOST
  1422. and functionality.SuperDarkBum == true then
  1423.  
  1424. if Sprite:IsPlaying("Spawn") then
  1425. if Sprite:GetFrame() == 1 then
  1426. for p = 1, #entities do
  1427. local entitis = entities[p]
  1428. if entitis.Type == EntityType.ENTITY_PICKUP
  1429. and entitis.Variant == PickupVariant.PICKUP_HEART then
  1430. if entitis.SubType == HeartSubType.HEART_SOUL
  1431. or entitis.SubType == HeartSubType.HEART_BLACK then
  1432. if entitis.SpawnerType == EntityType.ENTITY_FAMILIAR
  1433. and entitis.SpawnerVariant == FamiliarVariant.SUPER_BUM then
  1434. entitis:Remove()
  1435. local numBlueSpider = 2 -- number of spiders Dark Bum will spawn
  1436. for k = 1, numBlueSpider do
  1437. player:ThrowBlueSpider(SBum.Position, player.Position)
  1438. end
  1439. end
  1440. end
  1441. end
  1442. end
  1443. end
  1444. end
  1445. end
  1446.  
  1447. -- Super/Dark Bums extra ability if you are the Keeper
  1448. if SBum:GetSprite():IsFinished("PreSpawnSuperCoin") then -- "PreSpawnCoin" can only be played if you are the Keeper
  1449. HeartCounter = HeartCounter - 5 -- reduce the heart counter
  1450. Mod:SaveData(HeartCounter)
  1451. Sprite:Play("SpawnSuperCoin", true)
  1452.  
  1453. -- spawn the coins equally around Super Bum
  1454. for e = 1, numCoins do
  1455. angle = math.random(math.floor(360/numCoins)) -- get the angle
  1456. angleVector = Vector.FromAngle(angle + (e-1)*(math.floor(360/numCoins))) -- this distributes the coins equally around Super Bum
  1457. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COIN, CoinSubType.COIN_PENNY, SBum.Position, angleVector, SBum)
  1458. end
  1459. end
  1460. if Sprite:IsFinished("SpawnSuperCoin") then
  1461. -- check if Super Bum shouldn't spawn more coins
  1462. if HeartCounter < 5 then
  1463. superbum.CoinPayout = false -- prevents that Super Bum spawns an other coin
  1464. superbum.CoinSpawned = false
  1465. else
  1466. superbum.CoinPayout = true -- allows Super Bum to spawn another coin
  1467. superbum.CoinSpawned = false
  1468. end
  1469.  
  1470. -- make Super Bum floats after he spawned something
  1471. Sprite:Play("FloatDown", true)
  1472. end
  1473.  
  1474. -- play float
  1475. if Sprite:IsFinished("Steal")
  1476. or SBum:GetSprite():IsFinished("ThumbUp") then
  1477. Sprite:Play("FloatDown", true)
  1478. end
  1479.  
  1480. -- Key Bums extra ability
  1481. -- Golden keys
  1482. if Sprite:IsFinished("PreSpawnKey") then -- no need to check for the functionality.KeyBum
  1483. -- play spawn animation
  1484. Sprite:Play("SpawnGoldenKey", true)
  1485. -- spawn a golden key
  1486. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_GOLDEN, SBum.Position, Vector(0,0), SBum)
  1487. end
  1488. -- Key themed items/trinkets
  1489. if Sprite:IsFinished("PreSpawnItem") then
  1490. -- play spawn animation
  1491. Sprite:Play("SpawnItem", true)
  1492. -- decide if Super Bum will spawn an item or a trinket
  1493. if keyrolltwo < 70 then -- we spawn an item -- o testing
  1494. local spawner = SBum
  1495. KeyItemPool(spawner, keyrolltwo)
  1496.  
  1497. else -- we spawn a trinket
  1498. local spawner = SBum
  1499. KeyTrinketPool(spawner, keyrolltwo)
  1500. end
  1501. end
  1502.  
  1503. -- After Super Bum finished the 'SpawnGoldenKey' or 'SpawnItem' we check if he could spawn more
  1504. if Sprite:IsFinished("SpawnGoldenKey")
  1505. or Sprite:IsFinished("SpawnItem") then
  1506. if has.AllItems == true then -- he spawned every possible items
  1507. if KeyCounter >= 7 then -- if the key counter is over 7
  1508. superbum.GoldenKeyPayout = true -- he can still spawn a golden Key
  1509. superbum.GoldenKeySpawned = false -- so he can spawn a golden key again
  1510. -- we substract 7 from KeyCounter
  1511. KeyCounter = KeyCounter - 7
  1512. superbum:SaveData(KeyCounter)
  1513. else
  1514. -- we stop him from paying out
  1515. superbum.GoldenKeyPayout = false
  1516. superbum.GoldenKeySpawned = false
  1517.  
  1518. -- just in case Super Bum didn't spawned Dad's Key
  1519. superbum.KeyPayout = false
  1520. superbum.KeySpawned = false
  1521. end
  1522. else
  1523. if KeyCounter == 7 then -- there is a chacne to spawn a golden key
  1524. if keyroll < 50 then -- we flip a coin
  1525. superbum.GoldenKeyPayout = true -- spawn an other key
  1526. superbum.GoldenKeySpawned = false
  1527. -- we substract 7 from KeyCounter
  1528. KeyCounter = KeyCounter - 7
  1529. Mod:SaveData(KeyCounter)
  1530. else
  1531. -- prevent him from spawning another key
  1532. superbum.GoldenKeyPayout = false
  1533. superbum.GoldenKeySpawned = false
  1534. end
  1535.  
  1536. elseif KeyCounter >= 12 then -- there is a chance to spawn an item
  1537. if KeyCounter == 12 then
  1538. Extra = 35
  1539. minusKeys = 12
  1540. elseif KeyCounter == 13 then
  1541. Extra = 45
  1542. minusKeys = 13
  1543. elseif KeyCounter == 14 then
  1544. Extra = 55
  1545. minusKeys = 14
  1546. elseif KeyCounter == 15 then
  1547. Extra = 70
  1548. minusKeys = 15
  1549. elseif KeyCounter == 16 then
  1550. Extra = 85
  1551. minusKeys = 16
  1552. elseif KeyCounter >= 17 then -- there is a possiblity that Super Bum picked up more then 17 keys
  1553. Extra = 100
  1554. minusKeys = 17
  1555. end
  1556.  
  1557. -- after getting Extra and minusKeys check if Super Bum could spawn an item
  1558. if keyroll < Extra then
  1559. superbum.KeyPayout = true -- he should spawn another item
  1560. superbum.KeySpawned = false -- allows Super Bum to spawn an other item
  1561. -- we substract minusKeys from KeyCounter
  1562. KeyCounter = KeyCounter - minusKeys
  1563. Mod:SaveData(KeyCounter)
  1564. else
  1565. superbum.KeyPayout = false
  1566. superbum.KeySpawned = false
  1567. end
  1568. -- reset Extra and minusKeys
  1569. Extra = 0
  1570. minusKeys = 0
  1571. -- Isaac.ConsoleOutput("Reset")
  1572.  
  1573. else
  1574. -- if nothing can happen set the variables back
  1575. -- golden key
  1576. superbum.GoldenKeyPayout = false
  1577. superbum.GoldenKeySpawned = false
  1578. -- items
  1579. superbum.KeyPayout = false
  1580. superbum.KeySpawned = false
  1581. end
  1582. end
  1583.  
  1584. -- make Super Bum float after he spawned something
  1585. Sprite:Play("FloatDown", true)
  1586. end
  1587.  
  1588.  
  1589.  
  1590. -- play float animation
  1591. if Sprite:IsFinished("ThumbUp") then
  1592. Sprite:Play("FloatDown", true)
  1593. end
  1594. end
  1595.  
  1596. Mod:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, Mod.onConsumablePickup, FamiliarVariant.SUPER_BUM)
  1597.  
  1598. -- on new room
  1599. function Mod:onNewRoom(_)
  1600. local player = Isaac.GetPlayer(0)
  1601. local entities = Isaac.GetRoomEntities()
  1602. local roomType = game:GetRoom():GetType()
  1603. local bumPool = {144,278,388}
  1604.  
  1605.  
  1606. if game:GetRoom():IsFirstVisit() == true then
  1607.  
  1608. -- get base bumChance
  1609. if functionality.OldBumChance == false then
  1610. bumChance = 5
  1611. else
  1612. bumChance = 0
  1613. end
  1614.  
  1615. -- get bumChance
  1616. if Mod.Init == false then -- if the player hasn't Super Bum
  1617. -- the chance increases if the player has a bum
  1618. if player:HasCollectible(388) then
  1619. table.remove(bumPool, 3)
  1620. bumChance = bumChance + 10
  1621. end
  1622. if player:HasCollectible(278) then
  1623. table.remove(bumPool, 2)
  1624. bumChance = bumChance + 10
  1625. end
  1626. if player:HasCollectible(144) then
  1627. table.remove(bumPool, 1)
  1628. bumChance = bumChance + 10
  1629. end
  1630. end
  1631.  
  1632. -- room specific action
  1633. if functionality.MoreBums == true then
  1634. if roomType == RoomType.ROOM_TREASURE then
  1635. 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}
  1636. for w = 1, #entities do
  1637. local entity = entities[w]
  1638. if entity.Type == EntityType.ENTITY_PICKUP
  1639. and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE then
  1640. -- look for a familiar from the treasure pool
  1641. for r = 1, #treasurePool do
  1642. if entity.SubType == treasurePool[r]
  1643. and entity:GetData().Rerolled == nil then
  1644. entity:GetData().Rerolled = true
  1645. local itemRng = player:GetCollectibleRNG(treasurePool[r])
  1646. local bumRoll = itemRng:RandomInt(100)
  1647. if bumRoll < bumChance then
  1648. -- spaen a random bum
  1649. local pickBum = math.random(#bumPool)
  1650. entity:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, bumPool[pickBum], true)
  1651. end
  1652. end
  1653. end
  1654. end
  1655. end
  1656.  
  1657. elseif roomType == RoomType.ROOM_SECRET then
  1658. local secretPool = {94,131,271,321,389,405}
  1659. for v = 1, #entities do
  1660. local entity = entities[v]
  1661. if entity.Type == EntityType.ENTITY_PICKUP
  1662. and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE then
  1663. -- look for a familiar from the secret pool
  1664. for g = 1, #secretPool do
  1665. if entity.SubType == secretPool[g]
  1666. and entity:GetData().Rerolled == nil then
  1667. entity:GetData().Rerolled = true
  1668. local itemRng = player:GetCollectibleRNG(secretPool[g])
  1669. local bumRoll = itemRng:RandomInt(100)
  1670. if bumRoll < bumChance then
  1671. -- spawn a key bum
  1672. entity:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_KEY_BUM, true)
  1673. end
  1674. end
  1675. end
  1676. end
  1677. end
  1678.  
  1679.  
  1680. elseif roomType == RoomType.ROOM_DEVIL then
  1681. local devilPool = {67,113,163,187,268,269,275,360,412,417,431,433,468,519}
  1682. for z = 1, #entities do
  1683. local entity = entities[z]
  1684. if entity.Type == EntityType.ENTITY_PICKUP
  1685. and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE then
  1686. -- look for a familiar from the devil pool
  1687. for t = 1, #devilPool do
  1688. if entity.SubType == devilPool[t]
  1689. and entity:GetData().Rerolled == nil then
  1690. entity:GetData().Rerolled = true
  1691. local itemRng = player:GetCollectibleRNG(devilPool[t])
  1692. local bumRoll = itemRng:RandomInt(100)
  1693. if bumRoll < bumChance then
  1694. -- spawn a dark bum
  1695. entity:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_DARK_BUM, true)
  1696. end
  1697. end
  1698. end
  1699. end
  1700. end
  1701.  
  1702. end
  1703. -- reset bumChance and bumPool
  1704. if functionality.OldBumChance == false then
  1705. bumChance = 5
  1706. else
  1707. bumChance = 0
  1708. end
  1709. bumPool = backBumPool
  1710. end
  1711. end
  1712.  
  1713. end
  1714. Mod:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, Mod.onNewRoom)
  1715.  
  1716. -- on reroll
  1717. function Mod:onReroll(_)
  1718. local player = Isaac.GetPlayer(0)
  1719. local entities = Isaac.GetRoomEntities()
  1720. local roomType = game:GetRoom():GetType()
  1721. local bumPool = {144,278,388}
  1722.  
  1723. -- get bumChance
  1724. if functionality.OldBumChance == false then
  1725. bumChance = 5
  1726. else
  1727. bumChance = 0
  1728. end
  1729.  
  1730. -- get bumChance
  1731. if Mod.Init == false then -- if the player hasn't Super Bum
  1732. -- the chance increases if the player has a bum
  1733. if player:HasCollectible(388) then
  1734. table.remove(bumPool, 3)
  1735. bumChance = bumChance + 10
  1736. end
  1737. if player:HasCollectible(278) then
  1738. table.remove(bumPool, 2)
  1739. bumChance = bumChance + 10
  1740. end
  1741. if player:HasCollectible(144) then
  1742. table.remove(bumPool, 1)
  1743. bumChance = bumChance + 10
  1744. end
  1745. end
  1746.  
  1747. if player:GetActiveItem() == CollectibleType.COLLECTIBLE_D6 then
  1748. -- room specific action
  1749. if functionality.MoreBums == true then
  1750. if roomType == RoomType.ROOM_TREASURE then
  1751. 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}
  1752. for w = 1, #entities do
  1753. local entity = entities[w]
  1754. if entity.Type == EntityType.ENTITY_PICKUP
  1755. and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE then
  1756. -- look for a familiar from the treasure pool
  1757. for i = 1, #treasurePool do
  1758. if entity.SubType == treasurePool[i] then
  1759. local itemRng = player:GetCollectibleRNG(treasurePool[i])
  1760. local bumRoll = itemRng:RandomInt(100)
  1761. if bumRoll < bumChance then
  1762. -- spaen a random bum
  1763. local pickBum = math.random(#bumPool)
  1764. entity:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, bumPool[pickBum], true)
  1765. end
  1766. end
  1767. end
  1768. end
  1769. end
  1770. elseif roomType == RoomType.ROOM_SECRET then
  1771. local secretPool = {94,131,271,321,389,405}
  1772. for v = 1, #entities do
  1773. local entity = entities[v]
  1774. if entity.Type == EntityType.ENTITY_PICKUP
  1775. and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE then
  1776. -- look for a familiar from the secret pool
  1777. for h = 1, #secretPool do
  1778. if entity.SubType == secretPool[h] then
  1779. local itemRng = player:GetCollectibleRNG(secretPool[h])
  1780. local bumRoll = itemRng:RandomInt(100)
  1781. if bumRoll < bumChance then
  1782. -- spawn a key bum
  1783. entity:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_KEY_BUM, true)
  1784. end
  1785. end
  1786. end
  1787. end
  1788. end
  1789. elseif roomType == RoomType.ROOM_DEVIL then
  1790. local devilPool = {67,113,163,187,268,269,275,360,412,417,431,433,468,519}
  1791. for z = 1, #entities do
  1792. local entity = entities[z]
  1793. if entity.Type == EntityType.ENTITY_PICKUP
  1794. and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE then
  1795. -- look for a familiar from the devil pool
  1796. for x = 1, #devilPool do
  1797. if entity.SubType == devilPool[x] then
  1798. local itemRng = player:GetCollectibleRNG(devilPool[x])
  1799. local bumRoll = itemRng:RandomInt(100)
  1800. if bumRoll < bumChance then
  1801. -- spawn a dark bum
  1802. entity:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_DARK_BUM, true)
  1803. end
  1804. end
  1805. end
  1806. end
  1807. end
  1808.  
  1809. end
  1810. -- reset bumChance and bumPool
  1811. if functionality.OldBumChance == false then
  1812. bumChance = 5
  1813. else
  1814. bumChance = 0
  1815. end
  1816. bumPool = backBumPool
  1817. end
  1818. end
  1819. end
  1820. Mod:AddCallback(ModCallbacks.MC_USE_ITEM, Mod.onReroll)
Advertisement
Add Comment
Please, Sign In to add comment