isaacscript-common 76.0.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.
@@ -25,6 +25,14 @@ export declare function getCardName(cardType: CardType): string;
25
25
  * Returns undefined if the provided card type was not valid.
26
26
  */
27
27
  export declare function getItemConfigCardType(cardType: CardType): ItemConfigCardType | undefined;
28
+ /**
29
+ * Helper function to check if a player is holding a specific card in one of their pocket item
30
+ * slots.
31
+ *
32
+ * This function is variadic, meaning that you can pass as many cards as you want to check for. The
33
+ * function will return true if the player has any of the cards.
34
+ */
35
+ export declare function hasCard(player: EntityPlayer, ...cardTypes: CardType[]): boolean;
28
36
  /**
29
37
  * Returns true for card types that have the following item config card type:
30
38
  *
@@ -1 +1 @@
1
- {"version":3,"file":"cards.d.ts","sourceRoot":"","sources":["../../src/functions/cards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAW,MAAM,8BAA8B,CAAC;AAW3E;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAgB7D;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAgBtD;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,QAAQ,GACjB,kBAAkB,GAAG,SAAS,CAOhC;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAOlD;AAED,uFAAuF;AACvF,wBAAgB,UAAU,CACxB,QAAQ,EAAE,QAAQ,EAClB,kBAAkB,EAAE,kBAAkB,GACrC,OAAO,CAET;AAED,qDAAqD;AACrD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE5D;AAED,iFAAiF;AACjF,wBA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MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAOlD;AAED,uFAAuF;AACvF,wBAAgB,UAAU,CACxB,QAAQ,EAAE,QAAQ,EAClB,kBAAkB,EAAE,kBAAkB,GACrC,OAAO,CAET;AAED,qDAAqD;AACrD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE5D;AAED,iFAAiF;AACjF,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE9D;AAED,gFAAgF;AAChF,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE9D;AAED,uEAAuE;AACvE,wBAAgB,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAElD;AAED,0EAA0E;AAC1E,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAEzD;AAED,uEAAuE;AACvE,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAEtD;AAED,wEAAwE;AACxE,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAEvD;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE7D;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAG1E"}
@@ -1,7 +1,13 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local Set = ____lualib.Set
3
+ local __TS__New = ____lualib.__TS__New
4
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
1
5
  local ____exports = {}
2
6
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
7
  local ItemConfigCardType = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigCardType
4
8
  local UseFlag = ____isaac_2Dtypescript_2Ddefinitions.UseFlag
9
+ local ____cachedEnumValues = require("arrays.cachedEnumValues")
10
+ local POCKET_ITEM_SLOT_VALUES = ____cachedEnumValues.POCKET_ITEM_SLOT_VALUES
5
11
  local ____cachedClasses = require("core.cachedClasses")
6
12
  local itemConfig = ____cachedClasses.itemConfig
7
13
  local ____constantsFirstLast = require("core.constantsFirstLast")
@@ -64,6 +70,22 @@ function ____exports.getItemConfigCardType(self, cardType)
64
70
  end
65
71
  return itemConfigCard.CardType
66
72
  end
73
+ --- Helper function to check if a player is holding a specific card in one of their pocket item
74
+ -- slots.
75
+ --
76
+ -- This function is variadic, meaning that you can pass as many cards as you want to check for. The
77
+ -- function will return true if the player has any of the cards.
78
+ function ____exports.hasCard(self, player, ...)
79
+ local cardTypes = {...}
80
+ local cardTypesSet = __TS__New(Set, cardTypes)
81
+ return __TS__ArraySome(
82
+ POCKET_ITEM_SLOT_VALUES,
83
+ function(____, pocketItemSlot)
84
+ local cardType = player:GetCard(pocketItemSlot)
85
+ return cardTypesSet:has(cardType)
86
+ end
87
+ )
88
+ end
67
89
  --- Returns true for card types that have the following item config card type:
68
90
  --
69
91
  -- - `ItemConfigCardType.TAROT` (0)
@@ -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,E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oB,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"}
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;;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;;;;;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,kBAAk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,OAAO,CAGpD;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAE3D;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAG3D;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAGtD;AAED,+EAA+E;AAC/E,wBAAgB,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAGpD;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAE/D;AAED,kFAAkF;AAClF,wBAAgB,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAMvD;AAED,8FAA8F;AAC9F,wBAAgB,gBAAgB,CAAC,MAAM,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
@@ -35,8 +35,12 @@ export declare function getTearsStat(fireDelay: float): float;
35
35
  * Helper function to check if a tear hit an enemy. A tear is considered to be missed if it hit the
36
36
  * ground, a wall, or a grid entity.
37
37
  *
38
- * Under the hood, this function uses the `Entity.IsDead` method to determine this. (Tears will not
39
- * die if they hit an enemy, but they will die if they hit a wall or object.)
38
+ * Note that tears are still considered to be missed if they hit a poop or fire, so you may want to
39
+ * handle those separately using the `POST_GRID_ENTITY_COLLISION` and `POST_ENTITY_COLLISION`
40
+ * callbacks, respectively.
41
+ *
42
+ * Under the hood, this function uses the `Entity.IsDead` method. (Tears will not die if they hit an
43
+ * enemy, but they will die if they hit a wall or object.)
40
44
  */
