Josh64

onlyTrinketChallenge side code

Jul 12th, 2020 (edited)
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.38 KB | None | 0 0
  1. -- check for the SpawnerType (if possible) for stuff like beggars, slots, the player etc.
  2. if item.SpawnerType == EntityType.ENTITY_SLOT then
  3. -- check for the spawner variant (to differ between the slots)
  4. if item.SpawnerVariant == 1 then -- Slot Machine (doesn't work)
  5. -- get the slot machine trinket "pool"
  6. local pool = {121} -- while it makes no sense for one trinket [...]
  7. local poolBackwards = {121} -- [...] it allows to extend the trinket pool more easily
  8.  
  9. -- trinket pool stuff
  10. TrinketPools(item, pool, poolBackwards) -- gives the item itself and the both pools into the pool function
  11.  
  12. elseif item.SpawnerVariant == 2 then -- Blood Donation Machine
  13. -- get the blood donation machine trinket "pool"
  14. local pool = {34} -- Child's Heart
  15. local poolBackwards = {34}
  16.  
  17. -- trinket pool stuff
  18. TrinketPools(item, pool, poolBackwards)
  19.  
  20. elseif item.SpawnerVariant == 3 then -- Fortune Teller
  21. -- get the fortune teller trinket "pool"
  22. local pool = {102} -- Fragmented Card
  23. local poolBackwards = {102}
  24.  
  25. -- trinket pool stuff
  26. TrinketPools(item, pool, poolBackwards)
  27.  
  28. -- elseif item.SpawnerVariant == 5 then -- Devil Beggar
  29. -- elseif item.SpawnerVariant == 6 then -- Shell Game
  30. -- elseif item.SpawnerVariant == 7 then -- Key Master (Key Beggar)
  31. -- nothing for SpawnerVariant 8
  32. -- elseif item.SpawnerVariant == 9 then -- Bomb Beggar
  33. -- nothing for SpawnerVariant 10
  34. -- nothing for SpawnerVariant 11
  35.  
  36. elseif item.SpawnerVariant == 12 then -- Dressing Table
  37. -- get the dressing table trinket "pool"
  38. local pool = {16,17,44}
  39. local poolBackwards = {44,17,16}
  40.  
  41. -- trinket pool stuff
  42. TrinketPools(item, pool, poolBackwards)
  43. end
  44. elseif item.SpawnerType == EntityType.ENTITY_PICKUP then
  45. if item.SpawnerVariant == PickupVariant.PICKUP_LOCKEDCHEST then -- Golden Chest
  46. -- get the golden chest trinket "pool"
  47. local pool = {29,54,57}
  48. local poolBackwards = {57,54,29}
  49.  
  50. -- trinket pool stuff
  51. TrinketPools(item, pool, poolBackwards)
  52.  
  53. morphItem = true -- the item is already morphed
  54.  
  55. elseif item.SpawnerVariant == PickupVariant.PICKUP_REDCHEST then
  56. -- get the red chest trinket "pool"
  57. local pool = {40,43,80,107,128}
  58. local poolBackwards = {128,107,80,43,40}
  59.  
  60. -- trinket pool stuff
  61. TrinketPools(item, pool, poolBackwards)
  62.  
  63. morphItem = true -- the item is already morphed
  64.  
  65. elseif item.SpawnerVariant == PickupVariant.PICKUP_ETERNALCHEST then
  66. -- get the eternal/holy chest trinket "pool"
  67. local pool = {7,18,38,85,87,92,100,110,121} -- pool is shared with the angel room
  68. local poolBackwards = {121,110,100,92,87,85,38,18,7}
  69.  
  70. -- trinket pool stuff
  71. TrinketPools(item, pool, poolBackwards)
  72.  
  73. morphItem = true -- the item is already morphed
  74. end
  75.  
  76. elseif item.SpawnerType == EntityType.ENTITY_PLAYER then
  77. -- for item spawning trinkets/effects (inlucdes Lunch Bag and Wish Bone)
  78. -- needs thought tho
  79. end
  80.  
  81.  
  82. -- evaluate stats
  83. if flag == CacheFlag.CACHE_FIREDELAY then
  84. -- check if the player plays the challenge
  85. if game.Challenge == Challenges.CHALLENGE_ONLY_TRINKETS
  86. and extraRules == true then
  87. -- Isaac.ConsoleOutput("First ")
  88. -- check if the player has Filigree Feather
  89. if player:HasTrinket(TrinketType.TRINKET_FILIGREE_FEATHERS)
  90. or hasEffect:HasTrinketEffect(TrinketType.TRINKET_FILIGREE_FEATHERS) then
  91. -- tearUp = 0 -- reset for new evaluation
  92. local faithTrinkets = {7,18,55,121} -- Rosary Bead, Bible Tract, Maggy's Faith, Wooden Cross
  93. -- check if the player has Faith related trinkets
  94. for x = 1, #faithTrinkets do
  95. if player:HasTrinket(faithTrinkets[x])
  96. or hasEffect:HasTrinketEffect(faithTrinkets[x]) then
  97. tearUp = tearUp - 0.25
  98. -- Isaac.ConsoleOutput("Appear ")
  99. end
  100. end
  101. if tearUp == 0 then
  102. Isaac.ConsoleOutput("Upps ")
  103. end
  104.  
  105. -- evaluate the fire delay
  106. if player.MaxFireDelay > MIN_FIRE_DELAY then
  107. local TearBonus = math.min(
  108. tearUp,
  109. player.MaxFireDelay - MIN_FIRE_DELAY
  110. )
  111. player.MaxFireDelay = player.MaxFireDelay + TearBonus
  112. end
  113. end
  114.  
  115. tearUp = 0
  116. end
  117. end
  118.  
  119.  
  120.  
  121. -- destroy Donation machine
  122. -- destroy the restock machine once it is used to many times
  123. if rerollItemRo >= 3 then
  124. if roomType == RoomType.ROOM_TREASURE
  125. and restock:GetData().IsBroken == nil then
  126. -- let it play the death animation
  127. sprite:Play("Death", false)
  128.  
  129. restock:GetData().IsBroken = true
  130.  
  131. -- make it intengable to other entities
  132. restock.EntityCollisionClass = EntityCollisionClass.ENTCOLL_NONE
  133. end
  134. end
  135. if rerollSecretRo >= 3 then
  136. if roomType == RoomType.ROOM_SECRET
  137. and restock:GetData().IsBroken == nil then
  138. -- let it play the death animation
  139. sprite:Play("Death", false)
  140.  
  141. restock:GetData().IsBroken = true
  142. end
  143. end
  144.  
  145. --normal switch code
  146. if entities.Variant == PickupVariant.PICKUP_COLLECTIBLE then -- look for items
  147. local item = entities
  148.  
  149. -- check if a beggar spawned an item
  150. if waitForBeggar == true -- a beggar spawned an item
  151. and morphItem == false then -- item hasn't morphed yet
  152. -- Isaac.ConsoleOutput("Wait!! ")
  153. if collectible.Beggar == true then
  154. -- get the beggar trinket "pool"
  155. local pool = {1,24,49,50,51,52,126} -- mostly the penny trinkets
  156. local poolBackwards = {126,52,51,50,49,24,1}
  157.  
  158. -- trinket pool stuff
  159. TrinketPools(item, pool, poolBackwards)
  160.  
  161. collectible.Beggar = false
  162. Isaac.ConsoleOutput("Please? ")
  163.  
  164. elseif collectible.DemonBeggar == true then
  165. -- get the devil beggar trinket "pool"
  166. local pool = {61,111} -- Left Hand, Bloody Crown
  167. local poolBackwards = {111,61}
  168.  
  169. -- trinket pool stuff
  170. TrinketPools(item, pool, poolBackwards)
  171.  
  172. collectible.DemonBeggar = false
  173.  
  174. elseif collectible.ShellGame == true then
  175.  
  176. -- get the shell game trinket "pool"
  177. local pool = {2,93} -- Petrified Poop, Used Diaper
  178. local poolBackwards = {93,2}
  179.  
  180. -- trinket pool stuff
  181. TrinketPools(item, pool, poolBackwards)
  182.  
  183. collectible.ShellGame = false
  184.  
  185. -- Isaac.ConsoleOutput("Shell Game")
  186.  
  187. elseif collectible.KeyBeggar == true then
  188. -- get the key master trinket "pool"
  189. local pool = {19,36,83,124} -- key related trinkets
  190. local poolBackwards = {124,83,36,19}
  191.  
  192. -- trinket pool stuff
  193. TrinketPools(item, pool, poolBackwards)
  194.  
  195. collectible.KeyBeggar = false
  196.  
  197.  
  198. elseif collectible.BombBeggar == true then
  199. -- get the bomb beggar trinket "pool"
  200. local pool = {63,71,73} -- Bob's Bladder / bomb related trinkets
  201. local poolBackwards = {73,71,63}
  202.  
  203. -- trinket pool stuff
  204. TrinketPools(item, pool, poolBackwards)
  205.  
  206. collectible.BombBeggar = false
  207.  
  208.  
  209. -- Isaac.ConsoleOutput("Kaboooom")
  210. end
  211. -- set waitForBeggar and morphItem
  212. waitForBeggar = false
  213. morphItem = true -- the item is already morphed
  214. end
  215.  
  216. if morphItem == true then
  217. -- break
  218. -- morphItem = false
  219. end
  220.  
  221. -- Look for specific items via the CollectibleType
  222. if (item.SubType == CollectibleType.COLLECTIBLE_LUMP_OF_COAL -- spawned from the Krampus fight
  223. or item.SubType == CollectibleType.COLLECTIBLE_KRAMPUS_HEAD) then
  224. -- possible needs room type?
  225. -- get krampu's trinket pool
  226. local pool = {35,95}
  227. local poolBackwards = {95,35}
  228.  
  229. -- trinket pool stuff
  230. TrinketPools(item, pool, poolBackwards)
  231.  
  232. morphItem = true -- the item is already morphed
  233.  
  234. elseif (item.SubType == CollectibleType.COLLECTIBLE_CUBE_OF_MEAT -- spawned by the horesman fight
  235. or item.SubType == CollectibleType.COLLECTIBLE_BALL_OF_BANDAGES
  236. or item.SubType == CollectibleType.COLLECTIBLE_WHITE_PONY) then -- spawned by Conquest
  237. -- get room data to see which horseman room it is
  238. if roomType == RoomType.ROOM_BOSS then -- first check the room type
  239. if roomContains.Famine == true then
  240. -- morph the item into a locust. This will always happen regardless if the player has it or not
  241. item:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_LOCUST_OF_FAMINE, false)
  242. -- reset the roomContains
  243. roomContains.Famine = false
  244.  
  245. elseif roomContains.Pestilence == true then
  246. -- morph the item into a locust. This will always happen regardless if the player has it or not
  247. item:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_LOCUST_OF_PESTILENCE, false)
  248. -- reset the roomContains
  249. roomContains.Pestilence = false
  250.  
  251. elseif roomContains.Death == true then
  252. -- morph the item into a locust. This will always happen regardless if the player has it or not
  253. item:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_LOCUST_OF_DEATH, false)
  254. -- reset the roomContains
  255. roomContains.Death = false
  256.  
  257. -- elseif roomData.IsWarsRoom == true then
  258. elseif roomContains.War == true then
  259. -- morph the item into a locust. This will always happen regardless if the player has it or not
  260. item:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_LOCUST_OF_WRATH, false)
  261. -- reset the roomContains
  262. roomContains.War = false
  263.  
  264. elseif roomContains.Conquest == true then
  265. -- morph the item into a locust. This will always happen regardless if the player has it or not
  266. item:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_LOCUST_OF_CONQUEST, false)
  267. -- reset the roomContains
  268. roomContains.Conquest = false
  269. end
  270. end
  271. morphItem = true -- the item is already morphed
  272.  
  273. elseif (item.SubType == CollectibleType.COLLECTIBLE_POLAROID -- spawned from the Krampus fight
  274. or item.SubType == CollectibleType.COLLECTIBLE_NEGATIVE) then
  275. -- get mom's "pool"
  276. -- local pool = {69} -- Faded Polariod
  277.  
  278. -- morph the item to the picked trinket
  279. item:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_FADED_POLAROID, false)
  280.  
  281. morphItem = true -- the item is already morphed
  282.  
  283. elseif item.SubType == CollectibleType.COLLECTIBLE_SKATOLE then -- shell game
  284. -- get the shell game trinket "pool"
  285. local pool = {2,93} -- Petrified Poop, Used Diaper
  286. local poolBackwards = {93,2}
  287.  
  288. -- trinket pool stuff
  289. TrinketPools(item, pool, poolBackwards)
  290.  
  291. morphItem = true -- the item is already morphed
  292.  
  293. elseif item.SubType == CollectibleType.COLLECTIBLE_DOLLAR then -- slot machine
  294. -- get the slot machine trinket "pool"
  295. -- local pool = 121
  296. -- morph the item to the picked trinket
  297. item:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_SILVER_DOLLAR, false)
  298.  
  299. morphItem = true -- the item is already morphed
  300.  
  301. elseif item.SubType == CollectibleType.COLLECTIBLE_BLOOD_BAG -- blood donation machine
  302. or item.SubType == CollectibleType.COLLECTIBLE_IV_BAG then
  303. -- get the blood donation trinket "pool"
  304. local pool = {34,40,87}
  305. local poolBackwards = {87,40,34}
  306. -- trinket pool stuff
  307. TrinketPools(item, pool, poolBackwards)
  308.  
  309. morphItem = true -- the item is already morphed
  310.  
  311. elseif item.SubType == CollectibleType.COLLECTIBLE_CRYSTAL_BALL then -- fortune teller
  312. -- get the fortune teller trinket "pool"
  313. -- local pool = 102 -- Fragmented Card
  314. -- morph the item to the picked trinket
  315. item:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_FRAGMENTED_CARD, false)
  316.  
  317. morphItem = true -- the item is already morphed
  318.  
  319. elseif item.SubType == CollectibleType.COLLECTIBLE_PONY then
  320. -- get the headless trinket "pool"
  321. -- local pool = 54 -- Isaac's Head
  322. -- morph the item to the picked trinket
  323. item:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_ISAACS_HEAD, false)
  324.  
  325. morphItem = true -- the item is already morphed
  326.  
  327. elseif item.SubType == CollectibleType.COLLECTIBLE_KEY_PIECE_1
  328. or item.SubType == CollectibleType.COLLECTIBLE_KEY_PIECE_2 then
  329. local droppedFeather = false -- keeps track if the Filigree Feather is already in the room
  330. -- look for the feather
  331. for _, entity in pairs(Isaac.GetRoomEntities()) do
  332. if entity.Type == EntityType.ENTITY_PICKUP
  333. and entity.Variant == PickupVariant.PICKUP_TRINKET
  334. and entity.SubType == TrinketType.TRINKET_FILIGREE_FEATHERS then
  335. if droppedFeather == false then
  336. droppedFeather = true
  337. -- Isaac.ConsoleOutput("Kaboooom")
  338. end
  339. end
  340. end
  341.  
  342. -- after searching decide in what the item is going to be morped
  343. if droppedFeather == true
  344. or player:HasTrinket(TrinketType.TRINKET_FILIGREE_FEATHERS)
  345. or hasEffect:HasTrinketEffect(TrinketType.TRINKET_FILIGREE_FEATHERS) then
  346. -- a random trinket from the angel trinket room pool
  347. -- get the secret room pool
  348. local pool = {7,18,38,85,87,92,100,110,121}
  349. local poolBackwards = {121,110,100,92,87,85,38,18,7}
  350.  
  351. -- trinket pool stuff
  352. TrinketPools(item, pool, poolBackwards)
  353. else
  354. item:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_FILIGREE_FEATHERS, false)
  355. end
  356.  
  357. morphItem = true -- the item is already morphed
  358. end
  359.  
  360. if morphItem == true then
  361. -- Isaac.ConsoleOutput("Kaboooom")
  362. end
  363.  
  364. -- check the room pools
  365. if waitForBeggar == false -- the item wasn't spawned by a beggar
  366. and morphItem == false then -- item hasn't morphed yet
  367.  
  368. -- go through the different room types
  369. if roomType == RoomType.ROOM_TREASURE
  370. or roomType == RoomType.ROOM_DUNGEON then
  371. -- get the treasure room pool
  372. local pool = {5,8,14,16,25,30,31,33,53,54,55,57,60,68,70,71,77,81,86,90,93,95,97,98,99,127}
  373. local poolBackwards = {127,99,98,97,95,93,90,86,81,77,71,70,68,60,57,55,54,53,33,31,30,25,16,14,8,5}
  374.  
  375. -- trinket pool stuff
  376. TrinketPools(item, pool, poolBackwards)
  377.  
  378.  
  379. -- if item:GetData().ThereIsOptions == nil then
  380. -- item:GetData().ThereIsOptions = true
  381. -- end
  382.  
  383. elseif roomType == RoomType.ROOM_SHOP
  384. or roomType == RoomType.ROOM_BLACK_MARKET then
  385. -- get the shop room pool
  386. local pool = {3,29,34,36,41,44,59,62,63,72,73,74,76,78,82,89,94,103,106,109,120,125}
  387. local poolBackwards = {125,120,109,106,103,94,89,82,78,76,74,73,72,63,62,59,44,41,36,34,29,3}
  388.  
  389. -- trinket pool stuff
  390. TrinketPools(item, pool, poolBackwards)
  391.  
  392. -- asign data to the entity to make it a shop item later down the line
  393. item:GetData().ShopTrinket = true
  394. item:GetData().NeedsNewPrize = true
  395.  
  396.  
  397. elseif roomType == RoomType.ROOM_LIBRARY then
  398. -- get the library room pool
  399. local pool = {9,10,11,12,21,23,26,27,45,48,64,65,66,96,102}
  400. local poolBackwards = {102,96,66,65,64,48,45,27,26,23,21,12,11,10,9}
  401.  
  402. -- trinket pool stuff
  403. TrinketPools(item, pool, poolBackwards)
  404.  
  405. elseif roomType == RoomType.ROOM_BOSS
  406. or roomType == RoomType.ROOM_MINIBOSS then
  407. if roomContains.Fallen == true then -- the boss room contains the Fallen
  408. -- get the devil room pool
  409. local pool = {13,17,20,22,35,80,111,118}
  410. local poolBackwards = {118,111,80,35,22,20,17,13}
  411.  
  412. -- trinket pool stuff
  413. TrinketPools(item, pool, poolBackwards)
  414.  
  415. roomContains.Fallen = false
  416. else
  417. -- get the boss room pool
  418. local pool = {37,39,42,46,58,101,104,105,108,119}
  419. local poolBackwards = {119,108,105,104,101,58,46,42,39,37}
  420.  
  421. -- trinket pool stuff
  422. TrinketPools(item, pool, poolBackwards)
  423. end
  424.  
  425. elseif roomType == RoomType.ROOM_SECRET
  426. or roomType == RoomType.ROOM_SUPERSECRET then
  427. -- get the secret room pool
  428. local pool = {15,28,32,83,84,91}
  429. local poolBackwards = {91,84,83,32,28,15}
  430.  
  431. -- trinket pool stuff
  432. TrinketPools(item, pool, poolBackwards)
  433.  
  434. elseif roomType == RoomType.ROOM_DEVIL then
  435. -- get the secret room pool
  436. local pool = {13,17,20,22,35,80,111,118}
  437. local poolBackwards = {118,111,80,35,22,20,17,13}
  438.  
  439. -- trinket pool stuff
  440. TrinketPools(item, pool, poolBackwards)
  441.  
  442. elseif roomType == RoomType.ROOM_ANGEL
  443. or roomType == RoomType.ROOM_SACRIFICE then
  444. -- get the secret room pool
  445. local pool = {7,18,38,87,92,100,110,121}
  446. local poolBackwards = {121,110,100,92,87,38,18,7}
  447.  
  448. -- trinket pool stuff
  449. TrinketPools(item, pool, poolBackwards)
  450.  
  451. elseif roomType == RoomType.ROOM_CURSE then
  452. -- get the secret room pool
  453. local pool = {40,43,61,107,128}
  454. local poolBackwards = {128,107,61,43,40}
  455.  
  456. -- trinket pool stuff
  457. TrinketPools(item, pool, poolBackwards)
  458.  
  459. elseif roomType == RoomType.ROOM_ISAACS
  460. or roomType == RoomType.ROOM_BARREN then
  461. -- get the secret room pool
  462. local pool = {8,46,54,63,67,99}
  463. local poolBackwards = {99,67,63,54,46,8}
  464.  
  465. -- trinket pool stuff
  466. TrinketPools(item, pool, poolBackwards)
  467.  
  468. elseif roomType == RoomType.ROOM_CHALLENGE then
  469. -- get the secret room pool
  470. local pool = {6,40,58}
  471. local poolBackwards = {58,40,6}
  472.  
  473. -- trinket pool stuff
  474. TrinketPools(item, pool, poolBackwards)
  475.  
  476. elseif roomType == RoomType.ROOM_CHEST then
  477. -- get the secret room pool
  478. local pool = {29,54,55,56,57,58,59,60}
  479. local poolBackwards = {60,59,58,57,56,55,54,29}
  480.  
  481. -- trinket pool stuff
  482. TrinketPools(item, pool, poolBackwards)
  483.  
  484. elseif roomType == RoomType.ROOM_ARCADE then
  485. -- get the secret room pool
  486. local pool = {8,45,67,76,112}
  487. local poolBackwards = {112,76,67,45,8}
  488.  
  489. -- trinket pool stuff
  490. TrinketPools(item, pool, poolBackwards)
  491.  
  492. elseif roomType == RoomType.ROOM_ERROR then
  493. -- get the secret room pool
  494. local pool = {4,6,67,75,79,92}
  495. local poolBackwards = {92,79,75,67,6,4}
  496.  
  497. -- trinket pool stuff
  498. TrinketPools(item, pool, poolBackwards)
  499.  
  500. elseif roomType == RoomType.ROOM_BOSSRUSH
  501. or roomType == RoomType.ROOM_DEFAULT then
  502. -- Isaac.ConsoleOutput("s,rjzgqp")
  503. -- morph the item into a random trinket. This will always happen regardless if the player has it or not
  504. item:ToPickup():Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, TrinketType.TRINKET_NULL, false)
  505. end
  506. end
  507.  
  508. if morphItem == true then
  509. morphItem = false
  510. end
  511.  
Add Comment
Please, Sign In to add comment