isaacscript-common 83.4.1 → 84.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.
@@ -1,4 +1,4 @@
1
- /// <reference types="isaac-typescript-definitions" />
1
+ import type { CollectibleType } from "isaac-typescript-definitions";
2
2
  import type { PlayerStat } from "../../../enums/PlayerStat";
3
3
  import type { PlayerHealth } from "../../../interfaces/PlayerHealth";
4
4
  import type { PlayerStats } from "../../../interfaces/PlayerStats";
@@ -11,6 +11,34 @@ export declare class EdenStartingStatsHealth extends Feature {
11
11
  private readonly postPlayerInit;
12
12
  private getEdenStats;
13
13
  private getEdenHealth;
14
+ /**
15
+ * We must use the `POST_PLAYER_COLLECTIBLE_ADDED` callback since the collectibles are not yet
16
+ * granted in the `POST_PLAYER_INIT` callback.
17
+ */
18
+ private readonly postPlayerCollectibleAdded;
19
+ /**
20
+ * Helper function to get the active collectible that Eden started with at the beginning of the
21
+ * run.
22
+ *
23
+ * Returns undefined if passed a player that is not Eden or if the starting collectibles are not
24
+ * yet added. (Eden's starting collectibles are added after the `POST_PLAYER_INIT` callback has
25
+ * fired.)
26
+ *
27
+ * @public
28
+ */
29
+ getEdenStartingActiveCollectible(player: EntityPlayer): CollectibleType | undefined;
30
+ /**
31
+ * Helper function to get an array containing the active collectible and the passive collectible
32
+ * that Eden started with at the beginning of the run. The active collectible will be the first
33
+ * element and the passive collectible will be the second element.
34
+ *
35
+ * Returns an empty array if passed a player that is not Eden or if the starting collectibles are
36
+ * not yet added. (Eden's starting collectibles are added after the `POST_PLAYER_INIT` callback
37
+ * has fired.)
38
+ *
39
+ * @public
40
+ */
41
+ getEdenStartingCollectibles(player: EntityPlayer): CollectibleType[];
14
42
  /**
15
43
  * Helper function to get the health that Eden started with at the beginning of the run before any
16
44
  * of the random collectibles were added.
@@ -22,6 +50,17 @@ export declare class EdenStartingStatsHealth extends Feature {
22
50
  * @public
23
51
  */
24
52
  getEdenStartingHealth(player: EntityPlayer): Readonly<PlayerHealth> | undefined;
53
+ /**
54
+ * Helper function to get the passive collectible that Eden started with at the beginning of the
55
+ * run.
56
+ *
57
+ * Returns undefined if passed a player that is not Eden or if the starting collectibles are not
58
+ * yet added. (Eden's starting collectibles are added after the `POST_PLAYER_INIT` callback has
59
+ * fired.)
60
+ *
61
+ * @public
62
+ */
63
+ getEdenStartingPassiveCollectible(player: EntityPlayer): CollectibleType | undefined;
25
64
  /**
26
65
  * Helper function to get the value of the randomized starting stat for Eden that was assigned at
27
66
  * the beginning of the run before any of the random collectibles were added.
@@ -1 +1 @@
1
- {"version":3,"file":"EdenStartingStatsHealth.d.ts","sourceRoot":"","sources":["../../../../src/classes/features/other/EdenStartingStatsHealth.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAQ5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAShD,qBAAa,uBAAwB,SAAQ,OAAO;IAclD;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,cAAc,CAO7B;IAEF,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,aAAa;IAUrB;;;;;;;;;OASG;IAEI,qBAAqB,CAC1B,MAAM,EAAE,YAAY,GACnB,QAAQ,CAAC,YAAY,CAAC,GAAG,SAAS;IAIrC;;;;;;;;;OASG;IAEI,mBAAmB,CAAC,CAAC,SAAS,UAAU,EAC7C,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,CAAC,GACZ,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS;IAS7B;;;;;;;;;OASG;IAEI,oBAAoB,CACzB,MAAM,EAAE,YAAY,GACnB,QAAQ,CAAC,WAAW,CAAC,GAAG,SAAS;CAGrC"}
1
+ {"version":3,"file":"EdenStartingStatsHealth.d.ts","sourceRoot":"","sources":["../../../../src/classes/features/other/EdenStartingStatsHealth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAIpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAU5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAWhD,qBAAa,uBAAwB,SAAQ,OAAO;IAqBlD;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,cAAc,CAO7B;IAEF,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,aAAa;IAUrB;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAezC;IAEF;;;;;;;;;OASG;IAEI,gCAAgC,CACrC,MAAM,EAAE,YAAY,GACnB,eAAe,GAAG,SAAS;IAI9B;;;;;;;;;;OAUG;IAEI,2BAA2B,CAAC,MAAM,EAAE,YAAY,GAAG,eAAe,EAAE;IAwB3E;;;;;;;;;OASG;IAEI,qBAAqB,CAC1B,MAAM,EAAE,YAAY,GACnB,QAAQ,CAAC,YAAY,CAAC,GAAG,SAAS;IAIrC;;;;;;;;;OASG;IAEI,iCAAiC,CACtC,MAAM,EAAE,YAAY,GACnB,eAAe,GAAG,SAAS;IAI9B;;;;;;;;;OASG;IAEI,mBAAmB,CAAC,CAAC,SAAS,UAAU,EAC7C,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,CAAC,GACZ,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS;IAS7B;;;;;;;;;OASG;IAEI,oBAAoB,CACzB,MAAM,EAAE,YAAY,GACnB,QAAQ,CAAC,WAAW,CAAC,GAAG,SAAS;CAGrC"}
@@ -9,8 +9,13 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
9
9
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
10
10
  local ____decorators = require("decorators")
11
11
  local Exported = ____decorators.Exported
12
+ local ____ModCallbackCustom = require("enums.ModCallbackCustom")
13
+ local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
14
+ local ____collectibles = require("functions.collectibles")
15
+ local isActiveCollectible = ____collectibles.isActiveCollectible
12
16
  local ____playerDataStructures = require("functions.playerDataStructures")
13
17
  local mapGetPlayer = ____playerDataStructures.mapGetPlayer
18
+ local mapHasPlayer = ____playerDataStructures.mapHasPlayer
14
19
  local mapSetPlayer = ____playerDataStructures.mapSetPlayer
15
20
  local ____playerHealth = require("functions.playerHealth")
16
21
  local getPlayerHealth = ____playerHealth.getPlayerHealth
@@ -21,6 +26,8 @@ local getPlayerStats = ____stats.getPlayerStats
21
26
  local ____Feature = require("classes.private.Feature")
22
27
  local Feature = ____Feature.Feature
23
28
  local v = {run = {
29
+ edenActiveCollectibles = __TS__New(Map),
30
+ edenPassiveCollectibles = __TS__New(Map),
24
31
  edenPlayerStats = __TS__New(Map),
25
32
  edenPlayerHealth = __TS__New(Map)
26
33
  }}
@@ -38,7 +45,17 @@ function EdenStartingStatsHealth.prototype.____constructor(self)
38
45
  self:getEdenStats(player)
39
46
  self:getEdenHealth(player)
40
47
  end
48
+ self.postPlayerCollectibleAdded = function(____, player, collectibleType)
49
+ if not isEden(nil, player) then
50
+ return
51
+ end
52
+ local map = isActiveCollectible(nil, collectibleType) and v.run.edenActiveCollectibles or v.run.edenPassiveCollectibles
53
+ if not mapHasPlayer(nil, map, player) then
54
+ mapSetPlayer(nil, map, player, collectibleType)
55
+ end
56
+ end
41
57
  self.callbacksUsed = {{ModCallback.POST_PLAYER_INIT, self.postPlayerInit}}
58
+ self.customCallbacksUsed = {{ModCallbackCustom.POST_PLAYER_COLLECTIBLE_ADDED, self.postPlayerCollectibleAdded}}
42
59
  end
43
60
  function EdenStartingStatsHealth.prototype.getEdenStats(self, player)
44
61
  local existingStatMap = mapGetPlayer(nil, v.run.edenPlayerStats, player)
@@ -56,10 +73,31 @@ function EdenStartingStatsHealth.prototype.getEdenHealth(self, player)
56
73
  local playerHealth = getPlayerHealth(nil, player)
57
74
  mapSetPlayer(nil, v.run.edenPlayerHealth, player, playerHealth)
58
75
  end
76
+ function EdenStartingStatsHealth.prototype.getEdenStartingActiveCollectible(self, player)
77
+ return mapGetPlayer(nil, v.run.edenActiveCollectibles, player)
78
+ end
79
+ __TS__DecorateLegacy({Exported}, EdenStartingStatsHealth.prototype, "getEdenStartingActiveCollectible", true)
80
+ function EdenStartingStatsHealth.prototype.getEdenStartingCollectibles(self, player)
81
+ local collectibleTypes = {}
82
+ local activeCollectibleType = mapGetPlayer(nil, v.run.edenActiveCollectibles, player)
83
+ if activeCollectibleType ~= nil then
84
+ collectibleTypes[#collectibleTypes + 1] = activeCollectibleType
85
+ end
86
+ local passiveCollectibleType = mapGetPlayer(nil, v.run.edenPassiveCollectibles, player)
87
+ if passiveCollectibleType ~= nil then
88
+ collectibleTypes[#collectibleTypes + 1] = passiveCollectibleType
89
+ end
90
+ return collectibleTypes
91
+ end
92
+ __TS__DecorateLegacy({Exported}, EdenStartingStatsHealth.prototype, "getEdenStartingCollectibles", true)
59
93
  function EdenStartingStatsHealth.prototype.getEdenStartingHealth(self, player)
60
94
  return mapGetPlayer(nil, v.run.edenPlayerHealth, player)
61
95
  end
62
96
  __TS__DecorateLegacy({Exported}, EdenStartingStatsHealth.prototype, "getEdenStartingHealth", true)
97
+ function EdenStartingStatsHealth.prototype.getEdenStartingPassiveCollectible(self, player)
98
+ return mapGetPlayer(nil, v.run.edenPassiveCollectibles, player)
99
+ end
100
+ __TS__DecorateLegacy({Exported}, EdenStartingStatsHealth.prototype, "getEdenStartingPassiveCollectible", true)
63
101
  function EdenStartingStatsHealth.prototype.getEdenStartingStat(self, player, playerStat)
64
102
  local playerStats = mapGetPlayer(nil, v.run.edenPlayerStats, player)
65
103
  if playerStats == nil then
@@ -4,7 +4,7 @@
4
4
  * @module
5
5
  */
6
6
  import { CardType, CollectibleType, PillColor, PillEffect, PlayerType, TrinketType } from "isaac-typescript-definitions";
7
- /** Equal to `CollectibleType.SAD_ONION`. */
7
+ /** Equal to `CollectibleType.SAD_ONION` (1). */
8
8
  export declare const FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION;
9
9
  /**
10
10
  * Calculated from the `CollectibleType` enum.
@@ -15,7 +15,7 @@ export declare const FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION;
15
15
  export declare const LAST_VANILLA_COLLECTIBLE_TYPE: CollectibleType;
16
16
  /** Calculated from the `CollectibleType` enum. (`CollectibleType.NULL` is not included.) */
17
17
  export declare const NUM_VANILLA_COLLECTIBLE_TYPES: number;
18
- /** Equal to `TrinketType.SWALLOWED_PENNY`. */
18
+ /** Equal to `TrinketType.SWALLOWED_PENNY` (1). */
19
19
  export declare const FIRST_TRINKET_TYPE = TrinketType.SWALLOWED_PENNY;
20
20
  /**
21
21
  * Calculated from the `TrinketType` enum.
@@ -26,13 +26,13 @@ export declare const FIRST_TRINKET_TYPE = TrinketType.SWALLOWED_PENNY;
26
26
  export declare const LAST_VANILLA_TRINKET_TYPE: TrinketType;
27
27
  /** Calculated from the `TrinketType` enum. (`TrinketType.NULL` is not included.) */
28
28
  export declare const NUM_VANILLA_TRINKET_TYPES: number;
29
- /** Equal to `Card.FOOL`. */
29
+ /** Equal to `Card.FOOL` (1). */
30
30
  export declare const FIRST_CARD_TYPE = CardType.FOOL;
31
31
  /** Calculated from the `CardType` enum. */
32
32
  export declare const LAST_VANILLA_CARD_TYPE: CardType;
33
33
  /** Calculated from the `Card` enum. `Card.NULL` is not included. */
34
34
  export declare const NUM_VANILLA_CARD_TYPES: number;
35
- /** Equal to `PillEffect.BAD_GAS`. */
35
+ /** Equal to `PillEffect.BAD_GAS` (0). */
36
36
  export declare const FIRST_PILL_EFFECT = PillEffect.BAD_GAS;
37
37
  /** Calculated from the `PillEffect` enum. */
38
38
  export declare const LAST_VANILLA_PILL_EFFECT: PillEffect;
@@ -41,26 +41,30 @@ export declare const LAST_VANILLA_PILL_EFFECT: PillEffect;
41
41
  * do not have to subtract one here.)
