isaacscript-common 76.1.0 → 76.2.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.
@@ -21,6 +21,12 @@ export declare function anyPlayerHasCollectible(collectibleType: CollectibleType
21
21
  * in. Returns an empty array if the player does not have the collectible in any active slot.
22
22
  */
23
23
  export declare function getActiveItemSlots(player: EntityPlayer, collectibleType: CollectibleType): ActiveSlot[];
24
+ /**
25
+ * Helper function to get the adjusted price for a pickup, depending on how many Steam Sales all
26
+ * players currently have. (For example, if Jacob has one Steam Sale and Esau has one Steam Sale,
27
+ * the prices for items in the shop would be the same as if Isaac had two Steam Sales.)
28
+ */
29
+ export declare function getAdjustedPrice(basePrice: int): int;
24
30
  /**
25
31
  * Helper function to return the total amount of collectibles that a player has that match the
26
32
  * collectible type(s) provided.
@@ -1 +1 @@
1
- {"version":3,"file":"playerCollectibles.d.ts","sourceRoot":"","sources":["../../src/functions/playerCollectibles.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,eAAe,EAEhB,MAAM,8BAA8B,CAAC;AAStC;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,IAAI,CAIN;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAON;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,eAAe,EAChC,eAAe,CAAC,EAAE,OAAO,GACxB,OAAO,CAMT;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,UAAU,EAAE,CAKd;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,YAAY,EACpB,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,GAAG,CAQL;AAED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BAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAEN"}
1
+ {"version":3,"file":"playerCollectibles.d.ts","sourceRoot":"","sources":["../../src/functions/playerCollectibles.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,eAAe,EAEhB,MAAM,8BAA8B,CAAC;AAStC;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,IAAI,CAIN;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAON;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,eAAe,EAChC,eAAe,CAAC,EAAE,OAAO,GACxB,OAAO,CAMT;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,UAAU,EAAE,CAKd;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,GAAG,GAAG,GAAG,CAKpD;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,YAAY,EACpB,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,GAAG,CAQL;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,YAAY,EAAE,CAQhB;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,eAAe,GAC/B,GAAG,CAQL;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,OAAO,CAIT;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,EAChC,GAAG,WAAW,EAAE,UAAU,EAAE,GAC3B,OAAO,CAOT;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAiBnE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,UAAU,aAAqB,GAC9B,OAAO,CAGT;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAa/D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,IAAI,CAIN;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAON;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAC7C,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,IAAI,CAQN;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,EAChC,UAAU,aAAqB,EAC/B,MAAM,CAAC,EAAE,GAAG,EACZ,WAAW,UAAQ,GAClB,IAAI,CA6DN;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAEN"}
@@ -25,6 +25,18 @@ local getAllPlayers = ____playerIndex.getAllPlayers
25
25
  local getPlayers = ____playerIndex.getPlayers
26
26
  local ____players = require("functions.players")
27
27
  local isCharacter = ____players.isCharacter
28
+ --- Returns the total number of collectibles amongst all players. For example, if player 1 has 1 Sad
29
+ -- Onion and player 2 has 2 Sad Onions, then this function would return 3.
30
+ --
31
+ -- Note that this will filter out non-real collectibles like Lilith's Incubus.
32
+ function ____exports.getTotalPlayerCollectibles(self, collectibleType)
33
+ local players = getPlayers(nil)
34
+ local numCollectiblesArray = __TS__ArrayMap(
35
+ players,
36
+ function(____, player) return player:GetCollectibleNum(collectibleType, true) end
37
+ )
38
+ return sumArray(nil, numCollectiblesArray)
39
+ end
28
40
  --- Helper function to add one or more collectibles to a player.
29
41
  --
30
42
  -- This function is variadic, meaning that you can supply as many collectible types as you want to
@@ -66,6 +78,13 @@ function ____exports.getActiveItemSlots(self, player, collectibleType)
66
78
  end
67
79
  )
68
80
  end
81
+ --- Helper function to get the adjusted price for a pickup, depending on how many Steam Sales all
82
+ -- players currently have. (For example, if Jacob has one Steam Sale and Esau has one Steam Sale,
83
+ -- the prices for items in the shop would be the same as if Isaac had two Steam Sales.)
84
+ function ____exports.getAdjustedPrice(self, basePrice)
85
+ local numSteamSales = ____exports.getTotalPlayerCollectibles(nil, CollectibleType.STEAM_SALE)
86
+ return numSteamSales > 0 and math.floor(basePrice / (numSteamSales + 1)) or basePrice
87
+ end
69
88
  --- Helper function to return the total amount of collectibles that a player has that match the
70
89
  -- collectible type(s) provided.
71
90
  --
@@ -95,18 +114,6 @@ function ____exports.getPlayersWithCollectible(self, ...)
95
114
  ) end
96
115
  )
97
116
  end
98
- --- Returns the total number of collectibles amongst all players. For example, if player 1 has 1 Sad
99
- -- Onion and player 2 has 2 Sad Onions, then this function would return 3.
100
- --
101
- -- Note that this will filter out non-real collectibles like Lilith's Incubus.
102
- function ____exports.getTotalPlayerCollectibles(self, collectibleType)
103
- local players = getPlayers(nil)
104
- local numCollectiblesArray = __TS__ArrayMap(
105
- players,
106
- function(____, player) return player:GetCollectibleNum(collectibleType, true) end
107
- )
108
- return sumArray(nil, numCollectiblesArray)
109
- end
110
117
  --- Helper function to check to see if a player has one or more collectibles.
111
118
  --
112
119
  -- This function is variadic, meaning that you can supply as many collectible types as you want to
@@ -170,7 +177,7 @@ function ____exports.removeAllActiveItems(self, player)
170
177
  do
171
178
  local collectibleType = player:GetActiveItem(activeSlot)
172
179
  if collectibleType == CollectibleType.NULL then
173
- goto __continue28
180
+ goto __continue29
174
181
  end
175
182
  local stillHasCollectible
176
183
  repeat
@@ -180,7 +187,7 @@ function ____exports.removeAllActiveItems(self, player)
180
187
  end
181
188
  until not stillHasCollectible
182
189
  end
183
- ::__continue28::
190
+ ::__continue29::
184
191
  end
185
192
  end
186
193
  --- Helper function to remove one or more collectibles to a player.
@@ -249,9 +256,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
249
256
  itemPool:RemoveCollectible(collectibleType)
250
257
  end
251
258
  repeat
252
- local ____switch46 = activeSlot
253
- local ____cond46 = ____switch46 == ActiveSlot.PRIMARY
254
- if ____cond46 then
259
+ local ____switch47 = activeSlot
260
+ local ____cond47 = ____switch47 == ActiveSlot.PRIMARY
261
+ if ____cond47 then
255
262
  do
256
263
  if primaryCollectibleType ~= CollectibleType.NULL then
257
264
  player:RemoveCollectible(primaryCollectibleType)
@@ -260,8 +267,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
260
267
  break
261
268
  end
262
269
  end
263
- ____cond46 = ____cond46 or ____switch46 == ActiveSlot.SECONDARY
264
- if ____cond46 then
270
+ ____cond47 = ____cond47 or ____switch47 == ActiveSlot.SECONDARY
271
+ if ____cond47 then
265
272
  do
266
273
  if primaryCollectibleType ~= CollectibleType.NULL then
267
274
  player:RemoveCollectible(primaryCollectibleType)
@@ -276,16 +283,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
276
283
  break
277
284
  end
278
285
  end
279
- ____cond46 = ____cond46 or ____switch46 == ActiveSlot.POCKET
280
- if ____cond46 then
286
+ ____cond47 = ____cond47 or ____switch47 == ActiveSlot.POCKET
287
+ if ____cond47 then
281
288
  do
282
289
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
283
290
  player:SetActiveCharge(charge, activeSlot)
284
291
  break
285
292
  end
286
293
  end
287
- ____cond46 = ____cond46 or ____switch46 == ActiveSlot.POCKET_SINGLE_USE
288
- if ____cond46 then
294
+ ____cond47 = ____cond47 or ____switch47 == ActiveSlot.POCKET_SINGLE_USE
295
+ if ____cond47 then
289
296
  do
290
297
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
291
298
  break
@@ -1 +1 @@
1
- {"version":3,"file":"players.d.ts","sourceRoot":"","sources":["../../src/functions/players.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EAEf,UAAU,EACV,UAAU,EAEX,MAAM,8BAA8B,CAAC;AAatC;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAG9C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,kBAAkB,EAAE,UAAU,EAAE,GAAG,OAAO,CAKxE;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CASjE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAWzD;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,kBAAkB,EAAE,YAAY,GAAG,KAAK,GACvC,KAAK,CAMP;AAED,+FAA+F;AAC/F,wBAAgB,aAAa,IAAI,UAAU,EAAE,CAG5C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAe/D;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,YAAY,CAU7C;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,YAAY,CAa9C;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,KAAK,GACd,YAAY,GAAG,SAAS,CAM1B;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CA0B5E;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,SAAS,GACnB,YAAY,GA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,EAAE,YAAY,GAAG,OAAO,CAM9D;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAG7D;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAIlE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,aAAa,UAAO,GACnB,IAAI,CAsBN"}
@@ -319,12 +319,6 @@ function ____exports.isDamageFromPlayer(self, damageSource)
319
319
  local indirectPlayer = ____exports.getPlayerFromEntity(nil, damageSource)
320
320
  return indirectPlayer ~= nil
321
321
  end
322
- --- Helper function for detecting when a player is Eden or Tainted Eden. Useful for situations where
323
- -- you want to know if the starting stats were randomized, for example.
324
- function ____exports.isEden(self, player)
325
- local character = player:GetPlayerType()
326
- return character == PlayerType.EDEN or character == PlayerType.EDEN_B
327
- end
328
322
  --- Not exported since end-users should use the `isTainted` helper function directly.
329
323
  local function isTaintedModded(self, player)
330
324
  local character = player:GetPlayerType()
@@ -332,6 +326,12 @@ local function isTaintedModded(self, player)
332
326
  local taintedCharacter = Isaac.GetPlayerTypeByName(name, true)
333
327
  return character == taintedCharacter
334
328
  end
329
+ --- Helper function for detecting when a player is Eden or Tainted Eden. Useful for situations where
330
+ -- you want to know if the starting stats were randomized, for example.
331
+ function ____exports.isEden(self, player)
332
+ local character = player:GetPlayerType()
333
+ return character == PlayerType.EDEN or character == PlayerType.EDEN_B
334
+ end
335
335
  function ____exports.isFirstPlayer(self, player)
336
336
  return getPlayerIndexVanilla(nil, player) == 0
337
337
  end
@@ -4759,6 +4759,13 @@ export declare function getAdjacentNonExistingRoomGridIndexes(roomGridIndex?: in
4759
4759
  */
4760
4760
  export declare function getAdjacentRoomGridIndexes(roomGridIndex?: int): readonly int[];
4761
4761
 
4762
+ /**
4763
+ * Helper function to get the adjusted price for a pickup, depending on how many Steam Sales all
4764
+ * players currently have. (For example, if Jacob has one Steam Sale and Esau has one Steam Sale,
4765
+ * the prices for items in the shop would be the same as if Isaac had two Steam Sales.)
4766
+ */
4767
+ export declare function getAdjustedPrice(basePrice: int): int;
4768
+
4762
4769
  /**
4763
4770
  * Helper function to get all of the non-dead bosses in the room.
4764
4771
  *
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 76.0.0
3
+ isaacscript-common 76.1.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -21761,12 +21761,6 @@ function ____exports.isDamageFromPlayer(self, damageSource)
21761
21761
  local indirectPlayer = ____exports.getPlayerFromEntity(nil, damageSource)
21762
21762
  return indirectPlayer ~= nil
21763
21763
  end
21764
- --- Helper function for detecting when a player is Eden or Tainted Eden. Useful for situations where
21765
- -- you want to know if the starting stats were randomized, for example.
21766
- function ____exports.isEden(self, player)
21767
- local character = player:GetPlayerType()
21768
- return character == PlayerType.EDEN or character == PlayerType.EDEN_B
21769
- end
21770
21764
  --- Not exported since end-users should use the `isTainted` helper function directly.
21771
21765
  local function isTaintedModded(self, player)
21772
21766
  local character = player:GetPlayerType()
@@ -21774,6 +21768,12 @@ local function isTaintedModded(self, player)
21774
21768
  local taintedCharacter = Isaac.GetPlayerTypeByName(name, true)
21775
21769
  return character == taintedCharacter
21776
21770
  end
21771
+ --- Helper function for detecting when a player is Eden or Tainted Eden. Useful for situations where
21772
+ -- you want to know if the starting stats were randomized, for example.
21773
+ function ____exports.isEden(self, player)
21774
+ local character = player:GetPlayerType()
21775
+ return character == PlayerType.EDEN or character == PlayerType.EDEN_B
21776
+ end
21777
21777
  function ____exports.isFirstPlayer(self, player)
21778
21778
  return getPlayerIndexVanilla(nil, player) == 0
21779
21779
  end
@@ -27014,6 +27014,18 @@ local getAllPlayers = ____playerIndex.getAllPlayers
27014
27014
  local getPlayers = ____playerIndex.getPlayers
27015
27015
  local ____players = require("functions.players")
27016
27016
  local isCharacter = ____players.isCharacter
27017
+ --- Returns the total number of collectibles amongst all players. For example, if player 1 has 1 Sad
27018
+ -- Onion and player 2 has 2 Sad Onions, then this function would return 3.
27019
+ --
27020
+ -- Note that this will filter out non-real collectibles like Lilith's Incubus.
27021
+ function ____exports.getTotalPlayerCollectibles(self, collectibleType)
27022
+ local players = getPlayers(nil)
27023
+ local numCollectiblesArray = __TS__ArrayMap(
27024
+ players,
27025
+ function(____, player) return player:GetCollectibleNum(collectibleType, true) end
27026
+ )
27027
+ return sumArray(nil, numCollectiblesArray)
27028
+ end
27017
27029
  --- Helper function to add one or more collectibles to a player.
27018
27030
  --
27019
27031
  -- This function is variadic, meaning that you can supply as many collectible types as you want to
@@ -27055,6 +27067,13 @@ function ____exports.getActiveItemSlots(self, player, collectibleType)
27055
27067
  end
27056
27068
  )
27057
27069
  end
27070
+ --- Helper function to get the adjusted price for a pickup, depending on how many Steam Sales all
27071
+ -- players currently have. (For example, if Jacob has one Steam Sale and Esau has one Steam Sale,
27072
+ -- the prices for items in the shop would be the same as if Isaac had two Steam Sales.)
27073
+ function ____exports.getAdjustedPrice(self, basePrice)
27074
+ local numSteamSales = ____exports.getTotalPlayerCollectibles(nil, CollectibleType.STEAM_SALE)
27075
+ return numSteamSales > 0 and math.floor(basePrice / (numSteamSales + 1)) or basePrice
27076
+ end
27058
27077
  --- Helper function to return the total amount of collectibles that a player has that match the
27059
27078
  -- collectible type(s) provided.
27060
27079
  --
@@ -27084,18 +27103,6 @@ function ____exports.getPlayersWithCollectible(self, ...)
27084
27103
  ) end
27085
27104
  )
27086
27105
  end
27087
- --- Returns the total number of collectibles amongst all players. For example, if player 1 has 1 Sad
27088
- -- Onion and player 2 has 2 Sad Onions, then this function would return 3.
27089
- --
27090
- -- Note that this will filter out non-real collectibles like Lilith's Incubus.
27091
- function ____exports.getTotalPlayerCollectibles(self, collectibleType)
27092
- local players = getPlayers(nil)
27093
- local numCollectiblesArray = __TS__ArrayMap(
27094
- players,
27095
- function(____, player) return player:GetCollectibleNum(collectibleType, true) end
27096
- )
27097
- return sumArray(nil, numCollectiblesArray)
27098
- end
27099
27106
  --- Helper function to check to see if a player has one or more collectibles.
27100
27107
  --
27101
27108
  -- This function is variadic, meaning that you can supply as many collectible types as you want to
@@ -27159,7 +27166,7 @@ function ____exports.removeAllActiveItems(self, player)
27159
27166
  do
27160
27167
  local collectibleType = player:GetActiveItem(activeSlot)
27161
27168
  if collectibleType == CollectibleType.NULL then
27162
- goto __continue28
27169
+ goto __continue29
27163
27170
  end
27164
27171
  local stillHasCollectible
27165
27172
  repeat
@@ -27169,7 +27176,7 @@ function ____exports.removeAllActiveItems(self, player)
27169
27176
  end
27170
27177
  until not stillHasCollectible
27171
27178
  end
27172
- ::__continue28::
27179
+ ::__continue29::
27173
27180
  end
27174
27181
  end
27175
27182
  --- Helper function to remove one or more collectibles to a player.
@@ -27238,9 +27245,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
27238
27245
  itemPool:RemoveCollectible(collectibleType)
27239
27246
  end
27240
27247
  repeat
27241
- local ____switch46 = activeSlot
27242
- local ____cond46 = ____switch46 == ActiveSlot.PRIMARY
27243
- if ____cond46 then
27248
+ local ____switch47 = activeSlot
27249
+ local ____cond47 = ____switch47 == ActiveSlot.PRIMARY
27250
+ if ____cond47 then
27244
27251
  do
27245
27252
  if primaryCollectibleType ~= CollectibleType.NULL then
27246
27253
  player:RemoveCollectible(primaryCollectibleType)
@@ -27249,8 +27256,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
27249
27256
  break
27250
27257
  end
27251
27258
  end
27252
- ____cond46 = ____cond46 or ____switch46 == ActiveSlot.SECONDARY
27253
- if ____cond46 then
27259
+ ____cond47 = ____cond47 or ____switch47 == ActiveSlot.SECONDARY
27260
+ if ____cond47 then
27254
27261
  do
27255
27262
  if primaryCollectibleType ~= CollectibleType.NULL then
27256
27263
  player:RemoveCollectible(primaryCollectibleType)
@@ -27265,16 +27272,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
27265
27272
  break
27266
27273
  end
27267
27274
  end
27268
- ____cond46 = ____cond46 or ____switch46 == ActiveSlot.POCKET
27269
- if ____cond46 then
27275
+ ____cond47 = ____cond47 or ____switch47 == ActiveSlot.POCKET
27276
+ if ____cond47 then
27270
27277
  do
27271
27278
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
27272
27279
  player:SetActiveCharge(charge, activeSlot)
27273
27280
  break
27274
27281
  end
27275
27282
  end
27276
- ____cond46 = ____cond46 or ____switch46 == ActiveSlot.POCKET_SINGLE_USE
27277
- if ____cond46 then
27283
+ ____cond47 = ____cond47 or ____switch47 == ActiveSlot.POCKET_SINGLE_USE
27284
+ if ____cond47 then
27278
27285
  do
27279
27286
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
27280
27287
  break
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "76.1.0",
3
+ "version": "76.2.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -71,6 +71,18 @@ export function getActiveItemSlots(
71
71
  });
72
72
  }
73
73
 
74
+ /**
75
+ * Helper function to get the adjusted price for a pickup, depending on how many Steam Sales all
76
+ * players currently have. (For example, if Jacob has one Steam Sale and Esau has one Steam Sale,
77
+ * the prices for items in the shop would be the same as if Isaac had two Steam Sales.)
78
+ */
79
+ export function getAdjustedPrice(basePrice: int): int {
80
+ const numSteamSales = getTotalPlayerCollectibles(CollectibleType.STEAM_SALE);
81
+ return numSteamSales > 0
82
+ ? Math.floor(basePrice / (numSteamSales + 1))
83
+ : basePrice;
84
+ }
85
+
74
86
  /**
75
87
  * Helper function to return the total amount of collectibles that a player has that match the
76
88
  * collectible type(s) provided.
@@ -408,18 +408,6 @@ export function isEden(player: EntityPlayer): boolean {
408
408
  return character === PlayerType.EDEN || character === PlayerType.EDEN_B;
409
409
  }
410
410
 
411
- /** Not exported since end-users should use the `isTainted` helper function directly. */
412
- function isTaintedModded(player: EntityPlayer) {
413
- // This algorithm only works for modded characters because the `Isaac.GetPlayerTypeByName` method
414
- // is bugged.
415
- // https://github.com/Meowlala/RepentanceAPIIssueTracker/issues/117
416
- const character = player.GetPlayerType();
417
- const name = player.GetName();
418
- const taintedCharacter = Isaac.GetPlayerTypeByName(name, true);
419
-
420
- return character === taintedCharacter;
421
- }
422
-
423
411
  export function isFirstPlayer(player: EntityPlayer): boolean {
424
412
  return getPlayerIndexVanilla(player) === 0;
425
413
  }
@@ -538,3 +526,15 @@ export function setBlindfold(
538
526
  }
539
527
  }
540
528
  }
529
+
530
+ /** Not exported since end-users should use the `isTainted` helper function directly. */
531
+ function isTaintedModded(player: EntityPlayer) {
532
+ // This algorithm only works for modded characters because the `Isaac.GetPlayerTypeByName` method
533
+ // is bugged.
534
+ // https://github.com/Meowlala/RepentanceAPIIssueTracker/issues/117
535
+ const character = player.GetPlayerType();
536
+ const name = player.GetName();
537
+ const taintedCharacter = Isaac.GetPlayerTypeByName(name, true);
538
+
539
+ return character === taintedCharacter;
540
+ }