isaacscript-common 1.2.131 → 1.2.134

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.
@@ -1,6 +1,6 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /**
3
- * A cached version of the `Game()` constructor.
3
+ * A cached version of the class returned from the `Game()` constructor.
4
4
  *
5
5
  * Use this instead of invoking the constructor again for a miniscule performance increase.
6
6
  *
@@ -9,7 +9,7 @@
9
9
  */
10
10
  export declare const game: Game;
11
11
  /**
12
- * A cached version of the `Isaac.GetItemConfig()()` constructor.
12
+ * A cached version of the class returned from the `Isaac.GetItemConfig()` constructor.
13
13
  *
14
14
  * Use this instead of invoking the constructor again for a miniscule performance increase.
15
15
  *
@@ -18,7 +18,7 @@ export declare const game: Game;
18
18
  */
19
19
  export declare const itemConfig: ItemConfig;
20
20
  /**
21
- * A cached version of the `MusicManager()` constructor.
21
+ * A cached version of the class returned from the `MusicManager()` constructor.
22
22
  *
23
23
  * Use this instead of invoking the constructor again for a miniscule performance increase.
24
24
  *
@@ -27,7 +27,7 @@ export declare const itemConfig: ItemConfig;
27
27
  */
28
28
  export declare const musicManager: MusicManager;
29
29
  /**
30
- * A cached version of the `SFXManager()` constructor.
30
+ * A cached version of the class returned from the `SFXManager()` constructor.
31
31
  *
32
32
  * Use this instead of invoking the constructor again for a miniscule performance increase.
33
33
  *
@@ -1,7 +1,7 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /**
3
3
  * The distance of the laser when Azazel does not have any range up items yet.
4
- * For more info, see the documentation for the `getAzazelBrimstoneDistance()` function.
4
+ * For more info, see the documentation for the `getAzazelBrimstoneDistance` function.
5
5
  */
6
6
  export declare const AZAZEL_DEFAULT_BRIMSTONE_DISTANCE = 75.125;
7
7
  /**
@@ -51,7 +51,7 @@ export declare const DOOR_HITBOX_DISTANCE = 11;
51
51
  export declare const EGGY_STATE_FRAME_OF_FINAL_SPIDER = 45;
52
52
  /**
53
53
  * A non-existent or completely transparent PNG file for use in clearing sprites. For more
54
- * information, see the documentation for the `clearSprite()` helper function.
54
+ * information, see the documentation for the `clearSprite` helper function.
55
55
  */
56
56
  export declare const EMPTY_PNG_PATH = "gfx/none.png";
57
57
  export declare const FAMILIARS_THAT_SHOOT_PLAYER_TEARS: ReadonlySet<FamiliarVariant>;
@@ -18,7 +18,7 @@ import { JSONRoom } from "../types/JSONRoom";
18
18
  * Default is `Random()`.
19
19
  * @param verbose Optional. If specified, will write entries to the "log.txt" file that describe
20
20
  * what the function is doing. Default is false.
21
- * @returns Before using the seed for spawning each entity, it is iterated with `nextSeed()`. The
21
+ * @returns Before using the seed for spawning each entity, it is iterated with `nextSeed`. The
22
22
  * function returns the final iterated seed after spawning everything, which can be used in
23
23
  * subsequent room deployments.
24
24
  */