42
42
  */
43
43
  export declare const NUM_VANILLA_PILL_EFFECTS: int;
44
- /** Equal to `PillColor.BLUE_BLUE`. */
44
+ /** Equal to `PillColor.BLUE_BLUE` (1). */
45
45
  export declare const FIRST_PILL_COLOR = PillColor.BLUE_BLUE;
46
46
  /**
47
- * Equal to `PillColor.WHITE_YELLOW`.
47
+ * Equal to `PillColor.WHITE_YELLOW` (13).
48
48
  *
49
49
  * Note that `PillColor.GOLD` is technically higher, but that is not considered for the purposes of
50
50
  * this constant.
51
51
  */
52
52
  export declare const LAST_NORMAL_PILL_COLOR = PillColor.WHITE_YELLOW;
53
- /** Equal to `PillColor.HORSE_BLUE_BLUE`. */
53
+ /** Equal to `PillColor.HORSE_BLUE_BLUE` (2049). */
54
54
  export declare const FIRST_HORSE_PILL_COLOR = PillColor.HORSE_BLUE_BLUE;
55
55
  /**
56
- * Equal to `PillColor.HORSE_WHITE_YELLOW`.
56
+ * Equal to `PillColor.HORSE_WHITE_YELLOW` (2061).
57
57
  *
58
58
  * Note that `PillColor.HORSE_GOLD` is technically higher, but that is not considered for the
59
59
  * purposes of this constant.
60
60
  */
61
61
  export declare const LAST_HORSE_PILL_COLOR = PillColor.HORSE_WHITE_YELLOW;
62
+ /**
63
+ * Calculated from the difference between the first pill color and the last pill color. This does
64
+ * not include Gold Pills. In Repentance, this should be equal to 13.
65
+ */
62
66
  export declare const NUM_NORMAL_PILL_COLORS: number;
63
- /** Equal to `PlayerType.ISAAC`. */
67
+ /** Equal to `PlayerType.ISAAC` (0). */
64
68
  export declare const FIRST_CHARACTER = PlayerType.ISAAC;
65
69
  /** Calculated from the `PlayerType` enum. */
66
70
  export declare const LAST_VANILLA_CHARACTER: PlayerType;
@@ -1 +1 @@
1
- {"version":3,"file":"constantsFirstLast.d.ts","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AO,MAAM,eAAe,mBAAmB,CAAC;AAIhD,6CAA6C;AAC7C,eAAO,MAAM,sBAAsB,YAAkC,CAAC;AAMtE,8EAA8E;AAC9E,eAAO,MAAM,sBAAsB,QAA+B,CAAC"}
@@ -10,9 +10,7 @@ local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
10
10
  local ____enums = require("functions.enums")
11
11
  local getEnumLength = ____enums.getEnumLength
12
12
  local getHighestEnumValue = ____enums.getHighestEnumValue
13
- local ____utils = require("functions.utils")
14
- local iRange = ____utils.iRange
15
- --- Equal to `CollectibleType.SAD_ONION`.
13
+ --- Equal to `CollectibleType.SAD_ONION` (1).
16
14
  ____exports.FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION
17
15
  --- Calculated from the `CollectibleType` enum.
18
16
  --
