isaacscript-common 84.3.0 → 85.0.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.
@@ -232,14 +232,14 @@ exports.emptyArray = emptyArray;
232
232
  */
233
233
  // eslint-disable-next-line isaacscript/no-mutable-return
234
234
  function filterMap(array, func) {
235
- const newArray = [];
235
+ const filteredArray = [];
236
236
  for (const element of array) {
237
237
  const newElement = func(element);
238
238
  if (newElement !== undefined) {
239
- newArray.push(newElement);
239
+ filteredArray.push(newElement);
240
240
  }
241
241
  }
242
- return newArray;
242
+ return filteredArray;
243
243
  }
244
244
  exports.filterMap = filterMap;
245
245
  /**
@@ -317,14 +317,14 @@ end
317
317
  -- This is named `filterMap` after the Rust function:
318
318
  -- https://doc.rust-lang.org/std/iter/struct.FilterMap.html
319
319
  function ____exports.filterMap(self, array, func)
320
- local newArray = {}
320
+ local filteredArray = {}
321
321
  for ____, element in ipairs(array) do
322
322
  local newElement = func(nil, element)
323
323
  if newElement ~= nil then
324
- newArray[#newArray + 1] = newElement
324
+ filteredArray[#filteredArray + 1] = newElement
325
325
  end
326
326
  end
327
- return newArray
327
+ return filteredArray
328
328
  end
329
329
  --- Helper function to get all possible combinations of the given array. This includes the
330
330
  -- combination of an empty array.
@@ -2,12 +2,6 @@ import type { CollectibleType, TrinketType } from "isaac-typescript-definitions"
2
2
  import { PlayerType } from "isaac-typescript-definitions";
3
3
  import { MAIN_CHARACTERS } from "../core/constants";
4
4
  type MainCharacter = (typeof MAIN_CHARACTERS)[number];
5
- /**
6
- * Normally, characters get a red heart container upon reaching a new floor with an eternal heart,
7
- * but some characters grant a black heart instead. Returns true for Dark Judas and Tainted Judas.
8
- * Otherwise, returns false.
9
- */
10
- export declare function canCharacterGetBlackHeartFromEternalHeart(character: PlayerType): boolean;
11
5
  /**
12
6
  * Helper function to determine if the given character can have red heart containers. Returns true
13
7
  * for characters like Isaac, Magdalene, or Cain. Returns true for Keeper and Tainted Keeper, even
@@ -26,6 +20,12 @@ export declare function canCharacterHaveSoulHearts(character: PlayerType): boole
26
20
  * Lost, Tainted Lost, etc.)
27
21
  */
28
22
  export declare function canCharacterTakeFreeDevilDeals(character: PlayerType): boolean;
23
+ /**
24
+ * Normally, characters get a red heart container upon reaching a new floor with an eternal heart,
25
+ * but some characters grant a black heart instead. Returns true for Dark Judas and Tainted Judas.
26
+ * Otherwise, returns false.
27
+ */
28
+ export declare function doesCharacterGetBlackHeartFromEternalHeart(character: PlayerType): boolean;
29
29
  /**
30
30
  * Helper function to determine if the specified character starts with an active item.
31
31
  *
@@ -88,7 +88,7 @@ export declare function getCharacterStartingTrinketType(character: PlayerType):
88
88
  *
89
89
  * For `PlayerType.POSSESSOR` (-1) and modded characters, the same character will be returned.
90
90
  */
91
- export declare function getMainCharacter(character: PlayerType): PlayerType | undefined;
91
+ export declare function getMainCharacter(character: PlayerType): PlayerType;
92
92
  export declare function isFlyingCharacter(character: PlayerType): boolean;
