isaacscript-common 2.3.2 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (337) hide show
  1. package/cachedClasses.d.ts +6 -4
  2. package/cachedClasses.lua +24 -0
  3. package/callbacks/customRevive.lua +2 -0
  4. package/callbacks/itemPickup.lua +2 -0
  5. package/callbacks/postBombInitLate.lua +2 -0
  6. package/callbacks/postBoneSwing.lua +2 -0
  7. package/callbacks/postCollectibleInitFirst.lua +2 -0
  8. package/callbacks/postCursedTeleport.lua +2 -0
  9. package/callbacks/postCustomDoorEnter.lua +44 -0
  10. package/callbacks/postDoorRender.lua +2 -0
  11. package/callbacks/postDoorUpdate.lua +2 -0
  12. package/callbacks/postEffectInitLate.lua +2 -0
  13. package/callbacks/postEffectStateChanged.lua +2 -0
  14. package/callbacks/postEsauJr.lua +2 -0
  15. package/callbacks/postFamiliarInitLate.lua +2 -0
  16. package/callbacks/postFamiliarStateChanged.lua +2 -0
  17. package/callbacks/postFlip.lua +2 -0
  18. package/callbacks/postGreedModeWave.lua +2 -0
  19. package/callbacks/postGridEntity.lua +2 -0
  20. package/callbacks/postGridEntityCollision.lua +2 -0
  21. package/callbacks/postGridEntityRender.lua +2 -0
  22. package/callbacks/postHolyMantleRemoved.lua +2 -0
  23. package/callbacks/postKnifeInitLate.lua +2 -0
  24. package/callbacks/postLaserInitLate.lua +2 -0
  25. package/callbacks/postNPCInitLate.lua +2 -0
  26. package/callbacks/postNPCStateChanged.lua +2 -0
  27. package/callbacks/postNewRoomEarly.lua +2 -0
  28. package/callbacks/postPickupCollect.lua +2 -0
  29. package/callbacks/postPickupInitFirst.d.ts +1 -0
  30. package/callbacks/postPickupInitFirst.lua +55 -0
  31. package/callbacks/postPickupInitLate.lua +2 -0
  32. package/callbacks/postPickupStateChanged.lua +2 -0
  33. package/callbacks/postPitRender.lua +2 -0
  34. package/callbacks/postPitUpdate.lua +2 -0
  35. package/callbacks/postPlayerChangeHealth.lua +2 -0
  36. package/callbacks/postPlayerChangeType.lua +2 -0
  37. package/callbacks/postPlayerFatalDamage.lua +2 -0
  38. package/callbacks/postPlayerInitLate.lua +2 -0
  39. package/callbacks/postPlayerReordered.lua +2 -0
  40. package/callbacks/postPoopRender.lua +2 -0
  41. package/callbacks/postPoopUpdate.lua +2 -0
  42. package/callbacks/postPressurePlateRender.lua +2 -0
  43. package/callbacks/postPressurePlateUpdate.lua +2 -0
  44. package/callbacks/postProjectileInitLate.lua +2 -0
  45. package/callbacks/postPurchase.lua +2 -0
  46. package/callbacks/postRockRender.lua +2 -0
  47. package/callbacks/postRockUpdate.lua +2 -0
  48. package/callbacks/postRoomClearChanged.lua +2 -0
  49. package/callbacks/postSacrifice.lua +2 -0
  50. package/callbacks/postSlotDestroyed.d.ts +1 -0
  51. package/callbacks/postSlotDestroyed.lua +66 -0
  52. package/callbacks/postSlotInitUpdate.lua +2 -0
  53. package/callbacks/postSlotRender.lua +5 -21
  54. package/callbacks/postSpikesRender.lua +2 -0
  55. package/callbacks/postSpikesUpdate.lua +2 -0
  56. package/callbacks/postTNTRender.lua +2 -0
  57. package/callbacks/postTNTUpdate.lua +2 -0
  58. package/callbacks/postTearInitLate.lua +2 -0
  59. package/callbacks/postTearInitVeryLate.lua +2 -0
  60. package/callbacks/postTransformation.lua +2 -0
  61. package/callbacks/postTrinketBreak.lua +2 -0
  62. package/callbacks/preBerserkDeath.lua +2 -0
  63. package/callbacks/preNewLevel.lua +2 -0
  64. package/callbacks/reorderedCallbacks.lua +16 -0
  65. package/callbacks/subscriptions/postBombInitLate.lua +6 -0
  66. package/callbacks/subscriptions/postBoneSwing.lua +6 -0
  67. package/callbacks/subscriptions/postCollectibleInitFirst.lua +6 -0
  68. package/callbacks/subscriptions/postCursedTeleport.lua +6 -0
  69. package/callbacks/subscriptions/postCustomDoorEnter.lua +6 -0
  70. package/callbacks/subscriptions/postCustomRevive.d.ts +1 -0
  71. package/callbacks/subscriptions/postCustomRevive.lua +6 -0
  72. package/callbacks/subscriptions/postDoorRender.d.ts +1 -0
  73. package/callbacks/subscriptions/postDoorRender.lua +6 -0
  74. package/callbacks/subscriptions/postDoorUpdate.d.ts +1 -0
  75. package/callbacks/subscriptions/postDoorUpdate.lua +6 -0
  76. package/callbacks/subscriptions/postEffectInitLate.lua +6 -0
  77. package/callbacks/subscriptions/postEffectStateChanged.lua +6 -0
  78. package/callbacks/subscriptions/postEsauJr.lua +6 -0
  79. package/callbacks/subscriptions/postFamiliarInitLate.lua +6 -0
  80. package/callbacks/subscriptions/postFamiliarStateChanged.lua +6 -0
  81. package/callbacks/subscriptions/postFirstEsauJr.lua +6 -0
  82. package/callbacks/subscriptions/postFirstFlip.lua +6 -0
  83. package/callbacks/subscriptions/postFlip.lua +6 -0
  84. package/callbacks/subscriptions/postGameStartedReordered.lua +6 -0
  85. package/callbacks/subscriptions/postGreedModeWave.lua +6 -0
  86. package/callbacks/subscriptions/postGridEntityBroken.lua +6 -0
  87. package/callbacks/subscriptions/postGridEntityCollision.lua +6 -0
  88. package/callbacks/subscriptions/postGridEntityInit.lua +6 -0
  89. package/callbacks/subscriptions/postGridEntityRemove.lua +6 -0
  90. package/callbacks/subscriptions/postGridEntityRender.lua +6 -0
  91. package/callbacks/subscriptions/postGridEntityStateChanged.lua +6 -0
  92. package/callbacks/subscriptions/postGridEntityUpdate.lua +6 -0
  93. package/callbacks/subscriptions/postHolyMantleRemoved.lua +6 -0
  94. package/callbacks/subscriptions/postItemDischarged.lua +6 -0
  95. package/callbacks/subscriptions/postItemPickup.lua +6 -0
  96. package/callbacks/subscriptions/postKnifeInitLate.lua +6 -0
  97. package/callbacks/subscriptions/postLaserInitLate.lua +6 -0
  98. package/callbacks/subscriptions/postNPCInitLate.lua +6 -0
  99. package/callbacks/subscriptions/postNPCStateChanged.lua +6 -0
  100. package/callbacks/subscriptions/postNewLevelReordered.lua +6 -0
  101. package/callbacks/subscriptions/postNewRoomEarly.lua +6 -0
  102. package/callbacks/subscriptions/postNewRoomReordered.lua +6 -0
  103. package/callbacks/subscriptions/postPEffectUpdateReordered.lua +6 -0
  104. package/callbacks/subscriptions/postPickupCollect.d.ts +1 -0
  105. package/callbacks/subscriptions/postPickupCollect.lua +6 -0
  106. package/callbacks/subscriptions/postPickupInitFirst.d.ts +3 -0
  107. package/callbacks/subscriptions/postPickupInitFirst.lua +29 -0
  108. package/callbacks/subscriptions/postPickupInitLate.lua +6 -0
  109. package/callbacks/subscriptions/postPickupStateChanged.d.ts +1 -0
  110. package/callbacks/subscriptions/postPickupStateChanged.lua +6 -0
  111. package/callbacks/subscriptions/postPitRender.d.ts +1 -0
  112. package/callbacks/subscriptions/postPitRender.lua +6 -0
  113. package/callbacks/subscriptions/postPitUpdate.d.ts +1 -0
  114. package/callbacks/subscriptions/postPitUpdate.lua +6 -0
  115. package/callbacks/subscriptions/postPlayerChangeHealth.lua +6 -0
  116. package/callbacks/subscriptions/postPlayerChangeType.lua +6 -0
  117. package/callbacks/subscriptions/postPlayerFatalDamage.lua +6 -0
  118. package/callbacks/subscriptions/postPlayerInitLate.lua +6 -0
  119. package/callbacks/subscriptions/postPlayerInitReordered.lua +6 -0
  120. package/callbacks/subscriptions/postPlayerRenderReordered.lua +6 -0
  121. package/callbacks/subscriptions/postPlayerUpdateReordered.lua +6 -0
  122. package/callbacks/subscriptions/postPoopRender.d.ts +1 -0
  123. package/callbacks/subscriptions/postPoopRender.lua +6 -0
  124. package/callbacks/subscriptions/postPoopUpdate.d.ts +1 -0
  125. package/callbacks/subscriptions/postPoopUpdate.lua +6 -0
  126. package/callbacks/subscriptions/postPressurePlateRender.d.ts +1 -0
  127. package/callbacks/subscriptions/postPressurePlateRender.lua +6 -0
  128. package/callbacks/subscriptions/postPressurePlateUpdate.d.ts +1 -0
  129. package/callbacks/subscriptions/postPressurePlateUpdate.lua +6 -0
  130. package/callbacks/subscriptions/postProjectileInitLate.lua +6 -0
  131. package/callbacks/subscriptions/postPurchase.lua +6 -0
  132. package/callbacks/subscriptions/postRockRender.d.ts +1 -0
  133. package/callbacks/subscriptions/postRockRender.lua +6 -0
  134. package/callbacks/subscriptions/postRockUpdate.d.ts +1 -0
  135. package/callbacks/subscriptions/postRockUpdate.lua +6 -0
  136. package/callbacks/subscriptions/postRoomClearChanged.lua +6 -0
  137. package/callbacks/subscriptions/postSacrifice.lua +6 -0
  138. package/callbacks/subscriptions/postSlotAnimationChanged.lua +6 -0
  139. package/callbacks/subscriptions/postSlotDestroyed.lua +6 -0
  140. package/callbacks/subscriptions/postSlotInit.lua +6 -0
  141. package/callbacks/subscriptions/postSlotRender.lua +6 -0
  142. package/callbacks/subscriptions/postSlotUpdate.lua +6 -0
  143. package/callbacks/subscriptions/postSpikesRender.d.ts +1 -0
  144. package/callbacks/subscriptions/postSpikesRender.lua +6 -0
  145. package/callbacks/subscriptions/postSpikesUpdate.d.ts +1 -0
  146. package/callbacks/subscriptions/postSpikesUpdate.lua +6 -0
  147. package/callbacks/subscriptions/postTNTRender.d.ts +1 -0
  148. package/callbacks/subscriptions/postTNTRender.lua +6 -0
  149. package/callbacks/subscriptions/postTNTUpdate.d.ts +1 -0
  150. package/callbacks/subscriptions/postTNTUpdate.lua +6 -0
  151. package/callbacks/subscriptions/postTearInitLate.lua +6 -0
  152. package/callbacks/subscriptions/postTearInitVeryLate.lua +6 -0
  153. package/callbacks/subscriptions/postTransformation.lua +6 -0
  154. package/callbacks/subscriptions/postTrinketBreak.lua +6 -0
  155. package/callbacks/subscriptions/preBerserkDeath.lua +6 -0
  156. package/callbacks/subscriptions/preCustomRevive.lua +6 -0
  157. package/callbacks/subscriptions/preItemPickup.lua +6 -0
  158. package/callbacks/subscriptions/preNewLevel.lua +6 -0
  159. package/classes/DefaultMap.d.ts +70 -39
  160. package/classes/DefaultMap.lua +94 -43
  161. package/classes/ModUpgraded.d.ts +3 -3
  162. package/classes/ModUpgraded.lua +5 -0
  163. package/constants.lua +41 -0
  164. package/constantsFirstLast.lua +63 -0
  165. package/enums/HealthType.lua +3 -0
  166. package/enums/ModCallbackCustom.d.ts +62 -40
  167. package/enums/ModCallbackCustom.lua +46 -38
  168. package/enums/private/CopyableIsaacAPIClassType.lua +1 -0
  169. package/enums/private/SerializationBrand.lua +5 -0
  170. package/features/characterHealthConversion.lua +6 -0
  171. package/features/characterStats.lua +17 -0
  172. package/features/debugDisplay/exports.d.ts +17 -0
  173. package/features/debugDisplay/exports.lua +90 -0
  174. package/features/debugDisplay/v.d.ts +17 -0
  175. package/features/deployJSONRoom.d.ts +1 -0
  176. package/features/deployJSONRoom.lua +56 -0
  177. package/features/disableInputs.lua +45 -0
  178. package/features/disableSound.lua +14 -0
  179. package/features/extraConsoleCommands/commandsDisplay.lua +90 -0
  180. package/features/extraConsoleCommands/init.lua +16 -0
  181. package/features/extraConsoleCommands/listCommands.lua +172 -0
  182. package/features/fadeInRemover.lua +10 -0
  183. package/features/fastReset.lua +10 -0
  184. package/features/forgottenSwitch.lua +4 -0
  185. package/features/getCollectibleItemPoolType.lua +5 -0
  186. package/features/playerInventory.lua +18 -0
  187. package/features/ponyDetection.lua +4 -0
  188. package/features/preventCollectibleRotation.lua +9 -0
  189. package/features/runInNFrames.lua +50 -0
  190. package/features/saveDataManager/constants.lua +1 -0
  191. package/features/saveDataManager/exports.lua +115 -0
  192. package/features/saveDataManager/load.lua +12 -8
  193. package/features/saveDataManager/main.lua +16 -3
  194. package/features/saveDataManager/maps.lua +3 -0
  195. package/features/saveDataManager/merge.lua +53 -21
  196. package/features/saveDataManager/save.lua +12 -7
  197. package/features/sirenHelpers.lua +13 -0
  198. package/features/taintedLazarusPlayers.lua +11 -0
  199. package/featuresInitialized.lua +6 -0
  200. package/functions/array.d.ts +2 -0
  201. package/functions/array.lua +85 -0
  202. package/functions/benchmark.lua +6 -0
  203. package/functions/bombs.d.ts +3 -0
  204. package/functions/bombs.lua +12 -0
  205. package/functions/boss.lua +35 -0
  206. package/functions/cacheFlag.lua +4 -0
  207. package/functions/cards.lua +60 -0
  208. package/functions/challenges.lua +1 -0
  209. package/functions/character.lua +23 -0
  210. package/functions/charge.lua +39 -0
  211. package/functions/chargeBar.d.ts +1 -0
  212. package/functions/chargeBar.lua +4 -0
  213. package/functions/collectibleCacheFlag.lua +15 -0
  214. package/functions/collectibleSet.lua +3 -0
  215. package/functions/collectibleTag.lua +9 -0
  216. package/functions/collectibles.d.ts +13 -8
  217. package/functions/collectibles.lua +147 -3
  218. package/functions/color.lua +18 -0
  219. package/functions/debug.lua +18 -0
  220. package/functions/deepCopy.lua +60 -26
  221. package/functions/deepCopyTests.lua +8 -5
  222. package/functions/direction.d.ts +8 -0
  223. package/functions/direction.lua +27 -0
  224. package/functions/doors.d.ts +1 -0
  225. package/functions/doors.lua +58 -0
  226. package/functions/entity.d.ts +4 -4
  227. package/functions/entity.lua +94 -6
  228. package/functions/entitySpecific.d.ts +20 -20
  229. package/functions/entitySpecific.lua +182 -0
  230. package/functions/entityTypes.d.ts +1 -1
  231. package/functions/entityTypes.lua +1 -0
  232. package/functions/enums.d.ts +2 -0
  233. package/functions/enums.lua +62 -0
  234. package/functions/familiars.lua +52 -0
  235. package/functions/flag.lua +77 -0
  236. package/functions/flying.lua +10 -0
  237. package/functions/globals.lua +8 -10
  238. package/functions/gridEntity.lua +105 -0
  239. package/functions/gridEntitySpecific.d.ts +5 -0
  240. package/functions/gridEntitySpecific.lua +8 -0
  241. package/functions/input.lua +11 -0
  242. package/functions/isaacAPIClass.d.ts +4 -4
  243. package/functions/isaacAPIClass.lua +15 -3
  244. package/functions/jsonHelpers.lua +11 -0
  245. package/functions/jsonRoom.d.ts +2 -0
  246. package/functions/jsonRoom.lua +5 -0
  247. package/functions/kColor.lua +9 -0
  248. package/functions/language.lua +5 -0
  249. package/functions/log.lua +31 -3
  250. package/functions/map.lua +18 -0
  251. package/functions/math.lua +26 -0
  252. package/functions/npc.lua +24 -0
  253. package/functions/pickupVariants.d.ts +11 -11
  254. package/functions/pickupVariants.lua +11 -0
  255. package/functions/pickups.d.ts +9 -9
  256. package/functions/pickups.lua +67 -0
  257. package/functions/pills.lua +45 -0
  258. package/functions/player.d.ts +7 -0
  259. package/functions/player.lua +210 -9
  260. package/functions/playerDataStructures.lua +65 -0
  261. package/functions/playerHealth.d.ts +3 -0
  262. package/functions/playerHealth.lua +92 -63
  263. package/functions/playerIndex.d.ts +2 -0
  264. package/functions/playerIndex.lua +47 -0
  265. package/functions/pocketItems.lua +18 -0
  266. package/functions/positionVelocity.d.ts +3 -0
  267. package/functions/positionVelocity.lua +46 -0
  268. package/functions/random.d.ts +2 -0
  269. package/functions/random.lua +32 -0
  270. package/functions/revive.d.ts +2 -0
  271. package/functions/revive.lua +15 -0
  272. package/functions/rng.d.ts +1 -0
  273. package/functions/rng.lua +19 -0
  274. package/functions/roomData.lua +68 -0
  275. package/functions/roomGrid.lua +21 -0
  276. package/functions/roomShape.lua +22 -0
  277. package/functions/rooms.lua +100 -0
  278. package/functions/run.lua +5 -0
  279. package/functions/seeds.lua +4 -0
  280. package/functions/serialization.lua +6 -2
  281. package/functions/set.d.ts +1 -0
  282. package/functions/set.lua +22 -0
  283. package/functions/spawnCollectible.lua +24 -0
  284. package/functions/sprite.d.ts +2 -0
  285. package/functions/sprite.lua +25 -0
  286. package/functions/stage.lua +16 -0
  287. package/functions/string.lua +6 -0
  288. package/functions/table.d.ts +12 -0
  289. package/functions/table.lua +53 -0
  290. package/functions/tears.d.ts +1 -0
  291. package/functions/tears.lua +12 -0
  292. package/functions/transformations.lua +18 -0
  293. package/functions/trinketCacheFlag.lua +3 -0
  294. package/functions/trinketGive.lua +24 -0
  295. package/functions/trinkets.lua +52 -0
  296. package/functions/tstlClass.d.ts +34 -0
  297. package/functions/tstlClass.lua +63 -9
  298. package/functions/ui.d.ts +2 -0
  299. package/functions/ui.lua +16 -0
  300. package/functions/utils.d.ts +16 -0
  301. package/functions/utils.lua +108 -0
  302. package/functions/vector.lua +13 -16
  303. package/index.d.ts +1 -0
  304. package/index.lua +8 -0
  305. package/initCustomCallbacks.lua +6 -0
  306. package/interfaces/AddCallbackParameterCustom.d.ts +2 -0
  307. package/interfaces/ChargeBarSprites.d.ts +1 -0
  308. package/interfaces/private/TSTLClassMetatable.d.ts +2 -0
  309. package/lualib_bundle.lua +21 -34
  310. package/maps/cardMap.lua +1 -0
  311. package/maps/characterMap.lua +1 -0
  312. package/maps/defaultPlayerStatMap.lua +1 -0
  313. package/maps/gridEntityXMLMap.lua +2 -0
  314. package/maps/pillEffectMap.lua +1 -0
  315. package/maps/roomShapeToTopLeftWallGridIndexMap.lua +2 -0
  316. package/maps/roomTypeMap.lua +1 -0
  317. package/objects/LRoomShapeToRectangles.lua +2 -0
  318. package/objects/callbackRegisterFunctions.lua +3 -0
  319. package/objects/colors.lua +4 -0
  320. package/objects/oppositeDoorSlots.d.ts +4 -0
  321. package/objects/oppositeDoorSlots.lua +15 -0
  322. package/objects/roomShapeBounds.lua +2 -0
  323. package/objects/roomShapeLayoutSizes.lua +4 -0
  324. package/objects/roomShapeToBottomRightPosition.lua +2 -0
  325. package/objects/roomShapeToDoorSlotsToGridIndexDelta.lua +2 -0
  326. package/objects/roomShapeToTopLeftPosition.lua +2 -0
  327. package/objects/roomShapeVolumes.lua +3 -0
  328. package/package.json +2 -2
  329. package/patchErrorFunctions.lua +8 -0
  330. package/sets/bossSets.lua +23 -0
  331. package/sets/charactersWithNoRedHeartsSet.lua +2 -0
  332. package/sets/charactersWithNoSoulHeartsSet.lua +2 -0
  333. package/sets/lostStyleCharactersSet.lua +2 -0
  334. package/types/AnyEntity.d.ts +10 -0
  335. package/types/PickingUpItem.lua +7 -0
  336. package/upgradeMod.d.ts +4 -4
  337. package/upgradeMod.lua +18 -0
