isaacscript-common 83.4.1 → 83.5.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
@@ -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.
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 83.4.0
3
+ isaacscript-common 83.4.1
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -55095,8 +55095,13 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescri
55095
55095
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
55096
55096
  local ____decorators = require("decorators")
55097
55097
  local Exported = ____decorators.Exported
55098
+ local ____ModCallbackCustom = require("enums.ModCallbackCustom")
55099
+ local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
55100
+ local ____collectibles = require("functions.collectibles")
55101
+ local isActiveCollectible = ____collectibles.isActiveCollectible
55098
55102
  local ____playerDataStructures = require("functions.playerDataStructures")
55099
55103
  local mapGetPlayer = ____playerDataStructures.mapGetPlayer
55104
+ local mapHasPlayer = ____playerDataStructures.mapHasPlayer
55100
55105
  local mapSetPlayer = ____playerDataStructures.mapSetPlayer
55101
55106
  local ____playerHealth = require("functions.playerHealth")
55102
55107
  local getPlayerHealth = ____playerHealth.getPlayerHealth
@@ -55107,6 +55112,8 @@ local getPlayerStats = ____stats.getPlayerStats
55107
55112
  local ____Feature = require("classes.private.Feature")
55108
55113
  local Feature = ____Feature.Feature
55109
55114
  local v = {run = {
55115
+ edenActiveCollectibles = __TS__New(Map),
55116
+ edenPassiveCollectibles = __TS__New(Map),
55110
55117
  edenPlayerStats = __TS__New(Map),
55111
55118
  edenPlayerHealth = __TS__New(Map)
55112
55119
  }}
@@ -55124,7 +55131,17 @@ function EdenStartingStatsHealth.prototype.____constructor(self)
55124
55131
  self:getEdenStats(player)
55125
55132
  self:getEdenHealth(player)
55126
55133
  end
55134
+ self.postPlayerCollectibleAdded = function(____, player, collectibleType)
55135
+ if not isEden(nil, player) then
55136
+ return
55137
+ end
55138
+ local map = isActiveCollectible(nil, collectibleType) and v.run.edenActiveCollectibles or v.run.edenPassiveCollectibles
55139
+ if not mapHasPlayer(nil, map, player) then
55140
+ mapSetPlayer(nil, map, player, collectibleType)
55141
+ end
55142
+ end
55127
55143
  self.callbacksUsed = {{ModCallback.POST_PLAYER_INIT, self.postPlayerInit}}
55144
+ self.customCallbacksUsed = {{ModCallbackCustom.POST_PLAYER_COLLECTIBLE_ADDED, self.postPlayerCollectibleAdded}}
55128
55145
  end
55129
55146
  function EdenStartingStatsHealth.prototype.getEdenStats(self, player)
55130
55147
  local existingStatMap = mapGetPlayer(nil, v.run.edenPlayerStats, player)
@@ -55142,10 +55159,31 @@ function EdenStartingStatsHealth.prototype.getEdenHealth(self, player)
55142
55159
  local playerHealth = getPlayerHealth(nil, player)
55143
55160
  mapSetPlayer(nil, v.run.edenPlayerHealth, player, playerHealth)
55144
55161
  end
55162
+ function EdenStartingStatsHealth.prototype.getEdenStartingActiveCollectible(self, player)
55163
+ return mapGetPlayer(nil, v.run.edenActiveCollectibles, player)
55164
+ end
55165
+ __TS__DecorateLegacy({Exported}, EdenStartingStatsHealth.prototype, "getEdenStartingActiveCollectible", true)
55166
+ function EdenStartingStatsHealth.prototype.getEdenStartingCollectibles(self, player)
55167
+ local collectibleTypes = {}
55168
+ local activeCollectibleType = mapGetPlayer(nil, v.run.edenActiveCollectibles, player)
55169
+ if activeCollectibleType ~= nil then
55170
+ collectibleTypes[#collectibleTypes + 1] = activeCollectibleType
55171
+ end
55172
+ local passiveCollectibleType = mapGetPlayer(nil, v.run.edenPassiveCollectibles, player)
55173
+ if passiveCollectibleType ~= nil then
55174
+ collectibleTypes[#collectibleTypes + 1] = passiveCollectibleType
55175
+ end
55176
+ return collectibleTypes
55177
+ end
55178
+ __TS__DecorateLegacy({Exported}, EdenStartingStatsHealth.prototype, "getEdenStartingCollectibles", true)
55145
55179
  function EdenStartingStatsHealth.prototype.getEdenStartingHealth(self, player)
55146
55180
  return mapGetPlayer(nil, v.run.edenPlayerHealth, player)
55147
55181
  end
55148
55182
  __TS__DecorateLegacy({Exported}, EdenStartingStatsHealth.prototype, "getEdenStartingHealth", true)
55183
+ function EdenStartingStatsHealth.prototype.getEdenStartingPassiveCollectible(self, player)
55184
+ return mapGetPlayer(nil, v.run.edenPassiveCollectibles, player)
55185
+ end
55186
+ __TS__DecorateLegacy({Exported}, EdenStartingStatsHealth.prototype, "getEdenStartingPassiveCollectible", true)
55149
55187
  function EdenStartingStatsHealth.prototype.getEdenStartingStat(self, player, playerStat)
55150
55188
  local playerStats = mapGetPlayer(nil, v.run.edenPlayerStats, player)
55151
55189
  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": "83.5.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -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.