@@ -21,7 +19,7 @@ ____exports.FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION
21
19
  ____exports.LAST_VANILLA_COLLECTIBLE_TYPE = getHighestEnumValue(nil, CollectibleType)
22
20
  --- Calculated from the `CollectibleType` enum. (`CollectibleType.NULL` is not included.)
23
21
  ____exports.NUM_VANILLA_COLLECTIBLE_TYPES = getEnumLength(nil, CollectibleType) - 1
24
- --- Equal to `TrinketType.SWALLOWED_PENNY`.
22
+ --- Equal to `TrinketType.SWALLOWED_PENNY` (1).
25
23
  ____exports.FIRST_TRINKET_TYPE = TrinketType.SWALLOWED_PENNY
26
24
  --- Calculated from the `TrinketType` enum.
27
25
  --
@@ -30,35 +28,37 @@ ____exports.FIRST_TRINKET_TYPE = TrinketType.SWALLOWED_PENNY
30
28
  ____exports.LAST_VANILLA_TRINKET_TYPE = getHighestEnumValue(nil, TrinketType)
31
29
  --- Calculated from the `TrinketType` enum. (`TrinketType.NULL` is not included.)
32
30
  ____exports.NUM_VANILLA_TRINKET_TYPES = getEnumLength(nil, TrinketType) - 1
33
- --- Equal to `Card.FOOL`.
31
+ --- Equal to `Card.FOOL` (1).
34
32
  ____exports.FIRST_CARD_TYPE = CardType.FOOL
35
33
  --- Calculated from the `CardType` enum.
36
34
  ____exports.LAST_VANILLA_CARD_TYPE = getHighestEnumValue(nil, CardType)
37
35
  --- Calculated from the `Card` enum. `Card.NULL` is not included.
38
36
  ____exports.NUM_VANILLA_CARD_TYPES = getEnumLength(nil, CardType) - 1
39
- --- Equal to `PillEffect.BAD_GAS`.
37
+ --- Equal to `PillEffect.BAD_GAS` (0).
40
38
  ____exports.FIRST_PILL_EFFECT = PillEffect.BAD_GAS
41
39
  --- Calculated from the `PillEffect` enum.
42
40
  ____exports.LAST_VANILLA_PILL_EFFECT = getHighestEnumValue(nil, PillEffect)
43
41
  --- Calculated from the `PillEffect` enum. (There is no `PillEffect.NULL` in the custom enum, so we
44
42
  -- do not have to subtract one here.)
45
43
  ____exports.NUM_VANILLA_PILL_EFFECTS = getEnumLength(nil, PillEffect)
46
- --- Equal to `PillColor.BLUE_BLUE`.
44
+ --- Equal to `PillColor.BLUE_BLUE` (1).
47
45
  ____exports.FIRST_PILL_COLOR = PillColor.BLUE_BLUE
48
- --- Equal to `PillColor.WHITE_YELLOW`.
46
+ --- Equal to `PillColor.WHITE_YELLOW` (13).
49
47
  --
50
48
  -- Note that `PillColor.GOLD` is technically higher, but that is not considered for the purposes of
51
49
  -- this constant.
52
50
  ____exports.LAST_NORMAL_PILL_COLOR = PillColor.WHITE_YELLOW
53
- --- Equal to `PillColor.HORSE_BLUE_BLUE`.
51
+ --- Equal to `PillColor.HORSE_BLUE_BLUE` (2049).
54
52
  ____exports.FIRST_HORSE_PILL_COLOR = PillColor.HORSE_BLUE_BLUE
55
- --- Equal to `PillColor.HORSE_WHITE_YELLOW`.
53
+ --- Equal to `PillColor.HORSE_WHITE_YELLOW` (2061).
56
54
  --
57
55
  -- Note that `PillColor.HORSE_GOLD` is technically higher, but that is not considered for the
58
56
  -- purposes of this constant.
59
57
  ____exports.LAST_HORSE_PILL_COLOR = PillColor.HORSE_WHITE_YELLOW
60
- ____exports.NUM_NORMAL_PILL_COLORS = #iRange(nil, ____exports.FIRST_PILL_COLOR, ____exports.LAST_NORMAL_PILL_COLOR)
61
- --- Equal to `PlayerType.ISAAC`.
58
+ --- Calculated from the difference between the first pill color and the last pill color. This does
59
+ -- not include Gold Pills. In Repentance, this should be equal to 13.
60
+ ____exports.NUM_NORMAL_PILL_COLORS = ____exports.LAST_NORMAL_PILL_COLOR - ____exports.FIRST_PILL_COLOR + 1
61
+ --- Equal to `PlayerType.ISAAC` (0).
62
62
  ____exports.FIRST_CHARACTER = PlayerType.ISAAC
63
63
  --- Calculated from the `PlayerType` enum.
64
64
  ____exports.LAST_VANILLA_CHARACTER = getHighestEnumValue(nil, PlayerType)
@@ -3,6 +3,8 @@ import { RoomShape } from "isaac-typescript-definitions";
3
3
  * Helper function to get all of the grid indexes between two grid indexes on either a horizontal or
4
4
  * vertical line, inclusive on both ends.
5
5
  *
6
+ * If the first grid index is greater than the second grid index, the two will be swapped.
7
+ *
6
8
  * This function will throw a run-time error if the two provided grid indexes are not on the same
7
9
  * horizontal or vertical line.
