isaacscript-common 2.0.25 → 2.0.28

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.
@@ -71,14 +71,14 @@ export declare const MAX_PLAYER_HEART_CONTAINERS = 18;
71
71
  export declare const MAX_PLAYER_SPEED_IN_UNITS = 9.8;
72
72
  export declare const MAX_PLAYER_TRINKET_SLOTS: number;
73
73
  export declare const FIRST_ROOM_TYPE = RoomType.DEFAULT;
74
- export declare const MAX_ROOM_TYPE: RoomType;
74
+ export declare const LAST_ROOM_TYPE: RoomType;
75
75
  /**
76
76
  * The maximum speed stat that a player can have. Any additional speed beyond this will not take
77
77
  * effect.
78
78
  */
79
79
  export declare const MAX_SPEED_STAT = 2;
80
80
  export declare const FIRST_STAGE = LevelStage.BASEMENT_1;
81
- export declare const MAX_STAGE: LevelStage;
81
+ export declare const LAST_STAGE: LevelStage;
82
82
  /** Corresponds to the maximum value for `EntityPlayer.SamsonBerserkCharge`. */
83
83
  export declare const MAX_TAINTED_SAMSON_BERSERK_CHARGE = 100000;
84
84
  export declare const NUM_DIMENSIONS: number;
@@ -29,10 +29,10 @@ ____exports.MAX_PLAYER_HEART_CONTAINERS = 18
29
29
  ____exports.MAX_PLAYER_SPEED_IN_UNITS = 9.8
30
30
  ____exports.MAX_PLAYER_TRINKET_SLOTS = getEnumLength(nil, TrinketSlot)
31
31
  ____exports.FIRST_ROOM_TYPE = RoomType.DEFAULT
32
- ____exports.MAX_ROOM_TYPE = getLastEnumValue(nil, RoomType)
32
+ ____exports.LAST_ROOM_TYPE = getLastEnumValue(nil, RoomType)
33
33
  ____exports.MAX_SPEED_STAT = 2
34
34
  ____exports.FIRST_STAGE = LevelStage.BASEMENT_1
35
- ____exports.MAX_STAGE = getLastEnumValue(nil, LevelStage)
35
+ ____exports.LAST_STAGE = getLastEnumValue(nil, LevelStage)
36
36
  ____exports.MAX_TAINTED_SAMSON_BERSERK_CHARGE = 100000
37
37
  ____exports.NUM_DIMENSIONS = getEnumLength(nil, Dimension) - 1
38
38
  ____exports.SECOND_IN_MILLISECONDS = 1000
@@ -1,27 +1,130 @@
1
1
  import { Card, CollectibleType, PillColor, PillEffect, PlayerType, TrinketType } from "isaac-typescript-definitions";
2
- export declare const FIRST_CARD = Card.FOOL;
2
+ /** Equal to `CollectibleType.SAD_ONION`. */
3
+ export declare const FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION;
4
+ /**
5
+ * Will change depending on how many modded collectibles there are.
6
+ *
7
+ * Equal to `itemConfig.GetCollectibles().Size - 1`. (`Size` includes invalid collectibles. We
8
+ * subtract one to account for `CollectibleType.NULL`.)
9
+ */
10
+ export declare const LAST_COLLECTIBLE_TYPE: CollectibleType;
11
+ /**
12
+ * Calculated from the `CollectibleType` enum.
13
+ *
14
+ * Note that this cannot be calculated from the length of the enum, because unlike all of the other
15
+ * enums, collectible types are not contiguous.
16
+ */
17
+ export declare const LAST_VANILLA_COLLECTIBLE_TYPE: CollectibleType;
18
+ /**
19
+ * If there are no modded collectibles, this constant will represent a collectible type that does
20
+ * not exist.
21
+ */
22
+ export declare const FIRST_MODDED_COLLECTIBLE_TYPE: CollectibleType;
23
+ /** Calculated from the `CollectibleType` enum. `CollectibleType.NULL` is not included. */
24
+ export declare const NUM_VANILLA_COLLECTIBLE_TYPES: number;
25
+ /** Unlike vanilla collectible types, modded collectible types are always contiguous. */
26
+ export declare const NUM_MODDED_COLLECTIBLE_TYPES: number;
27
+ export declare const NUM_COLLECTIBLE_TYPES: number;
28
+ /**
29
+ * Will change depending on how many modded cards there are.
30
+ *
31
+ * Equal to `itemConfig.GetTrinkets().Size - 1`. (We subtract one to account for
32
+ * `TrinketType.NULL`.)
33
+ */
34
+ export declare const NUM_TRINKET_TYPES: number;
35
+ /** Calculated from the `TrinketType` enum. `TrinketType.NULL` is not included. */
36
+ export declare const NUM_VANILLA_TRINKET_TYPES: number;
37
+ export declare const NUM_MODDED_TRINKET_TYPES: number;
38
+ /** Equal to `TrinketType.SWALLOWED_PENNY`. */
39
+ export declare const FIRST_TRINKET_TYPE = TrinketType.SWALLOWED_PENNY;
40
+ /**
41
+ * Will change depending on how many modded cards there are.
42
+ *
43
+ * Equal to `itemConfig.GetTrinkets().Size - 1`. (We subtract one to account for
44
+ * `TrinketType.NULL`.)
45
+ */
46
+ export declare const LAST_TRINKET_TYPE: TrinketType;
47
+ /** Calculated from the `TrinketType` enum. */
48
+ export declare const LAST_VANILLA_TRINKET_TYPE: TrinketType;
49
+ /**
50
+ * If there are no modded trinkets, this constant will represent a trinket type that does not exist.
51
+ */
52
+ export declare const FIRST_MODDED_TRINKET_TYPE: TrinketType;
53
+ /**
54
+ * Will change depending on how many modded cards there are.
55
+ *
56
+ * Equal to `itemConfig.GetCards().Size - 1`. (We subtract one to account for `Card.NULL`.)
57
+ */
3
58
  export declare const NUM_CARDS: number;
4
- export declare const MAX_CARD: Card;
59
+ /** Calculated from the `Card` enum. `Card.NULL` is not included. */
5
60
  export declare const NUM_VANILLA_CARDS: number;
61
+ export declare const NUM_MODDED_CARDS: number;
62
+ /** Equal to `Card.FOOL`. */
63
+ export declare const FIRST_CARD = Card.FOOL;
64
+ /**
65
+ * Will change depending on how many modded cards there are.
66
+ *
67
+ * Equal to `itemConfig.GetCards().Size - 1`. (We subtract one to account for `Card.NULL`.)
68
+ */
69
+ export declare const LAST_CARD: Card;
70
+ /** Calculated from the `Card` enum. */
6
71
  export declare const MAX_VANILLA_CARD: Card;
