isaacscript-common 1.2.192 → 1.2.195

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 +4 -2
  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 +26 -125
  21. package/dist/functions/player.lua +97 -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 +3 -3
@@ -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;
@@ -23,37 +22,10 @@ export declare function anyPlayerIs(...matchingCharacters: Array<PlayerType | in
23
22
  */
24
23
  export declare function canPlayerCrushRocks(player: EntityPlayer): boolean;
25
24
  /**
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.)
25
+ * Helper function to find the active slot that the player has the corresponding collectible type
26
+ * in. Returns undefined if the player does not have the collectible in any active slot.
28
27
  */
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
- /**
50
- * Helper function to get every player with no restrictions, by using `Game.GetNumPlayers` and
51
- * `Isaac.GetPlayer`.
52
- *
53
- * This function is almost never what you want to use. For most purposes, use the `getPlayers`
54
- * helper function instead to get a filtered list of players.
55
- */
56
- export declare function getAllPlayers(): EntityPlayer[];
28
+ export declare function getActiveItemSlot(player: EntityPlayer, collectibleType: CollectibleType | int): ActiveSlot | undefined;
57
29
  /**
58
30
  * Helper function to get how long Azazel's Brimstone laser should be. You can pass either an
59
31
  * `EntityPlayer` object or a tear height stat.
@@ -61,31 +33,9 @@ export declare function getAllPlayers(): EntityPlayer[];
61
33
  * The formula for calculating it is: 32 - 2.5 * player.TearHeight
62
34
  */
63
35
  export declare function getAzazelBrimstoneDistance(playerOrTearHeight: EntityPlayer | float): float;
64
- /**
65
- * Returns the number of black hearts that the player has, excluding any soul hearts. For example,
66
- * if the player has one full black heart, one full soul heart, and one half black heart, this
67
- * function returns 3.
68
- *
69
- * This is different from the `EntityPlayer.GetBlackHearts` method, since that returns a bitmask.
70
- */
71
- export declare function getBlackHearts(player: EntityPlayer): int;
72
- /**
73
- * Returns the maximum heart containers that the provided character can have. Normally, this is 12,
74
- * but with Keeper it is 3, and with Tainted Keeper it is 2. This does not account for Birthright or
75
- * Mother's Kiss; use the `getPlayerMaxHeartContainers` helper function for that.
76
- */
77
- export declare function getCharacterMaxHeartContainers(character: PlayerType | int): int;
78
- /** Helper function to get the name of a character. Returns "unknown" for modded characters. */
79
- export declare function getCharacterName(character: PlayerType | int): string;
80
36
  /** Helper function to get an array containing the characters of all of the current players. */
81
37
  export declare function getCharacters(): PlayerType[];
82
38
  export declare function getClosestPlayer(position: Vector): EntityPlayer;
83
- /**
84
- * Most characters have a 56 frame death animation (i.e. the "Death" animation).
85
- * The Lost and Tainted Lost have a 38 frame death animation (i.e. the "LostDeath" animation).
86
- * Tainted Forgotten have a 20 frame death animation (i.e. the "ForgottenDeath" animation).
87
- */
88
- export declare function getDeathAnimationName(player: EntityPlayer): string;
89
39
  /**
90
40
  * Helper function to get an array of temporary effects for a player. This is helpful so that you
91
41
  * don't have to manually create an array from an `EffectsList` object.
@@ -96,20 +46,6 @@ export declare function getEffectsList(player: EntityPlayer): TemporaryEffect[];
96
46
  * method.
97
47
  */
98
48
  export declare function getFinalPlayer(): EntityPlayer;
99
- /**
100
- * Returns the number of red hearts that the player has, excluding any rotten hearts. For example,
101
- * if the player has one full black heart, one full soul heart, and one half black heart, this
102
- * function returns 3.
103
- *
104
- * This is different from the `EntityPlayer.GetHearts` method, since that returns a value that
105
- * includes rotten hearts.
106
- */
107
- export declare function getHearts(player: EntityPlayer): int;
108
- /**
109
- * Helper function that returns the type of the rightmost heart. This does not including golden
110
- * hearts or broken hearts, since they cannot be damaged directly.
111
- */
112
- export declare function getLastHeart(player: EntityPlayer): HealthType;
113
49
  /**
114
50
  * Helper function to get the first player with the lowest frame count. Useful to find a freshly
115
51
  * spawned player after using items like Esau Jr. Don't use this function if two or more players
@@ -122,6 +58,14 @@ export declare function getNewestPlayer(): EntityPlayer;
122
58
  * soul hearts and 3 broken hearts, then this function would return 6 (i.e. 12 - 1 - 2 - 3).
123
59
  */
124
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;
125
69
  /**
126
70
  * Iterates over all players and checks if any are close enough to the specified position.
127
71
  *
@@ -133,42 +77,20 @@ export declare function getPlayerCloserThan(position: Vector, distance: float):
133
77
  * the player has.
134
78
  */
135
79
  export declare function getPlayerCollectibleMap(player: EntityPlayer): Map<CollectibleType | int, int>;
136
- export declare function getPlayerFromIndex(playerIndex: PlayerIndex): EntityPlayer | undefined;
137
80
  /**
138
- * Mods often have to track variables relating to the player. In naive mods, information will only
139
- * be stored about the first player. However, in order to be robust, mods must handle up to 4
140
- * players playing at the same time. This means that information must be stored on a map data
141
- * structure. Finding a good index for these types of map data structures is difficult:
142
- *
143
- * - We cannot use the index from `Isaac.GetPlayer(i)` since this fails in the case where there are
144
- * two players and the first player leaves the run.
145
- * - We cannot use `EntityPlayer.ControllerIndex` as an index because it fails in the case of Jacob
146
- * & Esau or Tainted Forgotten. It also fails in the case of a player changing their controls
147
- * mid-run.
148
- * - We cannot use `EntityPlayer.GetData().index` because it does not persist across saving and
149
- * continuing.
150
- * - We cannot use `GetPtrHash()` as an index because it does not persist across exiting and
151
- * relaunching the game.
152
- * - We cannot use `EntityPlayer.InitSeed` because it is not consistent with additional players
153
- * beyond the first.
154
- *
155
- * Instead, we use the `EntityPlayer.GetCollectibleRNG` method with an arbitrary value of Sad Onion
156
- * (1). This works even if the player does not have any Sad Onions.
157
- *
158
- * Since the RNG value is the same for both Tainted Lazarus and Dead Tainted Lazarus, we revert to
159
- * 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.
160
84
  *
161
- * Note that by default, this returns the same index for both The Forgotten and The Soul. (Even
162
- * though they are technically different characters, they share the same inventory and InitSeed.) If
163
- * this is not desired, pass true for the `differentiateForgottenAndSoul` argument, and the RNG of
164
- * 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.
165
87
  */
166
- export declare function getPlayerIndex(player: EntityPlayer, differentiateForgottenAndSoul?: boolean): PlayerIndex;
88
+ export declare function getPlayerHearts(player: EntityPlayer): int;
167
89
  /**
168
- * Helper function to return the index of this player with respect to the output of the
169
- * `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.
170
92
  */
171
- export declare function getPlayerIndexVanilla(playerToFind: EntityPlayer): int | undefined;
93
+ export declare function getPlayerLastHeart(player: EntityPlayer): HealthType;
172
94
  /**
173
95
  * Returns the maximum heart containers that the provided player can have. Normally, this is 12, but
174
96
  * it can change depending on the character (e.g. Keeper) and other things (e.g. Mother's Kiss).
@@ -193,15 +115,14 @@ export declare function getPlayerName(player: EntityPlayer): string;
193
115
  */
194
116
  export declare function getPlayerNumHitsRemaining(player: EntityPlayer): int;
195
117
  /**
196
- * This function always excludes players with a non-undefined parent, since they are not real
197
- * players. (e.g. the Strawman Keeper)
198
- *
199
- * 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.
200
121
  *
201
- * @param performCharacterExclusions Whether or not to exclude characters that are not directly
202
- * 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.
203
124
  */
204
- export declare function getPlayers(performCharacterExclusions?: boolean): EntityPlayer[];
125
+ export declare function getPlayerSoulHearts(player: EntityPlayer): int;
205
126
  /**
206
127
  * Helper function to get all of the players that are a certain character.
207
128
  *
@@ -216,21 +137,6 @@ export declare function getPlayersOfType(...characters: Array<PlayerType | int>)
216
137
  * check for. It only returns the players that have all of the collectibles.
217
138
  */
218
139
  export declare function getPlayersWithCollectible(...collectibleTypes: Array<CollectibleType | int>): EntityPlayer[];
219
- /**
220
- * Returns the number of soul hearts that the player has, excluding any black hearts. For example,
221
- * if the player has one full black heart, one full soul heart, and one half black heart, this
222
- * function returns 2.
223
- *
224
- * This is different from the `EntityPlayer.GetSoulHearts` method, since that returns the combined
225
- * number of soul hearts and black hearts.
226
- */
227
- export declare function getSoulHearts(player: EntityPlayer): int;
228
- /**
229
- * Helper function to get a parent `EntityPlayer` object for a given `EntitySubPlayer` object. This
230
- * is useful because calling the `EntityPlayer.GetSubPlayer` method on a sub-player object will
231
- * return undefined.
232
- */
233
- export declare function getSubPlayerParent(subPlayer: EntitySubPlayer): EntityPlayer | undefined;
234
140
  /**
235
141
  * Helper function to determine how many heart containers that Tainted Magdalene has that will not
236
142
  * be automatically depleted over time. By default, this is 2, but this function will return 4 so
@@ -264,11 +170,6 @@ export declare function isActiveSlotEmpty(player: EntityPlayer, activeSlot: Acti
264
170
  * charges.
265
171
  */
266
172
  export declare function isBethany(player: EntityPlayer): boolean;
267
- /**
268
- * Some players are "child" players, meaning that they have a non-undefined Parent property.
269
- * (For example, the Strawman Keeper.)
270
- */
271
- export declare function isChildPlayer(player: EntityPlayer): boolean;
272
173
  /**
273
174
  * Helper function for detecting when a player is Eden or Tainted Eden. Useful for situations where
274
175
  * you want to know if the starting stats were randomized, for example.