isaacscript-common 1.0.489 → 1.0.493

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.
@@ -7,7 +7,16 @@ export declare const AZAZEL_DEFAULT_BRIMSTONE_DISTANCE = 75.125;
7
7
  /** Bombs explode when their frame count is equal to this value. */
8
8
  export declare const BOMB_EXPLODE_FRAME = 45;
9
9
  export declare const CHARACTERS_WITH_AN_ACTIVE_ITEM: Set<PlayerType>;
10
+ /**
11
+ * The set of characters where red heart containers will be turned into soul hearts (e.g. Blue
12
+ * Baby). This set includes The Lost and Tainted Lost.
13
+ */
10
14
  export declare const CHARACTERS_WITH_NO_RED_HEARTS: Set<PlayerType>;
15
+ /**
16
+ * The set of characters where soul hearts will be automatically stripped away (e.g. Bethany). This
17
+ * set includes The Lost and Tainted Lost.
18
+ */
19
+ export declare const CHARACTERS_WITH_NO_SOUL_HEARTS: Set<PlayerType>;
11
20
  export declare const DEFAULT_ITEM_POOL_TYPE = ItemPoolType.POOL_TREASURE;
12
21
  /** This is also the distance that a player spawns from the door that they enter a room from. */
13
22
  export declare const DISTANCE_OF_GRID_TILE = 40;
@@ -18,12 +18,15 @@ ____exports.CHARACTERS_WITH_AN_ACTIVE_ITEM = __TS__New(Set, {
18
18
  })
19
19
  ____exports.CHARACTERS_WITH_NO_RED_HEARTS = __TS__New(Set, {
20
20
  PlayerType.PLAYER_BLUEBABY,
21
+ PlayerType.PLAYER_THELOST,
21
22
  PlayerType.PLAYER_BLACKJUDAS,
22
23
  PlayerType.PLAYER_JUDAS_B,
23
24
  PlayerType.PLAYER_BLUEBABY_B,
25
+ PlayerType.PLAYER_THELOST_B,
24
26
  PlayerType.PLAYER_THEFORGOTTEN_B,
25
27
  PlayerType.PLAYER_BETHANY_B
26
28
  })
29
+ ____exports.CHARACTERS_WITH_NO_SOUL_HEARTS = __TS__New(Set, {PlayerType.PLAYER_THELOST, PlayerType.PLAYER_BETHANY, PlayerType.PLAYER_THELOST_B})
27
30
  ____exports.DEFAULT_ITEM_POOL_TYPE = ItemPoolType.POOL_TREASURE
28
31
  ____exports.DISTANCE_OF_GRID_TILE = 40
29
32
  ____exports.DOOR_HITBOX_DISTANCE = 11
@@ -1,6 +1,6 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /**
3
- * This is a helper function to get a card name from a Card.
3
+ * Helper function to get a card name from a Card.
4
4
  *
5
5
  * Example:
6
6
  * ```
@@ -10,7 +10,7 @@
10
10
  */
11
11
  export declare function getCardDescription(card: Card | int): string;
12
12
  /**
13
- * This is a helper function to get a card name from a Card.
13
+ * Helper function to get a card name from a Card.
14
14
  *
15
15
  * Example:
16
16
  * ```
@@ -1,18 +1,38 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  export declare function collectibleHasTag(collectibleType: CollectibleType | int, tag: ItemConfigTag): boolean;
3
- /** This is a helper function to get a description from a CollectibleType. */
3
+ /**
4
+ * Helper function to get the in-game description for a collectible. Returns "Unknown" if the
5
+ * provided collectible type was not valid.
6
+ */
4
7
  export declare function getCollectibleDescription(collectibleType: CollectibleType | int): string;
5
8
  /**
6
9
  * Helper function to get the heart cost that a collectible item would be if it were being offered
7
10
  * in a Devil Room deal. Returns 0 if passed CollectibleType.COLLECTIBLE_NULL.
8
11
  */