93
93
  /**
94
94
  * Helper function to check if the provided character is one of the characters that are selectable
@@ -1 +1 @@
1
- {"version":3,"file":"characters.d.ts","sourceRoot":"","sources":["../../src/functions/characters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACZ,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAqB,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAevE,KAAK,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAOtD;;;;GAIG;AACH,wBAAgB,yCAAyC,CACvD,SAAS,EAAE,UAAU,GACpB,OAAO,CAET;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO,CAExE;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO,CAEzE;AAED;;;GAGG;AACH,wBAAg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;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,UAAU,GAAG,UAAU,CA8ClE;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO,CAEhE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,UAAU,GACpB,SAAS,IAAI,aAAa,CAE5B;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO,CAEhE;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO,CAEjE"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isVanillaCharacter = exports.isModdedCharacter = exports.isMainCharacter = exports.isFlyingCharacter = exports.getMainCharacter = exports.getCharacterStartingTrinketType = exports.getCharacterStartingCollectibleTypes = exports.getCharacterSpritePNGFilePath = exports.getCharacterName = exports.getCharacterMaxHeartContainers = exports.getCharacterDeathAnimationName = exports.getCharacterDamageMultiplier = exports.doesCharacterStartWithActiveItem = exports.canCharacterTakeFreeDevilDeals = exports.canCharacterHaveSoulHearts = exports.canCharacterHaveRedHearts = exports.canCharacterGetBlackHeartFromEternalHeart = void 0;
3
+ exports.isVanillaCharacter = exports.isModdedCharacter = exports.isMainCharacter = exports.isFlyingCharacter = exports.getMainCharacter = exports.getCharacterStartingTrinketType = exports.getCharacterStartingCollectibleTypes = exports.getCharacterSpritePNGFilePath = exports.getCharacterName = exports.getCharacterMaxHeartContainers = exports.getCharacterDeathAnimationName = exports.getCharacterDamageMultiplier = exports.doesCharacterStartWithActiveItem = exports.doesCharacterGetBlackHeartFromEternalHeart = exports.canCharacterTakeFreeDevilDeals = exports.canCharacterHaveSoulHearts = exports.canCharacterHaveRedHearts = void 0;
4
4
  const isaac_typescript_definitions_1 = require("isaac-typescript-definitions");
5
5
  const constants_1 = require("../core/constants");
6
6
  const constantsFirstLast_1 = require("../core/constantsFirstLast");
@@ -19,15 +19,6 @@ const ReadonlySet_1 = require("../types/ReadonlySet");
19
19
  const FLYING_CHARACTERS_SET = new ReadonlySet_1.ReadonlySet(constants_1.FLYING_CHARACTERS);
20
20
  const MAIN_CHARACTERS_SET = new ReadonlySet_1.ReadonlySet(constants_1.MAIN_CHARACTERS);
21
21
  const PNG_PATH_PREFIX = "characters/costumes";
22
- /**
23
- * Normally, characters get a red heart container upon reaching a new floor with an eternal heart,
24
- * but some characters grant a black heart instead. Returns true for Dark Judas and Tainted Judas.
25
- * Otherwise, returns false.
26
- */
27
- function canCharacterGetBlackHeartFromEternalHeart(character) {
28
- return charactersWithBlackHeartFromEternalHeartSet_1.CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART_SET.has(character);
29
- }
30
- exports.canCharacterGetBlackHeartFromEternalHeart = canCharacterGetBlackHeartFromEternalHeart;
31
22
  /**
32
23
  * Helper function to determine if the given character can have red heart containers. Returns true
33
24
  * for characters like Isaac, Magdalene, or Cain. Returns true for Keeper and Tainted Keeper, even
@@ -55,6 +46,15 @@ function canCharacterTakeFreeDevilDeals(character) {
55
46
  return charactersWithFreeDevilDealsSet_1.CHARACTERS_WITH_FREE_DEVIL_DEALS_SET.has(character);
56
47
  }
57
48
  exports.canCharacterTakeFreeDevilDeals = canCharacterTakeFreeDevilDeals;
49
+ /**
50
+ * Normally, characters get a red heart container upon reaching a new floor with an eternal heart,
51
+ * but some characters grant a black heart instead. Returns true for Dark Judas and Tainted Judas.
52
+ * Otherwise, returns false.
53
+ */
54
+ function doesCharacterGetBlackHeartFromEternalHeart(character) {
55
+ return charactersWithBlackHeartFromEternalHeartSet_1.CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART_SET.has(character);
56
+ }
57
+ exports.doesCharacterGetBlackHeartFromEternalHeart = doesCharacterGetBlackHeartFromEternalHeart;
58
58
  /**
59
59
  * Helper function to determine if the specified character starts with an active item.
60
60
  *
@@ -47,12 +47,6 @@ end
47
47
  local FLYING_CHARACTERS_SET = __TS__New(ReadonlySet, FLYING_CHARACTERS)
48
48
  MAIN_CHARACTERS_SET = __TS__New(ReadonlySet, MAIN_CHARACTERS)
49
49
  local PNG_PATH_PREFIX = "characters/costumes"
50
- --- Normally, characters get a red heart container upon reaching a new floor with an eternal heart,
51
- -- but some characters grant a black heart instead. Returns true for Dark Judas and Tainted Judas.
52
- -- Otherwise, returns false.
53
- function ____exports.canCharacterGetBlackHeartFromEternalHeart(self, character)
54
- return CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART_SET:has(character)
55
- end
56
50
  --- Helper function to determine if the given character can have red heart containers. Returns true
57
51
  -- for characters like Isaac, Magdalene, or Cain. Returns true for Keeper and Tainted Keeper, even
58
52
  -- though coin containers are not technically the same as red heart containers. Returns false for
@@ -71,6 +65,12 @@ end
71
65
  function ____exports.canCharacterTakeFreeDevilDeals(self, character)
72
66
  return CHARACTERS_WITH_FREE_DEVIL_DEALS_SET:has(character)
73
67
  end
68
+ --- Normally, characters get a red heart container upon reaching a new floor with an eternal heart,
69
+ -- but some characters grant a black heart instead. Returns true for Dark Judas and Tainted Judas.
70
+ -- Otherwise, returns false.
71
+ function ____exports.doesCharacterGetBlackHeartFromEternalHeart(self, character)
72
+ return CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART_SET:has(character)
73
+ end
74
74
  --- Helper function to determine if the specified character starts with an active item.
75
75
  --
76
76
  -- For the purposes of this function, the save file is considered to be fully unlocked (e.g. Isaac
@@ -5,7 +5,7 @@ import { Direction } from "isaac-typescript-definitions";
5
5
  * - If `num` is less than `min`, then it will be clamped to `min`.
6
6
  * - If `num` is greater than `max`, then it will be clamped to `max`.
7
7
  */