7
- export declare const FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION;
8
- export declare const NUM_COLLECTIBLE_TYPES: number;
9
- export declare const MAX_COLLECTIBLE_TYPE: CollectibleType;
10
- export declare const NUM_VANILLA_COLLECTIBLE_TYPES: CollectibleType;
11
- export declare const MAX_VANILLA_COLLECTIBLE_TYPE: CollectibleType;
12
- export declare const FIRST_PILL_EFFECT = PillEffect.BAD_GAS;
72
+ /** If there are no modded cards, this constant will represent a card that does not exist. */
73
+ export declare const FIRST_MODDED_CARD: Card;
74
+ /**
75
+ * Will change depending on how many modded pill effects there are.
76
+ *
77
+ * Equal to `itemConfig.GetPillEffects().Size - 1`. (We subtract one to account for
78
+ * `PillEffect.NULL`.)
79
+ */
13
80
  export declare const NUM_PILL_EFFECTS: number;
14
- export declare const MAX_PILL_EFFECT: PillEffect;
81
+ /**
82
+ * Calculated from the `PillEffect` enum.
83
+ *
84
+ * (There is no `PillEffect.NULL` in the custom enum, so we don't have to subtract one here.)
85
+ */
15
86
  export declare const NUM_VANILLA_PILL_EFFECTS: number;
16
- export declare const MAX_VANILLA_PILL_EFFECT: PillEffect;
17
- export declare const FIRST_TRINKET_TYPE = TrinketType.SWALLOWED_PENNY;
18
- export declare const NUM_TRINKET_TYPES: number;
19
- export declare const MAX_TRINKET_TYPE: TrinketType;
20
- export declare const NUM_VANILLA_TRINKET_TYPES: number;
21
- export declare const MAX_VANILLA_TRINKET_TYPE: TrinketType;
22
- export declare const FIRST_CHARACTER = PlayerType.ISAAC;
23
- export declare const MAX_VANILLA_CHARACTER: PlayerType;
87
+ export declare const NUM_MODDED_PILL_EFFECTS: number;
88
+ /** Equal to `PillEffect.BAD_GAS`. */
89
+ export declare const FIRST_PILL_EFFECT = PillEffect.BAD_GAS;
90
+ /**
91
+ * Will change depending on how many modded pill effects there are.
92
+ *
93
+ * Equal to `itemConfig.GetPillEffects().Size - 1`. (We subtract one to account for
94
+ * `PillEffect.NULL`.)
95
+ */
96
+ export declare const LAST_PILL_EFFECT: PillEffect;
97
+ /** Calculated from the `PillEffect` enum. */
98
+ export declare const LAST_VANILLA_PILL_EFFECT: PillEffect;
99
+ /**
100
+ * If there are no modded pill effects, this constant will represent a pill effect that does not
101
+ * exist.
102
+ */
103
+ export declare const FIRST_MODDED_PILL_EFFECT: PillEffect;
104
+ /** Equal to `PillColor.BLUE_BLUE`. */
24
105
  export declare const FIRST_PILL_COLOR = PillColor.BLUE_BLUE;
25
- export declare const MAX_NORMAL_PILL_COLOR = PillColor.WHITE_YELLOW;
106
+ /**
107
+ * Equal to `PillColor.WHITE_YELLOW`.
108
+ *
109
+ * Note that `PillColor.GOLD` is technically higher, but that is not considered for the purposes of
110
+ * this constant.
111
+ */
112
+ export declare const LAST_NORMAL_PILL_COLOR = PillColor.WHITE_YELLOW;
113
+ /** Equal to `PillColor.HORSE_BLUE_BLUE`. */
26
114
  export declare const FIRST_HORSE_PILL_COLOR = PillColor.HORSE_BLUE_BLUE;
27
- export declare const MAX_HORSE_PILL_COLOR = PillColor.HORSE_WHITE_YELLOW;
115
+ /**
116
+ * Equal to `PillColor.HORSE_WHITE_YELLOW`.
117
+ *
118
+ * Note that `PillColor.HORSE_GOLD` is technically higher, but that is not considered for the
119
+ * purposes of this constant.
120
+ */
121
+ export declare const LAST_HORSE_PILL_COLOR = PillColor.HORSE_WHITE_YELLOW;
122
+ export declare const NUM_NORMAL_PILL_COLORS: number;
123
+ /** Equal to `PlayerType.ISAAC`. */
124
+ export declare const FIRST_CHARACTER = PlayerType.ISAAC;
125
+ /** Calculated from the `PlayerType` enum. */
126
+ export declare const LAST_VANILLA_CHARACTER: PlayerType;
127
+ /**
128
+ * If there are no modded characters, this constant will represent a character that does not exist.
129
+ */
130
+ export declare const FIRST_MODDED_CHARACTER: PlayerType;
@@ -11,30 +11,40 @@ local itemConfig = ____cachedClasses.itemConfig
11
11
  local ____enums = require("functions.enums")
12
12
  local getEnumLength = ____enums.getEnumLength
13
13
  local getLastEnumValue = ____enums.getLastEnumValue
14
- ____exports.FIRST_CARD = Card.FOOL
14
+ ____exports.FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION
15
+ ____exports.LAST_COLLECTIBLE_TYPE = itemConfig:GetCollectibles().Size - 1
16
+ ____exports.LAST_VANILLA_COLLECTIBLE_TYPE = getLastEnumValue(nil, CollectibleType)
17
+ ____exports.FIRST_MODDED_COLLECTIBLE_TYPE = ____exports.LAST_VANILLA_COLLECTIBLE_TYPE + 1
18
+ ____exports.NUM_VANILLA_COLLECTIBLE_TYPES = getEnumLength(nil, CollectibleType) - 1
19
+ ____exports.NUM_MODDED_COLLECTIBLE_TYPES = ____exports.LAST_COLLECTIBLE_TYPE - ____exports.LAST_VANILLA_COLLECTIBLE_TYPE
20
+ ____exports.NUM_COLLECTIBLE_TYPES = ____exports.NUM_VANILLA_COLLECTIBLE_TYPES + ____exports.NUM_MODDED_COLLECTIBLE_TYPES
21
+ ____exports.NUM_TRINKET_TYPES = itemConfig:GetTrinkets().Size - 1
22
+ ____exports.NUM_VANILLA_TRINKET_TYPES = getEnumLength(nil, TrinketType) - 1
23
+ ____exports.NUM_MODDED_TRINKET_TYPES = ____exports.NUM_TRINKET_TYPES - ____exports.NUM_VANILLA_TRINKET_TYPES
24
+ ____exports.FIRST_TRINKET_TYPE = TrinketType.SWALLOWED_PENNY
25
+ ____exports.LAST_TRINKET_TYPE = ____exports.NUM_TRINKET_TYPES
26
+ ____exports.LAST_VANILLA_TRINKET_TYPE = getLastEnumValue(nil, TrinketType)
27
+ ____exports.FIRST_MODDED_TRINKET_TYPE = ____exports.LAST_VANILLA_TRINKET_TYPE + 1
15
28
  ____exports.NUM_CARDS = itemConfig:GetCards().Size - 1
16
- ____exports.MAX_CARD = ____exports.NUM_CARDS
17
29
  ____exports.NUM_VANILLA_CARDS = getEnumLength(nil, Card) - 1
