isaacscript-common 2.0.15 → 2.0.16

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.
@@ -160,6 +160,13 @@ export declare function getPlayersOfType(...characters: PlayerType[]): EntityPla
160
160
  * check for. It only returns the players that have all of the collectibles.
161
161
  */
162
162
  export declare function getPlayersWithCollectible(...collectibleTypes: CollectibleType[]): EntityPlayer[];
163
+ /**
164
+ * Helper function to get only the players that have a certain trinket.
165
+ *
166
+ * This function is variadic, meaning that you can supply as many trinket types as you want to check
167
+ * for. It only returns the players that have all of the trinkets.
168
+ */
169
+ export declare function getPlayersWithTrinket(...trinketTypes: TrinketType[]): EntityPlayer[];
163
170
  /**
164
171
  * Helper function to determine how many heart containers that Tainted Magdalene has that will not
165
172
  * be automatically depleted over time. By default, this is 2, but this function will return 4 so
@@ -398,6 +398,17 @@ function ____exports.getPlayersWithCollectible(self, ...)
398
398
  ) end
399
399
  )
400
400
  end
401
+ function ____exports.getPlayersWithTrinket(self, ...)
402
+ local trinketTypes = {...}
403
+ local players = getPlayers(nil)
404
+ return __TS__ArrayFilter(
405
+ players,
406
+ function(____, player) return __TS__ArrayEvery(
407
+ trinketTypes,
408
+ function(____, trinketType) return player:HasTrinket(trinketType) end
409
+ ) end
410
+ )
411
+ end
401
412
  function ____exports.getTaintedMagdaleneNonTemporaryMaxHearts(self, player)
402
413
  local maxHearts = player:GetMaxHearts()
403
414
  local hasBirthright = player:HasCollectible(CollectibleType.BIRTHRIGHT)
@@ -516,9 +527,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
516
527
  itemPool:RemoveCollectible(collectibleType)
517
528
  end
518
529
  repeat
519
- local ____switch110 = activeSlot
520
- local ____cond110 = ____switch110 == ActiveSlot.PRIMARY
521
- if ____cond110 then
530
+ local ____switch113 = activeSlot
531
+ local ____cond113 = ____switch113 == ActiveSlot.PRIMARY
532
+ if ____cond113 then
522
533
  do
523
534
  if primaryCollectibleType ~= CollectibleType.NULL then
524
535
  player:RemoveCollectible(primaryCollectibleType)
@@ -527,8 +538,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
527
538
  break
528
539
  end
529
540
  end
530
- ____cond110 = ____cond110 or ____switch110 == ActiveSlot.SECONDARY
531
- if ____cond110 then
541
+ ____cond113 = ____cond113 or ____switch113 == ActiveSlot.SECONDARY
542
+ if ____cond113 then
532
543
  do
533
544
  if primaryCollectibleType ~= CollectibleType.NULL then
534
545
  player:RemoveCollectible(primaryCollectibleType)
@@ -543,16 +554,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
543
554
  break
544
555
  end
545
556
  end
546
- ____cond110 = ____cond110 or ____switch110 == ActiveSlot.POCKET
547
- if ____cond110 then
557
+ ____cond113 = ____cond113 or ____switch113 == ActiveSlot.POCKET
558
+ if ____cond113 then
548
559
  do
549
560
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
550
561
  player:SetActiveCharge(charge, activeSlot)
551
562
  break
552
563
  end
553
564
  end
554
- ____cond110 = ____cond110 or ____switch110 == ActiveSlot.POCKET_SINGLE_USE
555
- if ____cond110 then
565
+ ____cond113 = ____cond113 or ____switch113 == ActiveSlot.POCKET_SINGLE_USE
566
+ if ____cond113 then
556
567
  do
557
568
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
558
569
  break
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "2.0.15",
3
+ "version": "2.0.16",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",