Josh64

A better Key Bum v 1.3

Aug 5th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.09 KB | None | 0 0
  1. local Mod = RegisterMod("betterkeybum", 1)
  2. local game = Game()
  3.  
  4. -- BumsKeys = 0 -- gobal variable which keeps track on how many keys Key Bum picked up
  5. local DadsKey = nil
  6. local BumsKeys = 0
  7.  
  8. local KBumExtra = 0
  9.  
  10. function Mod:onInit(player)
  11. if game:GetFrameCount() == 1 then
  12. -- spawn in if you want to
  13. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_PAPER_CLIP, Vector(150, 250), Vector(0,0), player)
  14. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_STORE_KEY, Vector(250, 250), Vector(0,0), player)
  15. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_SKELETON_KEY, Vector(350, 250), Vector(0,0), player)
  16. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_LATCH_KEY, Vector400, 250), Vector(0,0), player)
  17. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_MOMS_KEY, Vector(350, 250), Vector(0,0), player)
  18. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_DADS_KEY, Vector(300, 250), Vector(0,0), player)
  19. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_KEY_BUM, Vector(300, 200), Vector(0,0), player)
  20. -- check for Dads Key
  21. DadsKey = false
  22. end
  23. end
  24. Mod:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, Mod.onInit)
  25.  
  26.  
  27. local function SkeletonKey(KBum, keyone)
  28. local player = Isaac.GetPlayer(0)
  29. -- tables which contain the items Key Bum can pull from
  30. -- Item tables
  31. local SkeItemPool = {175,199,343} -- 175 = Dads Key, 199 = Moms Key, 343 = Latch Key
  32. local BackItemPool = {175,199,343}
  33. -- Trinket tables
  34. local SkeTrinketPool = {19,83} -- 19 = Paper Clip, 83 = Store Key
  35. local BackTrinketPool = {19,83}
  36. if player:HasCollectible(17) then -- 17 = Skeleton Key
  37. if keyone < 50 then
  38. -- check if the player has an item and remove it from the table. It is removed from the "pool"
  39. if player:HasCollectible(343) then
  40. table.remove(SkeItemPool, 3)
  41. end
  42. if player:HasCollectible(199) then
  43. table.remove(SkeItemPool, 2)
  44. end
  45. if DadsKey == true then
  46. table.remove(SkeItemPool, 1)
  47. end
  48. -- make sure the table is not empty
  49. if SkeItemPool[1] ~= 175
  50. and SkeItemPool[1] ~= 199
  51. and SkeItemPool[1] ~= 343 then
  52. -- Breakfasting, if the table is empty
  53. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
  54. else
  55. local pickitem = math.random(#SkeItemPool)
  56. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, SkeItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
  57. if SkeItemPool[pickitem] == 175 then
  58. DadsKey = true
  59. end
  60. -- after spawning the Item you have to reset the table
  61. SkeItemPool = BackItemPool
  62. end
  63. else
  64. -- check if the player has a trinket and remove it from the table. It is removed from the "pool"
  65. if player:GetTrinket(0) == TrinketType.TRINKET_STORE_KEY
  66. or player:GetTrinket(1) == TrinketType.TRINKET_STORE_KEY then
  67. table.remove(SkeTrinketPool, 2)
  68. end
  69. if player:GetTrinket(0) == TrinketType.TRINKET_PAPER_CLIP
  70. or player:GetTrinket(1) == TrinketType.TRINKET_PAPER_CLIP then
  71. table.remove(SkeTrinketPool, 1)
  72. end
  73. -- make sure the table is not empty
  74. if SkeTrinketPool[1] ~= 19
  75. and SkeTrinketPool[1] ~= 83 then
  76. -- if the table is empty, then Key Bum will spawn an item
  77. if player:HasCollectible(343) then
  78. table.remove(SkeItemPool, 3)
  79. end
  80. if player:HasCollectible(199) then
  81. table.remove(SkeItemPool, 2)
  82. end
  83. if player:HasCollectible(175) then
  84. table.remove(SkeItemPool, 1)
  85. end
  86. if SkeItemPool[1] ~= 175
  87. and SkeItemPool[1] ~= 199
  88. and SkeItemPool[1] ~= 343 then
  89. -- Breakfasting
  90. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
  91. else
  92. local pickitem = math.random(#SkeItemPool)
  93. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, SkeItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
  94. if SkeItemPool[pickitem] == 175 then
  95. DadsKey = true
  96. end
  97. SkeItemPool = BackItemPool
  98. end
  99. else
  100. local picktrinket = math.random(#SkeTrinketPool)
  101. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, SkeTrinketPool[picktrinket], KBum.Position, Vector(0,0), KBum)
  102. -- reset the Trinket "pool"
  103. SkeTrinketPool = BackTrinketPool
  104.  
  105. end
  106. end
  107. else
  108. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_SKELETON_KEY, KBum.Position, Vector(0,0), KBum)
  109. end
  110. end
  111.  
  112. local function MomKey(KBum, keytwo)
  113. local player = Isaac.GetPlayer(0)
  114. -- tables which contain the items Key Bum can pull from
  115. -- Item tables
  116. local MomItemPool = {17,175,343} -- 17 = Skeleton Key, 175 = Dads Key, 343 = Latch Key
  117. local BackMomItemPool = {17,175,343}
  118. -- Trinket tables
  119. local MomTrinketPool = {19,83} -- 19 = Paper Clip, 83 = Store Key
  120. local BackMomTrinketPool = {19,83}
  121. if player:HasCollectible(199) then -- 199 = Moms Key
  122. if keytwo < 50 then
  123. if player:HasCollectible(343) then
  124. table.remove(MomItemPool, 3)
  125. end
  126. if DadsKey == true then
  127. table.remove(MomItemPool, 2)
  128. end
  129. if player:HasCollectible(17) then
  130. table.remove(MomItemPool, 1)
  131. end
  132. if MomItemPool[1] ~= 17
  133. and MomItemPool[1] ~= 175
  134. and MomItemPool[1] ~= 343 then
  135. -- Breakfasting
  136. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
  137. else
  138. local pickitem = math.random(#MomItemPool)
  139. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, MomItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
  140. if MomItemPool[pickitem] == 175 then
  141. DadsKey = true
  142. end
  143. MomItemPool = BackMomItemPool
  144. end
  145. else
  146. if player:GetTrinket(0) == TrinketType.TRINKET_STORE_KEY
  147. or player:GetTrinket(1) == TrinketType.TRINKET_STORE_KEY then
  148. table.remove(MomTrinketPool, 2)
  149. end
  150. if player:GetTrinket(0) == TrinketType.TRINKET_PAPER_CLIP
  151. or player:GetTrinket(1) == TrinketType.TRINKET_PAPER_CLIP then
  152. table.remove(MomTrinketPool, 1)
  153. end
  154. if MomTrinketPool[1] ~= 19
  155. and MomTrinketPool[1] ~= 83 then
  156. if player:HasCollectible(343) then
  157. table.remove(MomItemPool, 3)
  158. end
  159. if DadsKey == true then
  160. table.remove(MomItemPool, 2)
  161. end
  162. if player:HasCollectible(17) then
  163. table.remove(MomItemPool, 1)
  164. end
  165. if MomItemPool[1] ~= 17
  166. and MomItemPool[1] ~= 175
  167. and MomItemPool[1] ~= 343 then
  168. -- Breakfasting
  169. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
  170. else
  171. local pickitem = math.random(#MomItemPool)
  172. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, MomItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
  173. if MomItemPool[pickitem] == 175 then
  174. DadsKey = true
  175. end
  176. MomItemPool = BackMomItemPool
  177. end
  178. else
  179. local picktrinket = math.random(#MomTrinketPool)
  180. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, MomTrinketPool[picktrinket], KBum.Position, Vector(0,0), KBum)
  181. MomTrinketPool = BackMomTrinketPool
  182.  
  183. end
  184. end
  185. else
  186. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_MOMS_KEY, KBum.Position, Vector(0,0), KBum)
  187. end
  188. end
  189.  
  190.  
  191. local function DadKey(KBum, keythree)
  192. local player = Isaac.GetPlayer(0)
  193. -- tables which contain the items Key Bum can pull from
  194. -- Item tables
  195. local DadItemPool = {17,199,343} -- 17 = Skeleton Key, 199 = Moms Key, 343 = Latch Key
  196. local BackDadItemPool = {17,199,343}
  197. -- Trinket tables
  198. local DadTrinketPool = {19,83} -- 19 = Paper Clip, 83 = Store Key
  199. local BackDadTrinketPool = {19,83}
  200. if DadsKey == true then
  201. if keythree < 50 then
  202. if player:HasCollectible(343) then
  203. table.remove(DadItemPool, 3)
  204. end
  205. if player:HasCollectible(199) then
  206. table.remove(DadItemPool, 2)
  207. end
  208. if player:HasCollectible(17) then
  209. table.remove(DadItemPool, 1)
  210. end
  211. if DadItemPool[1] ~= 17
  212. and DadItemPool[1] ~= 199
  213. and DadItemPool[1] ~= 343 then
  214. -- Breakfasting
  215. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
  216. else
  217. local pickitem = math.random(#DadItemPool)
  218. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, DadItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
  219. DadItemPool = BackDadItemPool
  220. end
  221. else
  222. if player:GetTrinket(0) == TrinketType.TRINKET_STORE_KEY
  223. or player:GetTrinket(1) == TrinketType.TRINKET_STORE_KEY then
  224. table.remove(DadTrinketPool, 2)
  225. end
  226. if player:GetTrinket(0) == TrinketType.TRINKET_PAPER_CLIP
  227. or player:GetTrinket(1) == TrinketType.TRINKET_PAPER_CLIP then
  228. table.remove(DadTrinketPool, 1)
  229. end
  230. if DadTrinketPool[1] ~= 19
  231. and DadTrinketPool[1] ~= 83 then
  232. if player:HasCollectible(343) then
  233. table.remove(DadItemPool, 3)
  234. end
  235. if DadsKey == true then
  236. table.remove(DadItemPool, 2)
  237. end
  238. if player:HasCollectible(17) then
  239. table.remove(DadItemPool, 1)
  240. end
  241. if DadItemPool[1] ~= 17
  242. and DadItemPool[1] ~= 199
  243. and DadItemPool[1] ~= 343 then
  244. -- Breakfasting
  245. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
  246. else
  247. local pickitem = math.random(#DadItemPool)
  248. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, DadItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
  249. DadItemPool = BackDadItemPool
  250. end
  251. else
  252. local picktrinket = math.random(#DadTrinketPool)
  253. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET,DadTrinketPool[picktrinket], KBum.Position, Vector(0,0), KBum)
  254. DadTrinketPool = BackDadTrinketPool
  255.  
  256. end
  257. end
  258. else
  259. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_DADS_KEY, KBum.Position, Vector(0,0), KBum)
  260. DadsKey = true
  261. end
  262. end
  263.  
  264. local function LatchKey(KBum, keyfour)
  265. local player = Isaac.GetPlayer(0)
  266. -- tables which contain the items Key Bum can pull from
  267. -- Item tables
  268. local LatchItemPool = {17,175,199} -- 17 = Skeleton Key, 175 = Dads Key, 199 = Moms Key
  269. local BackLatchItemPool = {17,175,199}
  270. -- Trinket tables
  271. local LatchTrinketPool = {19,83} -- 19 = Paper Clip, 83 = Store Key
  272. local BackLatchTrinketPool = {19,83}
  273. if player:HasCollectible(343) then -- 343 = Latch Key
  274. if keyfour < 50 then
  275. if player:HasCollectible(199) then
  276. table.remove(LatchItemPool, 3)
  277. end
  278. if DadsKey == true then
  279. table.remove(LatchItemPool, 2)
  280. end
  281. if player:HasCollectible(17) then
  282. table.remove(LatchItemPool, 1)
  283. end
  284. if LatchItemPool[1] ~= 17
  285. and LatchItemPool[1] ~= 175
  286. and LatchItemPool[1] ~= 199 then
  287. -- Breakfasting
  288. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
  289. else
  290. local pickitem = math.random(#LatchItemPool)
  291. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, LatchItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
  292. if LatchItemPool[pickitem] == 175 then
  293. DadsKey = true
  294. end
  295. LatchItemPool = BackLatchItemPool
  296. end
  297. else
  298. if player:GetTrinket(0) == TrinketType.TRINKET_STORE_KEY
  299. or player:GetTrinket(1) == TrinketType.TRINKET_STORE_KEY then
  300. table.remove(LatchTrinketPool, 2)
  301. end
  302. if player:GetTrinket(0) == TrinketType.TRINKET_PAPER_CLIP
  303. or player:GetTrinket(1) == TrinketType.TRINKET_PAPER_CLIP then
  304. table.remove(LatchTrinketPool, 1)
  305. end
  306. if LatchTrinketPool[1] ~= 19
  307. and LatchTrinketPool[1] ~= 83 then
  308. if player:HasCollectible(199) then
  309. table.remove(LatchItemPool, 3)
  310. end
  311. if DadsKey == true then
  312. table.remove(LatchItemPool, 2)
  313. end
  314. if player:HasCollectible(17) then
  315. table.remove(LatchItemPool, 1)
  316. end
  317. if LatchItemPool[1] ~= 17
  318. and LatchItemPool[1] ~= 175
  319. and LatchItemPool[1] ~= 199 then
  320. -- Breakfasting
  321. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
  322. else
  323. local pickitem = math.random(#LatchItemPool)
  324. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, LatchItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
  325. if LatchItemPool[pickitem] == 175 then
  326. DadsKey = true
  327. end
  328. LatchItemPool = BackLatchItemPool
  329. end
  330. else
  331. local picktrinket = math.random(#LatchTrinketPool)
  332. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, LatchTrinketPool[picktrinket], KBum.Position, Vector(0,0), KBum)
  333. LatchTrinketPool = BackLatchTrinketPool
  334.  
  335. end
  336. end
  337. else
  338. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, CollectibleType.COLLECTIBLE_LATCH_KEY, KBum.Position, Vector(0,0), KBum)
  339. end
  340. end
  341.  
  342. local function PaperKey(KBum, keyfive)
  343. local player = Isaac.GetPlayer(0)
  344. -- tables which contain the items Key Bum can pull from
  345. -- Item tables
  346. local PaperItemPool = {17,175,199,343} -- 17 = Skeleton Key, 175 = Dads Key, 199 = Moms Key, 343 = Latch Key
  347. local BackPaperItemPool = {17,175,199,343}
  348. -- Trinket tables
  349. local PaperTrinketPool = {83} -- 83 = Store Key
  350. local BackPaperTrinketPool = {83}
  351. if player:GetTrinket(0) == TrinketType.TRINKET_PAPER_CLIP
  352. or player:GetTrinket(1) == TrinketType.TRINKET_PAPER_CLIP then -- 19 = Paper Clip
  353. if keyfive < 50 then
  354. if player:HasCollectible(343) then
  355. table.remove(PaperItemPool, 4)
  356. end
  357. if player:HasCollectible(199) then
  358. table.remove(PaperItemPool, 3)
  359. end
  360. if DadsKey == true then
  361. table.remove(PaperItemPool, 2)
  362. end
  363. if player:HasCollectible(17) then
  364. table.remove(PaperItemPool, 1)
  365. end
  366. if PaperItemPool[1] ~= 17
  367. and PaperItemPool[1] ~= 175
  368. and PaperItemPool[1] ~= 199
  369. and PaperItemPool[1] ~= 343 then
  370. -- Breakfasting
  371. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
  372. else
  373. local pickitem = math.random(#PaperItemPool)
  374. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, PaperItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
  375. if PaperItemPool[pickitem] == 175 then
  376. DadsKey = true
  377. end
  378. PaperItemPool = BackPaperItemPool
  379. end
  380. else
  381. if player:GetTrinket(0) == TrinketType.TRINKET_STORE_KEY
  382. or player:GetTrinket(1) == TrinketType.TRINKET_STORE_KEY then
  383. table.remove(PaperTrinketPool, 1)
  384. end
  385. if PaperTrinketPool[1] ~= 83 then
  386. if player:HasCollectible(343) then
  387. table.remove(PaperItemPool, 4)
  388. end
  389. if player:HasCollectible(199) then
  390. table.remove(PaperItemPool, 3)
  391. end
  392. if DadsKey == true then
  393. table.remove(PaperItemPool, 2)
  394. end
  395. if player:HasCollectible(17) then
  396. table.remove(PaperItemPool, 1)
  397. end
  398. if PaperItemPool[1] ~= 17
  399. and PaperItemPool[1] ~= 175
  400. and PaperItemPool[1] ~= 199
  401. and PaperItemPool[1] ~= 343 then
  402. -- Breakfasting
  403. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
  404. else
  405. local pickitem = math.random(#PaperItemPool)
  406. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, PaperItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
  407. if PaperItemPool[pickitem] == 175 then
  408. DadsKey = true
  409. end
  410. PaperItemPool = BackPaperItemPool
  411. end
  412. else
  413. local picktrinket = math.random(#PaperTrinketPool)
  414. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, PaperTrinketPool[picktrinket], KBum.Position, Vector(0,0), KBum)
  415. PaperTrinketPool = BackPaperTrinketPool
  416.  
  417. end
  418. end
  419. else
  420. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_PAPER_CLIP, KBum.Position, Vector(0,0), KBum)
  421. end
  422. end
  423.  
  424. local function StoreKey(KBum, keysix)
  425. local player = Isaac.GetPlayer(0)
  426. -- tables which contain the items Key Bum can pull from
  427. -- Item tables
  428. local StoreItemPool = {17,175,199,343} -- 17 = Skeleton Key, 175 = Dads Key, 199 = Moms Key, 343 = Latch Key
  429. local BackStoreItemPool = {17,175,199,343}
  430. -- Trinket tables
  431. local StoreTrinketPool = {19} -- 19 = Paper Clip
  432. local BackStoreTrinketPool = {19}
  433. if player:GetTrinket(0) == TrinketType.TRINKET_STORE_KEY
  434. or player:GetTrinket(1) == TrinketType.TRINKET_STORE_kEY then
  435. if keysix < 50 then
  436. if player:HasCollectible(343) then
  437. table.remove(StoreItemPool, 4)
  438. end
  439. if player:HasCollectible(199) then
  440. table.remove(StoreItemPool, 3)
  441. end
  442. if DadsKey == true then
  443. table.remove(StoreItemPool, 2)
  444. end
  445. if player:HasCollectible(17) then
  446. table.remove(StoreItemPool, 1)
  447. end
  448. if StoreItemPool[1] ~= 17
  449. and StoreItemPool[1] ~= 175
  450. and StoreItemPool[1] ~= 199
  451. and StoreItemPool[1] ~= 343 then
  452. -- Breakfasting
  453. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
  454. else
  455. local pickitem = math.random(#StoreItemPool)
  456. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, StoreItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
  457. if StoreItemPool[pickitem] == 175 then
  458. DadsKey = true
  459. end
  460. StoreItemPool = BackStoreItemPool
  461. end
  462. else
  463. if player:GetTrinket(0) == TrinketType.TRINKET_PAPER_CLIP
  464. or player:GetTrinket(1) == TrinketType.TRINKET_PAPER_CLIP then
  465. table.remove(StoreTrinketPool, 1)
  466. end
  467. if StoreTrinketPool[1] ~= 83 then
  468. if player:HasCollectible(343) then
  469. table.remove(StoreItemPool, 4)
  470. end
  471. if player:HasCollectible(199) then
  472. table.remove(StoreItemPool, 3)
  473. end
  474. if DadsKey == true then
  475. table.remove(StoreItemPool, 2)
  476. end
  477. if player:HasCollectible(17) then
  478. table.remove(StoreItemPool, 1)
  479. end
  480. if StoreItemPool[1] ~= 17
  481. and StoreItemPool[1] ~= 175
  482. and StoreItemPool[1] ~= 199
  483. and StoreItemPool[1] ~= 343 then
  484. -- Breakfasting
  485. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_CHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
  486. else
  487. local pickitem = math.random(#StoreItemPool)
  488. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, StoreItemPool[pickitem], KBum.Position, Vector(0,0), KBum)
  489. if StoreItemPool[pickitem] == 175 then
  490. DadsKey = true
  491. end
  492. StoreItemPool = BackStoreItemPool
  493. end
  494. else
  495. local picktrinket = math.random(#StoreTrinketPool)
  496. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, StoreTrinketPool[picktrinket], KBum.Position, Vector(0,0), KBum)
  497. StoreTrinketPool = BackStoreTrinketPool
  498.  
  499. end
  500. end
  501. else
  502. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_STORE_KEY, KBum.Position, Vector(0,0), KBum)
  503. end
  504. end
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511. function Mod:onPickup(KBum)
  512. local player = Isaac.GetPlayer(0)
  513. local entities = Isaac.GetRoomEntities()
  514.  
  515. if player:HasCollectible(CollectibleType.COLLECTIBLE_KEY_BUM) then
  516.  
  517. local rng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_KEY_BUM)
  518. local roll = rng:RandomInt(100)
  519. -- RNG of the synergie items
  520. local rngone = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_SKELETON_KEY)
  521. local keyone = rngone:RandomInt(100)
  522. local rngtwo = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_MOMS_KEY)
  523. local keytwo = rngtwo:RandomInt(100)
  524. local rngthree = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_DADS_KEY)
  525. local keythree = rngthree:RandomInt(100)
  526. local rngfour = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_LATCH_KEY)
  527. local keyfour = rngfour:RandomInt(100)
  528. local rngfive = player:GetCollectibleRNG(TrinketType.TRINKET_PAPER_CLIP)
  529. local keyfive = rngfive:RandomInt(100)
  530. local rngsix = player:GetCollectibleRNG(TrinketType.TRINKET_STORE_KEY)
  531. local keysix = rngsix:RandomInt(100)
  532.  
  533.  
  534. -- we check all entities in the room
  535. for j = 1, #entities do
  536. -- collision detection
  537. if entities[j].Type == EntityType.ENTITY_PICKUP
  538. and KBum.Position:Distance(entities[j].Position) <= 150
  539. then
  540. if entities[j]:GetSprite():IsPlaying("Collect")
  541. and entities[j]:GetData().Picked == nil then
  542. entities[j]:GetData().Picked = true
  543. -- pickup specific action
  544. if entities[j].Variant == PickupVariant.PICKUP_KEY then
  545. if entities[j].SubType == KeySubType.KEY_NORMAL
  546. or entities[j].SubType == KeySubType.KEY_CHARGED then
  547. -- key counter
  548. BumsKeys = BumsKeys + 1
  549. -- if BumsKeys == 1 then
  550. -- Isaac.DebugString("BumsKeys + 1")
  551. -- depending on how high the key counter Key Bum can spawn different things
  552. if BumsKeys == 7 then
  553. if player:HasCollectible(CollectibleType.COLLECTIBLE_SKELETON_KEY)
  554. and player:HasCollectible(CollectibleType.COLLECTIBLE_MOMS_KEY)
  555. and player:HasCollectible(CollectibleType.COLLECTIBLE_LATCH_KEY)
  556. and DadsKey == true then
  557. if roll < 98 then
  558. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_GOLDEN, entities[j].Position, Vector(0,0), KBum)
  559. BumsKeys = 0 -- reset the counter to 0
  560. Mod:SaveData(BumsKeys)
  561. else
  562. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_LOCKEDCHEST, ChestSubType.CHEST_CLOSED, KBum.Position, Vector(0,0), KBum)
  563. BumsKeys = 0 -- reset the counter to 0
  564. Mod:SaveData(BumsKeys)
  565. end
  566. else
  567. if roll < 50 then
  568. Isaac.Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_KEY, KeySubType.KEY_GOLDEN, entities[j].Position, Vector(0,0), KBum)
  569. BumsKeys = 0 -- reset the counter to 0
  570. Mod:SaveData(BumsKeys)
  571. end
  572. end
  573. elseif BumsKeys >= 12 then
  574. -- the chance to drop something increases with every key picked up
  575. if BumsKeys == 12 then
  576. KBumExtra = 0
  577. Mod:SaveData(KBumExtra)
  578. elseif BumsKeys == 13 then
  579. KBumExtra = KBumExtra + 10
  580. Mod:SaveData(KBumExtra)
  581. elseif BumsKeys == 14 then
  582. KBumExtra = KBumExtra + 10
  583. Mod:SaveData(KBumExtra)
  584. elseif BumsKeys == 15 then
  585. KBumExtra = KBumExtra + 15
  586. Mod:SaveData(KBumExtra)
  587. elseif BumsKeys == 16 then
  588. KBumExtra = KBumExtra + 15
  589. Mod:SaveData(KBumExtra)
  590. elseif BumsKeys == 17 then
  591. KBumExtra = KBumExtra + 15
  592. Mod:SaveData(KBumExtra)
  593. end
  594. if roll < (35 + KBumExtra) then
  595. local rolltwo = rng:RandomInt(120)
  596. if rolltwo < 10 then
  597. SkeletonKey(KBum, keyone)
  598. BumsKeys = 0
  599. Mod:SaveData(BumsKeys)
  600. elseif rolltwo < 30 then
  601. MomKey(KBum, keytwo)
  602. BumsKeys = 0
  603. Mod:SaveData(BumsKeys)
  604. elseif rolltwo < 50 then
  605. DadKey(KBum, keythree)
  606. BumsKeys = 0
  607. Mod:SaveData(BumsKeys)
  608. DadsKey = true
  609. elseif rolltwo < 70 then
  610. LatchKey(KBum, keyfour)
  611. BumsKeys = 0
  612. Mod:SaveData(BumsKeys)
  613. elseif rolltwo < 95 then
  614. PaperKey(KBum, keyfive)
  615. BumsKeys = 0
  616. Mod:SaveData(BumsKeys)
  617. else
  618. StoreKey(KBum, keysix)
  619. BumsKeys = 0
  620. Mod:SaveData(BumsKeys)
  621. end
  622. end
  623. end
  624. end
  625. end
  626. end
  627. end
  628. end
  629. end
  630. end
  631. Mod:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, Mod.onPickup, FamiliarVariant.KEY_BUM)
Advertisement
Add Comment
Please, Sign In to add comment