Josh64

Better Super Bum

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