isaacscript-common 84.2.4 → 84.3.0
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.
- package/dist/core/constantsFirstLast.js +1 -1
- package/dist/functions/characters.d.ts +25 -11
- package/dist/functions/characters.d.ts.map +1 -1
- package/dist/functions/characters.js +68 -18
- package/dist/functions/characters.lua +81 -16
- package/dist/index.rollup.d.ts +51 -37
- package/dist/isaacscript-common.lua +82 -17
- package/dist/lib/jsonLua.js +984 -0
- package/package.json +1 -1
- package/src/core/constantsFirstLast.ts +1 -1
- package/src/functions/characters.ts +82 -16
- package/src/lib/jsonLua.js +984 -0
package/package.json
CHANGED
|
@@ -121,7 +121,7 @@ export const NUM_NORMAL_PILL_COLORS =
|
|
|
121
121
|
/** Equal to `PlayerType.ISAAC` (0). */
|
|
122
122
|
export const FIRST_CHARACTER = PlayerType.ISAAC;
|
|
123
123
|
|
|
124
|
-
// It is not possible to determine "
|
|
124
|
+
// It is not possible to determine "LAST_CHARACTER", since there is no associated config.
|
|
125
125
|
|
|
126
126
|
/** Calculated from the `PlayerType` enum. */
|
|
127
127
|
export const LAST_VANILLA_CHARACTER = getHighestEnumValue(PlayerType);
|
|
@@ -18,18 +18,31 @@ import { CHARACTERS_WITH_NO_SOUL_HEARTS_SET } from "../sets/charactersWithNoSoul
|
|
|
18
18
|
import { LOST_STYLE_CHARACTERS_SET } from "../sets/lostStyleCharactersSet";
|
|
19
19
|
import { ReadonlySet } from "../types/ReadonlySet";
|
|
20
20
|
|
|
21
|
+
type MainCharacter = (typeof MAIN_CHARACTERS)[number];
|
|
22
|
+
|
|
21
23
|
const FLYING_CHARACTERS_SET = new ReadonlySet<PlayerType>(FLYING_CHARACTERS);
|
|
22
24
|
const MAIN_CHARACTERS_SET = new ReadonlySet<PlayerType>(MAIN_CHARACTERS);
|
|
23
25
|
|
|
24
26
|
const PNG_PATH_PREFIX = "characters/costumes";
|
|
25
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Normally, characters get a red heart container upon reaching a new floor with an eternal heart,
|
|
30
|
+
* but some characters grant a black heart instead. Returns true for Dark Judas and Tainted Judas.
|
|
31
|
+
* Otherwise, returns false.
|
|
32
|
+
*/
|
|
33
|
+
export function canCharacterGetBlackHeartFromEternalHeart(
|
|
34
|
+
character: PlayerType,
|
|
35
|
+
): boolean {
|
|
36
|
+
return CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART_SET.has(character);
|
|
37
|
+
}
|
|
38
|
+
|
|
26
39
|
/**
|
|
27
40
|
* Helper function to determine if the given character can have red heart containers. Returns true
|
|
28
41
|
* for characters like Isaac, Magdalene, or Cain. Returns true for Keeper and Tainted Keeper, even
|
|
29
42
|
* though coin containers are not technically the same as red heart containers. Returns false for
|
|
30
43
|
* characters like Blue Baby. Returns false for The Lost and Tainted Lost.
|
|
31
44
|
*/
|
|
32
|
-
export function
|
|
45
|
+
export function canCharacterHaveRedHearts(character: PlayerType): boolean {
|
|
33
46
|
return !CHARACTERS_WITH_NO_RED_HEARTS_SET.has(character);
|
|
34
47
|
}
|
|
35
48
|
|
|
@@ -38,7 +51,7 @@ export function characterCanHaveRedHearts(character: PlayerType): boolean {
|
|
|
38
51
|
* characters like Isaac, Magdalene, or Cain. Returns false for characters like Bethany. Returns
|
|
39
52
|
* false for The Lost and Tainted Lost.
|
|
40
53
|
*/
|
|
41
|
-
export function
|
|
54
|
+
export function canCharacterHaveSoulHearts(character: PlayerType): boolean {
|
|
42
55
|
return !CHARACTERS_WITH_NO_SOUL_HEARTS_SET.has(character);
|
|
43
56
|
}
|
|
44
57
|
|
|
@@ -46,28 +59,19 @@ export function characterCanHaveSoulHearts(character: PlayerType): boolean {
|
|
|
46
59
|
* Helper function for determining whether the given character can take free Devil Deals. (e.g. The
|
|
47
60
|
* Lost, Tainted Lost, etc.)
|
|
48
61
|
*/
|
|
49
|
-
export function
|
|
62
|
+
export function canCharacterTakeFreeDevilDeals(character: PlayerType): boolean {
|
|
50
63
|
return CHARACTERS_WITH_FREE_DEVIL_DEALS_SET.has(character);
|
|
51
64
|
}
|
|
52
65
|
|
|
53
|
-
/**
|
|
54
|
-
* Normally, characters get a red heart container upon reaching a new floor with an eternal heart,
|
|
55
|
-
* but some characters grant a black heart instead. Returns true for Dark Judas and Tainted Judas.
|
|
56
|
-
* Otherwise, returns false.
|
|
57
|
-
*/
|
|
58
|
-
export function characterGetsBlackHeartFromEternalHeart(
|
|
59
|
-
character: PlayerType,
|
|
60
|
-
): boolean {
|
|
61
|
-
return CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART_SET.has(character);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
66
|
/**
|
|
65
67
|
* Helper function to determine if the specified character starts with an active item.
|
|
66
68
|
*
|
|
67
69
|
* For the purposes of this function, the save file is considered to be fully unlocked (e.g. Isaac
|
|
68
70
|
* is considered to starts with the D6, but this is not the case on a brand new save file).
|
|
69
71
|
*/
|
|
70
|
-
export function
|
|
72
|
+
export function doesCharacterStartWithActiveItem(
|
|
73
|
+
character: PlayerType,
|
|
74
|
+
): boolean {
|
|
71
75
|
return CHARACTERS_THAT_START_WITH_AN_ACTIVE_ITEM_SET.has(character);
|
|
72
76
|
}
|
|
73
77
|
|
|
@@ -181,6 +185,66 @@ export function getCharacterStartingTrinketType(
|
|
|
181
185
|
return CHARACTER_STARTING_TRINKET_TYPE[character];
|
|
182
186
|
}
|
|
183
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Helper function to get the "main" version of the character. In other words, this is the character
|
|
190
|
+
* that selectable from the main menu (and has achievements related to completing the various bosses
|
|
191
|
+
* and so on).
|
|
192
|
+
*
|
|
193
|
+
* For example, the main character for `PlayerType.MAGDALENE` (1) is also `PlayerType.MAGDALENE`
|
|
194
|
+
* (1), but the main character for `PlayerType.LAZARUS_2` (11) would be `PlayerType.LAZARUS` (8).
|
|
195
|
+
*
|
|
196
|
+
* For `PlayerType.POSSESSOR` (-1) and modded characters, the same character will be returned.
|
|
197
|
+
*/
|
|
198
|
+
export function getMainCharacter(
|
|
199
|
+
character: PlayerType,
|
|
200
|
+
): PlayerType | undefined {
|
|
201
|
+
if (isMainCharacter(character) || isModdedCharacter(character)) {
|
|
202
|
+
return character;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
switch (character) {
|
|
206
|
+
// -1
|
|
207
|
+
case PlayerType.POSSESSOR: {
|
|
208
|
+
return PlayerType.POSSESSOR;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// 11
|
|
212
|
+
case PlayerType.LAZARUS_2: {
|
|
213
|
+
return PlayerType.LAZARUS;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// 12
|
|
217
|
+
case PlayerType.DARK_JUDAS: {
|
|
218
|
+
return PlayerType.JUDAS;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// 17
|
|
222
|
+
case PlayerType.SOUL: {
|
|
223
|
+
return PlayerType.FORGOTTEN;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// 20
|
|
227
|
+
case PlayerType.ESAU: {
|
|
228
|
+
return PlayerType.JACOB;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// 38
|
|
232
|
+
case PlayerType.LAZARUS_2_B: {
|
|
233
|
+
return PlayerType.LAZARUS_2;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// 39
|
|
237
|
+
case PlayerType.JACOB_2_B: {
|
|
238
|
+
return PlayerType.JACOB_B;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// 40
|
|
242
|
+
case PlayerType.SOUL_B: {
|
|
243
|
+
return PlayerType.FORGOTTEN_B;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
184
248
|
export function isFlyingCharacter(character: PlayerType): boolean {
|
|
185
249
|
return FLYING_CHARACTERS_SET.has(character);
|
|
186
250
|
}
|
|
@@ -189,7 +253,9 @@ export function isFlyingCharacter(character: PlayerType): boolean {
|
|
|
189
253
|
* Helper function to check if the provided character is one of the characters that are selectable
|
|
190
254
|
* from the main menu (and have achievements related to completing the various bosses and so on).
|
|
191
255
|
*/
|
|
192
|
-
export function isMainCharacter(
|
|
256
|
+
export function isMainCharacter(
|
|
257
|
+
character: PlayerType,
|
|
258
|
+
): character is MainCharacter {
|
|
193
259
|
return MAIN_CHARACTERS_SET.has(character);
|
|
194
260
|
}
|
|
195
261
|
|