@@ -46,7 +46,7 @@ export declare function deployJSONRoom(jsonRoom: JSONRoom, seed?: Seed, verbose?
46
46
  * that, it is also used for spawning every entity in the room. Default is `Random()`.
47
47
  * @param verbose Optional. If specified, will write entries to the "log.txt" file that describe
48
48
  * what the function is doing. Default is false.
49
- * @returns Before using the seed for spawning each entity, it is iterated with `nextSeed()`. The
49
+ * @returns Before using the seed for spawning each entity, it is iterated with `nextSeed`. The
50
50
  * function returns the final iterated seed after spawning everything, which can be used in
51
51
  * subsequent room deployments.
52
52
  */
@@ -7,7 +7,7 @@
7
7
  export declare function getTraceback(): string;
8
8
  /**
9
9
  * Helper function to print a stack trace to the "log.txt" file, similar to JavaScript's
10
- * `console.trace()` function.
10
+ * `console.trace` function.
11
11
  *
12
12
  * This will only work if the `--luadebug` launch option is enabled or the Racing+ sandbox is
13
13
  * enabled.
@@ -1,8 +1,8 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  export declare function closeAllDoors(): void;
3
3
  /**
4
- * Use this instead of the `door.Close()` method if you want the door to immediately close without
5
- * an animation.
4
+ * Use this instead of the `GridEntityDoor.Close` method if you want the door to immediately close
5
+ * without an animation.
6
6
  */
7
7
  export declare function closeDoorFast(door: GridEntityDoor): void;
8
8
  /**
@@ -63,9 +63,9 @@ export declare function isRepentanceDoor(door: GridEntityDoor): boolean;
63
63
  export declare function isSecretRoomDoor(door: GridEntityDoor): boolean;
64
64
  /**
65
65
  * Helper function to reset an unlocked door back to a locked state. Doing this is non-trivial
66
- * because in addition to calling the `SetLocked()` method, you must also:
66
+ * because in addition to calling the `GridEntityDoor.SetLocked` method, you must also:
67
67
  *
68
- * - Modify the `VisitedCount` of the room's `RoomDescription` to be set to 0.
68
+ * - Set the `VisitedCount` of the room's `RoomDescription` to 0.
69
69
  * - Set the variant to `DoorVariant.DOOR_LOCKED`.
70
70
  * - Close the door.
71
71
  */
@@ -76,8 +76,8 @@ export declare function lockDoor(door: GridEntityDoor): void;
76
76
  */
77
77
  export declare function openAllDoors(): void;
78
78
  /**
79
- * Use this instead of the `door.Open()` method if you want the door to immediately open without
80
- * an animation.
79
+ * Use this instead of the `GridEntityDoor.Open` method if you want the door to immediately open
80
+ * without an animation.
81
81
  */
82
82
  export declare function openDoorFast(door: GridEntityDoor): void;
83
83
  /**
@@ -11,7 +11,7 @@ export declare function anyEntityCloserThan(entities: Entity[], position: Vector
11
11
  * @param subType Default is -1.
12
12
  * @param ignoreFriendly Default is false.
13
13
  */
14
- export declare function countEntities(entityType?: EntityType | int, variant?: number, subType?: number, ignoreFriendly?: boolean): number;
14
+ export declare function countEntities(entityType?: EntityType | int, variant?: number, subType?: number, ignoreFriendly?: boolean): int;
15
15
  /**
16
16
  * Given an array of entities, this helper function returns the closest one to a provided reference
17
17
  * entity.
@@ -33,9 +33,9 @@ export declare function getFilteredNewEntities<T extends AnyEntity>(oldEntities:
33
33
  * Helper function to get all of the entities in the room or all of the entities that match a
34
34
  * specific entity type / variant / sub-type.
35
35
  *
36
- * Due to bugs with `Isaac.FindInRadius()`, this function uses `Isaac.GetRoomEntities()`,
37
- * which is more expensive but also more robust. (If a matching entity type is provided, then
38
- * `Isaac.FindByType()` will be used instead.)
36
+ * Due to bugs with `Isaac.FindInRadius`, this function uses `Isaac.GetRoomEntities`, which is more
37
+ * expensive but also more robust. (If a matching entity type is provided, then `Isaac.FindByType`
38
+ * will be used instead.)
39
39
  *
40
40
  * Example:
41
41
  * ```
@@ -102,15 +102,15 @@ export declare function removeAllMatchingGridEntities(...gridEntityType: GridEnt
102
102
  * @param updateRoom Optional. Whether or not to update the room after the grid entity is removed.
103
103
  * Default is true. This is generally a good idea because if the room is not updated, you will be
104
104
  * unable to spawn another grid entity on the same tile until a frame has passed. However, doing
105
- * this is expensive, since it involves a call to `Isaac.GetRoomEntities()`, so set it to false if
106
- * you need to invoke this function multiple times.
105
+ * this is expensive, since it involves a call to `Isaac.GetRoomEntities`, so set it to false if you
106
+ * need to invoke this function multiple times.
107
107
  */
108
108
  export declare function removeGridEntity(gridEntity: GridEntity, updateRoom?: boolean): void;
109
109
  /**
110
110
  * Helper function to make a grid entity invisible. This is accomplished by setting its sprite to
111
111
  * an empty/missing PNG file.
112
112
  *
113
- * For more information, see the documentation for the `clearSprite()` helper function.
113
+ * For more information, see the documentation for the `clearSprite` helper function.
114
114
  */
115
115
  export declare function setGridEntityInvisible(gridEntity: GridEntity): void;
116
116
  /**
@@ -124,7 +124,7 @@ export declare function spawnGiantPoop(topLeftGridIndex: int): void;
124
124
  * This function assumes you want to give the grid entity a variant of 0. If you want to specify a
125
125
  * variant, use the `spawnGridEntityWithVariant` helper function instead.
126
126
  *
127
- * Use this instead of the `Isaac.GridSpawn()` method since it:
127
+ * Use this instead of the `Isaac.GridSpawn` method since it:
128
128
  * - handles giving pits collision
129
129
  * - removes existing grid entities on the same tile, if any
130
130
  * - allows you to specify the grid index instead of the position
@@ -133,7 +133,7 @@ export declare function spawnGridEntity(gridEntityType: GridEntityType, gridInde
133
133
  /**
134
134
  * Helper function to spawn a grid entity with a specific variant.
135
135
  *
136
- * Use this instead of the `Isaac.GridSpawn()` method since it:
136
+ * Use this instead of the `Isaac.GridSpawn` method since it:
137
137
  * - handles giving pits collision
138
138
  * - removes existing grid entities on the same tile, if any
139
139
  * - allows you to specify the grid index instead of the position
@@ -32,7 +32,7 @@ export declare function logAllSeedEffects(this: void): void;
32
32
  /** Helper function for printing out every tear flag that is turned on. Useful when debugging. */
33
33
  export declare function logAllTearFlags(this: void, flags: int): void;
34
34
  /** Helper function for printing out every use flag that is turned on. Useful when debugging. */
35
- export declare function logAllUseFlags(this: void, flags: int): void;
35
+ export declare function logAllUseFlags(this: void, _flags: int): void;
36
36
  export declare function logArray<T>(this: void, array: T[]): void;
37
37
  export declare function logColor(this: void, color: Color): void;
38
38
  export declare function logEntity(this: void, entity: Entity): void;
@@ -107,8 +107,8 @@ end
107
107
  function ____exports.logAllTearFlags(flags)
108
108
  ____exports.logAllFlags(flags, TearFlags, "tear")
109
109
  end
110
- function ____exports.logAllUseFlags(flags)
111
- ____exports.logAllFlags(flags, UseFlag, "use")
110
+ function ____exports.logAllUseFlags(_flags)
111
+ ____exports.log("The \"logAllUseFlags\" helper function is temporarily disabled while the UseFlag enum remains unpatched in vanilla.")
112
112
  end
113
113
  function ____exports.logArray(array)
114
114
  local arrayString = arrayToString(nil, array)
@@ -1,7 +1,7 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /**
3
3
  * Helper function to make an NPC fire a projectile. Returns the fired projectile. Use this function
4
- * instead of `EntityNPC.FireProjectiles()`, since that returns void.
4
+ * instead of the `EntityNPC.FireProjectiles` method, since that returns void.
5
5
  *
6
6
  * @param npc The NPC to fire the projectile from.
7
7
  * @param position The staring position of the projectile.
@@ -29,7 +29,7 @@ export declare function getAliveBosses(matchingEntityType?: EntityType | int, ma
29
29
  export declare function getAliveNPCs(matchingEntityType?: EntityType | int, matchingVariant?: int, matchingSubType?: int, ignoreFriendly?: boolean): EntityNPC[];
30
30
  /** Helper function to get all of the bosses in the room. */
31
31
  export declare function getBosses(matchingEntityType?: EntityType | int, matchingVariant?: int, matchingSubType?: int, ignoreFriendly?: boolean): EntityNPC[];
32
- /** The same thing as the `getEntities()` function, but returns only NPCs. */
32
+ /** The same thing as the `getEntities` function, but returns only NPCs. */
33
33
  export declare function getNPCs(matchingEntityType?: EntityType | int, matchingVariant?: int, matchingSubType?: int, ignoreFriendly?: boolean): EntityNPC[];
34
34
  /**
35
35
  * Checks for specific NPCs that have "CanShutDoors" set to true naturally by the game, but should
@@ -14,6 +14,16 @@ export declare function anyPlayerHasTrinket(trinketType: TrinketType | int): boo
14
14
  * for. Returns true if any of the characters supplied are present.
15
15
  */
16
16
  export declare function anyPlayerIs(...matchingCharacters: Array<PlayerType | int>): boolean;
17
+ /**
18
+ * Helper function to determine if a player will destroy a rock/pot/skull/etc. if they walk over it.
19
+ *
20
+ * The following things allow for this to be true:
21
+ * - the player has Leo (collectible 302)
22
+ * - the player has Thunder Thighs (collectible 314)
23
+ * - the player is under the effects of Mega Mush (collectible 625)
24
+ * - the player has Stompy (transformation 13)
25
+ */
26
+ export declare function canPlayerCrushRocks(player: EntityPlayer): boolean;
17
27
  /**
18
28
  * Helper function to determine if the provided character can have red heart containers. Returns
19
29
  * true for characters like Isaac, Magdalene, or Cain. Returns true for Keeper and Tainted Keeper,
@@ -38,7 +48,7 @@ export declare function characterGetsBlackHeartFromEternalHeart(character: Playe
38
48
  * `Isaac.GetPlayer`.
39
49
  *
40
50
  * This function is almost never what you want to use. For most intents and purposes, use the
41
- * `getPlayers()` helper function instead to get a more filtered list of players.
51
+ * `getPlayers` helper function instead to get a filtered list of players.
42
52
  */
43
53
  export declare function getAllPlayers(): EntityPlayer[];
44
54
  /**
@@ -47,7 +57,7 @@ export declare function getAllPlayers(): EntityPlayer[];
47
57
  *
48
58
  * The formula for calculating it is: 32 - 2.5 * player.TearHeight
49
59
  */
50
- export declare function getAzazelBrimstoneDistance(playerOrTearHeight: EntityPlayer | float): number;
60
+ export declare function getAzazelBrimstoneDistance(playerOrTearHeight: EntityPlayer | float): float;
51
61
  /**
52
62
  * Returns the number of black hearts that the player has, excluding any soul hearts. For example,
53
63
  * if the player has one full black heart, one full soul heart, and one half black heart, this
@@ -58,12 +68,12 @@ export declare function getAzazelBrimstoneDistance(playerOrTearHeight: EntityPla
58
68
  export declare function getBlackHearts(player: EntityPlayer): int;
59
69
  /**
60
70
  * Returns the maximum heart containers that the provided character can have. Normally, this is 12,
61
- * but with Keeper it is 3, with Tainted Keeper it is 2. Does not account for Birthright or Mother's
62
- * Kiss; use the `getPlayerMaxHeartContainers()` function for that.
71
+ * but with Keeper it is 3, and with Tainted Keeper it is 2. This does not account for Birthright or
72
+ * Mother's Kiss; use the `getPlayerMaxHeartContainers` helper function for that.
63
73
  */
64
74
  export declare function getCharacterMaxHeartContainers(character: PlayerType | int): int;
65
75
  /** Helper function to get an array containing the characters of all of the current players. */
66
- export declare function getCharacters(): number[];
76
+ export declare function getCharacters(): PlayerType[];
67
77
  export declare function getClosestPlayer(position: Vector): EntityPlayer;
68
78
  /**
69
79
  * Most characters have a 56 frame death animation (i.e. the "Death" animation).
@@ -77,7 +87,7 @@ export declare function getDeathAnimationName(player: EntityPlayer): string;
77
87
  */
78
88
  export declare function getEffectsList(player: EntityPlayer): TemporaryEffect[];
79
89
  /**
80
- * Helper function to return the player with the highest ID, according to the `Isaac.GetPlayer()`
90
+ * Helper function to return the player with the highest ID, according to the `Isaac.GetPlayer`
81
91
  * method.
82
92
  */
83
93
  export declare function getFinalPlayer(): EntityPlayer;
@@ -137,8 +147,8 @@ export declare function getPlayerFromIndex(playerIndex: PlayerIndex): EntityPlay
137
147
  * - We cannot use `EntityPlayer.InitSeed` because it is not consistent with additional players
138
148
  * beyond the first.
139
149
  *
140
- * Instead, we use `EntityPlayer.GetCollectibleRNG()` with an arbitrary value of Sad Onion (1). This
141
- * works even if the player does not have any Sad Onions.
150
+ * Instead, we use the `EntityPlayer.GetCollectibleRNG` method with an arbitrary value of Sad Onion
151
+ * (1). This works even if the player does not have any Sad Onions.
142
152
  *
143
153
  * Since the RNG value is the same for both Tainted Lazarus and Dead Tainted Lazarus, we revert to
144
154
  * using the RNG of The Inner Eye (2) for Dead Tainted Lazarus.
@@ -151,13 +161,14 @@ export declare function getPlayerFromIndex(playerIndex: PlayerIndex): EntityPlay
151
161
  export declare function getPlayerIndex(player: EntityPlayer, differentiateForgottenAndSoul?: boolean): PlayerIndex;
152
162
  /**
153
163
  * Helper function to return the index of this player with respect to the output of the
154
- * `Isaac.GetPlayer()` function.
164
+ * `Isaac.GetPlayer` method.
155
165
  */
156
166
  export declare function getPlayerIndexVanilla(playerToFind: EntityPlayer): int | undefined;
157
167
  /**
158
168
  * Returns the maximum heart containers that the provided player can have. Normally, this is 12, but
159
169
  * it can change depending on the character (e.g. Keeper) and other things (e.g. Mother's Kiss).
160
- * Does not account for Broken Hearts; use the `getPlayerAvailableHeartSlots()` function for that.
170
+ * This function does not account for Broken Hearts; use the `getPlayerAvailableHeartSlots` helper
171
+ * function for that.
161
172
  */
162
173
  export declare function getPlayerMaxHeartContainers(player: EntityPlayer): int;
163
174
  /**
@@ -193,6 +204,13 @@ export declare function getPlayers(performCharacterExclusions?: boolean): Entity
193
204
  * for. Returns true if any of the characters supplied are present.
194
205
  */
195
206
  export declare function getPlayersOfType(...characters: Array<PlayerType | int>): EntityPlayer[];
207
+ /**
208
+ * Helper function to get only the players that have a certain collectible.
209
+ *
210
+ * This function is variadic, meaning that you can supply as many collectible types as you want to
211
+ * check for. It only returns the players that have all of the collectibles.
212
+ */
213
+ export declare function getPlayersWithCollectible(...collectibleTypes: Array<CollectibleType | int>): EntityPlayer[];
196
214
  /**
197
215
  * Returns the number of soul hearts that the player has, excluding any black hearts. For example,
198
216
  * if the player has one full black heart, one full soul heart, and one half black heart, this
@@ -218,7 +236,7 @@ export declare function getSubPlayerParent(subPlayer: EntitySubPlayer): EntityPl
218
236
  * This function does not validate whether or not the provided player is Tainted Magdalene; that
219
237
  * should be accomplished before invoking this function.
220
238
  */
221
- export declare function getTaintedMagdaleneNonTemporaryMaxHearts(player: EntityPlayer): number;
239
+ export declare function getTaintedMagdaleneNonTemporaryMaxHearts(player: EntityPlayer): int;
222
240
  /**
223
241
  * Helper function to return the active charge and the battery charge combined. This is useful
224
242
  * because you are not able to set the battery charge directly.
@@ -287,8 +305,8 @@ export declare function removeCollectibleCostume(player: EntityPlayer, collectib
287
305
  /**
288
306
  * Helper function to remove the Dead Eye multiplier from a player.
289
307
  *
290
- * Note that each time the `EntityPlayer.ClearDeadEyeCharge()` function is called, it only has a
291
- * chance of working, so this function calls it 100 times to be safe.
308
+ * Note that each time the `EntityPlayer.ClearDeadEyeCharge` method is called, it only has a chance
309
+ * of working, so this function calls it 100 times to be safe.
292
310
  */
293
311
  export declare function removeDeadEyeMultiplier(player: EntityPlayer): void;
294
312
  /**
@@ -298,8 +316,9 @@ export declare function removeDeadEyeMultiplier(player: EntityPlayer): void;
298
316
  export declare function removeTrinketCostume(player: EntityPlayer, trinketType: TrinketType | int): void;
299
317
  /**
300
318
  * Helper function to set an active collectible to a particular slot. This has different behavior
301
- * than calling `player.AddCollectible()` with the `activeSlot` argument, because this function will
302
- * not shift existing items into the Schoolbag and it handles `ActiveSlot.SLOT_POCKET2`.
319
+ * than calling the `player.AddCollectible` method with the `activeSlot` argument, because this
320
+ * function will not shift existing items into the Schoolbag and it handles
321
+ * `ActiveSlot.SLOT_POCKET2`.
303
322
  *
304
323
  * Note that if an item is set to `ActiveSlot.SLOT_POCKET2`, it will disappear after being used and
305
324
  * will be automatically removed upon entering a new room.
@@ -9,6 +9,7 @@ local __TS__ArrayFind = ____lualib.__TS__ArrayFind
9
9
  local Map = ____lualib.Map
10
10
  local __TS__Iterator = ____lualib.__TS__Iterator
11
11
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
12
+ local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
12
13
  local ____exports = {}
13
14
  local getPlayerIndexCollectibleType, getAdjustedPlayerName, isTaintedModded, DEFAULT_COLLECTIBLE_TYPE, EXCLUDED_CHARACTERS
14
15
  local ____cachedClasses = require("cachedClasses")
@@ -99,15 +100,15 @@ end
99
100
  function getPlayerIndexCollectibleType(self, player, differentiateForgottenAndSoul)
100
101
  local character = player:GetPlayerType()
101
102
  repeat
102
- local ____switch68 = character
103
- local ____cond68 = ____switch68 == PlayerType.PLAYER_THESOUL
104
- if ____cond68 then
103
+ local ____switch69 = character
104
+ local ____cond69 = ____switch69 == PlayerType.PLAYER_THESOUL
105
+ if ____cond69 then
105
106
  do
106
107
  return differentiateForgottenAndSoul and CollectibleType.COLLECTIBLE_SPOON_BENDER or DEFAULT_COLLECTIBLE_TYPE
107
108
  end
108
109
  end
109
- ____cond68 = ____cond68 or ____switch68 == PlayerType.PLAYER_LAZARUS2_B
110
- if ____cond68 then
110
+ ____cond69 = ____cond69 or ____switch69 == PlayerType.PLAYER_LAZARUS2_B
111
+ if ____cond69 then
111
112
  do
112
113
  return CollectibleType.COLLECTIBLE_INNER_EYE
113
114
  end
@@ -138,39 +139,39 @@ end
138
139
  function getAdjustedPlayerName(self, player)
139
140
  local character = player:GetPlayerType()
140
141
  repeat
141
- local ____switch81 = character
142
- local ____cond81 = ____switch81 == PlayerType.PLAYER_BLUEBABY or ____switch81 == PlayerType.PLAYER_BLUEBABY_B
143
- if ____cond81 then
142
+ local ____switch82 = character
143
+ local ____cond82 = ____switch82 == PlayerType.PLAYER_BLUEBABY or ____switch82 == PlayerType.PLAYER_BLUEBABY_B
144
+ if ____cond82 then
144
145
  do
145
146
  return "Blue Baby"
146
147
  end
147
148
  end
148
- ____cond81 = ____cond81 or ____switch81 == PlayerType.PLAYER_LAZARUS2
149
- if ____cond81 then
149
+ ____cond82 = ____cond82 or ____switch82 == PlayerType.PLAYER_LAZARUS2
150
+ if ____cond82 then
150
151
  do
151
152
  return "Lazarus II"
152
153
  end
153
154
  end
154
- ____cond81 = ____cond81 or ____switch81 == PlayerType.PLAYER_BLACKJUDAS
155
- if ____cond81 then
155
+ ____cond82 = ____cond82 or ____switch82 == PlayerType.PLAYER_BLACKJUDAS
156
+ if ____cond82 then
156
157
  do
157
158
  return "Dark Judas"
158
159
  end
159
160
  end
160
- ____cond81 = ____cond81 or ____switch81 == PlayerType.PLAYER_JACOB
161
- if ____cond81 then
161
+ ____cond82 = ____cond82 or ____switch82 == PlayerType.PLAYER_JACOB
162
+ if ____cond82 then
162
163
  do
163
164
  return "Jacob & Esau"
164
165
  end
165
166
  end
166
- ____cond81 = ____cond81 or ____switch81 == PlayerType.PLAYER_LAZARUS2_B
167
- if ____cond81 then
167
+ ____cond82 = ____cond82 or ____switch82 == PlayerType.PLAYER_LAZARUS2_B
168
+ if ____cond82 then
168
169
  do
169
170
  return "Dead Tainted Lazarus"
170
171
  end
171
172
  end
172
- ____cond81 = ____cond81 or ____switch81 == PlayerType.PLAYER_JACOB2_B
173
- if ____cond81 then
173
+ ____cond82 = ____cond82 or ____switch82 == PlayerType.PLAYER_JACOB2_B
174
+ if ____cond82 then
174
175
  do
175
176
  return "Dead Tainted Jacob"
176
177
  end
@@ -291,6 +292,10 @@ function ____exports.anyPlayerIs(self, ...)
291
292
  function(____, character) return matchingCharacterSet:has(character) end
292
293
  )
293
294
  end
295
+ function ____exports.canPlayerCrushRocks(self, player)
296
+ local effects = player:GetEffects()
297
+ return player:HasCollectible(CollectibleType.COLLECTIBLE_LEO) or player:HasCollectible(CollectibleType.COLLECTIBLE_THUNDER_THIGHS) or effects:HasCollectibleEffect(CollectibleType.COLLECTIBLE_MEGA_MUSH) or player:HasPlayerForm(PlayerForm.PLAYERFORM_STOMPY)
298
+ end
294
299
  function ____exports.characterCanHaveRedHearts(self, character)
295
300
  return not CHARACTERS_WITH_NO_RED_HEARTS:has(character)
296
301
  end
@@ -498,6 +503,17 @@ function ____exports.getPlayersOfType(self, ...)
498
503
  end
499
504
  )
500
505
  end
506
+ function ____exports.getPlayersWithCollectible(self, ...)
507
+ local collectibleTypes = {...}
508
+ local players = ____exports.getPlayers(nil)
509
+ return __TS__ArrayFilter(
510
+ players,
511
+ function(____, player) return __TS__ArrayEvery(
512
+ collectibleTypes,
513
+ function(____, collectibleType) return player:HasCollectible(collectibleType) end
514
+ ) end
515
+ )
516
+ end
501
517
  function ____exports.getSoulHearts(self, player)
502
518
  local soulHearts = player:GetSoulHearts()
503
519
  local blackHearts = ____exports.getBlackHearts(nil, player)
@@ -604,9 +620,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
604
620
  itemPool:RemoveCollectible(collectibleType)
605
621
  end
606
622
  repeat
607
- local ____switch129 = activeSlot
608
- local ____cond129 = ____switch129 == ActiveSlot.SLOT_PRIMARY
609
- if ____cond129 then
623
+ local ____switch133 = activeSlot
624
+ local ____cond133 = ____switch133 == ActiveSlot.SLOT_PRIMARY
625
+ if ____cond133 then
610
626
  do
611
627
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
612
628
  player:RemoveCollectible(primaryCollectibleType)
@@ -615,8 +631,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
615
631
  break
616
632
  end
617
633
  end
618
- ____cond129 = ____cond129 or ____switch129 == ActiveSlot.SLOT_SECONDARY
619
- if ____cond129 then
634
+ ____cond133 = ____cond133 or ____switch133 == ActiveSlot.SLOT_SECONDARY
635
+ if ____cond133 then
620
636
  do
621
637
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
622
638
  player:RemoveCollectible(primaryCollectibleType)
@@ -631,16 +647,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
631
647
  break
632
648
  end
633
649
  end
634
- ____cond129 = ____cond129 or ____switch129 == ActiveSlot.SLOT_POCKET
635
- if ____cond129 then
650
+ ____cond133 = ____cond133 or ____switch133 == ActiveSlot.SLOT_POCKET
651
+ if ____cond133 then
636
652
  do
637
653
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
638
654
  player:SetActiveCharge(charge, activeSlot)
639
655
  break
640
656
  end
641
657
  end
642
- ____cond129 = ____cond129 or ____switch129 == ActiveSlot.SLOT_POCKET2
643
- if ____cond129 then
658
+ ____cond133 = ____cond133 or ____switch133 == ActiveSlot.SLOT_POCKET2
659
+ if ____cond133 then
644
660
  do
645
661
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
646
662
  break
@@ -5,7 +5,7 @@ import { PlayerHealth } from "../types/PlayerHealth";
5
5
  * `setPlayerHealth` function to restore the player's health back to a certain configuration at a
6
6
  * later time.
7
7
  *
8
- * This is based on the `REVEL.StoreHealth()` function in the Revelations mod.
8
+ * This is based on the `REVEL.StoreHealth` function in the Revelations mod.
9
9
  */
10
10
  export declare function getPlayerHealth(player: EntityPlayer): PlayerHealth;
11
11
  /**
@@ -13,7 +13,7 @@ export declare function getPlayerHealth(player: EntityPlayer): PlayerHealth;
13
13
  * with the `getPlayerHealth` function to restore the player's health back to a certain
14
14
  * configuration at a later time.
15
15
  *
16
- * Based on the `REVEL.LoadHealth()` function in the Revelations mod.
16
+ * Based on the `REVEL.LoadHealth` function in the Revelations mod.
17
17
  */
18
18
  export declare function setPlayerHealth(player: EntityPlayer, playerHealth: PlayerHealth): void;
19
19
  export declare function removeAllPlayerHealth(player: EntityPlayer): void;
@@ -2,7 +2,7 @@
2
2
  import { PocketItemDescription } from "../types/PocketItemDescription";
3
3
  export declare function getFirstCardOrPill(player: EntityPlayer): PocketItemDescription | undefined;
4
4
  /**
5
- * Use this helper function as a workaround for `EntityPlayer.GetPocketItem()` not working
5
+ * Use this helper function as a workaround for the `EntityPlayer.GetPocketItem` method not working
6
6
  * correctly.
7
7
  *
8
8
  * Note that due to API limitations, there is no way to determine the location of a Dice Bag trinket
@@ -1,7 +1,7 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /**
3
3
  * Helper function to get a room position that is not overlapping with a grid entity, a heaven door,
4
- * or a player. The `Room.FindFreePickupSpawnPosition()` function will return locations that overlap
4
+ * or a player. The `Room.FindFreePickupSpawnPosition` method will return locations that overlap
5
5
  * with heaven doors and partially overlap with players, if the thing being spawned is bigger than a
6
6
  * tile (like a Blood Donation Machine). Use this function instead if you want to account for those
7
7
  * specific situations.
@@ -14,20 +14,19 @@ export declare function findFreePosition(startingPosition: Vector, avoidActiveEn
14
14
  /**
15
15
  * Helper function to get a map containing the positions of every entity in the current room.
16
16
  *
17
- * This is useful for rewinding entity positions at a later time. Also see `setEntityPositions()`.
17
+ * This is useful for rewinding entity positions at a later time. Also see `setEntityPositions`.
18
18
  *
19
- * @param entities Optional. If provided, will only get the positions of the provided entities. This
20
- * can be used to cache the entities to avoid invoking `Isaac.GetRoomEntities()` multiple times.
19
+ * @param entities Optional. If provided, will only get the positions of the provided entities. Use
20
+ * this with cached entities to avoid invoking the `Isaac.GetRoomEntities` method multiple times.
21
21
  */
22
22
  export declare function getEntityPositions(entities?: Entity[]): Map<PtrHash, Vector>;
23
23
  /**
24
24
  * Helper function to get a map containing the velocities of every entity in the current room.
25
25
  *
26
- * This is useful for rewinding entity velocities at a later time. Also see `setEntityVelocities()`.
26
+ * This is useful for rewinding entity velocities at a later time. Also see `setEntityVelocities`.
27
27
  *
28
- * @param entities Optional. If provided, will only get the velocities of the provided entities.
29
- * This can be used to cache the entities to avoid invoking `Isaac.GetRoomEntities()` multiple
30
- * times.
28
+ * @param entities Optional. If provided, will only get the velocities of the provided entities. Use
29
+ * this with cached entities to avoid invoking the `Isaac.GetRoomEntities` method multiple times.
31
30
  */
32
31
  export declare function getEntityVelocities(entities?: Entity[]): Map<PtrHash, Vector>;
33
32
  /**
@@ -36,11 +35,11 @@ export declare function getEntityVelocities(entities?: Entity[]): Map<PtrHash, V
36
35
  * be skipped.
37
36
  *
38
37
  * This function is useful for rewinding entity positions at a later time. Also see
39
- * `getEntityPositions()`.
38
+ * `getEntityPositions`.
40
39
  *
41
40
  * @param entityPositions The map providing the positions for every entity.
42
- * @param entities Optional. If provided, will only set the positions of the provided entities. This
43
- * can be used to cache the entities to avoid invoking `Isaac.GetRoomEntities()` multiple times.
41
+ * @param entities Optional. If provided, will only set the positions of the provided entities. Use
42
+ * this with cached entities to avoid invoking the `Isaac.GetRoomEntities` method multiple times.
44
43
  */
45
44
  export declare function setEntityPositions(entityPositions: Map<PtrHash, Vector>, entities?: Entity[]): void;
46
45
  /**
@@ -49,11 +48,10 @@ export declare function setEntityPositions(entityPositions: Map<PtrHash, Vector>
49
48
  * be skipped.
50
49
  *
51
50
  * This function is useful for rewinding entity velocities at a later time. Also see
52
- * `getEntityVelocities()`.
51
+ * `getEntityVelocities`.
53
52
  *
54
53
  * @param entityVelocities The map providing the velocities for every entity.
55
- * @param entities Optional. If provided, will only set the velocities of the provided entities.
56
- * This can be used to cache the entities to avoid invoking `Isaac.GetRoomEntities()` multiple
57
- * times.
54
+ * @param entities Optional. If provided, will only set the velocities of the provided entities. Use
55
+ * this with cached entities to avoid invoking the `Isaac.GetRoomEntities` method multiple times.
58
56
  */
59
57
  export declare function setEntityVelocities(entityVelocities: Map<PtrHash, Vector>, entities?: Entity[]): void;
@@ -1,14 +1,14 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /**
3
3
  * This returns a random float between 0 and 1. It is inclusive on the low end, but exclusive on
4
- * the high end. (This is because `RNG.RandomFloat()` can return a value of 0.999, but it will never
5
- * return a value of exactly 1.)
4
+ * the high end. (This is because the `RNG.RandomFloat` method can return a value of 0.999, but it
5
+ * will never return a value of exactly 1.)
6
6
  */
7
7
  export declare function getRandom(seed?: Seed): float;
8
8
  /**
9
9
  * This returns a random float between min and max. It is inclusive on the low end, but exclusive on
10
- * the high end. (This is because `RNG.RandomFloat()` can return a value of 0.999, but it will never
11
- * return a value of exactly 1.)
10
+ * the high end. (This is because the `RNG.RandomFloat` method can return a value of 0.999, but it
11
+ * will never return a value of exactly 1.)
12
12
  *
13
13
  * Example:
14
14
  * ```
@@ -5,8 +5,8 @@
5
5
  */
6
6
  export declare function isDamageToPlayerFatal(player: EntityPlayer, damageAmount: int, damageSource: EntityRef, lastDamageGameFrame: int | undefined): boolean;
7
7
  /**
8
- * The `EntityPlayer.WillPlayerRevive()` function does not properly account for Mysterious Paper, so
9
- * use this helper function instead for more robust revival detection.
8
+ * The `EntityPlayer.WillPlayerRevive` method does not properly account for Mysterious Paper, so use
9
+ * this helper function instead for more robust revival detection.
10
10
  */
11
11
  export declare function willPlayerRevive(player: EntityPlayer): boolean;
12
12
  /**
@@ -16,7 +16,7 @@ export declare function getAllRoomGridIndexes(): int[];
16
16
  */
17
17
  export declare function getCurrentDimension(): Dimension;
18
18
  /**
19
- * Alias for the `Level.GetCurrentRoomDesc()` method. Use this to make it more clear what type of
19
+ * Alias for the `Level.GetCurrentRoomDesc` method. Use this to make it more clear what type of
20
20
  * `RoomDescriptor` object that you are retrieving.
21
21
  */
22
22
  export declare function getCurrentRoomDescriptorReadOnly(): RoomDescriptorReadOnly;
@@ -73,8 +73,8 @@ export declare function getRoomGridIndexesForType(...roomTypes: RoomType[]): int
73
73
  export declare function getRoomItemPoolType(): ItemPoolType;
74
74
  /**
75
75
  * Helper function to get the list grid index of the provided room, which is equal to the index in
76
- * the `Level.GetRooms().Get()` method. In other words, this is equal to the order that the room was
77
- * created by the floor generation algorithm.
76
+ * the `RoomList.Get` method. In other words, this is equal to the order that the room was created
77
+ * by the floor generation algorithm.
78
78
  *
79
79
  * Use this as an index for data structures that store data per room, since it is unique across
80
80
  * different dimensions.
@@ -126,8 +126,8 @@ export declare function getRoomVariant(roomGridIndex?: int): int;
126
126
  */
127
127
  export declare function getRoomVisitedCount(roomGridIndex?: int): int;
128
128
  /**
129
- * Helper function to get the room descriptor for every room on the level. Uses the
130
- * `Level.GetRooms()` method to accomplish this.
129
+ * Helper function to get the room descriptor for every room on the level. Uses the `Level.GetRooms`
130
+ * method to accomplish this.
131
131
  *
132
132
  * @param includeExtraDimensionalRooms Optional. On some floors (e.g. Downpour 2, Mines 2),
133
133
  * extra-dimensional rooms are automatically be generated and can be seen when you iterate over the
@@ -188,7 +188,7 @@ export declare function inMinibossRoomOf(minibossID: MinibossID): boolean;
188
188
  export declare function inSecretShop(): boolean;
189
189
  /**
190
190
  * Helper function to determine whether or not the current room is the starting room of a floor.
191
- * Only returns true for the starting room of the primary dimension (meaning that being in the
191
+ * It only returns true for the starting room of the primary dimension (meaning that being in the
192
192
  * starting room of the mirror world does not count).
193
193
  */
194
194
  export declare function inStartingRoom(): boolean;
@@ -217,10 +217,10 @@ export declare function isRedKeyRoom(roomGridIndex?: int): boolean;
217
217
  */
218
218
  export declare function isRoomInsideMap(roomGridIndex?: int): boolean;
219
219
  /**
220
- * If `Room.Update()` is called in a PostNewRoom callback, then some entities will slide around
221
- * (such as the player). Since those entity velocities are already at zero, setting them to zero
222
- * will have no effect. Thus, a generic solution is to record all of the entity positions/velocities
223
- * before updating the room, and then restore those positions/velocities.
220
+ * If the `Room.Update` method is called in a PostNewRoom callback, then some entities will slide
221
+ * around (such as the player). Since those entity velocities are already at zero, setting them to
222
+ * zero will have no effect. Thus, a generic solution is to record all of the entity
223
+ * positions/velocities before updating the room, and then restore those positions/velocities.
224
224
  */
225
225
  export declare function roomUpdateSafe(): void;
226
226
  /**
@@ -237,9 +237,9 @@ export declare function setRoomUncleared(): void;
237
237
  /**
238
238
  * Helper function to change the current room. It can be used for both teleportation and "normal"
239
239
  * room transitions, depending on what is passed for the `direction` and `roomTransitionAnim`
240
- * arguments. Use this function instead of invoking `Game.StartRoomTransition()` directly so that
241
- * you do not forget to set `Level.LeaveDoor` property and to prevent crashing on invalid room grid
242
- * indexes.
240
+ * arguments. Use this function instead of invoking the `Game.StartRoomTransition` method directly
241
+ * so that you do not forget to set `Level.LeaveDoor` property and to prevent crashing on invalid
242
+ * room grid indexes.
243
243
  *
244
244
  * @param roomGridIndex The room grid index of the destination room.
245
245
  * @param direction Optional. Default is `Direction.NO_DIRECTION`.
@@ -1,8 +1,9 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /**
3
- * Helper function to spawn a collectible. Use this instead of `Game.Spawn()` because it handles the
4
- * cases of Tainted Keeper collectibles costing coins and preventing quest items from being rotated
5
- * by Tainted Isaac's rotation mechanic.
3
+ * Helper function to spawn a collectible. Use this instead of the `Game.Spawn` method because it
4
+ * handles the cases of Tainted Keeper collectibles costing coins and preventing quest items from
5
+ * being rotated by Tainted Isaac's rotation mechanic. (Rotation prevention will only occur in
6
+ * upgraded mods.)
6
7
  *
7
8
  * @param collectibleType The collectible type to spawn.
8
9
  * @param position The position to spawn the collectible at.
@@ -18,9 +18,9 @@ export declare function clearSprite(sprite: Sprite, ...layerIDs: int[]): void;
18
18
  * specific animation to check.
19
19
  *
20
20
  * Note that this function is bugged with the Stop Watch or the Broken Watch, since using the
21
- * `SetFrame()` method will reset the internal accumulator used to slow down the playback speed of
22
- * the animation. (The `PlaybackSpeed` property of the sprite is not used.) Thus, it is only safe to
23
- * use this function on animations that are not slowed down by Stop Watch or Broken Watch, such as
24
- * player animations.
21
+ * `Sprite.SetFrame` method will reset the internal accumulator used to slow down the playback speed
22
+ * of the animation. (The `PlaybackSpeed` property of the sprite is not used.) Thus, it is only safe
23
+ * to use this function on animations that are not slowed down by Stop Watch or Broken Watch, such
24
+ * as player animations.
25
25
  */
26
26
  export declare function getFinalFrameOfAnimation(sprite: Sprite, animation?: string): int;
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * Helper function to get the width of the first player's hearts on the UI. This is useful for
4
4
  * drawing UI elements to the right of where the player's hearts are. Make sure to use this in
5
- * combination with the `getHUDOffsetVector()` helper function.
5
+ * combination with the the `getHUDOffsetVector` helper function.
6
6
  */
7
7
  export declare function getHeartsUIWidth(): int;
8
8
  /**
@@ -50,7 +50,7 @@ export declare const ensureAllCases: (obj: never) => never;
50
50
  * https://isaacscript.github.io/docs/gotchas#iterating-over-enums
51
51
  *
52
52
  * You can also use this function for vanilla enums, which can make code easier to read than using
53
- * `pairs` or `Object.values()`.
53
+ * `pairs` or `Object.values`.
54
54
  */
55
55
  export declare function getEnumValues<T>(transpiledEnum: T): Array<T[keyof T]>;
56
56
  /**
@@ -78,9 +78,9 @@ export declare function isLuaDebugEnabled(): boolean;
78
78
  */
79
79
  export declare function onSetSeed(): boolean;
80
80
  /**
81
- * Helper function to print something to the in-game console. Use this instead of invoking
82
- * `Isaac.ConsoleOutput()` directly because it will automatically insert a newline at the end of the
83
- * message (which `Isaac.ConsoleOutput()` does not do by default).
81
+ * Helper function to print something to the in-game console. Use this instead of invoking the
82
+ * `Isaac.ConsoleOutput` method directly because it will automatically insert a newline at the end
83
+ * of the message (which `Isaac.ConsoleOutput` does not do by default).
84
84
  */
85
85
  export declare function printConsole(msg: string): void;
86
86
  /**
@@ -18,7 +18,7 @@ import { ModUpgraded } from "./types/ModUpgraded";
18
18
  * For a list of all custom callbacks, check out the
19
19
  * [Function Signatures](https://isaacscript.github.io/docs/function-signatures#custom-callbacks).
20
20
  *
21
- * @param modVanilla The mod object returned by the `RegisterMod()` function.
21
+ * @param modVanilla The mod object returned by the `RegisterMod` function.
22
22
  * @param verbose Enables verbose logging for the purposes of crash troubleshooting.
23
23
  * Defaults to false.
24
24
  * @returns The upgraded mod object.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.131",
3
+ "version": "1.2.134",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -26,8 +26,8 @@
26
26
  ],
27
27
  "devDependencies": {
28
28
  "@zamiell/typescript-to-lua": "^1.4.2",
29
- "isaac-typescript-definitions": "^1.0.362",
30
- "isaacscript-lint": "^1.0.84",
29
+ "isaac-typescript-definitions": "^1.0.364",
30
+ "isaacscript-lint": "^1.0.88",
31
31
  "isaacscript-tsconfig": "^1.1.8",
32
32
  "typedoc": "^0.22.13",
33
33
  "typescript": "4.5.5"