9
12
  export declare function getCollectibleDevilHeartPrice(collectibleType: CollectibleType | int, player: EntityPlayer): PickupPrice;
13
+ /**
14
+ * Helper function to get the path to a collectible's sprite. Returns
15
+ * "gfx/items/collectibles/questionmark.png" if the provided collectible type was not valid.
16
+ */
10
17
  export declare function getCollectibleGfxFilename(collectibleType: CollectibleType | int): string;
18
+ /**
19
+ * Helper function to get the initial amount of charges that a collectible has. Returns 0 if the
20
+ * provided collectible type was not valid.
21
+ */
11
22
  export declare function getCollectibleInitCharges(collectibleType: CollectibleType | int): int;
23
+ /**
24
+ * Helper function to get the `ItemType` of a collectible. Returns `ItemType.ITEM_NULL` if the
25
+ * provided collectible type was not valid.
26
+ */
12
27
  export declare function getCollectibleItemType(collectibleType: CollectibleType | int): ItemType;
28
+ /**
29
+ * Helper function to get the maximum amount of charges that a collectible has. Returns 0 if the
30
+ * provided collectible type was not valid.
31
+ */
13
32
  export declare function getCollectibleMaxCharges(collectibleType: CollectibleType | int): int;
14
33
  /**
15
- * This is a helper function to get an item name from a CollectibleType.
34
+ * Helper function to get the name of a collectible. Returns "Unknown" if the provided collectible
35
+ * type is not valid.
16
36
  *
17
37
  * Example:
18
38
  * ```
@@ -36,7 +56,14 @@ export declare function isGlitchedCollectible(entity: Entity): boolean;
36
56
  */
37
57
  export declare function isPassiveCollectible(collectibleType: CollectibleType | int): boolean;
38
58
  export declare function isQuestCollectible(collectibleType: CollectibleType | int): boolean;
39
- export declare function removeAllCollectibles(): void;
59
+ /**
60
+ * Helper function to remove all of the collectibles in the room.
61
+ *
62
+ * @param collectibleType Optional. If specified, will only remove collectibles that match this
63
+ * collectible type.
64
+ * @param cap Optional. If specified, will only remove the given amount of collectibles.
65
+ */
66
+ export declare function removeAllCollectibles(collectibleType?: CollectibleType | int, cap?: int): void;
40
67
  /**
41
68
  * Helper function to remove all pickup delay on a collectible. By default, collectibles have a 20
42
69
  * frame delay before they can be picked up by a player.
@@ -7,7 +7,7 @@ local COLLECTIBLE_DESCRIPTION_MAP = ____collectibleDescriptionMap.COLLECTIBLE_DE
7
7
  local ____collectibleNameMap = require("maps.collectibleNameMap")
8
8
  local COLLECTIBLE_NAME_MAP = ____collectibleNameMap.COLLECTIBLE_NAME_MAP
9
9
  local ____entity = require("functions.entity")
10
- local removeAllMatchingEntities = ____entity.removeAllMatchingEntities
10
+ local removeAllPickups = ____entity.removeAllPickups
11
11
  function ____exports.setCollectibleSprite(self, collectible, pngPath)
12
12
  if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
13
13
  error("You cannot set a collectible sprite for pickups of variant: " .. tostring(collectible.Variant))
@@ -136,8 +136,8 @@ end
136
136
  function ____exports.isQuestCollectible(self, collectibleType)
137
137
  return ____exports.collectibleHasTag(nil, collectibleType, 32768)
138
138
  end
139
- function ____exports.removeAllCollectibles(self)
140
- removeAllMatchingEntities(nil, EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE)
139
+ function ____exports.removeAllCollectibles(self, collectibleType, cap)
140
+ removeAllPickups(nil, PickupVariant.PICKUP_COLLECTIBLE, collectibleType, cap)
141
141
  end
142
142
  function ____exports.removeCollectiblePickupDelay(self, collectible)
143
143
  if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
@@ -1,7 +1,7 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  require("lualib_bundle");
3
3
  local ____exports = {}
4
- local isTSTLClass, cloneClass, getNewClassFromMetatable, deepCopyValue, copyVector, checkMetatable, validateValue, TSTL_CLASS_KEYS
4
+ local isTSTLClass, copyClass, getNewClassFromMetatable, deepCopyValue, copyVector, checkMetatable, validateValue, TSTL_CLASS_KEYS
5
5
  local ____constantsInternal = require("constantsInternal")
6
6
  local TSTL_CLASS_BRAND = ____constantsInternal.TSTL_CLASS_BRAND
7
7
  local TSTL_MAP_BRAND = ____constantsInternal.TSTL_MAP_BRAND
@@ -51,7 +51,7 @@ function ____exports.deepCopy(self, oldObject, serializationType, traversalDescr
51
51
  elseif serializationType == ____exports.SerializationType.NONE and __TS__InstanceOf(oldObject, Set) or serializationType == ____exports.SerializationType.DESERIALIZE and hasTSTLSetBrand then
52
52
  newObject = __TS__New(Set)
53
53
  elseif serializationType == ____exports.SerializationType.NONE and isClass or serializationType == ____exports.SerializationType.DESERIALIZE and hasTSTLClassBrand then
54
- newObject = cloneClass(nil, oldObject)
54
+ newObject = copyClass(nil, oldObject)
55
55
  else
56
56
  newObject = {}
57
57
  end
@@ -144,7 +144,7 @@ function isTSTLClass(self, object)
144
144
  end
145
145
  return numKeys == TSTL_CLASS_KEYS.size
146
146
  end
147
- function cloneClass(self, oldClass)
147
+ function copyClass(self, oldClass)
148
148
  local metatable = getmetatable(oldClass)
149
149
  local newClass = getNewClassFromMetatable(nil, metatable)
150
150
  for key, value in pairs(oldClass) do
@@ -152,17 +152,88 @@ export declare function getSlots(matchingVariant?: number, matchingSubType?: num
152
152
  * ```
153
153
  */