41
45
  export declare function isMissedTear(tear: EntityTear): boolean;
42
46
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"tears.d.ts","sourceRoot":"","sources":["../../src/functions/tears.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,GAAG,IAAI,CAKzE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAEpD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAEtD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,UAAU,EAChB,eAAe,CAAC,EAAE,eAAe,EACjC,OAAO,CAAC,EAAE,GAAG,GACZ,OAAO,CAuBT;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAgB1D"}
1
+ {"version":3,"file":"tears.d.ts","sourceRoot":"","sources":["../../src/functions/tears.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,GAAG,IAAI,CAKzE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAEpD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAEtD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,UAAU,EAChB,eAAe,CAAC,EAAE,eAAe,EACjC,OAAO,CAAC,EAAE,GAAG,GACZ,OAAO,CAuBT;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAgB1D"}
@@ -37,8 +37,12 @@ end
37
37
  --- Helper function to check if a tear hit an enemy. A tear is considered to be missed if it hit the
38
38
  -- ground, a wall, or a grid entity.
39
39
  --
40
- -- Under the hood, this function uses the `Entity.IsDead` method to determine this. (Tears will not
41
- -- die if they hit an enemy, but they will die if they hit a wall or object.)
40
+ -- Note that tears are still considered to be missed if they hit a poop or fire, so you may want to
41
+ -- handle those separately using the `POST_GRID_ENTITY_COLLISION` and `POST_ENTITY_COLLISION`
42
+ -- callbacks, respectively.
43
+ --
44
+ -- Under the hood, this function uses the `Entity.IsDead` method. (Tears will not die if they hit an
45
+ -- enemy, but they will die if they hit a wall or object.)
42
46
  function ____exports.isMissedTear(self, tear)
43
47
  return tear:IsDead()
44
48
  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
  *
@@ -8189,6 +8196,15 @@ export declare function hasAnyTrinket(player: EntityPlayer): boolean;
8189
8196
  */
8190
8197
  export declare function hasArmor(entity: Entity): boolean;
8191
8198
 
8199
+ /**
8200
+ * Helper function to check if a player is holding a specific card in one of their pocket item
8201
+ * slots.
8202
+ *
8203
+ * This function is variadic, meaning that you can pass as many cards as you want to check for. The
8204
+ * function will return true if the player has any of the cards.
8205
+ */
8206
+ export declare function hasCard(player: EntityPlayer, ...cardTypes: CardType[]): boolean;
8207
+
8192
8208
  /**
8193
8209
  * Helper function to check to see if a player has one or more collectibles.
8194
8210
  *
@@ -9564,8 +9580,12 @@ export declare function isMirrorRoom(roomData: RoomConfig): boolean;
9564
9580
  * Helper function to check if a tear hit an enemy. A tear is considered to be missed if it hit the
9565
9581
  * ground, a wall, or a grid entity.
9566
9582
  *
9567
- * Under the hood, this function uses the `Entity.IsDead` method to determine this. (Tears will not
9568
- * die if they hit an enemy, but they will die if they hit a wall or object.)
9583
+ * Note that tears are still considered to be missed if they hit a poop or fire, so you may want to
9584
+ * handle those separately using the `POST_GRID_ENTITY_COLLISION` and `POST_ENTITY_COLLISION`
9585
+ * callbacks, respectively.
9586
+ *
9587
+ * Under the hood, this function uses the `Entity.IsDead` method. (Tears will not die if they hit an
9588
+ * enemy, but they will die if they hit a wall or object.)
9569
9589
  */
9570
9590
  export declare function isMissedTear(tear: EntityTear): boolean;
9571
9591
 
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 75.2.1
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
@@ -34799,8 +34806,12 @@ end
34799
34806
  --- Helper function to check if a tear hit an enemy. A tear is considered to be missed if it hit the
34800
34807
  -- ground, a wall, or a grid entity.
34801
34808
  --
34802
- -- Under the hood, this function uses the `Entity.IsDead` method to determine this. (Tears will not
34803
- -- die if they hit an enemy, but they will die if they hit a wall or object.)
34809
+ -- Note that tears are still considered to be missed if they hit a poop or fire, so you may want to
34810
+ -- handle those separately using the `POST_GRID_ENTITY_COLLISION` and `POST_ENTITY_COLLISION`
34811
+ -- callbacks, respectively.
34812
+ --
34813
+ -- Under the hood, this function uses the `Entity.IsDead` method. (Tears will not die if they hit an
34814
+ -- enemy, but they will die if they hit a wall or object.)
34804
34815
  function ____exports.isMissedTear(self, tear)
34805
34816
  return tear:IsDead()
34806
34817
  end
@@ -43160,10 +43171,16 @@ ____exports.ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET = __TS__New(ReadonlySet, {ItemC
43160
43171
  return ____exports
43161
43172
  end,
43162
43173
  ["functions.cards"] = function(...)
43174
+ local ____lualib = require("lualib_bundle")
43175
+ local Set = ____lualib.Set
43176
+ local __TS__New = ____lualib.__TS__New
43177
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
43163
43178
  local ____exports = {}
43164
43179
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.index")
43165
43180
  local ItemConfigCardType = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigCardType
43166
43181
  local UseFlag = ____isaac_2Dtypescript_2Ddefinitions.UseFlag
43182
+ local ____cachedEnumValues = require("arrays.cachedEnumValues")
43183
+ local POCKET_ITEM_SLOT_VALUES = ____cachedEnumValues.POCKET_ITEM_SLOT_VALUES
43167
43184
  local ____cachedClasses = require("core.cachedClasses")
43168
43185
  local itemConfig = ____cachedClasses.itemConfig
43169
43186
  local ____constantsFirstLast = require("core.constantsFirstLast")
@@ -43226,6 +43243,22 @@ function ____exports.getItemConfigCardType(self, cardType)
43226
43243
  end
43227
43244
  return itemConfigCard.CardType
43228
43245
  end
43246
+ --- Helper function to check if a player is holding a specific card in one of their pocket item
43247
+ -- slots.
43248
+ --
43249
+ -- This function is variadic, meaning that you can pass as many cards as you want to check for. The
43250
+ -- function will return true if the player has any of the cards.
43251
+ function ____exports.hasCard(self, player, ...)
43252
+ local cardTypes = {...}
43253
+ local cardTypesSet = __TS__New(Set, cardTypes)
43254
+ return __TS__ArraySome(
43255
+ POCKET_ITEM_SLOT_VALUES,
43256
+ function(____, pocketItemSlot)
43257
+ local cardType = player:GetCard(pocketItemSlot)
43258
+ return cardTypesSet:has(cardType)
43259
+ end
43260
+ )
43261
+ end
43229
43262
  --- Returns true for card types that have the following item config card type:
43230
43263
  --
43231
43264
  -- - `ItemConfigCardType.TAROT` (0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "76.0.0",
3
+ "version": "76.2.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -1,5 +1,6 @@
1
1
  import type { CardType } from "isaac-typescript-definitions";
2
2
  import { ItemConfigCardType, UseFlag } from "isaac-typescript-definitions";
3
+ import { POCKET_ITEM_SLOT_VALUES } from "../arrays/cachedEnumValues";
3
4
  import { itemConfig } from "../core/cachedClasses";
4
5
  import { LAST_VANILLA_CARD_TYPE } from "../core/constantsFirstLast";
5
6
  import {
@@ -79,6 +80,24 @@ export function getItemConfigCardType(
79
80
  return itemConfigCard.CardType;
80
81
  }
81
82
 
83
+ /**
84
+ * Helper function to check if a player is holding a specific card in one of their pocket item
85
+ * slots.
86
+ *
87
+ * This function is variadic, meaning that you can pass as many cards as you want to check for. The
88
+ * function will return true if the player has any of the cards.
89
+ */
90
+ export function hasCard(
91
+ player: EntityPlayer,
92
+ ...cardTypes: CardType[]
93
+ ): boolean {
94
+ const cardTypesSet = new Set(cardTypes);
95
+ return POCKET_ITEM_SLOT_VALUES.some((pocketItemSlot) => {
96
+ const cardType = player.GetCard(pocketItemSlot);
97
+ return cardTypesSet.has(cardType);
98
+ });
99
+ }
100
+
82
101
  /**
83
102
  * Returns true for card types that have the following item config card type:
84
103
  *
@@ -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
+ }
@@ -48,8 +48,12 @@ export function getTearsStat(fireDelay: float): float {
48
48
  * Helper function to check if a tear hit an enemy. A tear is considered to be missed if it hit the
49
49
  * ground, a wall, or a grid entity.
50
50
  *
51
- * Under the hood, this function uses the `Entity.IsDead` method to determine this. (Tears will not
52
- * die if they hit an enemy, but they will die if they hit a wall or object.)
51
+ * Note that tears are still considered to be missed if they hit a poop or fire, so you may want to
52
+ * handle those separately using the `POST_GRID_ENTITY_COLLISION` and `POST_ENTITY_COLLISION`
53
+ * callbacks, respectively.
54
+ *
55
+ * Under the hood, this function uses the `Entity.IsDead` method. (Tears will not die if they hit an
56
+ * enemy, but they will die if they hit a wall or object.)
53
57
  */
54
58
  export function isMissedTear(tear: EntityTear): boolean {
55
59
  return tear.IsDead();