isaacscript-common 1.2.193 → 1.2.196

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 (58) hide show
  1. package/dist/callbacks/customRevive.lua +3 -3
  2. package/dist/callbacks/postEsauJr.lua +2 -2
  3. package/dist/callbacks/postPlayerChangeHealth.lua +2 -2
  4. package/dist/callbacks/postPlayerFatalDamage.lua +2 -2
  5. package/dist/callbacks/postPlayerReordered.lua +3 -3
  6. package/dist/callbacks/preBerserkDeath.lua +2 -1
  7. package/dist/constants.d.ts +2 -38
  8. package/dist/constants.lua +3 -103
  9. package/dist/features/extraConsoleCommands/commands.lua +5 -3
  10. package/dist/features/playerInventory.lua +3 -3
  11. package/dist/functions/character.d.ts +46 -0
  12. package/dist/functions/character.lua +64 -0
  13. package/dist/functions/charge.lua +2 -2
  14. package/dist/functions/collectibles.lua +7 -6
  15. package/dist/functions/entity.lua +3 -3
  16. package/dist/functions/familiars.lua +3 -3
  17. package/dist/functions/flying.lua +1 -1
  18. package/dist/functions/pickups.d.ts +5 -0
  19. package/dist/functions/pickups.lua +33 -2
  20. package/dist/functions/player.d.ts +23 -127
  21. package/dist/functions/player.lua +86 -247
  22. package/dist/functions/playerDataStructures.lua +2 -2
  23. package/dist/functions/playerHealth.lua +7 -7
  24. package/dist/functions/playerIndex.d.ts +67 -0
  25. package/dist/functions/playerIndex.lua +125 -0
  26. package/dist/functions/pocketItems.d.ts +5 -0
  27. package/dist/functions/pocketItems.lua +5 -0
  28. package/dist/functions/positionVelocity.lua +2 -1
  29. package/dist/functions/revive.lua +6 -4
  30. package/dist/functions/utils.d.ts +2 -1
  31. package/dist/functions/utils.lua +5 -0
  32. package/dist/index.d.ts +3 -1
  33. package/dist/index.lua +17 -1
  34. package/dist/objects/colors.d.ts +17 -0
  35. package/dist/objects/colors.lua +13 -0
  36. package/dist/sets/charactersThatStartWithAnActiveItemSet.d.ts +2 -0
  37. package/dist/sets/charactersThatStartWithAnActiveItemSet.lua +18 -0
  38. package/dist/sets/charactersWithBlackHeartFromEternalHeartSet.d.ts +2 -0
  39. package/dist/sets/charactersWithBlackHeartFromEternalHeartSet.lua +6 -0
  40. package/dist/sets/charactersWithFreeDevilDealsSet.d.ts +2 -0
  41. package/dist/sets/charactersWithFreeDevilDealsSet.lua +6 -0
  42. package/dist/sets/charactersWithNoRedHeartsSet.d.ts +6 -0
  43. package/dist/sets/charactersWithNoRedHeartsSet.lua +15 -0
  44. package/dist/sets/charactersWithNoSoulHeartsSet.d.ts +6 -0
  45. package/dist/sets/charactersWithNoSoulHeartsSet.lua +12 -0
  46. package/dist/sets/chestPickupVariantsSet.d.ts +2 -0
  47. package/dist/sets/chestPickupVariantsSet.lua +19 -0
  48. package/dist/sets/familiarsThatShootPlayerTearsSet.d.ts +2 -0
  49. package/dist/sets/familiarsThatShootPlayerTearsSet.lua +15 -0
  50. package/dist/sets/lostStyleCharactersSet.d.ts +6 -0
  51. package/dist/sets/lostStyleCharactersSet.lua +12 -0
  52. package/dist/sets/redHeartSubTypesSet.d.ts +2 -0
  53. package/dist/sets/redHeartSubTypesSet.lua +6 -0
  54. package/dist/sets/singleUseActiveCollectibleTypesSet.d.ts +2 -0
  55. package/dist/sets/singleUseActiveCollectibleTypesSet.lua +15 -0
  56. package/dist/sets/storyBossesSet.d.ts +2 -0
  57. package/dist/sets/storyBossesSet.lua +20 -0
  58. package/package.json +2 -2
@@ -1,6 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  import { HealthType } from "../enums/HealthType";
3
- import { PlayerIndex } from "../types/PlayerIndex";
4
3
  export declare function addCollectibleCostume(player: EntityPlayer, collectibleType: CollectibleType | int): void;