154
154
  export declare function getTears(matchingVariant?: number, matchingSubType?: number): EntityTear[];
155
- /** Removes all of the entities in the supplied array. */
156
- export declare function removeEntities(entities: Entity[]): void;
157
- export declare function removeAllBombs(): void;
158
- export declare function removeAllEffects(): void;
159
- export declare function removeAllFamiliars(): void;
160
- export declare function removeAllKnives(): void;
161
- export declare function removeAllLasers(): void;
162
- export declare function removeAllMatchingEntities(entityType: int, entityVariant?: number, entitySubType?: number): void;
163
- export declare function removeAllPickups(): void;
164
- export declare function removeAllProjectiles(): void;
165
- export declare function removeAllTears(): void;
155
+ /**
156
+ * Helper function to remove all of the entities in the supplied array.
157
+ *
158
+ * @param entities The array of entities to remove.
159
+ * @param cap Optional. If specified, will only remove the given amount of entities.
160
+ */
161
+ export declare function removeEntities(entities: Entity[], cap?: int): void;
162
+ /**
163
+ * Helper function to remove all of the bombs in the room.
164
+ *
165
+ * @param variant Optional. If specified, will only remove bombs that match this variant.
166
+ * @param subType Optional. If specified, will only remove bombs that match this sub-type.
167
+ * @param cap Optional. If specified, will only remove the given amount of bombs.
168
+ */
169
+ export declare function removeAllBombs(variant?: BombVariant, subType?: int, cap?: int): void;
170
+ /**
171
+ * Helper function to remove all of the effects in the room.
172
+ *
173
+ * @param variant Optional. If specified, will only remove effects that match this variant.
174
+ * @param subType Optional. If specified, will only remove effects that match this sub-type.
175
+ * @param cap Optional. If specified, will only remove the given amount of effects.
176
+ */
177
+ export declare function removeAllEffects(variant?: EffectVariant, subType?: int, cap?: int): void;
178
+ /**
179
+ * Helper function to remove all of the familiars in the room.
180
+ *
181
+ * @param variant Optional. If specified, will only remove familiars that match this variant.
182
+ * @param subType Optional. If specified, will only remove familiars that match this sub-type.
183
+ * @param cap Optional. If specified, will only remove the given amount of familiars.
184
+ */
185
+ export declare function removeAllFamiliars(variant?: FamiliarVariant, subType?: int, cap?: int): void;
186
+ /**
187
+ * Helper function to remove all of the knives in the room.
188
+ *
189
+ * @param variant Optional. If specified, will only remove knives that match this variant.
190
+ * @param subType Optional. If specified, will only remove knives that match this sub-type.
191
+ * @param cap Optional. If specified, will only remove the given amount of knives.
192
+ */
193
+ export declare function removeAllKnives(variant?: KnifeVariant, subType?: int, cap?: int): void;
194
+ /**
195
+ * Helper function to remove all of the lasers in the room.
196
+ *
197
+ * @param variant Optional. If specified, will only remove lasers that match this variant.
198
+ * @param subType Optional. If specified, will only remove lasers that match this sub-type.
199
+ * @param cap Optional. If specified, will only remove the given amount of lasers.
200
+ */
201
+ export declare function removeAllLasers(variant?: LaserVariant, subType?: int, cap?: int): void;
202
+ /**
203
+ * Helper function to remove all of the matching entities in the room.
204
+ *
205
+ * @param entityType The entity type to match.
206
+ * @param entityVariant Optional. The variant to match. -1 by default (which will match every
207
+ * variant).
208
+ * @param entitySubType Optional. The sub-type to match. -1 by default (which will match every
209
+ * sub-type).
210
+ * @param cap Optional. If specified, will only remove the given amount of collectibles.
211
+ */
212
+ export declare function removeAllMatchingEntities(entityType: int, entityVariant?: number, entitySubType?: number, cap?: int | undefined): void;
213
+ /**
214
+ * Helper function to remove all of the pickups in the room.
215
+ *
216
+ * @param variant Optional. If specified, will only remove pickups that match this variant.
217
+ * @param subType Optional. If specified, will only remove pickups that match this sub-type.
218
+ * @param cap Optional. If specified, will only remove the given amount of pickups.
219
+ */
220
+ export declare function removeAllPickups(variant?: PickupVariant, subType?: int, cap?: int): void;
221
+ /**
222
+ * Helper function to remove all of the projectiles in the room.
223
+ *
224
+ * @param variant Optional. If specified, will only remove projectiles that match this variant.
225
+ * @param subType Optional. If specified, will only remove projectiles that match this sub-type.
226
+ * @param cap Optional. If specified, will only remove the given amount of projectiles.
227
+ */
228
+ export declare function removeAllProjectiles(variant?: ProjectileVariant, subType?: int, cap?: int): void;
229
+ /**
230
+ * Helper function to remove all of the tears in the room.
231
+ *
232
+ * @param variant Optional. If specified, will only remove tears that match this variant.
233
+ * @param subType Optional. If specified, will only remove tears that match this sub-type.
234
+ * @param cap Optional. If specified, will only remove the given amount of tears.
235
+ */
236
+ export declare function removeAllTears(variant?: TearVariant, subType?: int, cap?: int): void;
166
237
  /**
167
238
  * Helper function to set the position of every entity in the room based on a map of positions. If
168
239
  * an entity is found that does not have matching element in the provided map, then that entity will
@@ -210,68 +210,65 @@ function ____exports.getTears(self, matchingVariant, matchingSubType)
210
210
  end
211
211
  return tears
212
212
  end
213
- function ____exports.removeEntities(self, entities)
214
- for ____, entity in ipairs(entities) do
215
- entity:Remove()
213
+ function ____exports.removeEntities(self, entities, cap)
214
+ local numEntitiesRemoved = 0
215
+ do
216
+ local i = 0
217
+ while i < #entities do
218
+ local entity = entities[i + 1]
219
+ entity:Remove()
220
+ numEntitiesRemoved = numEntitiesRemoved + 1
221
+ if cap ~= nil and numEntitiesRemoved >= cap then
222
+ return
223
+ end
224
+ i = i + 1
225
+ end
216
226
  end
217
227
  end
218
- function ____exports.removeAllBombs(self)
219
- local bombs = ____exports.getBombs(nil)
220
- for ____, bomb in ipairs(bombs) do
221
- bomb:Remove()
222
- end
228
+ function ____exports.removeAllBombs(self, variant, subType, cap)
229
+ local bombs = ____exports.getBombs(nil, variant, subType)
230
+ ____exports.removeEntities(nil, bombs, cap)
223
231
  end
224
- function ____exports.removeAllEffects(self)
225
- local effects = ____exports.getEffects(nil)
226
- for ____, effect in ipairs(effects) do
227
- effect:Remove()
228
- end
232
+ function ____exports.removeAllEffects(self, variant, subType, cap)
233
+ local effects = ____exports.getEffects(nil, variant, subType)
234
+ ____exports.removeEntities(nil, effects, cap)
229
235
  end
230
- function ____exports.removeAllFamiliars(self)
231
- local familiars = ____exports.getFamiliars(nil)
232
- for ____, familiar in ipairs(familiars) do
233
- familiar:Remove()
234
- end
236
+ function ____exports.removeAllFamiliars(self, variant, subType, cap)
237
+ local familiars = ____exports.getFamiliars(nil, variant, subType)
238
+ ____exports.removeEntities(nil, familiars, cap)
235
239
  end
236
- function ____exports.removeAllKnives(self)
237
- local knives = ____exports.getKnives(nil)
238
- for ____, knife in ipairs(knives) do
239
- knife:Remove()
240
- end
240
+ function ____exports.removeAllKnives(self, variant, subType, cap)
241
+ local knives = ____exports.getKnives(nil, variant, subType)
242
+ ____exports.removeEntities(nil, knives, cap)
241
243
  end
242
- function ____exports.removeAllLasers(self)
243
- local lasers = ____exports.getLasers(nil)
244
- for ____, laser in ipairs(lasers) do
245
- laser:Remove()
246
- end
244
+ function ____exports.removeAllLasers(self, variant, subType, cap)
245
+ local lasers = ____exports.getLasers(nil, variant, subType)
246
+ ____exports.removeEntities(nil, lasers, cap)
247
247
  end
248
- function ____exports.removeAllMatchingEntities(self, entityType, entityVariant, entitySubType)
248
+ function ____exports.removeAllMatchingEntities(self, entityType, entityVariant, entitySubType, cap)
249
249
  if entityVariant == nil then
250
250
  entityVariant = -1
251
251
  end
252
252
  if entitySubType == nil then
253
253
  entitySubType = -1
254
254
  end
255
+ if cap == nil then
256
+ cap = nil
257
+ end
255
258
  local entities = Isaac.FindByType(entityType, entityVariant, entitySubType)
256
- ____exports.removeEntities(nil, entities)
259
+ ____exports.removeEntities(nil, entities, cap)
257
260
  end
258
- function ____exports.removeAllPickups(self)
259
- local pickups = ____exports.getPickups(nil)
260
- for ____, pickup in ipairs(pickups) do
261
- pickup:Remove()
262
- end
261
+ function ____exports.removeAllPickups(self, variant, subType, cap)
262
+ local pickups = ____exports.getPickups(nil, variant, subType)
263
+ ____exports.removeEntities(nil, pickups, cap)
263
264
  end
264
- function ____exports.removeAllProjectiles(self)
265
- local projectiles = ____exports.getProjectiles(nil)
266
- for ____, projectile in ipairs(projectiles) do
267
- projectile:Remove()
268
- end
265
+ function ____exports.removeAllProjectiles(self, variant, subType, cap)
266
+ local projectiles = ____exports.getProjectiles(nil, variant, subType)
267
+ ____exports.removeEntities(nil, projectiles, cap)
269
268
  end
270
- function ____exports.removeAllTears(self)
271
- local tears = ____exports.getTears(nil)
272
- for ____, tear in ipairs(tears) do
273
- tear:Remove()
274
- end
269
+ function ____exports.removeAllTears(self, variant, subType, cap)
270
+ local tears = ____exports.getTears(nil, variant, subType)
271
+ ____exports.removeEntities(nil, tears, cap)
275
272
  end
276
273
  function ____exports.setEntityPositions(self, entityPositions, entities)
277
274
  if entities == nil then
@@ -39,7 +39,8 @@ export declare function isAllPressurePlatesPushed(): boolean;
39
39
  */