18
- ____exports.MAX_VANILLA_CARD = ____exports.NUM_VANILLA_CARDS
19
- ____exports.FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION
20
- ____exports.NUM_COLLECTIBLE_TYPES = itemConfig:GetCollectibles().Size - 1
21
- ____exports.MAX_COLLECTIBLE_TYPE = ____exports.NUM_COLLECTIBLE_TYPES
22
- ____exports.NUM_VANILLA_COLLECTIBLE_TYPES = getLastEnumValue(nil, CollectibleType)
23
- ____exports.MAX_VANILLA_COLLECTIBLE_TYPE = ____exports.NUM_VANILLA_COLLECTIBLE_TYPES
24
- ____exports.FIRST_PILL_EFFECT = PillEffect.BAD_GAS
30
+ ____exports.NUM_MODDED_CARDS = ____exports.NUM_CARDS - ____exports.NUM_VANILLA_CARDS
31
+ ____exports.FIRST_CARD = Card.FOOL
32
+ ____exports.LAST_CARD = ____exports.NUM_CARDS
33
+ ____exports.MAX_VANILLA_CARD = getLastEnumValue(nil, Card)
34
+ ____exports.FIRST_MODDED_CARD = ____exports.MAX_VANILLA_CARD + 1
25
35
  ____exports.NUM_PILL_EFFECTS = itemConfig:GetPillEffects().Size - 1
26
- ____exports.MAX_PILL_EFFECT = ____exports.NUM_PILL_EFFECTS
27
36
  ____exports.NUM_VANILLA_PILL_EFFECTS = getEnumLength(nil, PillEffect)
28
- ____exports.MAX_VANILLA_PILL_EFFECT = ____exports.NUM_VANILLA_PILL_EFFECTS
29
- ____exports.FIRST_TRINKET_TYPE = TrinketType.SWALLOWED_PENNY
30
- ____exports.NUM_TRINKET_TYPES = itemConfig:GetTrinkets().Size - 1
31
- ____exports.MAX_TRINKET_TYPE = ____exports.NUM_TRINKET_TYPES
32
- ____exports.NUM_VANILLA_TRINKET_TYPES = getEnumLength(nil, TrinketType) - 1
33
- ____exports.MAX_VANILLA_TRINKET_TYPE = ____exports.NUM_VANILLA_TRINKET_TYPES
34
- ____exports.FIRST_CHARACTER = PlayerType.ISAAC
35
- ____exports.MAX_VANILLA_CHARACTER = getLastEnumValue(nil, PlayerType)
37
+ ____exports.NUM_MODDED_PILL_EFFECTS = ____exports.NUM_PILL_EFFECTS - ____exports.NUM_VANILLA_PILL_EFFECTS
38
+ ____exports.FIRST_PILL_EFFECT = PillEffect.BAD_GAS
39
+ ____exports.LAST_PILL_EFFECT = ____exports.NUM_PILL_EFFECTS
40
+ ____exports.LAST_VANILLA_PILL_EFFECT = getLastEnumValue(nil, PillEffect)
41
+ ____exports.FIRST_MODDED_PILL_EFFECT = ____exports.LAST_VANILLA_PILL_EFFECT + 1
36
42
  ____exports.FIRST_PILL_COLOR = PillColor.BLUE_BLUE
37
- ____exports.MAX_NORMAL_PILL_COLOR = PillColor.WHITE_YELLOW
43
+ ____exports.LAST_NORMAL_PILL_COLOR = PillColor.WHITE_YELLOW
38
44
  ____exports.FIRST_HORSE_PILL_COLOR = PillColor.HORSE_BLUE_BLUE
39
- ____exports.MAX_HORSE_PILL_COLOR = PillColor.HORSE_WHITE_YELLOW
45
+ ____exports.LAST_HORSE_PILL_COLOR = PillColor.HORSE_WHITE_YELLOW
46
+ ____exports.NUM_NORMAL_PILL_COLORS = ____exports.LAST_NORMAL_PILL_COLOR - ____exports.FIRST_PILL_COLOR
47
+ ____exports.FIRST_CHARACTER = PlayerType.ISAAC
48
+ ____exports.LAST_VANILLA_CHARACTER = getLastEnumValue(nil, PlayerType)
49
+ ____exports.FIRST_MODDED_CHARACTER = ____exports.LAST_VANILLA_CHARACTER + 1
40
50
  return ____exports
@@ -21,16 +21,16 @@ local sfxManager = ____cachedClasses.sfxManager
21
21
  local ____constants = require("constants")
22
22
  local FIRST_ROOM_TYPE = ____constants.FIRST_ROOM_TYPE
23
23
  local FIRST_STAGE = ____constants.FIRST_STAGE
24
+ local LAST_ROOM_TYPE = ____constants.LAST_ROOM_TYPE
25
+ local LAST_STAGE = ____constants.LAST_STAGE
24
26
  local MAX_LEVEL_GRID_INDEX = ____constants.MAX_LEVEL_GRID_INDEX
25
- local MAX_ROOM_TYPE = ____constants.MAX_ROOM_TYPE
26
- local MAX_STAGE = ____constants.MAX_STAGE
27
27
  local ____constantsMax = require("constantsMax")
28
28
  local FIRST_CARD = ____constantsMax.FIRST_CARD
29
29
  local FIRST_CHARACTER = ____constantsMax.FIRST_CHARACTER
30
30
  local FIRST_PILL_EFFECT = ____constantsMax.FIRST_PILL_EFFECT
31
- local MAX_CARD = ____constantsMax.MAX_CARD
32
- local MAX_PILL_EFFECT = ____constantsMax.MAX_PILL_EFFECT
33
- local MAX_VANILLA_CHARACTER = ____constantsMax.MAX_VANILLA_CHARACTER
31
+ local LAST_CARD = ____constantsMax.LAST_CARD
32
+ local LAST_PILL_EFFECT = ____constantsMax.LAST_PILL_EFFECT
33
+ local LAST_VANILLA_CHARACTER = ____constantsMax.LAST_VANILLA_CHARACTER
34
34
  local ____HealthType = require("enums.HealthType")
35
35
  local HealthType = ____HealthType.HealthType
36
36
  local ____cards = require("functions.cards")
@@ -282,7 +282,7 @@ function ____exports.card(self, params)
282
282
  end
283
283
  cardNum = match[2]
284
284
  else