5
4
  export declare function addTrinketCostume(player: EntityPlayer, trinketType: TrinketType | int): void;
6
5
  export declare function anyPlayerHasCollectible(collectibleType: CollectibleType | int): boolean;
@@ -22,43 +21,11 @@ export declare function anyPlayerIs(...matchingCharacters: Array<PlayerType | in
22
21
  * - the player has Stompy (transformation 13)
23
22
  */
24
23
  export declare function canPlayerCrushRocks(player: EntityPlayer): boolean;
25
- /**
26
- * Helper function for detecting when a player is one of the characters that can take free Devil
27
- * Deals. (e.g. The Lost, Tainted Lost, etc.)
28
- */
29
- export declare function canTakeFreeDevilDeals(player: EntityPlayer): boolean;
30
- /**
31
- * Helper function to determine if the provided character can have red heart containers. Returns
32
- * true for characters like Isaac, Magdalene, or Cain. Returns true for Keeper and Tainted Keeper,
33
- * even though coin containers are not technically the same as red heart containers. Returns false
34
- * for characters like Blue Baby. Returns false for The Lost and Tainted Lost.
35
- */
36
- export declare function characterCanHaveRedHearts(character: PlayerType | int): boolean;
37
- /**
38
- * Helper function to determine if the provided character can have soul hearts. Returns true for
39
- * characters like Isaac, Magdalene, or Cain. Returns false for characters like Bethany. Returns
40
- * false for The Lost and Tainted Lost.
41
- */
42
- export declare function characterCanHaveSoulHearts(character: PlayerType | int): boolean;
43
- /**
44
- * Normally, characters get a red heart container upon reaching a new floor with an eternal heart,
45
- * but some characters grant a black heart instead. Returns true for Dark Judas and Tainted Judas.
46
- * Otherwise, returns false.
47
- */
48
- export declare function characterGetsBlackHeartFromEternalHeart(character: PlayerType | int): boolean;
49
24
  /**
50
25
  * Helper function to find the active slot that the player has the corresponding collectible type
51
26
  * in. Returns undefined if the player does not have the collectible in any active slot.
52
27
  */
53
28
  export declare function getActiveItemSlot(player: EntityPlayer, collectibleType: CollectibleType | int): ActiveSlot | undefined;
54
- /**
55
- * Helper function to get every player with no restrictions, by using `Game.GetNumPlayers` and
56
- * `Isaac.GetPlayer`.
57
- *
58
- * This function is almost never what you want to use. For most purposes, use the `getPlayers`
59
- * helper function instead to get a filtered list of players.
60
- */
61
- export declare function getAllPlayers(): EntityPlayer[];
62
29
  /**
63
30
  * Helper function to get how long Azazel's Brimstone laser should be. You can pass either an
64
31
  * `EntityPlayer` object or a tear height stat.
@@ -66,31 +33,9 @@ export declare function getAllPlayers(): EntityPlayer[];
66
33
  * The formula for calculating it is: 32 - 2.5 * player.TearHeight
67
34
  */
68
35
  export declare function getAzazelBrimstoneDistance(playerOrTearHeight: EntityPlayer | float): float;
69
- /**
70
- * Returns the number of black hearts that the player has, excluding any soul hearts. For example,
71
- * if the player has one full black heart, one full soul heart, and one half black heart, this
72
- * function returns 3.
73
- *
74
- * This is different from the `EntityPlayer.GetBlackHearts` method, since that returns a bitmask.
75
- */
76
- export declare function getBlackHearts(player: EntityPlayer): int;
77
- /**
78
- * Returns the maximum heart containers that the provided character can have. Normally, this is 12,
79
- * but with Keeper it is 3, and with Tainted Keeper it is 2. This does not account for Birthright or
80
- * Mother's Kiss; use the `getPlayerMaxHeartContainers` helper function for that.
81
- */
82
- export declare function getCharacterMaxHeartContainers(character: PlayerType | int): int;
83
- /** Helper function to get the name of a character. Returns "unknown" for modded characters. */
84
- export declare function getCharacterName(character: PlayerType | int): string;
85
36
  /** Helper function to get an array containing the characters of all of the current players. */
86
37
  export declare function getCharacters(): PlayerType[];
87
38
  export declare function getClosestPlayer(position: Vector): EntityPlayer;
88
- /**
89
- * Most characters have a 56 frame death animation (i.e. the "Death" animation).
90
- * The Lost and Tainted Lost have a 38 frame death animation (i.e. the "LostDeath" animation).
91
- * Tainted Forgotten have a 20 frame death animation (i.e. the "ForgottenDeath" animation).
92
- */
93
- export declare function getDeathAnimationName(player: EntityPlayer): string;
94
39
  /**
95
40
  * Helper function to get an array of temporary effects for a player. This is helpful so that you
96
41
  * don't have to manually create an array from an `EffectsList` object.
@@ -101,20 +46,6 @@ export declare function getEffectsList(player: EntityPlayer): TemporaryEffect[];
101
46
  * method.
102
47
  */
103
48
  export declare function getFinalPlayer(): EntityPlayer;
104
- /**
105
- * Returns the number of red hearts that the player has, excluding any rotten hearts. For example,
106
- * if the player has one full black heart, one full soul heart, and one half black heart, this
107
- * function returns 3.
108
- *
109
- * This is different from the `EntityPlayer.GetHearts` method, since that returns a value that
110
- * includes rotten hearts.
111
- */
112
- export declare function getHearts(player: EntityPlayer): int;
113
- /**
114
- * Helper function that returns the type of the rightmost heart. This does not including golden
115
- * hearts or broken hearts, since they cannot be damaged directly.
116
- */
117
- export declare function getLastHeart(player: EntityPlayer): HealthType;
118
49
  /**
119
50
  * Helper function to get the first player with the lowest frame count. Useful to find a freshly
120
51
  * spawned player after using items like Esau Jr. Don't use this function if two or more players
@@ -127,6 +58,14 @@ export declare function getNewestPlayer(): EntityPlayer;
127
58
  * soul hearts and 3 broken hearts, then this function would return 6 (i.e. 12 - 1 - 2 - 3).
128
59
  */
129
60
  export declare function getPlayerAvailableHeartSlots(player: EntityPlayer): int;
61
+ /**
62
+ * Returns the number of black hearts that the player has, excluding any soul hearts. For example,
63
+ * if the player has one full black heart, one full soul heart, and one half black heart, this
64
+ * function returns 3.
65
+ *
66
+ * This is different from the `EntityPlayer.GetBlackHearts` method, since that returns a bitmask.
67
+ */
68
+ export declare function getPlayerBlackHearts(player: EntityPlayer): int;
130
69
  /**
131
70
  * Iterates over all players and checks if any are close enough to the specified position.
132
71
  *
@@ -138,42 +77,20 @@ export declare function getPlayerCloserThan(position: Vector, distance: float):
138
77
  * the player has.
139
78
  */
140
79
  export declare function getPlayerCollectibleMap(player: EntityPlayer): Map<CollectibleType | int, int>;
141
- export declare function getPlayerFromIndex(playerIndex: PlayerIndex): EntityPlayer | undefined;
142
80
  /**
143
- * Mods often have to track variables relating to the player. In naive mods, information will only
144
- * be stored about the first player. However, in order to be robust, mods must handle up to 4
145
- * players playing at the same time. This means that information must be stored on a map data
146
- * structure. Finding a good index for these types of map data structures is difficult:
147
- *
148
- * - We cannot use the index from `Isaac.GetPlayer(i)` since this fails in the case where there are
149
- * two players and the first player leaves the run.
150
- * - We cannot use `EntityPlayer.ControllerIndex` as an index because it fails in the case of Jacob
151
- * & Esau or Tainted Forgotten. It also fails in the case of a player changing their controls
152
- * mid-run.
153
- * - We cannot use `EntityPlayer.GetData().index` because it does not persist across saving and
154
- * continuing.
155
- * - We cannot use `GetPtrHash()` as an index because it does not persist across exiting and
156
- * relaunching the game.
157
- * - We cannot use `EntityPlayer.InitSeed` because it is not consistent with additional players
158
- * beyond the first.
159
- *
160
- * Instead, we use the `EntityPlayer.GetCollectibleRNG` method with an arbitrary value of Sad Onion
161
- * (1). This works even if the player does not have any Sad Onions.
162
- *
163
- * Since the RNG value is the same for both Tainted Lazarus and Dead Tainted Lazarus, we revert to
164
- * using the RNG of The Inner Eye (2) for Dead Tainted Lazarus.
81
+ * Returns the number of red hearts that the player has, excluding any rotten hearts. For example,
82
+ * if the player has one full black heart, one full soul heart, and one half black heart, this
83
+ * function returns 3.
165
84
  *
166
- * Note that by default, this returns the same index for both The Forgotten and The Soul. (Even
167
- * though they are technically different characters, they share the same inventory and InitSeed.) If
168
- * this is not desired, pass true for the `differentiateForgottenAndSoul` argument, and the RNG of
169
- * Spoon Bender (3) will be used for The Soul.
85
+ * This is different from the `EntityPlayer.GetHearts` method, since that returns a value that
86
+ * includes rotten hearts.
170
87
  */
171
- export declare function getPlayerIndex(player: EntityPlayer, differentiateForgottenAndSoul?: boolean): PlayerIndex;
88
+ export declare function getPlayerHearts(player: EntityPlayer): int;
172
89
  /**
173
- * Helper function to return the index of this player with respect to the output of the
174
- * `Isaac.GetPlayer` method.
90
+ * Helper function that returns the type of the rightmost heart. This does not including golden
91
+ * hearts or broken hearts, since they cannot be damaged directly.
175
92
  */
176
- export declare function getPlayerIndexVanilla(playerToFind: EntityPlayer): int | undefined;
93
+ export declare function getPlayerLastHeart(player: EntityPlayer): HealthType;
177
94
  /**
178
95
  * Returns the maximum heart containers that the provided player can have. Normally, this is 12, but
179
96
  * it can change depending on the character (e.g. Keeper) and other things (e.g. Mother's Kiss).
@@ -198,15 +115,14 @@ export declare function getPlayerName(player: EntityPlayer): string;
198
115
  */
199
116
  export declare function getPlayerNumHitsRemaining(player: EntityPlayer): int;
200
117
  /**
201
- * This function always excludes players with a non-undefined parent, since they are not real
202
- * players. (e.g. the Strawman Keeper)
203
- *
204
- * If this is not desired, use the `getAllPlayers` helper function instead.
118
+ * Returns the number of soul hearts that the player has, excluding any black hearts. For example,
119
+ * if the player has one full black heart, one full soul heart, and one half black heart, this
120
+ * function returns 2.
205
121
  *
206
- * @param performCharacterExclusions Whether or not to exclude characters that are not directly
207
- * controlled by the player (i.e. Esau & Tainted Soul). Default is false.
122
+ * This is different from the `EntityPlayer.GetSoulHearts` method, since that returns the combined
123
+ * number of soul hearts and black hearts.
208
124
  */
209
- export declare function getPlayers(performCharacterExclusions?: boolean): EntityPlayer[];
125
+ export declare function getPlayerSoulHearts(player: EntityPlayer): int;
210
126
  /**
211
127
  * Helper function to get all of the players that are a certain character.
212
128
  *
@@ -221,21 +137,6 @@ export declare function getPlayersOfType(...characters: Array<PlayerType | int>)
221
137
  * check for. It only returns the players that have all of the collectibles.
222
138
  */
223
139
  export declare function getPlayersWithCollectible(...collectibleTypes: Array<CollectibleType | int>): EntityPlayer[];
224
- /**
225
- * Returns the number of soul hearts that the player has, excluding any black hearts. For example,
226
- * if the player has one full black heart, one full soul heart, and one half black heart, this
227
- * function returns 2.
228
- *
229
- * This is different from the `EntityPlayer.GetSoulHearts` method, since that returns the combined
230
- * number of soul hearts and black hearts.
231
- */
232
- export declare function getSoulHearts(player: EntityPlayer): int;
233
- /**
234
- * Helper function to get a parent `EntityPlayer` object for a given `EntitySubPlayer` object. This
235
- * is useful because calling the `EntityPlayer.GetSubPlayer` method on a sub-player object will
236
- * return undefined.
237
- */
238
- export declare function getSubPlayerParent(subPlayer: EntitySubPlayer): EntityPlayer | undefined;
239
140
  /**
240
141
  * Helper function to determine how many heart containers that Tainted Magdalene has that will not
241
142
  * be automatically depleted over time. By default, this is 2, but this function will return 4 so
@@ -269,11 +170,6 @@ export declare function isActiveSlotEmpty(player: EntityPlayer, activeSlot: Acti
269
170
  * charges.
270
171
  */
271
172
  export declare function isBethany(player: EntityPlayer): boolean;
272
- /**
273
- * Some players are "child" players, meaning that they have a non-undefined Parent property.
274
- * (For example, the Strawman Keeper.)
275
- */
276
- export declare function isChildPlayer(player: EntityPlayer): boolean;
277
173
  /**
278
174
  * Helper function for detecting when a player is Eden or Tainted Eden. Useful for situations where
279
175
  * you want to know if the starting stats were randomized, for example.