40
40
  export declare function isPostBossVoidPortal(gridEntity: GridEntity): boolean;
41
41
  /**
42
- * Helper function to remove most grid entities in the room.
42
+ * Helper function to all grid entities in the room except for ones matching the grid entity types
43
+ * provided.
43
44
  *
44
45
  * Example:
45
46
  * ```
@@ -50,7 +51,20 @@ export declare function isPostBossVoidPortal(gridEntity: GridEntity): boolean;
50
51
  * ```
51
52
  */
52
53
  export declare function removeAllGridEntitiesExceptFor(...gridEntityTypes: GridEntityType[]): void;
53
- export declare function removeAllMatchingGridEntities(gridEntityType: GridEntityType): void;
54
+ /**
55
+ * Helper function to remove all of the grid entities in the room that match the grid entity types
56
+ * provided.
57
+ *
58
+ * Example:
59
+ * ```
60
+ * removeAllMatchingGridEntities(
61
+ * GridEntityType.GRID_ROCK,
62
+ * GridEntityType.GRID_ROCKB,
63
+ * GridEntityType.GRID_ROCKT,
64
+ * );
65
+ * ```
66
+ */
67
+ export declare function removeAllMatchingGridEntities(...gridEntityType: GridEntityType[]): void;
54
68
  /**
55
69
  * Helper function to remove a grid entity simply by providing the grid entity object.
56
70
  *
@@ -130,8 +130,8 @@ function ____exports.removeAllGridEntitiesExceptFor(self, ...)
130
130
  end
131
131
  roomUpdateSafe(nil)
132
132
  end
133
- function ____exports.removeAllMatchingGridEntities(self, gridEntityType)
134
- local gridEntities = ____exports.getGridEntities(nil, gridEntityType)
133
+ function ____exports.removeAllMatchingGridEntities(self, ...)
134
+ local gridEntities = ____exports.getGridEntities(nil, ...)
135
135
  for ____, gridEntity in ipairs(gridEntities) do
136
136
  ____exports.removeGridEntity(nil, gridEntity, false)
137
137
  end
@@ -35,4 +35,9 @@ export declare function isDyingEggyWithNoSpidersLeft(npc: EntityNPC): boolean;
35
35
  * enemies.
36
36
  */