@@ -50,10 +50,18 @@ function getSirenHelper(self, familiar)
50
50
  end
51
51
  local FEATURE_NAME = "siren helpers"
52
52
  v = {run = {familiarBlacklist = {}}}
53
+ ---
54
+ -- @internal
53
55
  function ____exports.sirenHelpersInit(self, mod)
54
56
  saveDataManager(nil, "sirenHelpers", v)
55
57
  mod:AddCallback(ModCallback.POST_NPC_INIT, postNPCInitSirenHelper, EntityType.SIREN_HELPER)
56
58
  end
59
+ --- Blacklists a familiar from being stolen by The Siren boss. This should be called once at the
60
+ -- beginning of every run.
61
+ --
62
+ -- @param familiarVariant The familiar variant to blacklist.
63
+ -- @param familiarSubType The sub-type to blacklist. Optional. The default is to blacklist all
64
+ -- sub-types of the given variant.
57
65
  function ____exports.setFamiliarNoSirenSteal(self, familiarVariant, familiarSubType)
58
66
  errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
59
67
  if blacklistEntryExists(nil, familiarVariant, familiarSubType) then
@@ -62,6 +70,11 @@ function ____exports.setFamiliarNoSirenSteal(self, familiarVariant, familiarSubT
62
70
  local ____v_run_familiarBlacklist_0 = v.run.familiarBlacklist
63
71
  ____v_run_familiarBlacklist_0[#____v_run_familiarBlacklist_0 + 1] = {familiarVariant, familiarSubType}
64
72
  end
73
+ --- Helper function to check if the Siren boss has stolen a familiar. Some familiars may need to
74
+ -- behave differently when under The Siren's control (e.g. if they auto-target enemies).
75
+ --
76
+ -- @param familiar The familiar to be checked.
77
+ -- @returns Returns whether the familiar has been stolen by The Siren.
65
78
  function ____exports.hasSirenStolenFamiliar(self, familiar)
66
79
  errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
67
80
  return getSirenHelper(nil, familiar) ~= nil
@@ -49,6 +49,8 @@ v = {run = {
49
49
  queuedDeadTaintedLazarus = {},
50
50
  subPlayerMap = __TS__New(Map)
51
51
  }}
52
+ ---
53
+ -- @internal
52
54
  function ____exports.taintedLazarusPlayersInit(self, mod)
53
55
  saveDataManager(
54
56
  nil,
@@ -58,6 +60,15 @@ function ____exports.taintedLazarusPlayersInit(self, mod)
58
60
  )
59
61
  mod:AddCallback(ModCallback.POST_PLAYER_INIT, postPlayerInit)
60
62
  end
63
+ --- Helper function to get the other version of Tainted Lazarus.
64
+ --
65
+ -- - On Tainted Lazarus, returns the player object for Dead Tainted Lazarus.
66
+ -- - On Dead Tainted Lazarus, returns the player object for Tainted Lazarus.
67
+ -- - Returns undefined if player object retrieval failed for any reason.
68
+ --
69
+ -- If you call the `EntityPlayer.Exists` method on the returned object, it will return false.
70
+ -- However, you can still call the other methods like you normally would (e.g.
71
+ -- `EntityPlayer.AddCollectible`).
61
72
  function ____exports.getTaintedLazarusSubPlayer(self, player)
62
73
  errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
63
74
  local ptrHash = GetPtrHash(player)
@@ -1,13 +1,19 @@
1
1
  local ____exports = {}
2
2
  local featuresInitialized = false
3
+ ---
4
+ -- @internal
3
5
  function ____exports.areFeaturesInitialized(self)
4
6
  return featuresInitialized
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.errorIfFeaturesNotInitialized(self, featureName)
7
11
  if not ____exports.areFeaturesInitialized(nil) then
8
12
  error(("The " .. featureName) .. " is not initialized. You must first upgrade your mod object by calling the \"upgradeMod\" function.")
9
13
  end
10
14
  end
15
+ ---
16
+ -- @internal
11
17
  function ____exports.setFeaturesInitialized(self)
12
18
  featuresInitialized = true
13
19
  end
@@ -1,4 +1,6 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
+ /// <reference types="isaac-typescript-definitions" />
3
+ /// <reference types="isaac-typescript-definitions" />
2
4
  /**
3
5
  * Helper function for determining if two arrays contain the exact same elements. Note that this
4
6
  * only performs a shallow comparison.
@@ -20,6 +20,11 @@ local newRNG = ____rng.newRNG
20
20
  local ____utils = require("functions.utils")
21
21
  local erange = ____utils.erange
22
22
  local ____repeat = ____utils["repeat"]
23
+ --- Helper function to get a random index from the provided array.
24
+ --
25
+ -- @param array The array to get the index from.
26
+ -- @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
27
+ -- `RNG.Next` method will be called. Default is `getRandomSeed()`.
23
28
  function ____exports.getRandomArrayIndex(self, array, seedOrRNG)
24
29
  if seedOrRNG == nil then
25
30
  seedOrRNG = getRandomSeed(nil)
@@ -29,6 +34,13 @@ function ____exports.getRandomArrayIndex(self, array, seedOrRNG)
29
34
  end
30
35
  return getRandomInt(nil, 0, #array - 1, seedOrRNG)
31
36
  end
37
+ --- Shuffles the provided array in-place using the Fisher-Yates algorithm.
38
+ --
39
+ -- From: https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
40
+ --
41
+ -- @param array The array to shuffle.
42
+ -- @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
43
+ -- `RNG.Next` method will be called. Default is `getRandomSeed()`.
32
44
  function ____exports.shuffleArrayInPlace(self, array, seedOrRNG)
33
45
  if seedOrRNG == nil then
34
46
  seedOrRNG = getRandomSeed(nil)
@@ -44,6 +56,8 @@ function ____exports.shuffleArrayInPlace(self, array, seedOrRNG)
44
56
  array[randomIndex + 1] = ____temp_0[2]
45
57
  end
46
58
  end
59
+ --- Helper function for determining if two arrays contain the exact same elements. Note that this
60
+ -- only performs a shallow comparison.
47
61
  function ____exports.arrayEquals(self, array1, array2)
48
62
  if #array1 ~= #array2 then
49
63
  return false
@@ -56,6 +70,11 @@ function ____exports.arrayEquals(self, array1, array2)
56
70
  end
57
71
  )
58
72
  end
73
+ --- Shallow copies and removes the specified element(s) from the array. Returns the copied array. If
74
+ -- the specified element(s) are not found in the array, it will simply return a shallow copy of the
75
+ -- array.
76
+ --
77
+ -- This function is variadic, meaning that you can specify N arguments to remove N elements.
59
78
  function ____exports.arrayRemove(self, originalArray, ...)
60
79
  local elementsToRemove = {...}
61
80
  local elementsToRemoveSet = __TS__New(Set, elementsToRemove)
@@ -67,6 +86,10 @@ function ____exports.arrayRemove(self, originalArray, ...)
67
86
  end
68
87
  return array
69
88
  end
89
+ --- Removes the specified element(s) from the array. If the specified element(s) are not found in the
90
+ -- array, this function will do nothing. Returns whether or not one or more elements were removed.
91
+ --
92
+ -- This function is variadic, meaning that you can specify N arguments to remove N elements.
70
93
  function ____exports.arrayRemoveInPlace(self, array, ...)
71
94
  local elementsToRemove = {...}
72
95
  local removedOneOrMoreElements = false
@@ -79,6 +102,11 @@ function ____exports.arrayRemoveInPlace(self, array, ...)
79
102
  end
80
103
  return removedOneOrMoreElements
81
104
  end
105
+ --- Shallow copies and removes the elements at the specified indexes from the array. Returns the
106
+ -- copied array. If the specified indexes are not found in the array, it will simply return a
107
+ -- shallow copy of the array.
108
+ --
109
+ -- This function is variadic, meaning that you can specify N arguments to remove N elements.
82
110
  function ____exports.arrayRemoveIndex(self, originalArray, ...)
83
111
  local indexesToRemove = {...}
84
112
  local indexesToRemoveSet = __TS__New(Set, indexesToRemove)
@@ -93,6 +121,11 @@ function ____exports.arrayRemoveIndex(self, originalArray, ...)
93
121
  )
94
122
  return array
95
123
  end
124
+ --- Removes the elements at the specified indexes from the array. If the specified indexes are not
125
+ -- found in the array, this function will do nothing. Returns whether or not one or more elements
126
+ -- were removed.
127
+ --
128
+ -- This function is variadic, meaning that you can specify N arguments to remove N elements.
96
129
  function ____exports.arrayRemoveIndexInPlace(self, array, ...)
97
130
  local indexesToRemove = {...}
98
131
  local legalIndexes = __TS__ArrayFilter(
@@ -123,6 +156,11 @@ function ____exports.arrayToString(self, array)
123
156
  local commaSeparatedStrings = table.concat(strings, ", ")
124
157
  return ("[" .. commaSeparatedStrings) .. "]"
125
158
  end
159
+ --- Helper function to combine two or more arrays. Returns a new array that is the composition of all
160
+ -- of the specified arrays.
161
+ --
162
+ -- This function is variadic, meaning that you can specify N arguments to combine N arrays. Note
163
+ -- that this will only perform a shallow copy of the array elements.
126
164
  function ____exports.combineArrays(self, ...)
127
165
  local arrays = {...}
128
166
  local elements = {}
@@ -133,6 +171,11 @@ function ____exports.combineArrays(self, ...)
133
171
  end
134
172
  return elements
135
173
  end
174
+ --- Helper function to perform a shallow copy.
175
+ --
176
+ -- @param oldArray The array to copy.
177
+ -- @param numElements Optional. If specified, will only copy the first N elements. By default, the
178
+ -- entire array will be copied.
136
179
  function ____exports.copyArray(self, oldArray, numElements)
137
180
  if numElements == nil then
138
181
  numElements = #oldArray
@@ -153,12 +196,24 @@ end
153
196
  function ____exports.emptyArray(self, array)
154
197
  __TS__ArraySplice(array, 0, #array)
155
198
  end
199
+ --- Helper function to get an array containing the indexes of an array.
200
+ --
201
+ -- For example, an array of `["Apple", "Banana"]` would return an array of `[0, 1]`.
156
202
  function ____exports.getArrayIndexes(self, array)
157
203
  return erange(nil, #array)
158
204
  end
205
+ --- Helper function to return the last element of an array.
206
+ --
207
+ -- If the array is empty, this will return undefined.
159
208
  function ____exports.getLastElement(self, array)
160
209
  return array[#array]
161
210
  end
211
+ --- Helper function to get a random element from the provided array.
212
+ --
213
+ -- @param array The array to get an element from.
214
+ -- @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
215
+ -- `RNG.Next` method will be called. Default is `getRandomSeed()`.
216
+ -- @param exceptions Optional. An array of elements to skip over if selected.
162
217
  function ____exports.getRandomArrayElement(self, array, seedOrRNG, exceptions)
163
218
  if seedOrRNG == nil then
164
219
  seedOrRNG = getRandomSeed(nil)
@@ -181,6 +236,13 @@ function ____exports.getRandomArrayElement(self, array, seedOrRNG, exceptions)
181
236
  end
182
237
  return randomElement
183
238
  end
239
+ --- Helper function to get a random element from the provided array. Once the random element is
240
+ -- decided, it is then removed from the array (in-place).
241
+ --
242
+ -- @param array The array to get an element from.
243
+ -- @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
244
+ -- `RNG.Next` method will be called. Default is `getRandomSeed()`.
245
+ -- @param exceptions Optional. An array of elements to skip over if selected.
184
246
  function ____exports.getRandomArrayElementAndRemove(self, array, seedOrRNG, exceptions)
185
247
  if seedOrRNG == nil then
186
248
  seedOrRNG = getRandomSeed(nil)
@@ -192,6 +254,13 @@ function ____exports.getRandomArrayElementAndRemove(self, array, seedOrRNG, exce
192
254
  ____exports.arrayRemoveInPlace(nil, array, randomArrayElement)
193
255
  return randomArrayElement
194
256
  end
257
+ --- Initializes an array with all elements containing the specified default value.
258
+ --
259
+ -- For example:
260
+ --
261
+ -- ```ts
262
+ -- const playerTransformations = initArray(false, PlayerForm.NUM_PLAYER_FORMS - 1);
263
+ -- ```
195
264
  function ____exports.initArray(self, defaultValue, size)
196
265
  local array = {}
197
266
  ____repeat(
@@ -203,6 +272,11 @@ function ____exports.initArray(self, defaultValue, size)
203
272
  )
204
273
  return array
205
274
  end
275
+ --- Since Lua uses tables for every non-primitive data structure, it is non-trivial to determine if a
276
+ -- particular table is being used as an array. `isArray` returns true if:
277
+ --
278
+ -- - the table contains all numerical indexes that are contiguous, starting at 1
279
+ -- - the table has no keys (i.e. an "empty" table)
206
280
  function ____exports.isArray(self, object)
207
281
  if type(object) ~= "table" then
208
282
  return false
@@ -234,6 +308,9 @@ function ____exports.isArray(self, object)
234
308
  end
235
309
  return true
236
310
  end
311
+ --- Helper function to see if every element in the array is N + 1.
312
+ --
313
+ -- For example, `[2, 3, 4]` would return true, and `[2, 3, 5]` would return false.
237
314
  function ____exports.isArrayContiguous(self, array)
238
315
  local lastValue
239
316
  for ____, element in ipairs(array) do
@@ -246,12 +323,20 @@ function ____exports.isArrayContiguous(self, array)
246
323
  end
247
324
  return true
248
325
  end
326
+ --- Checks if an array is in the provided 2-dimensional array.
249
327
  function ____exports.isArrayInArray(self, arrayToMatch, parentArray)
250
328
  return __TS__ArraySome(
251
329
  parentArray,
252
330
  function(____, element) return ____exports.arrayEquals(nil, element, arrayToMatch) end
253
331
  )
254
332
  end
333
+ --- Shallow copies and shuffles the array using the Fisher-Yates algorithm. Returns the copied array.
334
+ --
335
+ -- From: https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
336
+ --
337
+ -- @param originalArray The array to shuffle.
338
+ -- @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
339
+ -- `RNG.Next` method will be called. Default is `getRandomSeed()`.
255
340
  function ____exports.shuffleArray(self, originalArray, seedOrRNG)
256
341
  if seedOrRNG == nil then
257
342
  seedOrRNG = getRandomSeed(nil)
@@ -3,6 +3,12 @@ local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
3
3
  local ____exports = {}
4
4
  local ____log = require("functions.log")
5
5
  local log = ____log.log
6
+ --- Helper function to benchmark the performance of a function.
7
+ --
8
+ -- This function is variadic, which means that you can supply as many as you want to benchmark.
9
+ --
10
+ -- @returns An array containing the average time in milliseconds for each function. (This will also
11
+ -- be printed to the log.)
6
12
  function ____exports.benchmark(self, numTrials, ...)
7
13
  local functions = {...}
8
14
  log(((("Benchmarking " .. tostring(#functions)) .. " function(s) with ") .. tostring(numTrials)) .. " trials.")
@@ -0,0 +1,3 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ /** Helper function to find out how large a bomb explosion is based on the damage inflicted. */
3
+ export declare function getBombRadiusFromDamage(damage: float): float;
@@ -0,0 +1,12 @@
1
+ local ____exports = {}
2
+ --- Helper function to find out how large a bomb explosion is based on the damage inflicted.
3
+ function ____exports.getBombRadiusFromDamage(self, damage)
4
+ if damage > 175 then
5
+ return 105
6
+ end
7
+ if damage <= 140 then
8
+ return 75
9
+ end
10
+ return 90
11
+ end
12
+ return ____exports
@@ -63,6 +63,10 @@ local BOSSES_THAT_REQUIRE_MULTIPLE_SPAWNS = __TS__New(Set, {
63
63
  EntityType.TURDLET
64
64
  })
65
65
  DEFAULT_BOSS_MULTI_SEGMENTS = 4
66
+ --- Helper function to get all of the non-dead bosses in the room.
67
+ --
68
+ -- This function will not include bosses on an internal blacklist, such as Death's scythes or Big
69
+ -- Horn holes.
66
70
  function ____exports.getAliveBosses(self, matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
67
71
  if ignoreFriendly == nil then
68
72
  ignoreFriendly = false
@@ -79,9 +83,20 @@ function ____exports.getAliveBosses(self, matchingEntityType, matchingVariant, m
79
83
  function(____, aliveNPC) return aliveNPC:IsBoss() end
80
84
  )
81
85
  end
86
+ --- Helper function to get the set of every boss in the game.
87
+ --
88
+ -- The set contains strings with the entity type and variant, separated by a period.
89
+ --
90
+ -- Also see the `getBossSet` and `getCombinedBossSet` functions.
82
91
  function ____exports.getAllBossesSet(self)
83
92
  return copySet(nil, ALL_BOSSES_SET)
84
93
  end
94
+ --- Helper function to get the set of vanilla bosses for a particular stage and stage type
95
+ -- combination.
96
+ --
97
+ -- The set contains strings with the entity type and variant, separated by a period.
98
+ --
99
+ -- Also see the `getAllBossesSet` and `getCombinedBossSet` functions.
85
100
  function ____exports.getBossSet(self, stage, stageType)
86
101
  local stageTypeMap = STAGE_TO_STAGE_TYPE_TO_BOSS_SET_MAP:get(stage)
87
102
  if stageTypeMap == nil then
@@ -93,6 +108,7 @@ function ____exports.getBossSet(self, stage, stageType)
93
108
  end
94
109
  return copySet(nil, bossSet)
95
110
  end
111
+ --- Helper function to get all of the bosses in the room.
96
112
  function ____exports.getBosses(self, matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
97
113
  if ignoreFriendly == nil then
98
114
  ignoreFriendly = false
@@ -109,6 +125,13 @@ function ____exports.getBosses(self, matchingEntityType, matchingVariant, matchi
109
125
  function(____, npc) return npc:IsBoss() end
110
126
  )
111
127
  end
128
+ --- Helper function to get the set of vanilla bosses for a particular stage across all of the stage
129
+ -- types. For example, specifying a stage of 2 will return a set with all of the bosses for
130
+ -- Basement, Cellar, Burning Basement, Downpour, and Dross.
131
+ --
132
+ -- The set contains strings with the entity type and variant, separated by a period.
133
+ --
134
+ -- Also see the `getAllBossesSet` and `getBossSet` functions.
112
135
  function ____exports.getCombinedBossSet(self, stage)
113
136
  local bossSet = STAGE_TO_COMBINED_BOSS_SET_MAP:get(stage)
114
137
  if bossSet == nil then
@@ -116,9 +139,18 @@ function ____exports.getCombinedBossSet(self, stage)
116
139
  end
117
140
  return copySet(nil, bossSet)
118
141
  end
142
+ --- Helper function to check if the provided NPC is a Sin miniboss, such as Sloth or Lust.
119
143
  function ____exports.isSin(self, npc)
120
144
  return SIN_ENTITY_TYPES_SET:has(npc.Type)
121
145
  end
146
+ --- Helper function to spawn a boss.
147
+ --
148
+ -- Use this function instead of `spawnNPC` since it handles automatically spawning multiple segments
149
+ -- for multi-segment bosses.
150
+ --
151
+ -- By default, this will spawn Chub (and his variants) with 3 segments, Lokii with 2 copies,
152
+ -- Gurglings/Turdlings with 2 copies, and other multi-segment bosses with 4 segments. You can
153
+ -- customize this via the "numSegments" argument.
122
154
  function ____exports.spawnBoss(self, entityType, variant, subType, position, velocity, spawner, seed, numSegments)
123
155
  if velocity == nil then
124
156
  velocity = VectorZero
@@ -161,6 +193,9 @@ function ____exports.spawnBoss(self, entityType, variant, subType, position, vel
161
193
  end
162
194
  return npc
163
195
  end
196
+ --- Helper function to spawn a boss with a specific seed.
197
+ --
198
+ -- For more information, see the documentation for the `spawnBoss` function.
164
199
  function ____exports.spawnBossWithSeed(self, entityType, variant, subType, position, seed, velocity, spawner, numSegments)
165
200
  if velocity == nil then
166
201
  velocity = VectorZero
@@ -1,6 +1,10 @@
1
1
  local ____exports = {}
2
2
  local ____defaultPlayerStatMap = require("maps.defaultPlayerStatMap")
3
3
  local DEFAULT_PLAYER_STAT_MAP = ____defaultPlayerStatMap.DEFAULT_PLAYER_STAT_MAP
4
+ --- Returns the starting stat that Isaac (the default character) starts with. For example, if you
5
+ -- pass this function `CacheFlag.DAMAGE`, it will return 3.5.
6
+ --
7
+ -- Note that the default fire delay is represented in the tear stat, not the `MaxFireDelay` value.
4
8
  function ____exports.getDefaultPlayerStat(self, cacheFlag)
5
9
  return DEFAULT_PLAYER_STAT_MAP:get(cacheFlag)
6
10
  end
@@ -57,6 +57,7 @@ function initCardObjects(self)
57
57
  )
58
58
  addSetsToSet(nil, CARD_SET, cards)
59
59
  end
60
+ --- Helper function to get an array with every valid card sub-type. This includes modded cards.
60
61
  function ____exports.getAllCards(self)
61
62
  return irange(nil, FIRST_CARD, LAST_CARD)
62
63
  end
@@ -64,6 +65,10 @@ function ____exports.getCardType(self, card)
64
65
  local cardType = CARD_TYPES[card]
65
66
  return cardType == nil and DEFAULT_CARD_TYPE or cardType
66
67
  end
68
+ --- Helper function to get a set of cards matching the type. Also see the `CardType` enum.
69
+ --
70
+ -- This function is variadic, meaning that you can you can specify N card types to get a set
71
+ -- containing cards that match any of the specified types.
67
72
  function ____exports.getCardsOfType(self, ...)
68
73
  local cardTypes = {...}
69
74
  if CARD_TYPE_TO_CARDS_MAP.size == 0 then
@@ -83,6 +88,14 @@ function ____exports.getCardsOfType(self, ...)
83
88
  end
84
89
  CARD_TYPE_TO_CARDS_MAP = __TS__New(Map)
85
90
  CARD_SET = __TS__New(Set)
91
+ --- Helper function to get a card description from a Card enum value.
92
+ --
93
+ -- For example:
94
+ --
95
+ -- ```ts
96
+ -- const card = Card.FOOL;
97
+ -- const cardDescription = getCardDescription(card); // cardDescription is "Where journey begins"
98
+ -- ```
86
99
  function ____exports.getCardDescription(self, card)
87
100
  local cardDescription = CARD_DESCRIPTIONS[card]
88
101
  if cardDescription ~= nil then
@@ -94,6 +107,14 @@ function ____exports.getCardDescription(self, card)
94
107
  end
95
108
  return DEFAULT_CARD_DESCRIPTION
96
109
  end
110
+ --- Helper function to get a card name from a Card.
111
+ --
112
+ -- For example:
113
+ --
114
+ -- ```ts
115
+ -- const card = Card.FOOL;
116
+ -- const cardName = getCardName(card); // cardName is "0 - The Fool"
117
+ -- ```
97
118
  function ____exports.getCardName(self, card)
98
119
  local cardName = CARD_NAMES[card]
99
120
  if cardName ~= nil and cardName ~= DEFAULT_CARD_NAME then
@@ -105,12 +126,26 @@ function ____exports.getCardName(self, card)
105
126
  end
106
127
  return DEFAULT_CARD_NAME
107
128
  end
129
+ --- Helper function to get an array with every modded card sub-type.
130
+ --
131
+ -- Returns an empty array if there are no modded cards.
108
132
  function ____exports.getModdedCards(self)
109
133
  if MAX_VANILLA_CARD == LAST_CARD then
110
134
  return {}
111
135
  end
112
136
  return irange(nil, FIRST_MODDED_CARD, LAST_CARD)
113
137
  end
138
+ --- Has an equal chance of returning any card (e.g. Fool, Reverse Fool, Wild Card, etc.).
139
+ --
140
+ -- This will not return:
141
+ -- - any runes
142
+ -- - any objects like Dice Shard
143
+ -- - any modded cards (since there is not a way to distinguish between modded cards and modded
144
+ -- runes/objects)
145
+ --
146
+ -- @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
147
+ -- `RNG.Next` method will be called. Default is `getRandomSeed()`.
148
+ -- @param exceptions Optional. An array of cards to not select.
114
149
  function ____exports.getRandomCard(self, seedOrRNG, exceptions)
115
150
  if seedOrRNG == nil then
116
151
  seedOrRNG = getRandomSeed(nil)
@@ -120,6 +155,11 @@ function ____exports.getRandomCard(self, seedOrRNG, exceptions)
120
155
  end
121
156
  return getRandomSetElement(nil, CARD_SET, seedOrRNG, exceptions)
122
157
  end
158
+ ---
159
+ -- @param cardType The card type that represents the pool of cards to select from.
160
+ -- @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
161
+ -- `RNG.Next` method will be called. Default is `getRandomSeed()`.
162
+ -- @param exceptions Optional. An array of cards to not select.
123
163
  function ____exports.getRandomCardOfType(self, cardType, seedOrRNG, exceptions)
124
164
  if seedOrRNG == nil then
125
165
  seedOrRNG = getRandomSeed(nil)
@@ -130,6 +170,12 @@ function ____exports.getRandomCardOfType(self, cardType, seedOrRNG, exceptions)
130
170
  local cardSet = ____exports.getCardsOfType(nil, cardType)
131
171
  return getRandomSetElement(nil, cardSet, seedOrRNG, exceptions)
132
172
  end
173
+ --- Has an equal chance of returning any rune (e.g. Rune of Hagalaz, Blank Rune, Black Rune, Soul of
174
+ -- Isaac, etc.). This will never return a Rune Shard.
175
+ --
176
+ -- @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
177
+ -- `RNG.Next` method will be called. Default is `getRandomSeed()`.
178
+ -- @param exceptions Optional. An array of runes to not select.
133
179
  function ____exports.getRandomRune(self, seedOrRNG, exceptions)
134
180
  if seedOrRNG == nil then
135
181
  seedOrRNG = getRandomSeed(nil)
@@ -141,33 +187,47 @@ function ____exports.getRandomRune(self, seedOrRNG, exceptions)
141
187
  runesSet:delete(Card.RUNE_SHARD)
142
188
  return getRandomSetElement(nil, runesSet, seedOrRNG, exceptions)
143
189
  end
190
+ --- Helper function to get an array with every valid vanilla card sub-type.
144
191
  function ____exports.getVanillaCards(self)
145
192
  return irange(nil, FIRST_CARD, MAX_VANILLA_CARD)
146
193
  end
194
+ --- Returns true for cards that have the following card type:
195
+ -- - CardType.TAROT
196
+ -- - CardType.SUIT
197
+ -- - CardType.SPECIAL
198
+ -- - CardType.TAROT_REVERSE
147
199
  function ____exports.isCard(self, card)
148
200
  return CARD_SET:has(card)
149
201
  end
202
+ --- Returns whether or not the given card matches the specified card type.
150
203
  function ____exports.isCardType(self, card, cardType)
151
204
  return cardType == ____exports.getCardType(nil, card)
152
205
  end
206
+ --- Returns true for cards that have `CardType.MODDED`.
153
207
  function ____exports.isModdedCard(self, card)
154
208
  return ____exports.isCardType(nil, card, ItemConfigCardType.MODDED)
155
209
  end
210
+ --- Returns true for cards that have `CardType.SPECIAL_OBJECT`.
156
211
  function ____exports.isPocketItemObject(self, card)
157
212
  return ____exports.isCardType(nil, card, ItemConfigCardType.SPECIAL_OBJECT)
158
213
  end
214
+ --- Returns true for cards that have `CardType.TAROT_REVERSE`.
159
215
  function ____exports.isReverseTarotCard(self, card)
160
216
  return ____exports.isCardType(nil, card, ItemConfigCardType.TAROT_REVERSE)
161
217
  end
218
+ --- Returns true for cards that have `CardType.RUNE`.
162
219
  function ____exports.isRune(self, card)
163
220
  return ____exports.isCardType(nil, card, ItemConfigCardType.RUNE)
164
221
  end
222
+ --- Returns true for cards that have `CardType.SPECIAL`.
165
223
  function ____exports.isSpecialCard(self, card)
166
224
  return ____exports.isCardType(nil, card, ItemConfigCardType.SPECIAL)
167
225
  end
226
+ --- Returns true for cards that have `CardType.SUIT`.
168
227
  function ____exports.isSuitCard(self, card)
169
228
  return ____exports.isCardType(nil, card, ItemConfigCardType.SUIT)
170
229
  end
230
+ --- Returns true for cards that have `CardType.TAROT`.
171
231
  function ____exports.isTarotCard(self, card)
172
232
  return ____exports.isCardType(nil, card, ItemConfigCardType.TAROT)
173
233
  end
@@ -2,6 +2,7 @@ local ____exports = {}
2
2
  local ____challengeNames = require("objects.challengeNames")
3
3
  local CHALLENGE_NAMES = ____challengeNames.CHALLENGE_NAMES
4
4
  local DEFAULT_CHALLENGE_NAME = ____challengeNames.DEFAULT_CHALLENGE_NAME
5
+ --- Get the proper name for a `Challenge` enum. This will only work for vanilla challenges.
5
6
  function ____exports.getChallengeName(self, challenge)
6
7
  local challengeName = CHALLENGE_NAMES[challenge]
7
8
  return challengeName == nil and DEFAULT_CHALLENGE_NAME or challengeName
@@ -21,21 +21,40 @@ local LOST_STYLE_CHARACTERS_SET = ____lostStyleCharactersSet.LOST_STYLE_CHARACTE
21
21
  function ____exports.isVanillaCharacter(self, character)
22
22
  return character <= LAST_VANILLA_CHARACTER
23
23
  end
24
+ --- Helper function to determine if the given character can have red heart containers. Returns true
25
+ -- for characters like Isaac, Magdalene, or Cain. Returns true for Keeper and Tainted Keeper, even
26
+ -- though coin containers are not technically the same as red heart containers. Returns false for
27
+ -- characters like Blue Baby. Returns false for The Lost and Tainted Lost.
24
28
  function ____exports.characterCanHaveRedHearts(self, character)
25
29
  return not CHARACTERS_WITH_NO_RED_HEARTS_SET:has(character)
26
30
  end
31
+ --- Helper function to determine if the given character can have soul hearts. Returns true for
32
+ -- characters like Isaac, Magdalene, or Cain. Returns false for characters like Bethany. Returns
33
+ -- false for The Lost and Tainted Lost.
27
34
  function ____exports.characterCanHaveSoulHearts(self, character)
28
35
  return not CHARACTERS_WITH_NO_SOUL_HEARTS_SET:has(character)
29
36
  end
37
+ --- Helper function for determining whether the given character can take free Devil Deals. (e.g. The
38
+ -- Lost, Tainted Lost, etc.)
30
39
  function ____exports.characterCanTakeFreeDevilDeals(self, character)
31
40
  return CHARACTERS_WITH_FREE_DEVIL_DEALS_SET:has(character)
32
41
  end
42
+ --- Normally, characters get a red heart container upon reaching a new floor with an eternal heart,
43
+ -- but some characters grant a black heart instead. Returns true for Dark Judas and Tainted Judas.
44
+ -- Otherwise, returns false.
33
45
  function ____exports.characterGetsBlackHeartFromEternalHeart(self, character)
34
46
  return CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART_SET:has(character)
35
47
  end
48
+ --- Helper function to determine if the specified character starts with an active item.
49
+ --
50
+ -- For the purposes of this function, the save file is considered to be fully unlocked (e.g. Isaac
51
+ -- is considered to starts with the D6, but this is not the case on a brand new save file).
36
52
  function ____exports.characterStartsWithActiveItem(self, character)
37
53
  return CHARACTERS_THAT_START_WITH_AN_ACTIVE_ITEM_SET:has(character)
38
54
  end
55
+ --- - Most characters have a 56 frame death animation (i.e. the "Death" animation).
56
+ -- - The Lost and Tainted Lost have a 38 frame death animation (i.e. the "LostDeath" animation).
57
+ -- - Tainted Forgotten have a 20 frame death animation (i.e. the "ForgottenDeath" animation).
39
58
  function ____exports.getCharacterDeathAnimationName(self, character)
40
59
  if LOST_STYLE_CHARACTERS_SET:has(character) then
41
60
  return "LostDeath"
@@ -45,6 +64,9 @@ function ____exports.getCharacterDeathAnimationName(self, character)
45
64
  end
46
65
  return "Death"
47
66
  end
67
+ --- Returns the maximum heart containers that the provided character can have. Normally, this is 12,
68
+ -- but with Keeper it is 3, and with Tainted Keeper it is 2. This does not account for Birthright or
69
+ -- Mother's Kiss; use the `getPlayerMaxHeartContainers` helper function for that.
48
70
  function ____exports.getCharacterMaxHeartContainers(self, character)
49
71
  if character == PlayerType.KEEPER then
50
72
  return 3
@@ -60,6 +82,7 @@ function ____exports.getCharacterMaxHeartContainers(self, character)
60
82
  end
61
83
  return 12
62
84
  end
85
+ --- Helper function to get the name of a character. Returns "unknown" for modded characters.
63
86
  function ____exports.getCharacterName(self, character)
64
87
  if ____exports.isVanillaCharacter(nil, character) then
65
88
  return "unknown"