8
- export declare function clamp(num: int, min: int, max: int): int;
8
+ export declare function clamp(num: number, min: number, max: number): number;
9
9
  export declare function getAngleDifference(angle1: float, angle2: float): float;
10
10
  /**
11
11
  * Helper function to get an array of equidistant points on the circumference around a circle.
@@ -1 +1 @@
1
- {"version":3,"file":"math.d.ts","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AAgB,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAGxC;AAED,wBAAgB,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAGvC;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,GAAG,MAAM,CAE7D;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,KAAK,GACb,MAAM,CAER;AAED;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,gBAAgB,SAAI,GAAG,KAAK,CAI7D;AAED,wEAAwE;AACxE,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAUnC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,GAAG,EACT,WAAW,UAAQ,GAClB,aAAa,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAuB9C;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEtC"}
@@ -1353,13 +1353,6 @@ export declare function Callback<T extends ModCallback>(modCallback: T, ...optio
1353
1353
  */
1354
1354
  export declare function CallbackCustom<T extends ModCallbackCustom>(modCallbackCustom: T, ...optionalArgs: AllButFirst<AddCallbackParametersCustom[T]>): <Class extends ModFeature, Fn extends AddCallbackParametersCustom[T][0]>(target: Class, propertyKey: string, _descriptor: TypedPropertyDescriptor<Fn>) => void;
1355
1355
 
1356
- /**
1357
- * Normally, characters get a red heart container upon reaching a new floor with an eternal heart,
1358
- * but some characters grant a black heart instead. Returns true for Dark Judas and Tainted Judas.
1359
- * Otherwise, returns false.
1360
- */
1361
- export declare function canCharacterGetBlackHeartFromEternalHeart(character: PlayerType): boolean;
1362
-
1363
1356
  /**
1364
1357
  * Helper function to determine if the given character can have red heart containers. Returns true
1365
1358
  * for characters like Isaac, Magdalene, or Cain. Returns true for Keeper and Tainted Keeper, even
@@ -1545,7 +1538,7 @@ export declare const CHEST_PICKUP_VARIANTS_SET: ReadonlySet<PickupVariant>;
1545
1538
  * - If `num` is less than `min`, then it will be clamped to `min`.
1546
1539
  * - If `num` is greater than `max`, then it will be clamped to `max`.
1547
1540
  */
1548
- export declare function clamp(num: int, min: int, max: int): int;
1541
+ export declare function clamp(num: number, min: number, max: number): number;
1549
1542
 
1550
1543
  /**
1551
1544
  * Helper function to clear the current challenge, which will restart the run on a new random
@@ -1738,7 +1731,7 @@ export declare function combineSets<T>(...sets: ReadonlyArray<ReadonlySet<T>>):
1738
1731
  */
1739
1732
  export declare type CompositionTypeSatisfiesEnum<T extends {
1740
1733
  type: unknown;
1741
- }, _Enum extends T["type"]> = unknown;
1734
+ }, Enum extends T["type"]> = unknown;
1742
1735
 