37
37
  export declare function isRaglingDeathPatch(npc: EntityNPC): boolean;
38
- export declare function removeAllNPCs(): void;
38
+ /**
39
+ * Helper function to remove all NPCs in the room.
40
+ *
41
+ * @param cap Optional. If specified, will only remove the given amount of NPCs.
42
+ */
43
+ export declare function removeAllNPCs(cap?: int): void;
@@ -6,6 +6,7 @@ local ____constants = require("constants")
6
6
  local EGGY_STATE_FRAME_OF_FINAL_SPIDER = ____constants.EGGY_STATE_FRAME_OF_FINAL_SPIDER
7
7
  local ____entity = require("functions.entity")
8
8
  local getEntities = ____entity.getEntities
9
+ local removeEntities = ____entity.removeEntities
9
10
  function ____exports.getBosses(self)
10
11
  local bosses = {}
11
12
  for ____, npc in ipairs(____exports.getNPCs(nil)) do
@@ -94,10 +95,8 @@ function ____exports.getAliveNPCs(self)
94
95
  end
95
96
  return aliveNPCs
96
97
  end
97
- function ____exports.removeAllNPCs(self)
98
+ function ____exports.removeAllNPCs(self, cap)
98
99
  local npcs = ____exports.getNPCs(nil)
99
- for ____, npc in ipairs(npcs) do
100
- npc:Remove()
101
- end
100
+ removeEntities(nil, npcs, cap)
102
101
  end