285
- if num < FIRST_CARD or num > MAX_CARD then
285
+ if num < FIRST_CARD or num > LAST_CARD then
286
286
  printConsole(
287
287
  nil,
288
288
  "Invalid card sub-type: " .. tostring(num)
@@ -306,7 +306,7 @@ function ____exports.cards(self)
306
306
  do
307
307
  local x = 0
308
308
  while x <= 12 do
309
- if cardType == MAX_CARD then
309
+ if cardType == LAST_CARD then
310
310
  return
311
311
  end
312
312
  local position = gridCoordinatesToWorldPosition(nil, x, y)
@@ -337,7 +337,7 @@ function ____exports.characterCommand(self, params)
337
337
  end
338
338
  character = match[2]
339
339
  else
340
- if num < FIRST_CHARACTER or num > MAX_VANILLA_CHARACTER then
340
+ if num < FIRST_CHARACTER or num > LAST_VANILLA_CHARACTER then
341
341
  printConsole(
342
342
  nil,
343
343
  "Invalid player sub-type: " .. tostring(num)
@@ -559,7 +559,7 @@ function ____exports.pill(self, params)
559
559
  end
560
560
  pillEffect = match[2]
561
561
  else
562
- if num < FIRST_PILL_EFFECT or num > MAX_PILL_EFFECT then
562
+ if num < FIRST_PILL_EFFECT or num > LAST_PILL_EFFECT then
563
563
  printConsole(
564
564
  nil,
565
565
  "Invalid pill effect ID: " .. tostring(num)
@@ -678,10 +678,10 @@ function ____exports.s(self, params)
678
678
  )
679
679
  return
680
680
  end
681
- if stage < FIRST_STAGE or stage > MAX_STAGE then
681
+ if stage < FIRST_STAGE or stage > LAST_STAGE then
682
682
  printConsole(
683
683
  nil,
684
- ((("Invalid stage number; must be between " .. tostring(FIRST_STAGE)) .. " and ") .. tostring(MAX_STAGE)) .. "."
684
+ ((("Invalid stage number; must be between " .. tostring(FIRST_STAGE)) .. " and ") .. tostring(LAST_STAGE)) .. "."
685
685
  )
686
686
  return
687
687
  end
@@ -882,7 +882,7 @@ function ____exports.warp(self, params)
882
882
  end
883
883
  roomType = match[2]
884
884
  else
885
- if num < FIRST_ROOM_TYPE or num > MAX_ROOM_TYPE then
885
+ if num < FIRST_ROOM_TYPE or num > LAST_ROOM_TYPE then
886
886
  printConsole(
887
887
  nil,
888
888
  "Invalid room type: " .. tostring(num)
@@ -31,6 +31,12 @@ export declare function getCardType(card: Card): ItemConfigCardType;
31
31
  * containing cards that match any of the specified types.
32
32
  */
33
33
  export declare function getCardsOfType(...cardTypes: ItemConfigCardType[]): Set<Card>;
34
+ /**
35
+ * Helper function to get an array with every modded card sub-type.
36
+ *
37
+ * Returns an empty array if there are no modded cards.
38
+ */
39
+ export declare function getModdedCards(): Card[];
34
40
  /**
35
41
  * Has an equal chance of returning any card (e.g. Fool, Reverse Fool, Wild Card, etc.).
36
42
  *
@@ -61,6 +67,8 @@ export declare function getRandomCardOfType(cardType: ItemConfigCardType, seedOr
61
67
  * @param exceptions Optional. An array of runes to not select.
62
68
  */
63
69
  export declare function getRandomRune(seedOrRNG?: Seed | RNG, exceptions?: Card[]): Card;
70
+ /** Helper function to get an array with every valid vanilla card sub-type. */
71
+ export declare function getVanillaCards(): Card[];
64
72
  /**
65
73
  * Returns true for cards that have the following card type:
66
74
  * - CardType.TAROT
@@ -12,7 +12,9 @@ local ____cachedClasses = require("cachedClasses")
12
12
  local itemConfig = ____cachedClasses.itemConfig
13
13
  local ____constantsMax = require("constantsMax")
14
14
  local FIRST_CARD = ____constantsMax.FIRST_CARD
15
- local MAX_CARD = ____constantsMax.MAX_CARD
15
+ local FIRST_MODDED_CARD = ____constantsMax.FIRST_MODDED_CARD
16
+ local LAST_CARD = ____constantsMax.LAST_CARD
17
+ local MAX_VANILLA_CARD = ____constantsMax.MAX_VANILLA_CARD
16
18
  local ____cardDescriptions = require("objects.cardDescriptions")
17
19
  local CARD_DESCRIPTIONS = ____cardDescriptions.CARD_DESCRIPTIONS
18
20
  local DEFAULT_CARD_DESCRIPTION = ____cardDescriptions.DEFAULT_CARD_DESCRIPTION
@@ -56,7 +58,7 @@ function initCardObjects(self)
56
58
  addSetsToSet(nil, CARD_SET, cards)
57
59
  end
58
60
  function ____exports.getAllCards(self)
59
- return irange(nil, FIRST_CARD, MAX_CARD)
61
+ return irange(nil, FIRST_CARD, LAST_CARD)
60
62
  end
61
63
  function ____exports.getCardType(self, card)
62
64
  local cardType = CARD_TYPES[card]
@@ -103,6 +105,12 @@ function ____exports.getCardName(self, card)
103
105
  end
104
106
  return DEFAULT_CARD_NAME
105
107
  end
108
+ function ____exports.getModdedCards(self)
109
+ if MAX_VANILLA_CARD == LAST_CARD then
110
+ return {}
111
+ end
112
+ return irange(nil, FIRST_MODDED_CARD, LAST_CARD)
113
+ end
106
114
  function ____exports.getRandomCard(self, seedOrRNG, exceptions)
107
115
  if seedOrRNG == nil then
108
116
  seedOrRNG = getRandomSeed(nil)
@@ -133,6 +141,9 @@ function ____exports.getRandomRune(self, seedOrRNG, exceptions)
133
141
  runesSet:delete(Card.RUNE_SHARD)
134
142
  return getRandomSetElement(nil, runesSet, seedOrRNG, exceptions)
135
143
  end
144
+ function ____exports.getVanillaCards(self)
145
+ return irange(nil, FIRST_CARD, MAX_VANILLA_CARD)
146
+ end
136
147
  function ____exports.isCard(self, card)
137
148
  return CARD_SET:has(card)
138
149
  end
@@ -2,7 +2,7 @@ local ____exports = {}
2
2
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
3
  local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
4
4
  local ____constantsMax = require("constantsMax")
5
- local MAX_VANILLA_CHARACTER = ____constantsMax.MAX_VANILLA_CHARACTER
5
+ local LAST_VANILLA_CHARACTER = ____constantsMax.LAST_VANILLA_CHARACTER
6
6
  local ____characterNames = require("objects.characterNames")
7
7
  local CHARACTER_NAMES = ____characterNames.CHARACTER_NAMES
8
8
  local DEFAULT_CHARACTER_NAME = ____characterNames.DEFAULT_CHARACTER_NAME
@@ -19,7 +19,7 @@ local CHARACTERS_WITH_NO_SOUL_HEARTS_SET = ____charactersWithNoSoulHeartsSet.CHA
19
19
  local ____lostStyleCharactersSet = require("sets.lostStyleCharactersSet")
20
20
  local LOST_STYLE_CHARACTERS_SET = ____lostStyleCharactersSet.LOST_STYLE_CHARACTERS_SET
21
21
  function ____exports.isVanillaCharacter(self, character)
22
- return character <= MAX_VANILLA_CHARACTER
22
+ return character <= LAST_VANILLA_CHARACTER
23
23
  end
24
24
  function ____exports.characterCanHaveRedHearts(self, character)
25
25
  return not CHARACTERS_WITH_NO_RED_HEARTS_SET:has(character)
@@ -1,4 +1,5 @@
1
1
  import { CacheFlag, CollectibleType } from "isaac-typescript-definitions";
2
+ export declare function collectibleHasCacheFlag(collectibleType: CollectibleType, cacheFlag: CacheFlag): boolean;
2
3
  /**
3
4
  * Returns a set containing every collectible type with the given cache flag, including modded
4
5
  * collectibles.
@@ -5,22 +5,32 @@ local Set = ____lualib.Set
5
5
  local ____exports = {}
6
6
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
7
7
  local CacheFlag = ____isaac_2Dtypescript_2Ddefinitions.CacheFlag
8
+ local ____cachedClasses = require("cachedClasses")
9
+ local itemConfig = ____cachedClasses.itemConfig
8
10
  local ____collectibles = require("functions.collectibles")
9
- local collectibleHasCacheFlag = ____collectibles.collectibleHasCacheFlag
10
11
  local getCollectibleTypeRange = ____collectibles.getCollectibleTypeRange
11
12
  local ____enums = require("functions.enums")
12
13
  local getEnumValues = ____enums.getEnumValues
14
+ local ____flag = require("functions.flag")
15
+ local hasFlag = ____flag.hasFlag
13
16
  local ____set = require("functions.set")
14
17
  local copySet = ____set.copySet
15
18
  local getSortedSetValues = ____set.getSortedSetValues
16
19
  local ____utils = require("functions.utils")
17
20
  local ____repeat = ____utils["repeat"]
21
+ function ____exports.collectibleHasCacheFlag(self, collectibleType, cacheFlag)
22
+ local itemConfigItem = itemConfig:GetCollectible(collectibleType)
23
+ if itemConfigItem == nil then
24
+ return false
25
+ end
26
+ return hasFlag(nil, itemConfigItem.CacheFlags, cacheFlag)
27
+ end
18
28
  local CACHE_FLAG_TO_COLLECTIBLES_MAP = __TS__New(Map)
19
29
  local function initCacheFlagMap(self)
20
30
  for ____, cacheFlag in ipairs(getEnumValues(nil, CacheFlag)) do
21
31
  local collectiblesSet = __TS__New(Set)
22
32
  for ____, collectibleType in ipairs(getCollectibleTypeRange(nil)) do
23
- if collectibleHasCacheFlag(nil, collectibleType, cacheFlag) then
33
+ if ____exports.collectibleHasCacheFlag(nil, collectibleType, cacheFlag) then
24
34
  collectiblesSet:add(collectibleType)
25
35
  end
26
36
  end
@@ -1,3 +1,9 @@
1
1
  import { CollectibleType } from "isaac-typescript-definitions";
2
- /** Returns a set containing every valid collectible type in the game, including modded items. */
2
+ /**
3
+ * Returns a set containing every valid collectible type in the game, including modded collectibles.
4
+ */
3
5
  export declare function getCollectibleSet(): Set<CollectibleType>;
6
+ /** Returns a set containing every modded collectible type in the game. */
7
+ export declare function getModdedCollectibleSet(): Set<CollectibleType>;
8
+ /** Returns a set containing every valid vanilla collectible type in the game. */
9
+ export declare function getVanillaCollectibleSet(): Set<CollectibleType>;
@@ -4,23 +4,44 @@ local __TS__New = ____lualib.__TS__New
4
4
  local ____exports = {}
5
5
  local ____cachedClasses = require("cachedClasses")
6
6
  local itemConfig = ____cachedClasses.itemConfig
7
+ local ____constantsMax = require("constantsMax")
8
+ local LAST_VANILLA_COLLECTIBLE_TYPE = ____constantsMax.LAST_VANILLA_COLLECTIBLE_TYPE
7
9
  local ____collectibles = require("functions.collectibles")
8
10
  local getCollectibleTypeRange = ____collectibles.getCollectibleTypeRange
9
11
  local ____set = require("functions.set")
10
12
  local copySet = ____set.copySet
11
- local COLLECTIBLE_SET = __TS__New(Set)
12
- local function initCollectibleSet(self)
13
+ local ALL_COLLECTIBLES_SET = __TS__New(Set)
14
+ local VANILLA_COLLECTIBLES_SET = __TS__New(Set)
15
+ local MODDED_COLLECTIBLES_SET = __TS__New(Set)
16
+ local function initCollectibleSets(self)
13
17
  for ____, collectibleType in ipairs(getCollectibleTypeRange(nil)) do
14
18
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
15
19
  if itemConfigItem ~= nil then
16
- COLLECTIBLE_SET:add(collectibleType)
20
+ ALL_COLLECTIBLES_SET:add(collectibleType)
21
+ if collectibleType <= LAST_VANILLA_COLLECTIBLE_TYPE then
22
+ VANILLA_COLLECTIBLES_SET:add(collectibleType)
23
+ else
24
+ MODDED_COLLECTIBLES_SET:add(collectibleType)
25
+ end
17
26
  end
18
27
  end
19
28
  end
20
29
  function ____exports.getCollectibleSet(self)
21
- if COLLECTIBLE_SET.size == 0 then
22
- initCollectibleSet(nil)
30
+ if ALL_COLLECTIBLES_SET.size == 0 then
31
+ initCollectibleSets(nil)
23
32
  end
24
- return copySet(nil, COLLECTIBLE_SET)
33
+ return copySet(nil, ALL_COLLECTIBLES_SET)
34
+ end
35
+ function ____exports.getModdedCollectibleSet(self)
36
+ if ALL_COLLECTIBLES_SET.size == 0 then
37
+ initCollectibleSets(nil)
38
+ end
39
+ return copySet(nil, MODDED_COLLECTIBLES_SET)
40
+ end
41
+ function ____exports.getVanillaCollectibleSet(self)
42
+ if ALL_COLLECTIBLES_SET.size == 0 then
43
+ initCollectibleSets(nil)
44
+ end
45
+ return copySet(nil, VANILLA_COLLECTIBLES_SET)
25
46
  end
26
47
  return ____exports
@@ -1,7 +1,6 @@
1
- import { CacheFlag, CollectiblePedestalType, CollectibleType, ItemConfigTag, ItemType, PickupPrice } from "isaac-typescript-definitions";
1
+ import { CollectiblePedestalType, CollectibleType, ItemConfigTag, ItemType, PickupPrice } from "isaac-typescript-definitions";
2
2
  import { CollectibleIndex } from "../types/CollectibleIndex";
3
3
  export declare function clearCollectibleSprite(collectible: EntityPickup): void;
4
- export declare function collectibleHasCacheFlag(collectibleType: CollectibleType, cacheFlag: CacheFlag): boolean;
5
4
  /** Helper function to check if two collectible sprites have the same sprite sheet loaded. */
6
5
  export declare function collectibleSpriteEquals(sprite1: Sprite, sprite2: Sprite): boolean;
7
6
  /**
@@ -111,6 +110,28 @@ export declare function getCollectibleTags(collectibleType: CollectibleType): Bi
111
110
  * should use the `getCollectibleSet` helper function instead.
112
111
  */
113
112
  export declare function getCollectibleTypeRange(): CollectibleType[];
113
+ /**
114
+ * Helper function to get an array that represents the all modded collectible types.
115
+ *
116
+ * This function is only useful when building collectible type objects. For most purposes, you
117
+ * should use the `getModdedCollectibleSet` helper function instead.
118
+ *
119
+ * Returns an empty array if there are no modded collectible types.
120
+ *
121
+ * (This function is named differently from the `getVanillaCollectibleTypeRange` function because
122
+ * all modded collectible types are contiguous. Thus, each value represents a real
123
+ * `CollectibleType`.)
124
+ */
125
+ export declare function getModdedCollectibleTypes(): CollectibleType[];
126
+ /**
127
+ * Helper function to get an array that represents the range from the first collectible type to the
128
+ * last vanilla collectible type. This will include integers that do not represent any valid
129
+ * collectible types.
130
+ *
131
+ * This function is only useful when building collectible type objects. For most purposes, you
132
+ * should use the `getVanillaCollectibleSet` helper function instead.
133
+ */
134
+ export declare function getVanillaCollectibleTypeRange(): CollectibleType[];
114
135
  /** Returns true if the item type in the item config is equal to `ItemType.ITEM_ACTIVE`. */
115
136
  export declare function isActiveCollectible(collectibleType: CollectibleType): boolean;
116
137
  /** Returns true if the collectible has a red question mark sprite. */
@@ -15,7 +15,9 @@ local ____constants = require("constants")
15
15
  local BLIND_ITEM_PNG_PATH = ____constants.BLIND_ITEM_PNG_PATH
16
16
  local ____constantsMax = require("constantsMax")
17
17
  local FIRST_COLLECTIBLE_TYPE = ____constantsMax.FIRST_COLLECTIBLE_TYPE
18
- local MAX_COLLECTIBLE_TYPE = ____constantsMax.MAX_COLLECTIBLE_TYPE
18
+ local FIRST_MODDED_COLLECTIBLE_TYPE = ____constantsMax.FIRST_MODDED_COLLECTIBLE_TYPE
19
+ local LAST_COLLECTIBLE_TYPE = ____constantsMax.LAST_COLLECTIBLE_TYPE
20
+ local LAST_VANILLA_COLLECTIBLE_TYPE = ____constantsMax.LAST_VANILLA_COLLECTIBLE_TYPE
19
21
  local ____collectibleDescriptionMap = require("maps.collectibleDescriptionMap")
20
22
  local COLLECTIBLE_DESCRIPTION_MAP = ____collectibleDescriptionMap.COLLECTIBLE_DESCRIPTION_MAP
21
23
  local DEFAULT_COLLECTIBLE_DESCRIPTION = ____collectibleDescriptionMap.DEFAULT_COLLECTIBLE_DESCRIPTION
@@ -26,8 +28,6 @@ local ____singleUseActiveCollectibleTypesSet = require("sets.singleUseActiveColl
26
28
  local SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES_SET = ____singleUseActiveCollectibleTypesSet.SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES_SET
27
29
  local ____entity = require("functions.entity")
28
30
  local getEntityID = ____entity.getEntityID
29
- local ____flag = require("functions.flag")
30
- local hasFlag = ____flag.hasFlag
31
31
  local ____pickupVariants = require("functions.pickupVariants")
32
32
  local isCollectible = ____pickupVariants.isCollectible
33
33
  local ____roomData = require("functions.roomData")
@@ -64,13 +64,6 @@ local questionMarkSprite = initQuestionMarkSprite(nil)
64
64
  function ____exports.clearCollectibleSprite(self, collectible)
65
65
  ____exports.setCollectibleSprite(nil, collectible, nil)
66
66
  end
67
- function ____exports.collectibleHasCacheFlag(self, collectibleType, cacheFlag)
68
- local itemConfigItem = itemConfig:GetCollectible(collectibleType)
69
- if itemConfigItem == nil then
70
- return false
71
- end
72
- return hasFlag(nil, itemConfigItem.CacheFlags, cacheFlag)
73
- end
74
67
  function ____exports.collectibleSpriteEquals(self, sprite1, sprite2)
75
68
  local xStart = -1
76
69
  local xFinish = 1
@@ -194,7 +187,16 @@ function ____exports.getCollectibleTags(self, collectibleType)
194
187
  return itemConfigItem == nil and ItemConfigTagZero or itemConfigItem.Tags
195
188
  end
196
189
  function ____exports.getCollectibleTypeRange(self)
197
- return irange(nil, FIRST_COLLECTIBLE_TYPE, MAX_COLLECTIBLE_TYPE)
190
+ return irange(nil, FIRST_COLLECTIBLE_TYPE, LAST_COLLECTIBLE_TYPE)
191
+ end
192
+ function ____exports.getModdedCollectibleTypes(self)
193
+ if LAST_VANILLA_COLLECTIBLE_TYPE == LAST_COLLECTIBLE_TYPE then
194
+ return {}
195
+ end
196
+ return irange(nil, FIRST_MODDED_COLLECTIBLE_TYPE, LAST_COLLECTIBLE_TYPE)
197
+ end
198
+ function ____exports.getVanillaCollectibleTypeRange(self)
199
+ return irange(nil, FIRST_COLLECTIBLE_TYPE, LAST_VANILLA_COLLECTIBLE_TYPE)
198
200
  end
199
201
  function ____exports.isActiveCollectible(self, collectibleType)
200
202
  local itemType = ____exports.getCollectibleItemType(nil, collectibleType)
@@ -19,7 +19,7 @@ export declare function getKeys(matchingSubType?: number): EntityPickupKey[];
19
19
  /** Helper function to get all of the pill entities in the room. */
20
20
  export declare function getPills(matchingSubType?: number): EntityPickupPill[];
21
21
  /** Helper function to get all of the red heart pickup entities in the room. */
22
- export declare function getRedHearts(): EntityPickup[];
22
+ export declare function getRedHearts(): EntityPickupHeart[];
23
23
  /** Helper function to get all of the sack (i.e. grab bag) entities in the room. */
24
24
  export declare function getSacks(matchingSubType?: number): EntityPickupSack[];
25
25
  /** Helper function to get all of the trinket entities in the room. */
@@ -1,8 +1,4 @@
1
1
  import { ItemConfigPillEffectClass, ItemConfigPillEffectType, PillColor, PillEffect } from "isaac-typescript-definitions";
2
- /** Helper function to get an array with every non-gold horse pill color. */
3
- export declare function getAllHorsePillColors(): PillColor[];
4
- /** Helper function to get an array with every non-gold and non-horse pill color. */
5
- export declare function getAllNormalPillColors(): PillColor[];
6
2
  /**
7
3
  * Helper function to get an array with every non-null pill color. This includes all gold colors and
8
4
  * all horse colors.
@@ -19,6 +15,14 @@ export declare function getAllPillEffects(): PillEffect[];
19
15
  * corresponds to the horse pill color for blue/blue.
20
16
  */
21
17
  export declare function getHorsePillColor(pillColor: PillColor): PillColor;
18
+ /** Helper function to get an array with every non-gold horse pill color. */
19
+ export declare function getHorsePillColors(): PillColor[];
20
+ /**
21
+ * Helper function to get an array with every modded pill effect.
22
+ *
23
+ * Returns an empty array if there are no modded pill effects.
24
+ */
25
+ export declare function getModdedPillEffects(): PillEffect[];
22
26
  /**
23
27
  * Helper function to get the corresponding normal pill color from a horse pill color.
24
28
  *
@@ -27,6 +31,8 @@ export declare function getHorsePillColor(pillColor: PillColor): PillColor;
27
31
  * If called with a non-horse pill color, this function will return back the same color.
28
32
  */
29
33
  export declare function getNormalPillColorFromHorse(pillColor: PillColor): PillColor;
34
+ /** Helper function to get an array with every non-gold and non-horse pill color. */
35
+ export declare function getNormalPillColors(): PillColor[];
30
36
  /**
31
37
  * Helper function to get a pill effect class from a PillEffect enum value. In this context, the
32
38
  * class is equal to the numerical prefix in the "class" tag in the "pocketitems.xml" file. Use the
@@ -58,4 +64,6 @@ export declare function getPillEffectName(pillEffect: PillEffect): string;
58
64
  * will always return `DEFAULT_PILL_EFFECT_TYPE` in those cases.
59
65
  */
60
66
  export declare function getPillEffectType(pillEffect: PillEffect): ItemConfigPillEffectType;
67
+ /** Helper function to get an array with every vanilla pill effect. */
68
+ export declare function getVanillaPillEffects(): PillEffect[];
61
69
  export declare function isHorsePill(pillColor: PillColor): boolean;
@@ -7,11 +7,13 @@ local ____cachedClasses = require("cachedClasses")
7
7
  local itemConfig = ____cachedClasses.itemConfig
8
8
  local ____constantsMax = require("constantsMax")
9
9
  local FIRST_HORSE_PILL_COLOR = ____constantsMax.FIRST_HORSE_PILL_COLOR
10
+ local FIRST_MODDED_PILL_EFFECT = ____constantsMax.FIRST_MODDED_PILL_EFFECT
10
11
  local FIRST_PILL_COLOR = ____constantsMax.FIRST_PILL_COLOR
11
12
  local FIRST_PILL_EFFECT = ____constantsMax.FIRST_PILL_EFFECT
12
- local MAX_HORSE_PILL_COLOR = ____constantsMax.MAX_HORSE_PILL_COLOR
13
- local MAX_NORMAL_PILL_COLOR = ____constantsMax.MAX_NORMAL_PILL_COLOR
14
- local MAX_PILL_EFFECT = ____constantsMax.MAX_PILL_EFFECT
13
+ local LAST_HORSE_PILL_COLOR = ____constantsMax.LAST_HORSE_PILL_COLOR
14
+ local LAST_NORMAL_PILL_COLOR = ____constantsMax.LAST_NORMAL_PILL_COLOR
15
+ local LAST_PILL_EFFECT = ____constantsMax.LAST_PILL_EFFECT
16
+ local LAST_VANILLA_PILL_EFFECT = ____constantsMax.LAST_VANILLA_PILL_EFFECT
15
17
  local ____pillEffectClasses = require("objects.pillEffectClasses")
16
18
  local DEFAULT_PILL_EFFECT_CLASS = ____pillEffectClasses.DEFAULT_PILL_EFFECT_CLASS
17
19
  local PILL_EFFECT_CLASSES = ____pillEffectClasses.PILL_EFFECT_CLASSES
@@ -29,27 +31,33 @@ local ____utils = require("functions.utils")
29
31
  local irange = ____utils.irange
30
32
  local HORSE_PILL_FLAG = 2047
31
33
  local HORSE_PILL_ADJUSTMENT = 2048
32
- function ____exports.getAllHorsePillColors(self)
33
- return irange(nil, FIRST_HORSE_PILL_COLOR, MAX_HORSE_PILL_COLOR)
34
- end
35
- function ____exports.getAllNormalPillColors(self)
36
- return irange(nil, FIRST_PILL_COLOR, MAX_NORMAL_PILL_COLOR)
37
- end
38
34
  function ____exports.getAllPillColors(self)
39
35
  local pillColors = getEnumValues(nil, PillColor)
40
36
  __TS__ArraySlice(pillColors)
41
37
  return pillColors
42
38
  end
43
39
  function ____exports.getAllPillEffects(self)
44
- return irange(nil, FIRST_PILL_EFFECT, MAX_PILL_EFFECT)
40
+ return irange(nil, FIRST_PILL_EFFECT, LAST_PILL_EFFECT)
45
41
  end
46
42
  function ____exports.getHorsePillColor(self, pillColor)
47
43
  return pillColor + HORSE_PILL_ADJUSTMENT
48
44
  end
45
+ function ____exports.getHorsePillColors(self)
46
+ return irange(nil, FIRST_HORSE_PILL_COLOR, LAST_HORSE_PILL_COLOR)
47
+ end
48
+ function ____exports.getModdedPillEffects(self)
49
+ if LAST_VANILLA_PILL_EFFECT == LAST_PILL_EFFECT then
50
+ return {}
51
+ end
52
+ return irange(nil, FIRST_MODDED_PILL_EFFECT, LAST_PILL_EFFECT)
53
+ end
49
54
  function ____exports.getNormalPillColorFromHorse(self, pillColor)
50
55
  local normalPillColor = pillColor - HORSE_PILL_ADJUSTMENT
51
56
  return normalPillColor > PillColor.NULL and normalPillColor or pillColor
52
57
  end
58
+ function ____exports.getNormalPillColors(self)
59
+ return irange(nil, FIRST_PILL_COLOR, LAST_NORMAL_PILL_COLOR)
60
+ end
53
61
  function ____exports.getPillEffectClass(self, pillEffect)
54
62
  local pillEffectClass = PILL_EFFECT_CLASSES[pillEffect]
55
63
  return pillEffectClass == nil and DEFAULT_PILL_EFFECT_CLASS or pillEffectClass
@@ -69,6 +77,9 @@ function ____exports.getPillEffectType(self, pillEffect)
69
77
  local pillEffectClass = PILL_EFFECT_TYPES[pillEffect]
70
78
  return pillEffectClass == nil and DEFAULT_PILL_EFFECT_TYPE or pillEffectClass
71
79
  end
80
+ function ____exports.getVanillaPillEffects(self)
81
+ return irange(nil, FIRST_PILL_EFFECT, LAST_VANILLA_PILL_EFFECT)
82
+ end
72
83
  function ____exports.isHorsePill(self, pillColor)
73
84
  return hasFlag(nil, pillColor, HORSE_PILL_FLAG)
74
85
  end
@@ -12,12 +12,12 @@ local getEnumValues = ____enums.getEnumValues
12
12
  local ____set = require("functions.set")
13
13
  local copySet = ____set.copySet
14
14
  local ____trinkets = require("functions.trinkets")
15
- local getTrinketTypeRange = ____trinkets.getTrinketTypeRange
15
+ local getTrinketTypes = ____trinkets.getTrinketTypes
16
16
  local trinketHasCacheFlag = ____trinkets.trinketHasCacheFlag
17
17
  function initCacheFlagMap(self)
18
18
  for ____, cacheFlag in ipairs(getEnumValues(nil, CacheFlag)) do
19
19
  local trinketsSet = __TS__New(Set)
20
- for ____, trinketType in ipairs(getTrinketTypeRange(nil)) do
20
+ for ____, trinketType in ipairs(getTrinketTypes(nil)) do
21
21
  if trinketHasCacheFlag(nil, trinketType, cacheFlag) then
22
22
  trinketsSet:add(trinketType)
23
23
  end
@@ -6,6 +6,12 @@ import { CacheFlag, TrinketType } from "isaac-typescript-definitions";
6
6
  * corresponds to the golden trinket sub-type for Swallowed Penny.
7
7
  */
8
8
  export declare function getGoldenTrinketType(trinketType: TrinketType): TrinketType;
9
+ /**
10
+ * Helper function to get an array that represents every modded trinket type.
11
+ *
12
+ * Returns an empty array if there are no modded trinket types.
13
+ */
14
+ export declare function getModdedTrinketTypes(): TrinketType[];
9
15
  /**
10
16
  * Returns the slot number corresponding to where a trinket can be safely inserted.
11
17
  *
@@ -38,14 +44,10 @@ export declare function getTrinketDescription(trinketType: TrinketType): string;
38
44
  * ```
39
45
  */
40
46
  export declare function getTrinketName(trinketType: TrinketType): string;
41
- /**
42
- * Helper function to get an array that represents the range from the first trinket type to the last
43
- * trinket type. This will include integers that do not represent any valid trinket types.
44
- *
45
- * This function is only useful when building trinket type objects. For most purposes, you should
46
- * use the `getTrinketSet` helper function instead.
47
- */
48
- export declare function getTrinketTypeRange(): TrinketType[];
47
+ /** Helper function to get an array that contains every trinket type. */
48
+ export declare function getTrinketTypes(): TrinketType[];
49
+ /** Helper function to get an array that represents every vanilla trinket type. */
50
+ export declare function getVanillaTrinketTypes(): TrinketType[];
49
51
  /**
50
52
  * Returns whether or not the player can hold an additional trinket, beyond what they are currently
51
53
  * carrying. This takes into account items that modify the max number of trinkets, like Mom's Purse.
@@ -6,8 +6,10 @@ local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
6
6
  local ____cachedClasses = require("cachedClasses")
7
7
  local itemConfig = ____cachedClasses.itemConfig
8
8
  local ____constantsMax = require("constantsMax")
9
+ local FIRST_MODDED_TRINKET_TYPE = ____constantsMax.FIRST_MODDED_TRINKET_TYPE
9
10
  local FIRST_TRINKET_TYPE = ____constantsMax.FIRST_TRINKET_TYPE
10
- local MAX_TRINKET_TYPE = ____constantsMax.MAX_TRINKET_TYPE
11
+ local LAST_TRINKET_TYPE = ____constantsMax.LAST_TRINKET_TYPE
12
+ local LAST_VANILLA_TRINKET_TYPE = ____constantsMax.LAST_VANILLA_TRINKET_TYPE
11
13
  local ____trinketDescriptionMap = require("maps.trinketDescriptionMap")
12
14
  local DEFAULT_TRINKET_DESCRIPTION = ____trinketDescriptionMap.DEFAULT_TRINKET_DESCRIPTION
13
15
  local TRINKET_DESCRIPTION_MAP = ____trinketDescriptionMap.TRINKET_DESCRIPTION_MAP
@@ -32,6 +34,12 @@ local TRINKET_SPRITE_LAYER = 0
32
34
  function ____exports.getGoldenTrinketType(self, trinketType)
33
35
  return trinketType + GOLDEN_TRINKET_ADJUSTMENT
34
36
  end
37
+ function ____exports.getModdedTrinketTypes(self)
38
+ if LAST_VANILLA_TRINKET_TYPE == LAST_TRINKET_TYPE then
39
+ return {}
40
+ end
41
+ return irange(nil, FIRST_MODDED_TRINKET_TYPE, LAST_TRINKET_TYPE)
42
+ end
35
43
  function ____exports.getOpenTrinketSlot(self, player)
36
44
  local maxTrinkets = player:GetMaxTrinkets()
37
45
  local trinketType1 = player:GetTrinket(TrinketSlot.SLOT_1)
@@ -69,8 +77,11 @@ function ____exports.getTrinketName(self, trinketType)
69
77
  end
70
78
  return DEFAULT_TRINKET_NAME
71
79
  end
72
- function ____exports.getTrinketTypeRange(self)
73
- return irange(nil, FIRST_TRINKET_TYPE, MAX_TRINKET_TYPE)
80
+ function ____exports.getTrinketTypes(self)
81
+ return irange(nil, FIRST_TRINKET_TYPE, LAST_TRINKET_TYPE)
82
+ end
83
+ function ____exports.getVanillaTrinketTypes(self)
84
+ return irange(nil, FIRST_TRINKET_TYPE, LAST_VANILLA_TRINKET_TYPE)
74
85
  end
75
86
  function ____exports.hasOpenTrinketSlot(self, player)
76
87
  if isCharacter(nil, player, PlayerType.THE_SOUL_B) then
package/dist/index.d.ts CHANGED
@@ -101,7 +101,6 @@ export * from "./functions/transformations";
101
101
  export * from "./functions/trinketCacheFlag";
102
102
  export * from "./functions/trinketGive";
103
103
  export * from "./functions/trinkets";
104
- export * from "./functions/trinketSet";
105
104
  export * from "./functions/tstlClass";
106
105
  export * from "./functions/ui";
107
106
  export * from "./functions/utils";
package/dist/index.lua CHANGED
@@ -818,14 +818,6 @@ do
818
818
  end
819
819
  end
820
820
  end
821
- do
822
- local ____export = require("functions.trinketSet")
823
- for ____exportKey, ____exportValue in pairs(____export) do
824
- if ____exportKey ~= "default" then
825
- ____exports[____exportKey] = ____exportValue
826
- end
827
- end
828
- end
829
821
  do
830
822
  local ____export = require("functions.tstlClass")
831
823
  for ____exportKey, ____exportValue in pairs(____export) do
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "2.0.25",
3
+ "version": "2.0.28",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -28,7 +28,7 @@
28
28
  "isaac-typescript-definitions": "^2.0.45"
29
29
  },
30
30
  "devDependencies": {
31
- "isaacscript-lint": "^1.0.157",
31
+ "isaacscript-lint": "^1.0.159",
32
32
  "isaacscript-spell": "^1.0.3",
33
33
  "isaacscript-tsconfig": "^1.1.16",
34
34
  "npm-check-updates": "^13.0.1",