1743
1736
  /**
1744
1737
  * Helper function to get the enum name for the specified `Controller` value. Note that this will
@@ -3954,6 +3947,13 @@ export declare const DISTANCE_OF_GRID_TILE = 40;
3954
3947
  */
3955
3948
  export declare function doesAnyEntityExist(entityTypes: readonly EntityType[] | ReadonlySet<EntityType>, ignoreFriendly?: boolean): boolean;
3956
3949
 
3950
+ /**
3951
+ * Normally, characters get a red heart container upon reaching a new floor with an eternal heart,
3952
+ * but some characters grant a black heart instead. Returns true for Dark Judas and Tainted Judas.
3953
+ * Otherwise, returns false.
3954
+ */
3955
+ export declare function doesCharacterGetBlackHeartFromEternalHeart(character: PlayerType): boolean;
3956
+
3957
3957
  /**
3958
3958
  * Helper function to determine if the specified character starts with an active item.
3959
3959
  *
@@ -6355,7 +6355,7 @@ export declare function getLowestEnumValue<T extends TranspiledEnum>(transpiledE
6355
6355
  *
6356
6356
  * For `PlayerType.POSSESSOR` (-1) and modded characters, the same character will be returned.
6357
6357
  */
6358
- export declare function getMainCharacter(character: PlayerType): PlayerType | undefined;
6358
+ export declare function getMainCharacter(character: PlayerType): PlayerType;
6359
6359
 
6360
6360
  /**
6361
6361
  * Helper function to get the closest key from a map based on partial search text. (It only searches
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 84.2.5
3
+ isaacscript-common 84.3.1
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -18780,14 +18780,14 @@ end
18780
18780
  -- This is named `filterMap` after the Rust function:
18781
18781
  -- https://doc.rust-lang.org/std/iter/struct.FilterMap.html
18782
18782
  function ____exports.filterMap(self, array, func)
18783
- local newArray = {}
18783
+ local filteredArray = {}
18784
18784
  for ____, element in ipairs(array) do
18785
18785
  local newElement = func(nil, element)
18786
18786
  if newElement ~= nil then
18787
- newArray[#newArray + 1] = newElement
18787
+ filteredArray[#filteredArray + 1] = newElement
18788
18788
  end
18789
18789
  end
18790
- return newArray
18790
+ return filteredArray
18791
18791
  end
18792
18792
  --- Helper function to get all possible combinations of the given array. This includes the
18793
18793
  -- combination of an empty array.
@@ -22333,12 +22333,6 @@ end
22333
22333
  local FLYING_CHARACTERS_SET = __TS__New(ReadonlySet, FLYING_CHARACTERS)
22334
22334
  MAIN_CHARACTERS_SET = __TS__New(ReadonlySet, MAIN_CHARACTERS)
22335
22335
  local PNG_PATH_PREFIX = "characters/costumes"
22336
- --- Normally, characters get a red heart container upon reaching a new floor with an eternal heart,
22337
- -- but some characters grant a black heart instead. Returns true for Dark Judas and Tainted Judas.
22338
- -- Otherwise, returns false.
22339
- function ____exports.canCharacterGetBlackHeartFromEternalHeart(self, character)
22340
- return CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART_SET:has(character)
22341
- end
22342
22336
  --- Helper function to determine if the given character can have red heart containers. Returns true
22343
22337
  -- for characters like Isaac, Magdalene, or Cain. Returns true for Keeper and Tainted Keeper, even
22344
22338
  -- though coin containers are not technically the same as red heart containers. Returns false for
@@ -22357,6 +22351,12 @@ end
22357
22351
  function ____exports.canCharacterTakeFreeDevilDeals(self, character)
22358
22352
  return CHARACTERS_WITH_FREE_DEVIL_DEALS_SET:has(character)
22359
22353
  end
22354
+ --- Normally, characters get a red heart container upon reaching a new floor with an eternal heart,
22355
+ -- but some characters grant a black heart instead. Returns true for Dark Judas and Tainted Judas.
22356
+ -- Otherwise, returns false.
22357
+ function ____exports.doesCharacterGetBlackHeartFromEternalHeart(self, character)
22358
+ return CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART_SET:has(character)
22359
+ end
22360
22360
  --- Helper function to determine if the specified character starts with an active item.
22361
22361
  --
22362
22362
  -- For the purposes of this function, the save file is considered to be fully unlocked (e.g. Isaac
@@ -30,5 +30,5 @@
30
30
  */