103
102
  return ____exports
@@ -1,6 +1,6 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /**
3
- * This is a helper function to get a pill effect name from a PillEffect.
3
+ * Helper function to get a pill effect name from a PillEffect.
4
4
  *
5
5
  * Example:
6
6
  * ```
@@ -20,6 +20,18 @@ export declare function anyPlayerCloserThan(position: Vector, distance: float):
20
20
  export declare function anyPlayerHasCollectible(collectibleType: CollectibleType | int): boolean;
21
21
  export declare function anyPlayerHasTrinket(trinketType: TrinketType | int): boolean;
22
22
  export declare function anyPlayerIs(matchingCharacter: PlayerType): boolean;
23
+ /**
24
+ * Helper function to see if the provided character can have red heart containers. Returns true for
25
+ * characters like Isaac, Magdalene, or Cain. Returns false for characters like Blue Baby. Returns
26
+ * false for The Lost and Tainted Lost.
27
+ */
28
+ export declare function characterCanHaveRedHearts(character: PlayerType): boolean;
29
+ /**
30
+ * Helper function to see if the provided character can have soul hearts. Returns true for
31
+ * characters like Isaac, Magdalene, or Cain. Returns false for characters like Bethany. Returns
32
+ * false for The Lost and Tainted Lost.
33
+ */
34
+ export declare function characterCanHaveSoulHearts(character: PlayerType): boolean;
23
35
  /**
24
36
  * Helper function to get how long Azazel's Brimstone laser should be. You can pass either an
25
37
  * `EntityPlayer` object or a tear height stat.
@@ -3,6 +3,8 @@ require("lualib_bundle");
3
3
  local ____exports = {}
4
4
  local EXCLUDED_CHARACTERS
5
5
  local ____constants = require("constants")
6
+ local CHARACTERS_WITH_NO_RED_HEARTS = ____constants.CHARACTERS_WITH_NO_RED_HEARTS
7
+ local CHARACTERS_WITH_NO_SOUL_HEARTS = ____constants.CHARACTERS_WITH_NO_SOUL_HEARTS
6
8
  local LOST_STYLE_PLAYER_TYPES = ____constants.LOST_STYLE_PLAYER_TYPES
7
9
  local ____HealthType = require("types.HealthType")
8
10
  local HealthType = ____HealthType.HealthType
@@ -27,18 +29,18 @@ function ____exports.getPlayers(self, performExclusions)
27
29
  do
28
30
  local player = Isaac.GetPlayer(i)
29
31
  if player == nil then
30
- goto __continue51
32
+ goto __continue53
31
33
  end
32
34
  if ____exports.isChildPlayer(nil, player) then
33
- goto __continue51
35
+ goto __continue53
34
36
  end
35
37
  local character = player:GetPlayerType()
36
38
  if performExclusions and EXCLUDED_CHARACTERS:has(character) then
37
- goto __continue51
39
+ goto __continue53
38
40
  end
39
41
  __TS__ArrayPush(players, player)
40
42
  end
41
- ::__continue51::
43
+ ::__continue53::
42
44
  i = i + 1
43
45
  end
44
46
  end
@@ -104,6 +106,12 @@ function ____exports.anyPlayerIs(self, matchingCharacter)
104
106
  end
105
107
  return false
106
108
  end
109
+ function ____exports.characterCanHaveRedHearts(self, character)
110
+ return not CHARACTERS_WITH_NO_RED_HEARTS:has(character)
111
+ end
112
+ function ____exports.characterCanHaveSoulHearts(self, character)
113
+ return not CHARACTERS_WITH_NO_SOUL_HEARTS:has(character)
114
+ end
107
115
  function ____exports.getAzazelBrimstoneDistance(self, playerOrTearHeight)
108
116
  local tearHeight = tonumber(playerOrTearHeight)
109
117
  if tearHeight == nil then
@@ -243,14 +251,14 @@ function ____exports.getPlayerIndexVanilla(self, playerToFind)
243
251
  do
244
252
  local player = Isaac.GetPlayer(i)
245
253
  if player == nil then
246
- goto __continue60
254
+ goto __continue62
247
255
  end
248
256
  local playerHash = GetPtrHash(player)
249
257
  if playerHash == playerToFindHash then
250
258
  return i
251
259
  end
252
260
  end
253
- ::__continue60::
261
+ ::__continue62::
254
262
  i = i + 1
255
263
  end
256
264
  end
@@ -356,9 +364,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
356
364
  itemPool:RemoveCollectible(collectibleType)
357
365
  end
358
366
  repeat
359
- local ____switch87 = activeSlot
360
- local ____cond87 = ____switch87 == ActiveSlot.SLOT_PRIMARY
361
- if ____cond87 then
367
+ local ____switch89 = activeSlot
368
+ local ____cond89 = ____switch89 == ActiveSlot.SLOT_PRIMARY
369
+ if ____cond89 then
362
370
  do
363
371
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
364
372
  player:RemoveCollectible(primaryCollectibleType)
@@ -367,8 +375,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
367
375
  break
368
376
  end
369
377
  end
370
- ____cond87 = ____cond87 or ____switch87 == ActiveSlot.SLOT_SECONDARY
371
- if ____cond87 then
378
+ ____cond89 = ____cond89 or ____switch89 == ActiveSlot.SLOT_SECONDARY
379
+ if ____cond89 then
372
380
  do
373
381
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
374
382
  player:RemoveCollectible(primaryCollectibleType)
@@ -383,16 +391,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
383
391
  break
384
392
  end
385
393
  end
386
- ____cond87 = ____cond87 or ____switch87 == ActiveSlot.SLOT_POCKET
387
- if ____cond87 then
394
+ ____cond89 = ____cond89 or ____switch89 == ActiveSlot.SLOT_POCKET
395
+ if ____cond89 then
388
396
  do
389
397
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
390
398
  player:SetActiveCharge(charge, activeSlot)
391
399
  break
392
400
  end
393
401
  end
394
- ____cond87 = ____cond87 or ____switch87 == ActiveSlot.SLOT_POCKET2
395
- if ____cond87 then
402
+ ____cond89 = ____cond89 or ____switch89 == ActiveSlot.SLOT_POCKET2
403
+ if ____cond89 then
396
404
  do
397
405
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
398
406
  break
@@ -16,10 +16,14 @@ export declare function getMaxTrinketID(): int;
16
16
  export declare function getOpenTrinketSlot(player: EntityPlayer): int | undefined;
17
17
  /** Helper function to get all of the trinket entities in the room. */
18
18
  export declare function getTrinkets(matchingSubType?: number): EntityPickup[];
19
- /** This is a helper function to get a trinket description from a TrinketType. */
19
+ /**
20
+ * Helper function to get the in-game description for a trinket. Returns "Unknown" if the provided
21
+ * trinket type was not valid.
22
+ */
20
23
  export declare function getTrinketDescription(trinketType: TrinketType | int): string;
21
24
  /**
22
- * This is a helper function to get a trinket name from a TrinketType.
25
+ * Helper function to get the name of a trinket. Returns "Unknown" if the provided trinket type is
26
+ * not valid.
23
27
  *
24
28
  * Example:
25
29
  * ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.489",
3
+ "version": "1.0.493",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",