Josh64

function SuperBum:onNewRoom

Dec 25th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 50.23 KB | None | 0 0
  1. local SuperBum = RegisterMod("bettersuperbum", 1)
  2. local game = Game()
  3.  
  4. -- different counters
  5. local sHCount = 0 -- sHCount = heart count
  6. local sBKeys = 0 -- sBKeys = Super Bum Keys
  7. local sBExtra = 0 -- sBextra = Super Bum chance to spawn an item
  8. local minusKeys = 0 -- number which will be subtracted from sBKeys if Super Bum spawns an item or trinket
  9. local trinketCounter = 0 -- keeps track of the key themed trinkets
  10. local bumChance = 0 -- counter which increases when the player has a bum
  11.  
  12. -- variables/tables for Key Bums effect
  13. local has = {
  14. AllItems = nil, -- does the player has all key themed items
  15. DadsKey = nil, -- did Super Bum spawned Dads Key?
  16. PaperClip = nil, -- = true when the player has Paper Clip
  17. RustedKey = nil, -- = true when the player has Rusted Key
  18. StoreKey = nil -- = true when the player has Store Key
  19. }
  20.  
  21. -- variables for Dark Bums effect
  22. local superbum = {
  23. Init = false, -- keeps track if the player has Super Bum
  24. CoinSpawned = false, -- keeps track if Super Bum has already spawned a coin
  25. CoinPayout = false, -- keeps track if Super Bum should payout with a coin
  26. KeySpawned = false, -- keeps track if Super Bum has already spawned a key themed item or trinket
  27. KeyPayout = false, -- keeps track if Super Bum should payout with a key themed item or trinket
  28. GoldenKeySpawned = false, -- keeps track if Super Bum has already spawned a golden key
  29. GoldenKeyPayout = false, -- keeps track if Super Bum should payout with a golden key
  30. Bum = nil -- stores Super Bum as a familiar
  31. }
  32.  
  33. -- variables to costumize Super Bums abilities
  34. local functionality = {
  35. DarkBum = true, -- used to activate or deactive the ability from Dark Bum
  36. KeyBum = true, -- used to activate or deactive the ability from Key Bum
  37. BumFriend = true, -- used to activate or deactive the ability from Bum Friend
  38. MoreBums = true, -- if true then the player will have higher chance to find classic bums
  39. BonusAnimation = false -- used to activate or deactivate the bonus animation (ThumbsUp)
  40. }
  41.  
  42. -- tables for item and trinket pools
  43. -- for Super Bum
  44. local resetItemPool = {17,175,199,343} -- table which is used to restore itemPool?
  45. local resetTrinketPool = {19,36,83} -- table which is used to restore trinketPool?
  46.  
  47. -- to find more bums
  48. local devilPool = {67,113,163,187,268,269,275,360,412,417,431,433,468,519}
  49. local secretPool = {94,131,271,321,389,405}
  50. local backBumPool = {144,278,388} -- table which is used to restore bumPool?
  51.  
  52. -- Key Item Pool
  53. local function KeyItemPool(SBum, keyrolltwo)
  54. local player = Isaac.GetPlayer(0)
  55. -- item & trinket pool
  56. local itemPool = {17,175,199,343} -- 17 = Skeleton Key, 175 = Dad's Key, 199 = Mom's Key, 343 = Latch Key
  57. local trinketPool = {19,36,83} -- 19 = Paper Clip, 36 = Rusted Key, 83 = Store Key
  58.  
  59. -- empty the item pool table
  60. if player:HasCollectible(343) then -- Latch Key
  61. table.remove(itemPool, 4) -- remove the item from the table/pool
  62. end
  63. if player:HasCollectible(199) then -- Mom's Key
  64. table.remove(itemPool, 3)
  65. end
  66. if player:HasCollectible(175) -- Dad's Key
  67. or has.DadsKey == true then
  68. table.remove(itemPool, 2)
  69. end
  70. if player:HasCollectible(17) then -- Skeleton Key
  71. table.remove(itemPool, 1)
  72. end
  73.  
  74. -- empty the trinket pool table
  75. if player:GetTrinket(0) == TrinketType.TRINKET_STORE_KEY
  76. or player:GetTrinket(1) == TrinketType.TRINKET_STORE_KEY then
  77. table.remove(trinketPool, 3) -- remove the trinket from the table/pool
  78. trinketCounter = trinketCounter + 1 -- increase the trinket counter
  79. SuperBum:SaveData(trinketCounter)
  80. end
  81. if player:GetTrinket(0) == TrinketType.TRINKET_RUSTED_KEY
  82. or player:GetTrinket(1) == TrinketType.TRINKET_RUSTED_KEY then
  83. table.remove(trinketPool, 2)
  84. trinketCounter = trinketCounter + 1
  85. SuperBum:SaveData(trinketCounter)
  86. end
  87. if player:GetTrinket(0) == TrinketType.TRINKET_PAPER_CLIP
  88. or player:GetTrinket(1) == TrinketType.TRINKET_PAPER_CLIP then
  89. table.remove(trinketPool, 1)
  90. trinketCounter = trinketCounter + 1
  91. SuperBum:SaveData(trinketCounter)
  92. end
  93.  
  94. -- now we check which item should be spawned
  95. if keyrolltwo < 10 then
  96. -- get the collectible rng
  97. local rngone = player:GetCollectibleRNG(17) -- 17 = Skeleton Key
  98. local keyone = rngone:RandomInt(100)
  99.  
  100. if player:HasCollectible(17) then
  101. -- if the player has the item then we spawn another item or trinket
  102. if keyone < 50 then -- we spawn an item
  103. if has.AllItems == true then -- the player has all key items
  104. -- we "breakfast"
  105. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, SBum.Position, Vector(0,0), SBum)
  106. else
  107. -- spawn an item which is left in the pool
  108. local pickItem = math.random(#itemPool)
  109. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], SBum.Position, Vector(0,0), SBum)
  110. -- check for Dad's Key
  111. if itemPool[pickItem] == 175 then
  112. has.DadsKey = true
  113. end
  114. end
  115. else
  116. -- we should spawn a trinket
  117. if trinketCounter >= 2 then -- check if the player doesn't have two Key themed trinkets and then spawn an other item
  118. if has.AllItems == true then -- the player has all key items
  119. -- we "breakfast"
  120. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, SBum.Position, Vector(0,0), SBum)
  121. else
  122. -- spawn an item which is left in the pool
  123. local pickItem = math.random(#itemPool)
  124. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], SBum.Position, Vector(0,0), SBum)
  125. -- check for Dad's Key
  126. if itemPool[pickItem] == 175 then
  127. has.DadsKey = true
  128. end
  129. end
  130. else -- we spawn a trinket
  131. local pickTrinket = math.random(#trinketPool)
  132. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketPool[pickTrinket], SBum.Position, Vector(0,0), SBum)
  133. end
  134. end
  135. else
  136. -- spawn Skeleton Key
  137. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_SKELETON_KEY, SBum.Position, Vector(0,0), SBum)
  138. end
  139. elseif keyrolltwo < 30 then
  140. -- get the collectible rng
  141. local rngtwo = player:GetCollectibleRNG(175) -- 175 = Dad's Key
  142. local keytwo = rngtwo:RandomInt(100)
  143.  
  144. if player:HasCollectible(175)
  145. or has.DadsKey == true then
  146. -- if the player has the item then we spawn another item or trinket
  147. if keytwo < 50 then -- we spawn an item
  148. if has.AllItems == true then -- the player has all key items
  149. -- we "breakfast"
  150. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, SBum.Position, Vector(0,0), SBum)
  151. else
  152. -- spawn an item which is left in the pool
  153. local pickItem = math.random(#itemPool)
  154. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], SBum.Position, Vector(0,0), SBum)
  155. end
  156. else
  157. -- Super Bum should spawn a trinket
  158. if trinketCounter >= 2 then -- check if the player doesn't have two Key themed trinkets and then spawn an other item
  159. if has.AllItems == true then -- the player has all key items
  160. -- we "breakfast"
  161. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, SBum.Position, Vector(0,0), SBum)
  162. else
  163. -- spawn an item which is left in the pool
  164. local pickItem = math.random(#itemPool)
  165. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], SBum.Position, Vector(0,0), SBum)
  166. end
  167. else -- he spawns a trinket
  168. local pickTrinket = math.random(#trinketPool)
  169. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketPool[pickTrinket], SBum.Position, Vector(0,0), SBum)
  170. end
  171. end
  172. else
  173. -- spawn Dad's Key
  174. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_DADS_KEY, SBum.Position, Vector(0,0), SBum)
  175. has.DadsKey = true
  176. Isaac.ConsoleOutput("Super Dasds Key")
  177. end
  178. elseif keyrolltwo < 50 then
  179. -- get the collectible rng
  180. local rngthree = player:GetCollectibleRNG(199) -- 199 = Mom's Key
  181. local keythree = rngthree:RandomInt(100)
  182.  
  183. if player:HasCollectible(199) then
  184. -- if the player has the item then we spawn another item or trinket
  185. if keythree < 50 then -- we spawn an item
  186. if has.AllItems == true then -- the player has all key items
  187. -- we "breakfast"
  188. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, SBum.Position, Vector(0,0), SBum)
  189. else
  190. -- spawn an item which is left in the pool
  191. local pickItem = math.random(#itemPool)
  192. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], SBum.Position, Vector(0,0), SBum)
  193. -- check for Dad's Key
  194. if itemPool[pickItem] == 175 then
  195. has.DadsKey = true
  196. Isaac.ConsoleOutput("Super Bum")
  197. end
  198. end
  199. else
  200. -- Super Buh should spawn a trinket
  201. if trinketCounter >= 2 then -- check if the player doesn't have two Key themed trinkets and then spawn an other 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, SBum.Position, Vector(0,0), SBum)
  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], SBum.Position, Vector(0,0), SBum)
  209. -- check for Dad's Key
  210. if itemPool[pickItem] == 175 then
  211. has.DadsKey = true
  212. Isaac.ConsoleOutput("Super Bum")
  213. end
  214. end
  215. else -- we spawns a trinket
  216. local pickTrinket = math.random(#trinketPool)
  217. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketPool[pickTrinket], SBum.Position, Vector(0,0), SBum)
  218. end
  219. end
  220. else
  221. -- spawn Mom's Key
  222. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_MOMS_KEY, SBum.Position, Vector(0,0), SBum)
  223. end
  224. elseif keyrolltwo < 70 then
  225. -- get the collectible rng
  226. local rngfour = player:GetCollectibleRNG(343) -- 343 = Latch Key
  227. local keyfour = rngfour:RandomInt(100)
  228.  
  229. if player:HasCollectible(343) then
  230. -- if the player has the item then we spawn another item or trinket
  231. if keyfour < 50 then -- we spawn an item
  232. if has.AllItems == true then -- the player has all key items
  233. -- we "breakfast"
  234. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, SBum.Position, Vector(0,0), SBum)
  235. else
  236. -- spawn an item which is left in the pool
  237. local pickItem = math.random(#itemPool)
  238. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], SBum.Position, Vector(0,0), SBum)
  239. -- check for Dad's Key
  240. if itemPool[pickItem] == 175 then
  241. has.DadsKey = true
  242. Isaac.ConsoleOutput("Super Bum")
  243. end
  244. end
  245. else
  246. -- we should spawn a trinket
  247. if trinketCounter >= 2 then -- check if the player doesn't have two Key themed trinkets and then spawn an other item
  248. if has.AllItems == true then -- the player has all key items
  249. -- we "breakfast"
  250. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, SBum.Position, Vector(0,0), SBum)
  251. else
  252. -- spawn an item which is left in the pool
  253. local pickItem = math.random(#itemPool)
  254. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], SBum.Position, Vector(0,0), SBum)
  255. -- check for Dad's Key
  256. if itemPool[pickItem] == 175 then
  257. has.DadsKey = true
  258. Isaac.ConsoleOutput("Super Bum")
  259. end
  260. end
  261. else -- we spawn a trinket
  262. local pickTrinket = math.random(#trinketPool)
  263. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketPool[pickTrinket], SBum.Position, Vector(0,0), SBum)
  264. end
  265. end
  266. else
  267. -- spawn Latch Key
  268. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_LATCH_KEY, SBum.Position, Vector(0,0), SBum)
  269. end
  270. end
  271. -- reset the item and trinket pools?
  272. itemPool = resetItemPool
  273. trinketPool = resetTrinketPool
  274.  
  275. trinketCounter = 0
  276. SuperBum:SaveData(trinketCounter)
  277. end
  278.  
  279. local function KeyTrinketPool(SBum, keyrolltwo)
  280. local player = Isaac.GetPlayer(0)
  281. -- item & trinket pools
  282. local itemPool = {17,175,199,343} -- 17 = Skeleton Key, 175 = Dad's Key, 199 = Mom's Key, 343 = Latch Key
  283. local trinketPool = {19,36,83} -- 19 = Paper Clip, 36 = Rusted Key, 83 = Store Key
  284. -- variables
  285. local spawned = false -- keeps track if Super Bum has spawned a trinket
  286.  
  287. -- check if the player has a key themed trinket and empty the trinket pool
  288. if player:GetTrinket(0) == TrinketType.TRINKET_STORE_KEY
  289. or player:GetTrinket(1) == TrinketType.TRINKET_STORE_KEY then
  290. table.remove(trinketPool, 3)
  291. trinketCounter = trinketCounter + 1
  292. SuperBum:SaveData(trinketCounter)
  293. has.StoreKey = true -- player has the Store Key trinket
  294. else
  295. has.StoreKey = false
  296. end
  297. if player:GetTrinket(0) == TrinketType.TRINKET_RUSTED_KEY
  298. or player:GetTrinket(1) == TrinketType.TRINKET_RUSTED_KEY then
  299. table.remove(trinketPool, 2)
  300. trinketCounter = trinketCounter + 1
  301. SuperBum:SaveData(trinketCounter)
  302. has.RustedKey = true -- player has the Rusted Key trinket
  303. else
  304. has.RustedKey = false
  305. end
  306. if player:GetTrinket(0) == TrinketType.TRINKET_PAPER_CLIP
  307. or player:GetTrinket(1) == TrinketType.TRINKET_PAPER_CLIP then
  308. table.remove(trinketPool, 1)
  309. trinketCounter = trinketCounter + 1
  310. SuperBum:SaveData(trinketCounter)
  311. has.PaperClip = true -- player has the Paper Clip trinket
  312. else
  313. has.PaperClip = false
  314. end
  315.  
  316. -- empty the item pool table
  317. if player:HasCollectible(343) then -- Latch Key
  318. table.remove(itemPool, 4) -- remove the item from the table/pool
  319. end
  320. if player:HasCollectible(199) then -- Mom's Key
  321. table.remove(itemPool, 3)
  322. end
  323. if player:HasCollectible(175) -- Dad's Key
  324. or has.DadsKey == true then
  325. table.remove(itemPool, 2)
  326. end
  327. if player:HasCollectible(17) then -- Skeleton Key
  328. table.remove(itemPool, 1)
  329. end
  330.  
  331. -- different actions depending on the amount of trinkets
  332. if trinketCounter == 2 then
  333. Isaac.ConsoleOutput("trinketCounter = 2")
  334. -- we spawn an item
  335. if has.AllItems == true then
  336. -- "breakfast"
  337. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, SBum.Position, Vector(0,0), SBum)
  338. else
  339. -- spawn an item from the pool
  340. local pickItem = math.random(#itemPool)
  341. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], SBum.Position, Vector(0,0), SBum)
  342. -- check for Dad's Key
  343. if itemPool[pickItem] == 175 then
  344. has.DadsKey = true
  345. end
  346. end
  347. spawned = true
  348. end
  349. if trinketCounter == 1 then -- there's a chamce to spawn an item
  350. Isaac.ConsoleOutput("trinketCounter = 1")
  351. -- check which key themed trinket the player has
  352. -- does he has the Store Key
  353. if has.StoreKey == true then
  354. -- get the RNG
  355. local rngfive = player:GetTrinketRNG(TrinketType.TRINKET_STORE_KEY)
  356. local keyfive = rngfive:RandomInt(100)
  357. if keyfive < 50 then
  358. -- spawn item
  359. if has.AllItems == true then
  360. -- "breakfast"
  361. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, SBum.Position, Vector(0,0), SBum)
  362. else
  363. -- spawn an item from the pool
  364. local pickItem = math.random(#itemPool)
  365. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], SBum.Position, Vector(0,0), SBum)
  366. -- check for Dad's Key
  367. if itemPool[pickItem] == 175 then
  368. has.DadsKey = true
  369. end
  370. end
  371. else
  372. -- 50% chance to spawn a different trinket
  373. local pickTrinket = math.random(#trinketPool)
  374. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketPool[pickTrinket], SBum.Position, Vector(0,0), SBum)
  375. end
  376. spawned = true
  377. -- does he has the Rusted Key
  378. elseif has.RustedKey == true then
  379. -- get the RNG
  380. local rngsix = player:GetTrinketRNG(TrinketType.TRINKET_RUSTED_KEY)
  381. local keysix = rngsix:RandomInt(100)
  382. if keysix < 50 then
  383. -- spawn item
  384. if has.AllItems == true then
  385. -- "breakfast"
  386. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, SBum.Position, Vector(0,0), SBum)
  387. else
  388. -- spawn an item from the pool
  389. local pickItem = math.random(#itemPool)
  390. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], SBum.Position, Vector(0,0), SBum)
  391. -- check for Dad's Key
  392. if itemPool[pickItem] == 175 then
  393. has.DadsKey = true
  394. end
  395. end
  396. else
  397. -- 50% chance to spawn a different trinket
  398. local pickTrinket = math.random(#trinketPool)
  399. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketPool[pickTrinket], SBum.Position, Vector(0,0), SBum)
  400. end
  401. spawned = true
  402. -- does he has the Paper Clip
  403. elseif has.PaperClip == true then
  404. -- get the RNG
  405. local rngseven = player:GetTrinketRNG(TrinketType.TRINKET_PAPER_CLIP)
  406. local keyseven = rngseven:RandomInt(100)
  407. if keyseven < 50 then
  408. -- spawn item
  409. if has.AllItems == true then
  410. -- "breakfast"
  411. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, SBum.Position, Vector(0,0), SBum)
  412. else
  413. -- spawn an item from the pool
  414. local pickItem = math.random(#itemPool)
  415. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, itemPool[pickItem], SBum.Position, Vector(0,0), SBum)
  416. -- check for Dad's Key
  417. if itemPool[pickItem] == 175 then
  418. has.DadsKey = true
  419. end
  420. end
  421. else
  422. -- 50% chance to spawn a different trinket
  423. local pickTrinket = math.random(#trinketPool)
  424. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketPool[pickTrinket], SBum.Position, Vector(0,0), SBum)
  425. end
  426. spawned = true
  427. end
  428. else
  429. if spawned == false then
  430. Isaac.ConsoleOutput("trinketCounter = 0")
  431. --spawn a key themed trinket
  432. if keyrolltwo < 86 then
  433. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_PAPER_CLIP, SBum.Position, Vector(0,0), SBum)
  434. elseif keyrolltwo < 103 then
  435. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_RUSTED_KEY, SBum.Position, Vector(0,0), SBum)
  436. else
  437. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_STORE_KEY, SBum.Position, Vector(0,0), SBum)
  438. end
  439. end
  440. end
  441.  
  442. -- reset the item and trinket pools?
  443. itemPool = resetItemPool
  444. trinketPool = resetTrinketPool
  445.  
  446. spawned = false
  447. trinketCounter = 0
  448. SuperBum:SaveData(trinketCounter)
  449. end
  450.  
  451. -- console commands
  452. function SuperBum:costumizeBum(consol,para)
  453. if consol == "bonusAnimation" then
  454. if functionality.BonusAnimation == false then
  455. functionality.BonusAnimation = true
  456. Isaac.ConsoleOutput("bonus animation will be used")
  457. else
  458. functionality.BonusAnimation = false
  459. Isaac.ConsoleOutput("bonus animation won't be used")
  460. end
  461. elseif consol == "moreBums" then
  462. if functionality.MoreBums == false then
  463. functionality.MoreBums = true
  464. Isaac.ConsoleOutput("high chance to find other bums")
  465. else
  466. functionality.MoreBums = false
  467. Isaac.ConsoleOutput("normal chance to find other bums")
  468. end
  469. elseif consol == "darkAbility" then
  470. if functionality.DarkBum == false then
  471. functionality.DarkBum = true
  472. Isaac.ConsoleOutput("Dark Bum's ability will be used")
  473. else
  474. functionality.DarkBum = false
  475. Isaac.ConsoleOutput("Dark Bum's ability won't be used")
  476. end
  477.  
  478. elseif consol == "keyAbility" then
  479. if functionality.KeyBum == false then
  480. functionality.KeyBum = true
  481. Isaac.ConsoleOutput("Key Bum's ability will be used")
  482. else
  483. functionality.KeyBum = false
  484. Isaac.ConsoleOutput("Key Bum's ability wont be used")
  485.  
  486. end
  487.  
  488. elseif consol == "friendAbility" then
  489. if functionality.BumFriend == false then
  490. functionality.BumFriend = true
  491. Isaac.ConsoleOutput("Bum Friend's ability will be used")
  492. else
  493. functionality.BumFriend = false
  494. Isaac.ConsoleOutput("Bum Friend's ability wont be used")
  495. end
  496. end
  497. end
  498. SuperBum:AddCallback(ModCallbacks.MC_EXECUTE_CMD, SuperBum.costumizeBum)
  499.  
  500. -- post peffect update
  501. function SuperBum:onNewEvent(player)
  502. local entities = Isaac.GetRoomEntities()
  503. local entity = superbum.Bum
  504.  
  505.  
  506. -- stuff which happens on Frame 1
  507. if game:GetFrameCount() == 1 then
  508. -- spawn in if you want to
  509. end
  510.  
  511. -- check if the player has SuperBum
  512. if player:HasCollectible(388)
  513. and player:HasCollectible(278)
  514. and player:HasCollectible(144) then
  515. superbum.Init = true -- player has Super Bum
  516. else
  517. superbum.Init = false -- player doesn't have Super Bum
  518. end
  519.  
  520. -- check if SuperBum spawned every item
  521. if superbum.Init == true then
  522. if player:HasCollectible(343)
  523. and player:HasCollectible(199)
  524. and player:HasCollectible(17) then
  525. if has.DadsKey == true
  526. or player:GetActiveItem() == CollectibleType.COLLECTIBLE_DADS_KEY then
  527. has.AllItems = true -- we set has.AllItems to true
  528. else
  529. has.AllItems = false -- we set has.AllItems to false
  530. end
  531. else
  532. has.AllItems = false -- we set has.AllItems to false
  533. end
  534. end
  535.  
  536. -- keep track of Super Bum
  537. if superbum.Init == true then -- if the player has Super Bum
  538. for a = 1, #entities do -- we go through all entites in the room
  539. local bum = entities[a]
  540. if bum.Type == EntityType.ENTITY_FAMILIAR then
  541. if bum.Variant == FamiliarVariant.SUPER_BUM then
  542. entity = bum
  543. -- Isaac.ConsoleOutput("Super Bum") -- testing
  544. end
  545. end
  546. end
  547.  
  548.  
  549. -- Dark Bum's effect
  550. if player:GetPlayerType() == PlayerType.PLAYER_KEEPER
  551. and functionality.DarkBum == true then
  552.  
  553. -- if the player is the Keeper then we look for red hearts
  554. for x = 1, #entities do
  555. local toSteal = entities[x] -- variable which keeps track of all the hearts Super Bum can steal
  556. if toSteal.Type == EntityType.ENTITY_PICKUP
  557. and toSteal.Variant == PickupVariant.PICKUP_HEART then
  558.  
  559. -- look for all kinds of red hearts
  560. if toSteal.SubType == HeartSubType.HEART_HALF
  561. and (not toSteal:ToPickup():IsShopItem()) then
  562. toSteal:Remove() -- remove the heart before it gets turned into a blue fly
  563. entity:GetSprite():Play("Steal", true) -- play steal animation
  564. if entity:GetSprite():IsPlaying("Steal") then
  565. -- increase the heart counter
  566. sHCount = sHCount + 1
  567. SuperBum:SaveData(sHCount)
  568. -- check if he should spawn coins
  569. if sHCount >= 5 then -- pay out at 2,5 red hearts
  570. superbum.CoinPayout = true -- allows Super Bum to spawn coins
  571. end
  572. end
  573. elseif toSteal.SubType == HeartSubType.HEART_FULL
  574. and (not toSteal:ToPickup():IsShopItem()) then
  575. toSteal:Remove() -- remove the heart before it gets turned into a blue fly
  576. entity:GetSprite():Play("Steal", true)
  577. if entity:GetSprite():IsPlaying("Steal") then
  578. -- increase the heart counter
  579. sHCount = sHCount + 2
  580. SuperBum:SaveData(sHCount)
  581. Isaac.ConsoleOutput("Heart Counter")
  582.  
  583. -- check if he should spawn coins
  584. if sHCount >= 5 then
  585. superbum.CoinPayout = true -- allows Super Bum to spawn coins
  586. end
  587. end
  588. elseif toSteal.SubType == HeartSubType.HEART_SCARED
  589. and (not toSteal:ToPickup():IsShopItem()) then
  590. toSteal:Remove() -- remove the heart before it gets turned into a blue fly
  591. entity:GetSprite():Play("Steal", true)
  592. if entity:GetSprite():IsPlaying("Steal") then
  593. -- increase the heart counter
  594. sHCount = sHCount + 2
  595. SuperBum:SaveData(sHCount)
  596. -- check if he should spawn coins
  597. if sHCount >= 5 then
  598. superbum.CoinPayout = true -- allows Super Bum to spawn coins
  599. end
  600. end
  601. elseif toSteal.SubType == HeartSubType.HEART_DOUBLEPACK
  602. and (not toSteal:ToPickup():IsShopItem()) then
  603. toSteal:Remove() -- remove the heart before it gets turned into a blue fly
  604. entity:GetSprite():Play("Steal", true)
  605. if entity:GetSprite():IsPlaying("Steal") then
  606. -- increase the heart counter
  607. sHCount = sHCount + 4
  608. SuperBum:SaveData(sHCount)
  609. -- check if he should spawn coins
  610. if sHCount >= 5 then
  611. superbum.CoinPayout = true -- allows Super Bum to spawn coins
  612. end
  613. end
  614. end
  615. end
  616. end
  617. end
  618.  
  619. -- check Super Bums position
  620. if entity.Position:Distance(player.Position) <= 95 -- if he is close to the player
  621. and (not entity:GetSprite():IsPlaying("PreSpawn")) -- don't interfier with the normal spawn
  622. and (not entity:GetSprite():IsPlaying("Spawn")) then
  623. -- Isaac.ConsoleOutput("Close")
  624. local Sprite = entity:GetSprite()
  625.  
  626. if functionality.DarkBum == true then -- Super Bum has Dark Bums ability
  627. if player:GetPlayerType() == PlayerType.PLAYER_KEEPER then
  628. if superbum.CoinSpawned == false -- Super Bum hasn't spawned a coin yet,
  629. and superbum.CoinPayout == true then -- but he can payout with one
  630. superbum.CoinSpawned = true -- confirms that he spawned a coin
  631. Sprite:Play("PreSpawnCoin", true) -- triggers the spawn function for coins in the familiar update callback
  632. end
  633. end
  634. end
  635. if functionality.KeyBum == true then -- Super Bum has Key Bums ability
  636. if superbum.GoldenKeySpawned == false -- Super Bum hasn't spawned a golden key yet,
  637. and superbum.GoldenKeyPayout == true then -- but he can payout with one
  638. superbum.GoldenKeySpawned = true -- confirms that he spawned a golden key
  639. Sprite:Play("PreSpawnKey", true) -- triggers the spawn function for golden keys in the familiar update callback
  640. -- Isaac.ConsoleOutput("GoldenKey")
  641. end
  642. if superbum.KeySpawned == false -- Super Bum hasn't spawned a key themed item or trinket yet,
  643. and superbum.KeyPayout == true then -- but he can payout with one
  644. superbum.KeySpawned = true -- confirms that he spawned an item or trinket
  645. Sprite:Play("PreSpawnItem", true) -- triggers the spawn function for items and trinkets in the familiar update callback
  646. -- Isaac.ConsoleOutput("Item")
  647. end
  648. end
  649. end
  650. end
  651. end
  652. SuperBum:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, SuperBum.onNewEvent)
  653.  
  654. -- on familiar update
  655. function SuperBum:onConsumablePickup(SBum) -- SBum is the variable for the familiar Super Bum
  656.  
  657. local player = Isaac.GetPlayer(0)
  658. local entities = Isaac.GetRoomEntities()
  659. local Sprite = SBum:GetSprite()
  660. local numCoins
  661.  
  662. -- make global if needed
  663.  
  664. local rng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_BUM_FRIEND)
  665. local roll = rng:RandomInt(100)
  666. local keybumrng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_KEY_BUM)
  667. local keyroll = keybumrng:RandomInt(100)
  668. local keyrolltwo = keybumrng:RandomInt(120)
  669. local coinrng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_DARK_BUM)
  670. local numCoins = (coinrng:RandomInt(2)) + 2 -- number of coins Dark Bum spawns if you play as the Keeper
  671.  
  672.  
  673.  
  674. -- first we check all entities in the room
  675. for j = 1, #entities do
  676. local entity = entities[j]
  677. if entity.Type == EntityType.ENTITY_PICKUP then
  678.  
  679. -- the collision detection depends on the type pickup
  680. -- first key collision code
  681. if SBum.Position:Distance(entity.Position) <= 10
  682. and (not(player.Position:Distance(entity.Position) <= 40)) then
  683. if entity.Variant == PickupVariant.PICKUP_KEY
  684. and functionality.KeyBum == true then -- we check if Super Bum should have Key Bums ability
  685.  
  686.  
  687. if entity:GetSprite():IsPlaying("Collect")
  688. and entity:GetData().Picked == nil then
  689. entity:GetData().Picked = true
  690.  
  691. -- Sub type specific actions
  692. if entity.SubType == KeySubType.KEY_NORMAL then -- normal keys
  693. -- increase the key counter
  694. sBKeys = sBKeys + 1
  695. SuperBum:SaveData(sBKeys)
  696.  
  697. elseif entity.SubType == KeySubType.KEY_CHARGED then -- charged keys
  698. -- increase the key counter
  699. sBKeys = sBKeys + 1
  700. SuperBum:SaveData(sBKeys)
  701.  
  702. -- charge the active item
  703. if player:NeedsCharge() then -- if the active item could be charged
  704. if player:GetActiveItem() == CollectibleType.COLLECTIBLE_MEGA_SATANS_BREATH then -- don't forget Mega Blast
  705. player:FullCharge(3) -- Mega Blast only gets three charges from a battery
  706. else
  707. player:FullCharge(12) -- this covers every active item
  708. end
  709. end
  710. end
  711. -- check the amount of keys and set up animation if needed
  712.  
  713. -- first we check the amount of keys
  714. if sBKeys == 7 then
  715. if has.AllItems == true then -- if the player has all key items and/or Super Bum spawned Dads Key
  716. if superbum.GoldenKeyPayout == false then --if he shouldn't spawn one already
  717. -- we set the variables to allow a payout
  718. superbum.GoldenKeyPayout = true -- lets Super Bum spawn a key
  719. superbum.GoldenKeySpawned = false
  720.  
  721. -- for testimg purpose we spawn a golden key
  722. -- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_GOLDEN, entity.Position, Vector(0,0), SBum)
  723.  
  724. -- we substract 7 from sBKeys
  725. sBKeys = sBKeys - 7
  726. SuperBum:SaveData(sBKeys)
  727. Isaac.ConsoleOutput("Spawn Golden Key")
  728. end
  729. else -- if the player hasn't all the key items
  730. -- we flip a coin
  731. if keyroll < 50 then -- 0 for testing
  732. if superbum.GoldenKeyPayout == false then -- if he shouldn't spawn a key already
  733. -- for testing purpose we spawn a golden key
  734. -- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_GOLDEN, entity.Position, Vector(0,0), SBum)
  735.  
  736. -- animation has to be set up
  737. superbum.GoldenKeyPayout = true -- lets Super Bum spawn a Key
  738. superbum.GoldenKeySpawned = false
  739.  
  740. -- we substract 7 from sBKeys
  741. sBKeys = sBKeys - 7
  742. SuperBum:SaveData(sBKeys)
  743. Isaac.ConsoleOutput("Successful Coin Flip")
  744. end
  745. end
  746. end
  747. elseif sBKeys >= 12 -- the amount needed to have a chance to spawn an item/trinket
  748. and has.AllItems == false then
  749. -- check if he shouldn't already spawn a item/trinket
  750. if superbum.KeyPayout == false then
  751. -- set up sBExtra and minusKeys
  752. if sBKeys == 12 then
  753. sBExtra = 35
  754. minusKeys = 12
  755. elseif sBKeys == 13 then
  756. sBExtra = 45
  757. minusKeys = 13
  758. elseif sBKeys == 14 then
  759. sBExtra = 55
  760. minusKeys = 14
  761. elseif sBKeys == 15 then
  762. sBExtra = 70
  763. minusKeys = 15
  764. elseif sBKeys == 16 then
  765. sBExtra = 85
  766. minusKeys = 16
  767. elseif sBKeys == 17 then
  768. sBExtra = 100
  769. minusKeys = 17
  770. end
  771.  
  772. -- check if he has a chance to spawn an item/trinket
  773. if keyroll < sBExtra then -- testing
  774. -- set the variables
  775. superbum.KeyPayout = true -- allows Super Bum to spawn an item
  776. superbum.KeySpawned = false -- truns true if Super Bum spawned an item
  777.  
  778. -- substract 'minusKeys' from 'sBKeys'
  779. sBKeys = sBKeys - minusKeys
  780. SuperBum:SaveData(sBKeys)
  781. Isaac.ConsoleOutput("Successful Substraction")
  782.  
  783. -- reset sBExrta and minusKeys
  784. sBExtra = 0
  785. minusKeys = 0
  786. Isaac.ConsoleOutput("Reset")
  787.  
  788. -- testing: check sBExtra and minusKeys
  789. if minusKeys == 0 then
  790. Isaac.ConsoleOutput("0")
  791. elseif minusKeys == 12 then
  792. Isaac.ConsoleOutput("12")
  793. elseif minusKeys == 13 then
  794. Isaac.ConsoleOutput("13")
  795. elseif minusKeys == 14 then
  796. Isaac.ConsoleOutput("14")
  797. elseif minusKeys == 15 then
  798. Isaac.ConsoleOutput("15")
  799. elseif minusKeys == 16 then
  800. Isaac.ConsoleOutput("16")
  801. elseif minusKeys == 17 then
  802. Isaac.ConsoleOutput("17")
  803. end
  804. end
  805. end
  806. end
  807. end
  808. end
  809. end
  810. -- second coin collision code
  811. if (SBum.Position - entity.Position):Length() < SBum.Size + entity.Size then
  812. -- Isaac.ConsoleOutput("SPAWN INIT")
  813. if functionality.BumFriend == true then -- we check if Super Bum should have Bum Friends ability
  814.  
  815. if entity:GetSprite():IsPlaying("Collect")
  816. and entity:GetData().Picked == nil then
  817. entity:GetData().Picked = true
  818.  
  819. -- Sub type specific actions
  820. if entity.Variant == PickupVariant.PICKUP_COIN then
  821. if entity.SubType == CoinSubType.COIN_PENNY then
  822. -- Penny Trinkets synergies
  823. if player:GetTrinket(0) == TrinketType.TRINKET_BLOODY_PENNY
  824. or player:GetTrinket(1) == TrinketType.TRINKET_BLOODY_PENNY then
  825. if roll < 50 then
  826. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_HEART, HeartSubType.HEART_HALF, entity.Position, Vector(0,0), SBum)
  827. end
  828. end
  829. if player:GetTrinket(0) == TrinketType.TRINKET_BURNT_PENNY
  830. or player:GetTrinket(1) == TrinketType.TRINKET_BURNT_PENNY then
  831. if roll < 50 then
  832. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_BOMB, BombSubType.BOMB_NORMAL, entity.Position, Vector(0,0), SBum)
  833. end
  834. end
  835. if player:GetTrinket(0) == TrinketType.TRINKET_FLAT_PENNY
  836. or player:GetTrinket(1) == TrinketType.TRINKET_FLAT_PENNY then
  837. if roll < 50 then
  838. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_NORMAL, entity.Position, Vector(0,0), SBum)
  839. end
  840. end
  841. if player:GetTrinket(0) == TrinketType.TRINKET_BUTT_PENNY
  842. or player:GetTrinket(1) == TrinketType.TRINKET_BUTT_PENNY then
  843. if roll < 50 then
  844. Isaac.GridSpawn(GridEntityType.GRID_POOP, 0, entity.Position, true)
  845. end
  846. end
  847. if player:GetTrinket(0) == TrinketType.TRINKET_ROTTEN_PENNY
  848. or player:GetTrinket(1) == TrinketType.TRINKET_ROTTEN_PENNY then
  849. if roll < 50 then
  850. Isaac.Spawn(EntityType.ENTITY_FAMILIAR, FamiliarVariant.BLUE_FLY, 0, entity.Position, Vector(0,0), SBum)
  851. end
  852. end
  853. if player:GetTrinket(0) == TrinketType.TRINKET_COUNTERFEIT_PENNY
  854. or player:GetTrinket(1) == TrinketType.TRINKET_COUNTERFEIT_PENNY then
  855. if roll < 50 then
  856. player:AddCoins(1)
  857. end
  858. end
  859. elseif entity.SubType == CoinSubType.COIN_NICKEL then
  860. -- Penny Trinkets synergies
  861. if player:GetTrinket(0) == TrinketType.TRINKET_BLOODY_PENNY
  862. or player:GetTrinket(1) == TrinketType.TRINKET_BLOODY_PENNY then
  863. if roll < 75 then
  864. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_HEART, HeartSubType.HEART_HALF, entity.Position, Vector(0,0), SBum)
  865. end
  866. end
  867. if player:GetTrinket(0) == TrinketType.TRINKET_BURNT_PENNY
  868. or player:GetTrinket(1) == TrinketType.TRINKET_BURNT_PENNY then
  869. if roll < 75 then
  870. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_BOMB, BombSubType.BOMB_NORMAL, entity.Position, Vector(0,0), SBum)
  871. end
  872. end
  873. if player:GetTrinket(0) == TrinketType.TRINKET_FLAT_PENNY
  874. or player:GetTrinket(1) == TrinketType.TRINKET_FLAT_PENNY then
  875. if roll < 75 then
  876. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_NORMAL, entity.Position, Vector(0,0), SBum)
  877. end
  878. end
  879. if player:GetTrinket(0) == TrinketType.TRINKET_BUTT_PENNY
  880. or player:GetTrinket(1) == TrinketType.TRINKET_BUTT_PENNY then
  881. if roll < 75 then
  882. Isaac.GridSpawn(GridEntityType.GRID_POOP, 0, entity.Position, true)
  883. end
  884. end
  885. if player:GetTrinket(0) == TrinketType.TRINKET_ROTTEN_PENNY
  886. or player:GetTrinket(1) == TrinketType.TRINKET_ROTTEN_PENNY then
  887. if roll < 75 then
  888. Isaac.Spawn(EntityType.ENTITY_FAMILIAR, FamiliarVariant.BLUE_FLY, 0, entity.Position, Vector(0,0), SBum)
  889. end
  890. end
  891. if player:GetTrinket(0) == TrinketType.TRINKET_COUNTERFEIT_PENNY
  892. or player:GetTrinket(1) == TrinketType.TRINKET_COUNTERFEIT_PENNY then
  893. if roll < 75 then
  894. player:AddCoins(1)
  895. end
  896. end
  897. elseif entity.SubType == CoinSubType.COIN_DIME then
  898. -- Penny Trinkets synergies
  899. if player:GetTrinket(0) == TrinketType.TRINKET_BLOODY_PENNY
  900. or player:GetTrinket(1) == TrinketType.TRINKET_BLOODY_PENNY then
  901. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_HEART, HeartSubType.HEART_HALF, entity.Position, Vector(0,0), SBum)
  902. end
  903. if player:GetTrinket(0) == TrinketType.TRINKET_BURNT_PENNY
  904. or player:GetTrinket(1) == TrinketType.TRINKET_BURNT_PENNY then
  905. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_BOMB, BombSubType.BOMB_NORMAL, entity.Position, Vector(0,0), SBum)
  906. end
  907. if player:GetTrinket(0) == TrinketType.TRINKET_FLAT_PENNY
  908. or player:GetTrinket(1) == TrinketType.TRINKET_FLAT_PENNY then
  909. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_NORMAL, entity.Position, Vector(0,0), SBum)
  910. end
  911. if player:GetTrinket(0) == TrinketType.TRINKET_BUTT_PENNY
  912. or player:GetTrinket(1) == TrinketType.TRINKET_BUTT_PENNY then
  913. Isaac.GridSpawn(GridEntityType.GRID_POOP, 0, entity.Position, true)
  914. end
  915. if player:GetTrinket(0) == TrinketType.TRINKET_ROTTEN_PENNY
  916. or player:GetTrinket(1) == TrinketType.TRINKET_ROTTEN_PENNY then
  917. Isaac.Spawn(EntityType.ENTITY_FAMILIAR, FamiliarVariant.BLUE_FLY, 0, entity.Position, Vector(0,0), SBum)
  918. end
  919. if player:GetTrinket(0) == TrinketType.TRINKET_COUNTERFEIT_PENNY
  920. or player:GetTrinket(1) == TrinketType.TRINKET_COUNTERFEIT_PENNY then
  921. player:AddCoins(1)
  922. end
  923. elseif entity.SubType == CoinSubType.COIN_LUCKYPENNY then
  924. if functionality.BonusAnimation == true then
  925. Sprite:Play("ThumbUp", true)
  926. player.Luck = player.Luck + 1
  927. else
  928. player.Luck = player.Luck + 1
  929. end
  930. end
  931. end
  932. end
  933. end
  934. end
  935. end
  936. end
  937.  
  938. -- spawn functions
  939.  
  940. -- Dark Bums extra ability if you are the Lost
  941. if player:GetPlayerType() == PlayerType.PLAYER_THELOST
  942. and functionality.DarkBum == true then
  943. -- Isaac.ConsoleOutput("He is Lost")
  944.  
  945. if Sprite:IsPlaying("Spawn") then
  946. if Sprite:GetFrame() == 1 then
  947. Isaac.ConsoleOutput("Frame")
  948. for p = 1, #entities do
  949. local entitis = entities[p]
  950. if entitis.Type == EntityType.ENTITY_PICKUP
  951. and entitis.Variant == PickupVariant.PICKUP_HEART then
  952. if entitis.SubType == HeartSubType.HEART_SOUL
  953. or entitis.SubType == HeartSubType.HEART_BLACK then
  954. if entitis.SpawnerType == EntityType.ENTITY_FAMILIAR
  955. and entitis.SpawnerVariant == FamiliarVariant.SUPER_BUM then
  956. entitis:Remove()
  957. local numBlueSpider = 2 -- number of spiders Dark Bum will spawn
  958. for k = 1, numBlueSpider do
  959. player:ThrowBlueSpider(SBum.Position, player.Position)
  960. end
  961. end
  962. end
  963. end
  964. end
  965. end
  966. end
  967. end
  968.  
  969. -- Dark Bums extra ability if you are the Keeper
  970. if Sprite:IsFinished("PreSpawnCoin") then -- "PreSpawnCoin" can only be played if you are the Keeper
  971. sHCount = sHCount - 5 -- reduce the heart counter
  972. SuperBum:SaveData(sHCount)
  973. Sprite:Play("SpawnCoin", true)
  974.  
  975. -- spawn the coins equally around Super Bum
  976. for e = 1, numCoins do
  977. angle = math.random(math.floor(360/numCoins)) -- get the angle
  978. angleVector = Vector.FromAngle(angle + (e-1)*(math.floor(360/numCoins))) -- this distributes the coins equally around Super Bum
  979. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COIN, CoinSubType.COIN_PENNY, SBum.Position, angleVector, SBum)
  980. end
  981. end
  982. if Sprite:IsFinished("SpawnCoin") then
  983. -- check if Super Bum shouldn't spawn more coins
  984. if sHCount < 5 then
  985. superbum.CoinPayout = false -- prevents that Super Bum spawns an other coin
  986. superbum.CoinSpawned = false
  987. else
  988. superbum.CoinPayout = true -- allows SuperBum to spawn another coin
  989. superbum.CoinSpawned = false
  990. end
  991.  
  992. -- make Super Bum floats after he spawned something
  993. Sprite:Play("FloatDown", true)
  994. end
  995. if Sprite:IsFinished("Steal")
  996. or Sprite:IsFinished("ThumbUp") then
  997. Sprite:Play("FloatDown", true)
  998. end
  999.  
  1000. -- Key Bums extra ability
  1001. -- Golden keys
  1002. if Sprite:IsFinished("PreSpawnKey") then -- no need to check for the functionality.KeyBum
  1003. -- play spawn animation
  1004. Sprite:Play("SpawnGoldenKey", true)
  1005. -- spawn a golden key
  1006. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_GOLDEN, SBum.Position, Vector(0,0), SBum)
  1007. end
  1008. -- Key themed items/trinkets
  1009. if Sprite:IsFinished("PreSpawnItem") then
  1010. -- play spawn animation
  1011. Sprite:Play("SpawnItem", true)
  1012. -- decide if Super Bum will spawn an item or a trinket
  1013. if keyrolltwo < 70 then -- we spawn an item -- o testing
  1014. KeyItemPool(SBum, keyrolltwo)
  1015. -- testing
  1016. -- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, 388, SBum.Position, Vector(0,0), SBum)
  1017. else -- we spawn a trinket
  1018. KeyTrinketPool(SBum, keyrolltwo)
  1019. -- testing
  1020. -- Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, 144, SBum.Position, Vector(0,0), SBum)
  1021. end
  1022. end
  1023.  
  1024. -- After Super Bum finished the 'SpawnGoldenKey' or 'SpawnItem' we check if he could spawn more
  1025. if Sprite:IsFinished("SpawnGoldenKey")
  1026. or Sprite:IsFinished("SpawnItem") then
  1027. if has.AllItems == true then -- he spawned every possible items
  1028. if sBKeys >= 7 then -- if the key counter is over 7
  1029. superbum.GoldenKeyPayout = true -- he can still spawn a golden Key
  1030. superbum.GoldenKeySpawned = false -- so he can spawn a golden key again
  1031. -- we substract 7 from sBKeys
  1032. sBKeys = sBKeys - 7
  1033. SuperBum:SaveData(sBKeys)
  1034. else
  1035. -- we stop him from paying out
  1036. superbum.GoldenKeyPayout = false
  1037. superbum.GoldenKeySpawned = false
  1038.  
  1039. -- just in case Super Bum didn't spawned Dad's Key
  1040. superbum.KeyPayout = false
  1041. superbum.KeySpawned = false
  1042. end
  1043. else
  1044. if sBKeys == 7 then -- there is a chacne to spawn a golden key
  1045. if keyroll < 50 then -- we flip a coin
  1046. superbum.GoldenKeyPayout = true -- we spawn an other key
  1047. superbum.GoldenKeySpawned = false
  1048. -- we substract 7 from sBKeys
  1049. sBKeys = sBKeys - 7
  1050. SuperBum:SaveData(sBKeys)
  1051. else
  1052. -- we prevent him from spawning another key
  1053. superbum.GoldenKeyPayout = false
  1054. superbum.GoldenKeySpawned = false
  1055. end
  1056.  
  1057. elseif sBKeys >= 12 then -- there is a chance to spawn an item
  1058. if sBKeys == 12 then
  1059. sBExtra = 35
  1060. minusKeys = 12
  1061. elseif sBKeys == 13 then
  1062. sBExtra = 45
  1063. minusKeys = 13
  1064. elseif sBKeys == 14 then
  1065. sBExtra = 55
  1066. minusKeys = 14
  1067. elseif sBKeys == 15 then
  1068. sBExtra = 70
  1069. minusKeys = 15
  1070. elseif sBKeys == 16 then
  1071. sBExtra = 85
  1072. minusKeys = 16
  1073. elseif sBKeys >= 17 then -- there is a possiblity that Super Bum picked up more then 17 keys
  1074. sBExtra = 100
  1075. minusKeys = 17
  1076. end
  1077.  
  1078. -- after we got sBExtra and minusKeys we have to check if Super Bum could spawn an item
  1079. if keyroll < sBExtra then
  1080. superbum.KeyPayout = true -- he should spawn another item
  1081. superbum.KeySpawned = false -- allows Super Bum to spawn an other item
  1082. -- we substract minusKeys from sBKeys
  1083. sBKeys = sBKeys - minusKeys
  1084. SuperBum:SaveData(sBKeys)
  1085. else
  1086. superbum.KeyPayout = false
  1087. superbum.KeySpawned = false
  1088. end
  1089. -- reset sBExrta and minusKeys
  1090. sBExtra = 0
  1091. minusKeys = 0
  1092. Isaac.ConsoleOutput("Reset")
  1093.  
  1094. -- testing: check sBExtra and minusKeys
  1095. if minusKeys == 0 then
  1096. Isaac.ConsoleOutput("0")
  1097. elseif minusKeys == 12 then
  1098. Isaac.ConsoleOutput("12")
  1099. elseif minusKeys == 13 then
  1100. Isaac.ConsoleOutput("13")
  1101. elseif minusKeys == 14 then
  1102. Isaac.ConsoleOutput("14")
  1103. elseif minusKeys == 15 then
  1104. Isaac.ConsoleOutput("15")
  1105. elseif minusKeys == 16 then
  1106. Isaac.ConsoleOutput("16")
  1107. elseif minusKeys == 17 then
  1108. Isaac.ConsoleOutput("17")
  1109. end
  1110. else
  1111. -- if nothing can happen set the variables back
  1112. -- golden key
  1113. superbum.GoldenKeyPayout = false
  1114. superbum.GoldenKeySpawned = false
  1115. -- items
  1116. superbum.KeyPayout = false
  1117. superbum.KeySpawned = false
  1118. end
  1119. end
  1120.  
  1121. -- make Super Bum float after he spawned something
  1122. Sprite:Play("FloatDown", true)
  1123. end
  1124. end
  1125.  
  1126. SuperBum:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, SuperBum.onConsumablePickup, FamiliarVariant.SUPER_BUM)
  1127.  
  1128. -- on new room
  1129. function SuperBum:onNewRoom(_)
  1130. local player = Isaac.GetPlayer(0)
  1131. local entities = Isaac.GetRoomEntities()
  1132. local roomType = game:GetRoom():GetType()
  1133. local bumPool = {144,278,388}
  1134. local value = nil
  1135.  
  1136.  
  1137. if game:GetRoom():IsFirstVisit() == true then
  1138.  
  1139. -- get bumChance
  1140. if superbum.Init == false then -- if the player hasn't Super Bum
  1141. -- the chance increases if the player has a bum
  1142. if player:HasCollectible(388) then
  1143. table.remove(bumPool, 3)
  1144. bumChance = bumChance + 10
  1145. end
  1146. if player:HasCollectible(278) then
  1147. table.remove(bumPool, 2)
  1148. bumChance = bumChance + 10
  1149. end
  1150. if player:HasCollectible(144) then
  1151. table.remove(bumPool, 1)
  1152. bumChance = bumChance + 10
  1153. end
  1154. end
  1155.  
  1156. -- room specific action
  1157. if functionality.MoreBums == true then
  1158. if roomType == RoomType.ROOM_TREASURE then
  1159. -- testing
  1160. if bumChance == 0 then
  1161. Isaac.ConsoleOutput("0")
  1162. elseif bumChance == 10 then
  1163. Isaac.ConsoleOutput("10")
  1164. elseif bumChance == 20 then
  1165. Isaac.ConsoleOutput("20")
  1166. end
  1167. 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}
  1168.  
  1169. for w = 1, #entities do
  1170. local entity = entities[w]
  1171. if entity.Type == EntityType.ENTITY_PICKUP
  1172. and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE then
  1173. -- look for a familiar from the treasure pool
  1174. for i, value in ipairs(treasurePool) do
  1175. local item = value[i]
  1176. if entity.SubType == item
  1177. and entity:GetData().Rerolled == false then
  1178. entity:GetData().Rerolled = true
  1179. local itemRng = Isaac.GetCollectibleRNG(item)
  1180. local bumRoll = itemRng:RandomInit(100)
  1181. if bumRoll < bumChance then
  1182. -- spaen a random bum
  1183. local pickBum = math.Random(treasurePool)
  1184. entity:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, bumPool[pickBum], true)
  1185. end
  1186. end
  1187. end
  1188. end
  1189. end
  1190.  
  1191. elseif roomType == RoomType.ROOM_SECRET then
  1192. -- repeat the function
  1193.  
  1194. elseif roomType == RoomType.ROOM_DEVIL then
  1195. -- repeat the function
  1196. end
  1197. -- reset bumChance and bumPool
  1198. bumChance = 0
  1199. bumPool = backBumPool
  1200.  
  1201. end
  1202. -- testing
  1203. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COIN, CoinSubType.COIN_PENNY, player.Position, Vector(0,0), player)
  1204. end
  1205.  
  1206. end
  1207. SuperBum:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, SuperBum.onNewRoom)
Add Comment
Please, Sign In to add comment