8
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"gridIndex.d.ts","sourceRoot":"","sources":["../../src/functions/gridIndex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAIzD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,GAAG,EACf,UAAU,EAAE,GAAG,EACf,SAAS,EAAE,SAAS,GACnB,SAAS,GAAG,EAAE,CAwBhB"}
1
+ {"version":3,"file":"gridIndex.d.ts","sourceRoot":"","sources":["../../src/functions/gridIndex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAIzD;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,GAAG,EACf,UAAU,EAAE,GAAG,EACf,SAAS,EAAE,SAAS,GACnB,SAAS,GAAG,EAAE,CAwBhB"}
@@ -8,6 +8,8 @@ local iRange = ____utils.iRange
8
8
  --- Helper function to get all of the grid indexes between two grid indexes on either a horizontal or
9
9
  -- vertical line, inclusive on both ends.
10
10
  --
11
+ -- If the first grid index is greater than the second grid index, the two will be swapped.
12
+ --
11
13
  -- This function will throw a run-time error if the two provided grid indexes are not on the same
12
14
  -- horizontal or vertical line.
13
15
  function ____exports.getGridIndexesBetween(self, gridIndex1, gridIndex2, roomShape)
@@ -22,7 +22,7 @@ export declare function assertNotNull<T>(value: T, ...[msg]: [null] extends [T]
22
22
  * end and exclusive on the high end. (The "e" in the function name stands for exclusive.) Thus,
23
23
  * this function works in a similar way as the built-in `range` function from Python.
24
24
  *
25
- * If the end is lower than the start, then the range will be reversed.
25
+ * If the end is lower than the start, an empty array will be returned.
26
26
  *
27
27
  * For example:
28
28
  *
@@ -31,7 +31,6 @@ export declare function assertNotNull<T>(value: T, ...[msg]: [null] extends [T]
31
31
  * - `eRange(-3)` returns `[0, -1, -2]`.
32
32
  * - `eRange(1, 3)` returns `[1, 2]`.
33
33
  * - `eRange(2, 5)` returns `[2, 3, 4]`.
34
- * - `eRange(5, 2)` returns `[5, 4, 3]`.
35
34
  *
36
35
  * @param start The integer to start at.
37
36
  * @param end Optional. The integer to end at. If not specified, then the start will be 0 and the
@@ -48,7 +47,7 @@ export declare function getTraversalDescription(key: unknown, traversalDescripti
48
47
  * Helper function to return an array of integers with the specified range, inclusive on both ends.
49
48
  * (The "i" in the function name stands for inclusive.)
50
49
  *
51
- * If the end is lower than the start, then the range will be reversed.
50
+ * If the end is lower than the start, an empty array will be returned.
52
51
  *
53
52
  * For example:
54
53
  *
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/functions/utils.ts"],"names":[],"mappings":";AAIA;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,KAAK,EAAE,CAAC,EACR,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,SAAS,C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AAG,EAAE,GAAG,GAAG,OAAO,CAE/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAMvC;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAiBtC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAI7D;AAED;;;;;;;;;;;;;;GAcG;AAEH,wBAAgB,IAAI,CAAC,GAAG,IAAI,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CAAG"}
@@ -36,7 +36,7 @@ end
36
36
  -- end and exclusive on the high end. (The "e" in the function name stands for exclusive.) Thus,
37
37
  -- this function works in a similar way as the built-in `range` function from Python.
38
38
  --
39
- -- If the end is lower than the start, then the range will be reversed.
39
+ -- If the end is lower than the start, an empty array will be returned.
40
40
  --
41
41
  -- For example:
42
42
  --
@@ -45,7 +45,6 @@ end
45
45
  -- - `eRange(-3)` returns `[0, -1, -2]`.
46
46
  -- - `eRange(1, 3)` returns `[1, 2]`.
47
47
  -- - `eRange(2, 5)` returns `[2, 3, 4]`.
48
- -- - `eRange(5, 2)` returns `[5, 4, 3]`.
49
48
  --
50
49
  -- @param start The integer to start at.
51
50
  -- @param end Optional. The integer to end at. If not specified, then the start will be 0 and the
@@ -59,21 +58,11 @@ function ____exports.eRange(self, start, ____end, increment)
59
58
  return ____exports.eRange(nil, 0, start, increment)
60
59
  end
61
60
  local array = {}
62
- if start < ____end then
63
- do
64
- local i = start
65
- while i < ____end do
66
- array[#array + 1] = i
67
- i = i + increment
68
- end
69
- end
70
- else
71
- do
72
- local i = start
73
- while i > ____end do
74
- array[#array + 1] = i
75
- i = i - increment
76
- end
61
+ do
62
+ local i = start
63
+ while i < ____end do
64
+ array[#array + 1] = i
65
+ i = i + increment
77
66
  end
78
67
  end
79
68
  return array
@@ -90,7 +79,7 @@ end
90
79
  --- Helper function to return an array of integers with the specified range, inclusive on both ends.
91
80
  -- (The "i" in the function name stands for inclusive.)
92
81
  --
93
- -- If the end is lower than the start, then the range will be reversed.
82
+ -- If the end is lower than the start, an empty array will be returned.
94
83
  --
95
84
  -- For example:
96
85
  --
@@ -112,9 +101,7 @@ function ____exports.iRange(self, start, ____end, increment)
112
101
  if ____end == nil then
113
102
  return ____exports.iRange(nil, 0, start, increment)
114
103
  end
115
- local rangeIncreasing = start <= ____end
116
- local exclusiveEnd = rangeIncreasing and ____end + 1 or ____end - 1
117
- return ____exports.eRange(nil, start, exclusiveEnd, increment)
104
+ return ____exports.eRange(nil, start, ____end + 1, increment)
118
105
  end
119
106
  --- Helper function to check if a variable is within a certain range, inclusive on both ends.
120
107
  --
@@ -4260,6 +4260,34 @@ declare class EdenStartingStatsHealth extends Feature {
4260
4260
  private readonly postPlayerInit;
4261
4261
  private getEdenStats;
4262
4262
  private getEdenHealth;
4263
+ /**
4264
+ * We must use the `POST_PLAYER_COLLECTIBLE_ADDED` callback since the collectibles are not yet
4265
+ * granted in the `POST_PLAYER_INIT` callback.
4266
+ */
4267
+ private readonly postPlayerCollectibleAdded;
4268
+ /**
4269
+ * Helper function to get the active collectible that Eden started with at the beginning of the
4270
+ * run.
4271
+ *
4272
+ * Returns undefined if passed a player that is not Eden or if the starting collectibles are not
4273
+ * yet added. (Eden's starting collectibles are added after the `POST_PLAYER_INIT` callback has
4274
+ * fired.)
4275
+ *
4276
+ * @public
4277
+ */
4278
+ getEdenStartingActiveCollectible(player: EntityPlayer): CollectibleType | undefined;
4279
+ /**
4280
+ * Helper function to get an array containing the active collectible and the passive collectible
4281
+ * that Eden started with at the beginning of the run. The active collectible will be the first
4282
+ * element and the passive collectible will be the second element.
4283
+ *
4284
+ * Returns an empty array if passed a player that is not Eden or if the starting collectibles are
4285
+ * not yet added. (Eden's starting collectibles are added after the `POST_PLAYER_INIT` callback
4286
+ * has fired.)
4287
+ *
4288
+ * @public
4289
+ */
4290
+ getEdenStartingCollectibles(player: EntityPlayer): CollectibleType[];
4263
4291
  /**
4264
4292
  * Helper function to get the health that Eden started with at the beginning of the run before any
4265
4293
  * of the random collectibles were added.
@@ -4271,6 +4299,17 @@ declare class EdenStartingStatsHealth extends Feature {
4271
4299
  * @public
4272
4300
  */
4273
4301
  getEdenStartingHealth(player: EntityPlayer): Readonly<PlayerHealth> | undefined;
4302
+ /**
4303
+ * Helper function to get the passive collectible that Eden started with at the beginning of the
4304
+ * run.
4305
+ *
4306
+ * Returns undefined if passed a player that is not Eden or if the starting collectibles are not
4307
+ * yet added. (Eden's starting collectibles are added after the `POST_PLAYER_INIT` callback has
4308
+ * fired.)
4309
+ *
4310
+ * @public
4311
+ */
4312
+ getEdenStartingPassiveCollectible(player: EntityPlayer): CollectibleType | undefined;
4274
4313
  /**
4275
4314
  * Helper function to get the value of the randomized starting stat for Eden that was assigned at
4276
4315
  * the beginning of the run before any of the random collectibles were added.
@@ -4348,7 +4387,7 @@ export declare type ERange<Low extends number, High extends number> = Exclude<Na
4348
4387
  * end and exclusive on the high end. (The "e" in the function name stands for exclusive.) Thus,
4349
4388
  * this function works in a similar way as the built-in `range` function from Python.
4350
4389
  *
4351
- * If the end is lower than the start, then the range will be reversed.
4390
+ * If the end is lower than the start, an empty array will be returned.
4352
4391
  *
4353
4392
  * For example:
4354
4393
  *
@@ -4357,7 +4396,6 @@ export declare type ERange<Low extends number, High extends number> = Exclude<Na
4357
4396
  * - `eRange(-3)` returns `[0, -1, -2]`.
4358
4397
  * - `eRange(1, 3)` returns `[1, 2]`.
4359
4398
  * - `eRange(2, 5)` returns `[2, 3, 4]`.
4360
- * - `eRange(5, 2)` returns `[5, 4, 3]`.
4361
4399
  *
4362
4400
  * @param start The integer to start at.
4363
4401
  * @param end Optional. The integer to end at. If not specified, then the start will be 0 and the
@@ -4625,13 +4663,13 @@ export declare function fireProjectiles(npc: EntityNPC | undefined, position: Ve
4625
4663
  */
4626
4664
  export declare function fireProjectilesInCircle(npc: EntityNPC | undefined, position: Vector, speed: float, numProjectiles: int): readonly EntityProjectile[];
4627
4665
 
4628
- /** Equal to `Card.FOOL`. */
4666
+ /** Equal to `Card.FOOL` (1). */
4629
4667
  export declare const FIRST_CARD_TYPE = CardType.FOOL;
4630
4668
 
4631
- /** Equal to `PlayerType.ISAAC`. */
4669
+ /** Equal to `PlayerType.ISAAC` (0). */
4632
4670
  export declare const FIRST_CHARACTER = PlayerType.ISAAC;
4633
4671
 
4634
- /** Equal to `CollectibleType.SAD_ONION`. */
4672
+ /** Equal to `CollectibleType.SAD_ONION` (1). */
4635
4673
  export declare const FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION;
4636
4674
 
4637
4675
  /**
@@ -4643,16 +4681,16 @@ export declare const FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION;
4643
4681
  */
4644
4682
  export declare const FIRST_GLITCHED_COLLECTIBLE_TYPE: CollectibleType;
4645
4683
 
4646
- /** Equal to `PillColor.HORSE_BLUE_BLUE`. */
4684
+ /** Equal to `PillColor.HORSE_BLUE_BLUE` (2049). */
4647
4685
  export declare const FIRST_HORSE_PILL_COLOR = PillColor.HORSE_BLUE_BLUE;
4648
4686
 
4649
- /** Equal to `PillColor.BLUE_BLUE`. */
4687
+ /** Equal to `PillColor.BLUE_BLUE` (1). */
4650
4688
  export declare const FIRST_PILL_COLOR = PillColor.BLUE_BLUE;
4651
4689
 
4652
- /** Equal to `PillEffect.BAD_GAS`. */
4690
+ /** Equal to `PillEffect.BAD_GAS` (0). */
4653
4691
  export declare const FIRST_PILL_EFFECT = PillEffect.BAD_GAS;
4654
4692
 
4655
- /** Equal to `TrinketType.SWALLOWED_PENNY`. */
4693
+ /** Equal to `TrinketType.SWALLOWED_PENNY` (1). */
4656
4694
  export declare const FIRST_TRINKET_TYPE = TrinketType.SWALLOWED_PENNY;
4657
4695
 
4658
4696
  declare class FlipDetection extends Feature {
@@ -6050,6 +6088,8 @@ export declare function getGridIndexDelta(roomShape: RoomShape, doorSlot: DoorSl
6050
6088
  * Helper function to get all of the grid indexes between two grid indexes on either a horizontal or
6051
6089
  * vertical line, inclusive on both ends.
6052
6090
  *
6091
+ * If the first grid index is greater than the second grid index, the two will be swapped.
6092
+ *
6053
6093
  * This function will throw a run-time error if the two provided grid indexes are not on the same
6054
6094
  * horizontal or vertical line.
6055
6095
  */
@@ -8831,7 +8871,7 @@ export declare type IRange<Low extends number, High extends number> = Exclude<Na
8831
8871
  * Helper function to return an array of integers with the specified range, inclusive on both ends.
8832
8872
  * (The "i" in the function name stands for inclusive.)
8833
8873
  *
8834
- * If the end is lower than the start, then the range will be reversed.
8874
+ * If the end is lower than the start, an empty array will be returned.
8835
8875
  *
8836
8876
  * For example:
8837
8877
  *
@@ -10606,7 +10646,7 @@ export declare enum LadderSubTypeCustom {
10606
10646
  }
10607
10647
 
10608
10648
  /**
10609
- * Equal to `PillColor.HORSE_WHITE_YELLOW`.
10649
+ * Equal to `PillColor.HORSE_WHITE_YELLOW` (2061).
10610
10650
  *
10611
10651
  * Note that `PillColor.HORSE_GOLD` is technically higher, but that is not considered for the
10612
10652
  * purposes of this constant.
@@ -10614,7 +10654,7 @@ export declare enum LadderSubTypeCustom {
10614
10654
  export declare const LAST_HORSE_PILL_COLOR = PillColor.HORSE_WHITE_YELLOW;
10615
10655
 
10616
10656
  /**
10617
- * Equal to `PillColor.WHITE_YELLOW`.
10657
+ * Equal to `PillColor.WHITE_YELLOW` (13).
10618
10658
  *
10619
10659
  * Note that `PillColor.GOLD` is technically higher, but that is not considered for the purposes of
10620
10660
  * this constant.
@@ -14913,6 +14953,10 @@ declare class NoSirenSteal extends Feature {
14913
14953
  */
14914
14954
  export declare const NUM_DIMENSIONS: number;
14915
14955
 
14956
+ /**
14957
+ * Calculated from the difference between the first pill color and the last pill color. This does
14958
+ * not include Gold Pills. In Repentance, this should be equal to 13.
14959
+ */
14916
14960
  export declare const NUM_NORMAL_PILL_COLORS: number;
14917
14961
 
14918
14962
  /**
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 83.4.0
3
+ isaacscript-common 83.5.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -13067,6 +13067,9 @@ return ____exports
13067
13067
  ["lua_modules.isaac-typescript-definitions.dist.enums.PillEffect"] = function(...)
13068
13068
  local ____exports = {}
13069
13069
  --- This enum is contiguous. (Every value is satisfied between 0 and 49, inclusive.)
13070
+ --
13071
+ -- Note that the vanilla enum includes `NULL` (-1). Since it should be impossible to ever retrieve
13072
+ -- this value from the API, it is removed from the IsaacScript enum.
13070
13073
  ____exports.PillEffect = {}
13071
13074
  ____exports.PillEffect.BAD_GAS = 0
13072
13075
  ____exports.PillEffect[____exports.PillEffect.BAD_GAS] = "BAD_GAS"
@@ -17807,7 +17810,7 @@ end
17807
17810
  -- end and exclusive on the high end. (The "e" in the function name stands for exclusive.) Thus,
17808
17811
  -- this function works in a similar way as the built-in `range` function from Python.
17809
17812
  --
17810
- -- If the end is lower than the start, then the range will be reversed.
17813
+ -- If the end is lower than the start, an empty array will be returned.
17811
17814
  --
17812
17815
  -- For example:
17813
17816
  --
@@ -17816,7 +17819,6 @@ end
17816
17819
  -- - `eRange(-3)` returns `[0, -1, -2]`.
17817
17820
  -- - `eRange(1, 3)` returns `[1, 2]`.
17818
17821
  -- - `eRange(2, 5)` returns `[2, 3, 4]`.
17819
- -- - `eRange(5, 2)` returns `[5, 4, 3]`.
17820
17822
  --
17821
17823
  -- @param start The integer to start at.
17822
17824
  -- @param end Optional. The integer to end at. If not specified, then the start will be 0 and the
@@ -17830,21 +17832,11 @@ function ____exports.eRange(self, start, ____end, increment)
17830
17832
  return ____exports.eRange(nil, 0, start, increment)
17831
17833
  end
17832
17834
  local array = {}
17833
- if start < ____end then
17834
- do
17835
- local i = start
17836
- while i < ____end do
17837
- array[#array + 1] = i
17838
- i = i + increment
17839
- end
17840
- end
17841
- else
17842
- do
17843
- local i = start
17844
- while i > ____end do
17845
- array[#array + 1] = i
17846
- i = i - increment
17847
- end
17835
+ do
17836
+ local i = start
17837
+ while i < ____end do
17838
+ array[#array + 1] = i
17839
+ i = i + increment
17848
17840
  end
17849
17841
  end
17850
17842
  return array
@@ -17861,7 +17853,7 @@ end
17861
17853
  --- Helper function to return an array of integers with the specified range, inclusive on both ends.
17862
17854
  -- (The "i" in the function name stands for inclusive.)
17863
17855
  --
17864
- -- If the end is lower than the start, then the range will be reversed.
17856
+ -- If the end is lower than the start, an empty array will be returned.
17865
17857
  --
17866
17858
  -- For example:
17867
17859
  --
@@ -17883,9 +17875,7 @@ function ____exports.iRange(self, start, ____end, increment)
17883
17875
  if ____end == nil then
17884
17876
  return ____exports.iRange(nil, 0, start, increment)
17885
17877
  end
17886
- local rangeIncreasing = start <= ____end
17887
- local exclusiveEnd = rangeIncreasing and ____end + 1 or ____end - 1
17888
- return ____exports.eRange(nil, start, exclusiveEnd, increment)
17878
+ return ____exports.eRange(nil, start, ____end + 1, increment)
17889
17879
  end
17890
17880
  --- Helper function to check if a variable is within a certain range, inclusive on both ends.
17891
17881
  --
@@ -20189,9 +20179,7 @@ local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
20189
20179
  local ____enums = require("functions.enums")
20190
20180
  local getEnumLength = ____enums.getEnumLength
20191
20181
  local getHighestEnumValue = ____enums.getHighestEnumValue
20192
- local ____utils = require("functions.utils")
20193
- local iRange = ____utils.iRange
20194
- --- Equal to `CollectibleType.SAD_ONION`.
20182
+ --- Equal to `CollectibleType.SAD_ONION` (1).
20195
20183
  ____exports.FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION
20196
20184
  --- Calculated from the `CollectibleType` enum.
20197
20185
  --
@@ -20200,7 +20188,7 @@ ____exports.FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION
20200
20188
  ____exports.LAST_VANILLA_COLLECTIBLE_TYPE = getHighestEnumValue(nil, CollectibleType)
20201
20189
  --- Calculated from the `CollectibleType` enum. (`CollectibleType.NULL` is not included.)
20202
20190
  ____exports.NUM_VANILLA_COLLECTIBLE_TYPES = getEnumLength(nil, CollectibleType) - 1
20203
- --- Equal to `TrinketType.SWALLOWED_PENNY`.
20191
+ --- Equal to `TrinketType.SWALLOWED_PENNY` (1).
20204
20192
  ____exports.FIRST_TRINKET_TYPE = TrinketType.SWALLOWED_PENNY
20205
20193
  --- Calculated from the `TrinketType` enum.
20206
20194
  --
@@ -20209,35 +20197,37 @@ ____exports.FIRST_TRINKET_TYPE = TrinketType.SWALLOWED_PENNY
20209
20197
  ____exports.LAST_VANILLA_TRINKET_TYPE = getHighestEnumValue(nil, TrinketType)
20210
20198
  --- Calculated from the `TrinketType` enum. (`TrinketType.NULL` is not included.)
20211
20199
  ____exports.NUM_VANILLA_TRINKET_TYPES = getEnumLength(nil, TrinketType) - 1
20212
- --- Equal to `Card.FOOL`.
20200
+ --- Equal to `Card.FOOL` (1).
20213
20201
  ____exports.FIRST_CARD_TYPE = CardType.FOOL
20214
20202
  --- Calculated from the `CardType` enum.
20215
20203
  ____exports.LAST_VANILLA_CARD_TYPE = getHighestEnumValue(nil, CardType)
20216
20204
  --- Calculated from the `Card` enum. `Card.NULL` is not included.
20217
20205
  ____exports.NUM_VANILLA_CARD_TYPES = getEnumLength(nil, CardType) - 1
20218
- --- Equal to `PillEffect.BAD_GAS`.
20206
+ --- Equal to `PillEffect.BAD_GAS` (0).
20219
20207
  ____exports.FIRST_PILL_EFFECT = PillEffect.BAD_GAS
20220
20208
  --- Calculated from the `PillEffect` enum.
20221
20209
  ____exports.LAST_VANILLA_PILL_EFFECT = getHighestEnumValue(nil, PillEffect)
20222
20210
  --- Calculated from the `PillEffect` enum. (There is no `PillEffect.NULL` in the custom enum, so we
20223
20211
  -- do not have to subtract one here.)
20224
20212
  ____exports.NUM_VANILLA_PILL_EFFECTS = getEnumLength(nil, PillEffect)
20225
- --- Equal to `PillColor.BLUE_BLUE`.
20213
+ --- Equal to `PillColor.BLUE_BLUE` (1).
20226
20214
  ____exports.FIRST_PILL_COLOR = PillColor.BLUE_BLUE
20227
- --- Equal to `PillColor.WHITE_YELLOW`.
20215
+ --- Equal to `PillColor.WHITE_YELLOW` (13).
20228
20216
  --
20229
20217
  -- Note that `PillColor.GOLD` is technically higher, but that is not considered for the purposes of
20230
20218
  -- this constant.
20231
20219
  ____exports.LAST_NORMAL_PILL_COLOR = PillColor.WHITE_YELLOW
20232
- --- Equal to `PillColor.HORSE_BLUE_BLUE`.
20220
+ --- Equal to `PillColor.HORSE_BLUE_BLUE` (2049).
20233
20221
  ____exports.FIRST_HORSE_PILL_COLOR = PillColor.HORSE_BLUE_BLUE
20234
- --- Equal to `PillColor.HORSE_WHITE_YELLOW`.
20222
+ --- Equal to `PillColor.HORSE_WHITE_YELLOW` (2061).
20235
20223
  --
20236
20224
  -- Note that `PillColor.HORSE_GOLD` is technically higher, but that is not considered for the
20237
20225
  -- purposes of this constant.
20238
20226
  ____exports.LAST_HORSE_PILL_COLOR = PillColor.HORSE_WHITE_YELLOW
20239
- ____exports.NUM_NORMAL_PILL_COLORS = #iRange(nil, ____exports.FIRST_PILL_COLOR, ____exports.LAST_NORMAL_PILL_COLOR)
20240
- --- Equal to `PlayerType.ISAAC`.
20227
+ --- Calculated from the difference between the first pill color and the last pill color. This does
20228
+ -- not include Gold Pills. In Repentance, this should be equal to 13.
20229
+ ____exports.NUM_NORMAL_PILL_COLORS = ____exports.LAST_NORMAL_PILL_COLOR - ____exports.FIRST_PILL_COLOR + 1
20230
+ --- Equal to `PlayerType.ISAAC` (0).
20241
20231
  ____exports.FIRST_CHARACTER = PlayerType.ISAAC
20242
20232
  --- Calculated from the `PlayerType` enum.
20243
20233
  ____exports.LAST_VANILLA_CHARACTER = getHighestEnumValue(nil, PlayerType)
@@ -53742,6 +53732,8 @@ local iRange = ____utils.iRange
53742
53732
  --- Helper function to get all of the grid indexes between two grid indexes on either a horizontal or
53743
53733
  -- vertical line, inclusive on both ends.
53744
53734
  --
53735
+ -- If the first grid index is greater than the second grid index, the two will be swapped.
53736
+ --
53745
53737
  -- This function will throw a run-time error if the two provided grid indexes are not on the same
53746
53738
  -- horizontal or vertical line.
53747
53739
  function ____exports.getGridIndexesBetween(self, gridIndex1, gridIndex2, roomShape)
@@ -55095,8 +55087,13 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescri
55095
55087
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
55096
55088
  local ____decorators = require("decorators")
55097
55089
  local Exported = ____decorators.Exported
55090
+ local ____ModCallbackCustom = require("enums.ModCallbackCustom")
55091
+ local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
55092
+ local ____collectibles = require("functions.collectibles")
55093
+ local isActiveCollectible = ____collectibles.isActiveCollectible
55098
55094
  local ____playerDataStructures = require("functions.playerDataStructures")
55099
55095
  local mapGetPlayer = ____playerDataStructures.mapGetPlayer
55096
+ local mapHasPlayer = ____playerDataStructures.mapHasPlayer
55100
55097
  local mapSetPlayer = ____playerDataStructures.mapSetPlayer
55101
55098
  local ____playerHealth = require("functions.playerHealth")
55102
55099
  local getPlayerHealth = ____playerHealth.getPlayerHealth
@@ -55107,6 +55104,8 @@ local getPlayerStats = ____stats.getPlayerStats
55107
55104
  local ____Feature = require("classes.private.Feature")
55108
55105
  local Feature = ____Feature.Feature
55109
55106
  local v = {run = {
55107
+ edenActiveCollectibles = __TS__New(Map),
55108
+ edenPassiveCollectibles = __TS__New(Map),
55110
55109
  edenPlayerStats = __TS__New(Map),
55111
55110
  edenPlayerHealth = __TS__New(Map)
55112
55111
  }}
@@ -55124,7 +55123,17 @@ function EdenStartingStatsHealth.prototype.____constructor(self)
55124
55123
  self:getEdenStats(player)
55125
55124
  self:getEdenHealth(player)
55126
55125
  end
55126
+ self.postPlayerCollectibleAdded = function(____, player, collectibleType)
55127
+ if not isEden(nil, player) then
55128
+ return
55129
+ end
55130
+ local map = isActiveCollectible(nil, collectibleType) and v.run.edenActiveCollectibles or v.run.edenPassiveCollectibles
55131
+ if not mapHasPlayer(nil, map, player) then
55132
+ mapSetPlayer(nil, map, player, collectibleType)
55133
+ end
55134
+ end
55127
55135
  self.callbacksUsed = {{ModCallback.POST_PLAYER_INIT, self.postPlayerInit}}
55136
+ self.customCallbacksUsed = {{ModCallbackCustom.POST_PLAYER_COLLECTIBLE_ADDED, self.postPlayerCollectibleAdded}}
55128
55137
  end
55129
55138
  function EdenStartingStatsHealth.prototype.getEdenStats(self, player)
55130
55139
  local existingStatMap = mapGetPlayer(nil, v.run.edenPlayerStats, player)
@@ -55142,10 +55151,31 @@ function EdenStartingStatsHealth.prototype.getEdenHealth(self, player)
55142
55151
  local playerHealth = getPlayerHealth(nil, player)
55143
55152
  mapSetPlayer(nil, v.run.edenPlayerHealth, player, playerHealth)
55144
55153
  end
55154
+ function EdenStartingStatsHealth.prototype.getEdenStartingActiveCollectible(self, player)
55155
+ return mapGetPlayer(nil, v.run.edenActiveCollectibles, player)
55156
+ end
55157
+ __TS__DecorateLegacy({Exported}, EdenStartingStatsHealth.prototype, "getEdenStartingActiveCollectible", true)
55158
+ function EdenStartingStatsHealth.prototype.getEdenStartingCollectibles(self, player)
55159
+ local collectibleTypes = {}
55160
+ local activeCollectibleType = mapGetPlayer(nil, v.run.edenActiveCollectibles, player)
55161
+ if activeCollectibleType ~= nil then
55162
+ collectibleTypes[#collectibleTypes + 1] = activeCollectibleType
55163
+ end
55164
+ local passiveCollectibleType = mapGetPlayer(nil, v.run.edenPassiveCollectibles, player)
55165
+ if passiveCollectibleType ~= nil then
55166
+ collectibleTypes[#collectibleTypes + 1] = passiveCollectibleType
55167
+ end
55168
+ return collectibleTypes
55169
+ end
55170
+ __TS__DecorateLegacy({Exported}, EdenStartingStatsHealth.prototype, "getEdenStartingCollectibles", true)
55145
55171
  function EdenStartingStatsHealth.prototype.getEdenStartingHealth(self, player)
55146
55172
  return mapGetPlayer(nil, v.run.edenPlayerHealth, player)
55147
55173
  end
55148
55174
  __TS__DecorateLegacy({Exported}, EdenStartingStatsHealth.prototype, "getEdenStartingHealth", true)
55175
+ function EdenStartingStatsHealth.prototype.getEdenStartingPassiveCollectible(self, player)
55176
+ return mapGetPlayer(nil, v.run.edenPassiveCollectibles, player)
55177
+ end
55178
+ __TS__DecorateLegacy({Exported}, EdenStartingStatsHealth.prototype, "getEdenStartingPassiveCollectible", true)
55149
55179
  function EdenStartingStatsHealth.prototype.getEdenStartingStat(self, player, playerStat)
55150
55180
  local playerStats = mapGetPlayer(nil, v.run.edenPlayerStats, player)
55151
55181
  if playerStats == nil then
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.38.4"
8
+ "packageVersion": "7.38.5"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "83.4.1",
3
+ "version": "84.0.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -37,6 +37,6 @@
37
37
  "lint": "tsx --tsconfig ./scripts/tsconfig.json ./scripts/lint.mts"
38
38
  },
39
39
  "dependencies": {
40
- "isaac-typescript-definitions": "^40.0.1"
40
+ "isaac-typescript-definitions": "^40.0.2"
41
41
  }
42
42
  }
@@ -1,8 +1,12 @@
1
+ import type { CollectibleType } from "isaac-typescript-definitions";
1
2
  import { ModCallback } from "isaac-typescript-definitions";
2
3
  import { Exported } from "../../../decorators";
4
+ import { ModCallbackCustom } from "../../../enums/ModCallbackCustom";
3
5
  import type { PlayerStat } from "../../../enums/PlayerStat";
6
+ import { isActiveCollectible } from "../../../functions/collectibles";
4
7
  import {
5
8
  mapGetPlayer,
9
+ mapHasPlayer,
6
10
  mapSetPlayer,
7
11
  } from "../../../functions/playerDataStructures";
8
12
  import { getPlayerHealth } from "../../../functions/playerHealth";
@@ -15,6 +19,8 @@ import { Feature } from "../../private/Feature";
15
19
 
16
20
  const v = {
17
21
  run: {
22
+ edenActiveCollectibles: new Map<PlayerIndex, CollectibleType>(),
23
+ edenPassiveCollectibles: new Map<PlayerIndex, CollectibleType>(),
18
24
  edenPlayerStats: new Map<PlayerIndex, PlayerStats>(),
19
25
  edenPlayerHealth: new Map<PlayerIndex, PlayerHealth>(),
20
26
  },
@@ -32,6 +38,13 @@ export class EdenStartingStatsHealth extends Feature {
32
38
  // 9
33
39
  [ModCallback.POST_PLAYER_INIT, this.postPlayerInit],
34
40
  ];
41
+
42
+ this.customCallbacksUsed = [
43
+ [
44
+ ModCallbackCustom.POST_PLAYER_COLLECTIBLE_ADDED,
45
+ this.postPlayerCollectibleAdded,
46
+ ],
47
+ ];
35
48
  }
36
49
 
37
50
  /**
@@ -67,6 +80,80 @@ export class EdenStartingStatsHealth extends Feature {
67
80
  mapSetPlayer(v.run.edenPlayerHealth, player, playerHealth);
68
81
  }
69
82
 
83
+ /**
84
+ * We must use the `POST_PLAYER_COLLECTIBLE_ADDED` callback since the collectibles are not yet
85
+ * granted in the `POST_PLAYER_INIT` callback.
86
+ */
87
+ private readonly postPlayerCollectibleAdded = (
88
+ player: EntityPlayer,
89
+ collectibleType: CollectibleType,
90
+ ): void => {
91
+ if (!isEden(player)) {
92
+ return;
93
+ }
94
+
95
+ const map = isActiveCollectible(collectibleType)
96
+ ? v.run.edenActiveCollectibles
97
+ : v.run.edenPassiveCollectibles;
98
+
99
+ if (!mapHasPlayer(map, player)) {
100
+ mapSetPlayer(map, player, collectibleType);
101
+ }
102
+ };
103
+
104
+ /**
105
+ * Helper function to get the active collectible that Eden started with at the beginning of the
106
+ * run.
107
+ *
108
+ * Returns undefined if passed a player that is not Eden or if the starting collectibles are not
109
+ * yet added. (Eden's starting collectibles are added after the `POST_PLAYER_INIT` callback has
110
+ * fired.)
111
+ *
112
+ * @public
113
+ */
114
+ @Exported
115
+ public getEdenStartingActiveCollectible(
116
+ player: EntityPlayer,
117
+ ): CollectibleType | undefined {
118
+ return mapGetPlayer(v.run.edenActiveCollectibles, player);
119
+ }
120
+
121
+ /**
122
+ * Helper function to get an array containing the active collectible and the passive collectible
123
+ * that Eden started with at the beginning of the run. The active collectible will be the first
124
+ * element and the passive collectible will be the second element.
125
+ *
126
+ * Returns an empty array if passed a player that is not Eden or if the starting collectibles are
127
+ * not yet added. (Eden's starting collectibles are added after the `POST_PLAYER_INIT` callback
128
+ * has fired.)
129
+ *
130
+ * @public
131
+ */
132
+ @Exported
133
+ public getEdenStartingCollectibles(player: EntityPlayer): CollectibleType[] {
134
+ const collectibleTypes: CollectibleType[] = [];
135
+
136
+ const activeCollectibleType = mapGetPlayer(
137
+ v.run.edenActiveCollectibles,
138
+ player,
139
+ );
140
+
141
+ if (activeCollectibleType !== undefined) {
142
+ collectibleTypes.push(activeCollectibleType);
143
+ }
144
+
145
+ const passiveCollectibleType = mapGetPlayer(
146
+ v.run.edenPassiveCollectibles,
147
+ player,
148
+ );
149
+
150
+ if (passiveCollectibleType !== undefined) {
151
+ collectibleTypes.push(passiveCollectibleType);
152
+ }
153
+
154
+ return collectibleTypes;
155
+ }
156
+
70
157
  /**
71
158
  * Helper function to get the health that Eden started with at the beginning of the run before any
72
159
  * of the random collectibles were added.
@@ -84,6 +171,23 @@ export class EdenStartingStatsHealth extends Feature {
84
171
  return mapGetPlayer(v.run.edenPlayerHealth, player);
85
172
  }
86
173
 
174
+ /**
175
+ * Helper function to get the passive collectible that Eden started with at the beginning of the
176
+ * run.
177
+ *
178
+ * Returns undefined if passed a player that is not Eden or if the starting collectibles are not
179
+ * yet added. (Eden's starting collectibles are added after the `POST_PLAYER_INIT` callback has
180
+ * fired.)
181
+ *
182
+ * @public
183
+ */
184
+ @Exported
185
+ public getEdenStartingPassiveCollectible(
186
+ player: EntityPlayer,
187
+ ): CollectibleType | undefined {
188
+ return mapGetPlayer(v.run.edenPassiveCollectibles, player);
189
+ }
190
+
87
191
  /**
88
192
  * Helper function to get the value of the randomized starting stat for Eden that was assigned at
89
193
  * the beginning of the run before any of the random collectibles were added.
@@ -14,13 +14,12 @@ import {
14
14
  TrinketType,
15
15
  } from "isaac-typescript-definitions";
16
16
  import { getEnumLength, getHighestEnumValue } from "../functions/enums";
17
- import { iRange } from "../functions/utils";
18
17
 
19
18
  // ------------
20
19
  // Collectibles
21
20
  // ------------
22
21
 
23
- /** Equal to `CollectibleType.SAD_ONION`. */
22
+ /** Equal to `CollectibleType.SAD_ONION` (1). */
24
23
  export const FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION;
25
24
 
26
25
  /**
@@ -39,7 +38,7 @@ export const NUM_VANILLA_COLLECTIBLE_TYPES = getEnumLength(CollectibleType) - 1;
39
38
  // Trinkets
40
39
  // --------
41
40
 
42
- /** Equal to `TrinketType.SWALLOWED_PENNY`. */
41
+ /** Equal to `TrinketType.SWALLOWED_PENNY` (1). */
43
42
  export const FIRST_TRINKET_TYPE = TrinketType.SWALLOWED_PENNY;
44
43
 
45
44
  /**
@@ -57,7 +56,7 @@ export const NUM_VANILLA_TRINKET_TYPES = getEnumLength(TrinketType) - 1;
57
56
  // Cards
58
57
  // -----
59
58
 
60
- /** Equal to `Card.FOOL`. */
59
+ /** Equal to `Card.FOOL` (1). */
61
60
  export const FIRST_CARD_TYPE = CardType.FOOL;
62
61
 
63
62
  /** Calculated from the `CardType` enum. */
@@ -70,7 +69,7 @@ export const NUM_VANILLA_CARD_TYPES = getEnumLength(CardType) - 1;
70
69
  // Pill Effects
71
70
  // ------------
72
71
 
73
- /** Equal to `PillEffect.BAD_GAS`. */
72
+ /** Equal to `PillEffect.BAD_GAS` (0). */
74
73
  export const FIRST_PILL_EFFECT = PillEffect.BAD_GAS;
75
74
 
76
75
  /** Calculated from the `PillEffect` enum. */
@@ -86,38 +85,40 @@ export const NUM_VANILLA_PILL_EFFECTS = getEnumLength(PillEffect);
86
85
  // Pill Colors
87
86
  // -----------
88
87
 
89
- /** Equal to `PillColor.BLUE_BLUE`. */
88
+ /** Equal to `PillColor.BLUE_BLUE` (1). */
90
89
  export const FIRST_PILL_COLOR = PillColor.BLUE_BLUE;
91
90
 
92
91
  /**
93
- * Equal to `PillColor.WHITE_YELLOW`.
92
+ * Equal to `PillColor.WHITE_YELLOW` (13).
94
93
  *
95
94
  * Note that `PillColor.GOLD` is technically higher, but that is not considered for the purposes of
96
95
  * this constant.
97
96
  */
98
97
  export const LAST_NORMAL_PILL_COLOR = PillColor.WHITE_YELLOW;
99
98
 
100
- /** Equal to `PillColor.HORSE_BLUE_BLUE`. */
99
+ /** Equal to `PillColor.HORSE_BLUE_BLUE` (2049). */
101
100
  export const FIRST_HORSE_PILL_COLOR = PillColor.HORSE_BLUE_BLUE;
102
101
 
103
102
  /**
104
- * Equal to `PillColor.HORSE_WHITE_YELLOW`.
103
+ * Equal to `PillColor.HORSE_WHITE_YELLOW` (2061).
105
104
  *
106
105
  * Note that `PillColor.HORSE_GOLD` is technically higher, but that is not considered for the
107
106
  * purposes of this constant.
108
107
  */
109
108
  export const LAST_HORSE_PILL_COLOR = PillColor.HORSE_WHITE_YELLOW;
110
109
 
111
- export const NUM_NORMAL_PILL_COLORS = iRange(
112
- FIRST_PILL_COLOR,
113
- LAST_NORMAL_PILL_COLOR,
114
- ).length;
110
+ /**
111
+ * Calculated from the difference between the first pill color and the last pill color. This does
112
+ * not include Gold Pills. In Repentance, this should be equal to 13.
113
+ */
114
+ export const NUM_NORMAL_PILL_COLORS =
115
+ LAST_NORMAL_PILL_COLOR - FIRST_PILL_COLOR + 1;
115
116
 
116
117
  // -------
117
118
  // Players
118
119
  // -------
119
120
 
120
- /** Equal to `PlayerType.ISAAC`. */
121
+ /** Equal to `PlayerType.ISAAC` (0). */
121
122
  export const FIRST_CHARACTER = PlayerType.ISAAC;
122
123
 
123
124
  // It is not possible to determine "LAST_PLAYER_TYPE", since there is no associated config.
@@ -6,6 +6,8 @@ import { iRange } from "./utils";
6
6
  * Helper function to get all of the grid indexes between two grid indexes on either a horizontal or
7
7
  * vertical line, inclusive on both ends.
8
8
  *
9
+ * If the first grid index is greater than the second grid index, the two will be swapped.
10
+ *
9
11
  * This function will throw a run-time error if the two provided grid indexes are not on the same
10
12
  * horizontal or vertical line.
11
13
  */
@@ -45,7 +45,7 @@ export function assertNotNull<T>(
45
45
  * end and exclusive on the high end. (The "e" in the function name stands for exclusive.) Thus,
46
46
  * this function works in a similar way as the built-in `range` function from Python.
47
47
  *
48
- * If the end is lower than the start, then the range will be reversed.
48
+ * If the end is lower than the start, an empty array will be returned.
49
49
  *
50
50
  * For example:
51
51
  *
@@ -54,7 +54,6 @@ export function assertNotNull<T>(
54
54
  * - `eRange(-3)` returns `[0, -1, -2]`.
55
55
  * - `eRange(1, 3)` returns `[1, 2]`.
56
56
  * - `eRange(2, 5)` returns `[2, 3, 4]`.
57
- * - `eRange(5, 2)` returns `[5, 4, 3]`.
58
57
  *
59
58
  * @param start The integer to start at.
60
59
  * @param end Optional. The integer to end at. If not specified, then the start will be 0 and the
@@ -68,14 +67,8 @@ export function eRange(start: int, end?: int, increment = 1): readonly int[] {
68
67
 
69
68
  const array: int[] = [];
70
69
 
71
- if (start < end) {
72
- for (let i = start; i < end; i += increment) {
73
- array.push(i);
74
- }
75
- } else {
76
- for (let i = start; i > end; i -= increment) {
77
- array.push(i);
78
- }
70
+ for (let i = start; i < end; i += increment) {
71
+ array.push(i);
79
72
  }
80
73
 
81
74
  return array;
@@ -102,7 +95,7 @@ export function getTraversalDescription(
102
95
  * Helper function to return an array of integers with the specified range, inclusive on both ends.
103
96
  * (The "i" in the function name stands for inclusive.)
104
97
  *
105
- * If the end is lower than the start, then the range will be reversed.
98
+ * If the end is lower than the start, an empty array will be returned.
106
99
  *
107
100
  * For example:
108
101
  *
@@ -123,9 +116,7 @@ export function iRange(start: int, end?: int, increment = 1): readonly int[] {
123
116
  return iRange(0, start, increment);
124
117
  }
125
118
 
126
- const rangeIncreasing = start <= end;
127
- const exclusiveEnd = rangeIncreasing ? end + 1 : end - 1;
128
- return eRange(start, exclusiveEnd, increment);
119
+ return eRange(start, end + 1, increment);
129
120
  }
130
121
 
131
122
  /**