31
31
  export type CompositionTypeSatisfiesEnum<T extends {
32
32
  type: unknown;
33
- }, _Enum extends T["type"]> = unknown;
33
+ }, Enum extends T["type"]> = unknown;
34
34
  //# sourceMappingURL=CompositionTypeSatisfiesEnum.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CompositionTypeSatisfiesEnum.d.ts","sourceRoot":"","sources":["../../src/types/CompositionTypeSatisfiesEnum.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,MAAM,4BAA4B,CACtC,CAAC,SAAS;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,EAC3B,KAAK,SAAS,CAAC,CAAC,MAAM,CAAC,IACrB,OAAO,CAAC"}
1
+ {"version":3,"file":"CompositionTypeSatisfiesEnum.d.ts","sourceRoot":"","sources":["../../src/types/CompositionTypeSatisfiesEnum.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,MAAM,4BAA4B,CACtC,CAAC,SAAS;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,EAE3B,IAAI,SAAS,CAAC,CAAC,MAAM,CAAC,IACpB,OAAO,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "84.3.0",
3
+ "version": "85.0.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -270,16 +270,16 @@ export function filterMap<OldT, NewT>(
270
270
  array: readonly OldT[],
271
271
  func: (element: OldT) => NewT | undefined,
272
272
  ): NewT[] {
273
- const newArray: NewT[] = [];
273
+ const filteredArray: NewT[] = [];
274
274
 
275
275
  for (const element of array) {
276
276
  const newElement = func(element);
277
277
  if (newElement !== undefined) {
278
- newArray.push(newElement);
278
+ filteredArray.push(newElement);
279
279
  }
280
280
  }
281
281
 
282
- return newArray;
282
+ return filteredArray;
283
283
  }
284
284
 
285
285
  /**
@@ -25,17 +25,6 @@ const MAIN_CHARACTERS_SET = new ReadonlySet<PlayerType>(MAIN_CHARACTERS);
25
25
 
26
26
  const PNG_PATH_PREFIX = "characters/costumes";
27
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
-
39
28
  /**
40
29
  * Helper function to determine if the given character can have red heart containers. Returns true
41
30
  * for characters like Isaac, Magdalene, or Cain. Returns true for Keeper and Tainted Keeper, even
@@ -63,6 +52,17 @@ export function canCharacterTakeFreeDevilDeals(character: PlayerType): boolean {
63
52
  return CHARACTERS_WITH_FREE_DEVIL_DEALS_SET.has(character);
64
53
  }
65
54
 
55
+ /**
56
+ * Normally, characters get a red heart container upon reaching a new floor with an eternal heart,
57
+ * but some characters grant a black heart instead. Returns true for Dark Judas and Tainted Judas.
58
+ * Otherwise, returns false.
59
+ */
60
+ export function doesCharacterGetBlackHeartFromEternalHeart(
61
+ character: PlayerType,
62
+ ): boolean {
63
+ return CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART_SET.has(character);
64
+ }
65
+
66
66
  /**
67
67
  * Helper function to determine if the specified character starts with an active item.
68
68
  *
@@ -195,9 +195,7 @@ export function getCharacterStartingTrinketType(
195
195
  *
196
196
  * For `PlayerType.POSSESSOR` (-1) and modded characters, the same character will be returned.
197
197
  */
198
- export function getMainCharacter(
199
- character: PlayerType,
200
- ): PlayerType | undefined {
198
+ export function getMainCharacter(character: PlayerType): PlayerType {
201
199
  if (isMainCharacter(character) || isModdedCharacter(character)) {
202
200
  return character;
203
201
  }
@@ -7,7 +7,7 @@ import { directionToVector } from "./direction";
7
7
  * - If `num` is less than `min`, then it will be clamped to `min`.
8
8
  * - If `num` is greater than `max`, then it will be clamped to `max`.
9
9
  */
10
- export function clamp(num: int, min: int, max: int): int {
10
+ export function clamp(num: number, min: number, max: number): number {
11
11
  return Math.max(min, Math.min(num, max));
12
12
  }
13
13
 
@@ -30,7 +30,8 @@
30
30
  */
31
31
  export type CompositionTypeSatisfiesEnum<
32
32
  T extends { type: unknown },
33
- _Enum extends T["type"],
33
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
34
+ Enum extends T["type"],
34
35
  > = unknown;
35
36
 
36
37
  // -----