isaacscript-common 1.2.14 → 1.2.18

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.
@@ -0,0 +1,6 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ /**
3
+ * Returns a set containing every collectible type with the given cache flag, including modded
4
+ * items.
5
+ */
6
+ export declare function getCollectiblesForCacheFlag(cacheFlag: CacheFlag): Set<CollectibleType | int>;
@@ -0,0 +1,41 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____lualib = require("lualib_bundle")
3
+ local Map = ____lualib.Map
4
+ local __TS__New = ____lualib.__TS__New
5
+ local Set = ____lualib.Set
6
+ local ____exports = {}
7
+ local ____collectibles = require("functions.collectibles")
8
+ local collectibleHasCacheFlag = ____collectibles.collectibleHasCacheFlag
9
+ local getMaxCollectibleID = ____collectibles.getMaxCollectibleID
10
+ local ____set = require("functions.set")
11
+ local copySet = ____set.copySet
12
+ local ____util = require("functions.util")
13
+ local getEnumValues = ____util.getEnumValues
14
+ local CACHE_FLAG_TO_COLLECTIBLES_MAP = __TS__New(Map)
15
+ local function initCacheFlagMap(self)
16
+ local maxCollectibleID = getMaxCollectibleID(nil)
17
+ for ____, cacheFlag in ipairs(getEnumValues(nil, CacheFlag)) do
18
+ local collectiblesSet = __TS__New(Set)
19
+ do
20
+ local collectibleType = 1
21
+ while collectibleType <= maxCollectibleID do
22
+ if collectibleHasCacheFlag(nil, collectibleType, cacheFlag) then
23
+ collectiblesSet:add(collectibleType)
24
+ end
25
+ collectibleType = collectibleType + 1
26
+ end
27
+ end
28
+ CACHE_FLAG_TO_COLLECTIBLES_MAP:set(cacheFlag, collectiblesSet)
29
+ end
30
+ end
31
+ function ____exports.getCollectiblesForCacheFlag(self, cacheFlag)
32
+ if CACHE_FLAG_TO_COLLECTIBLES_MAP.size == 0 then
33
+ initCacheFlagMap(nil)
34
+ end
35
+ local collectiblesSet = CACHE_FLAG_TO_COLLECTIBLES_MAP:get(cacheFlag)
36
+ if collectiblesSet == nil then
37
+ return __TS__New(Set)
38
+ end
39
+ return copySet(nil, collectiblesSet)
40
+ end
41
+ return ____exports
@@ -10,9 +10,10 @@ local copySet = ____set.copySet
10
10
  local COLLECTIBLE_SET = __TS__New(Set)
11
11
  local function initCollectibleSet(self)
12
12
  local itemConfig = Isaac.GetItemConfig()
13
+ local maxCollectibleID = getMaxCollectibleID(nil)
13
14
  do
14
15
  local collectibleType = 1
15
- while collectibleType <= getMaxCollectibleID(nil) do
16
+ while collectibleType <= maxCollectibleID do
16
17
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
17
18
  if itemConfigItem ~= nil then
18
19
  COLLECTIBLE_SET:add(collectibleType)
@@ -1,5 +1,6 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  export declare function collectibleHasTag(collectibleType: CollectibleType | int, tag: ItemConfigTag): boolean;
3
+ export declare function collectibleHasCacheFlag(collectibleType: CollectibleType | int, cacheFlag: CacheFlag): boolean;
3
4
  /**
4
5
  * Helper function to get the in-game description for a collectible. Returns "Unknown" if the
5
6
  * provided collectible type was not valid.
@@ -14,6 +14,8 @@ local COLLECTIBLE_NAME_MAP = ____collectibleNameMap.COLLECTIBLE_NAME_MAP
14
14
  local ____entity = require("functions.entity")
15
15
  local getPickups = ____entity.getPickups
16
16
  local removeAllPickups = ____entity.removeAllPickups
17
+ local ____flag = require("functions.flag")
18
+ local hasFlag = ____flag.hasFlag
17
19
  local ____sprite = require("functions.sprite")
18
20
  local clearSprite = ____sprite.clearSprite
19
21
  function ____exports.setCollectibleSprite(self, collectible, pngPath)
@@ -39,6 +41,14 @@ function ____exports.collectibleHasTag(self, collectibleType, tag)
39
41
  end
40
42
  return itemConfigItem:HasTags(tag)
41
43
  end
44
+ function ____exports.collectibleHasCacheFlag(self, collectibleType, cacheFlag)
45
+ local itemConfig = Isaac.GetItemConfig()
46
+ local itemConfigItem = itemConfig:GetCollectible(collectibleType)
47
+ if itemConfigItem == nil then
48
+ return false
49
+ end
50
+ return hasFlag(nil, itemConfigItem.CacheFlags, cacheFlag)
51
+ end
42
52
  function ____exports.getCollectibleDescription(self, collectibleType)
43
53
  local itemConfig = Isaac.GetItemConfig()
44
54
  local defaultDescription = "Unknown"
@@ -1,4 +1,16 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
+ import { PillEffectClass } from "../types/PillEffectClass";
3
+ import { PillEffectType } from "../types/PillEffectType";
4
+ /**
5
+ * Helper function to get a pill effect class from a PillEffect enum value. In this context, the
6
+ * class is equal to the numerical prefix in the "class" tag in the "pocketitems.xml" file. Use the
7
+ * `getPillEffectType` helper function to determine whether or not the pill effect is positive,
8
+ * negative, or neutral.
9
+ *
10
+ * Due to limitations in the API, this function will not work properly for modded pill effects, and
11
+ * will always return `DEFAULT_PILL_EFFECT_CLASS` in those cases.
12
+ */
13
+ export declare function getPillEffectClass(pillEffect: PillEffect | int): PillEffectClass;
2
14
  /**
3
15
  * Helper function to get a pill effect name from a PillEffect enum value.
4
16
  *
@@ -9,3 +21,13 @@
9
21
  * ```
10
22
  */
11
23
  export declare function getPillEffectName(pillEffect: PillEffect | int): string;
24
+ /**
25
+ * Helper function to get a pill effect type from a PillEffect enum value. In this context, the
26
+ * type is equal to positive, negative, or neutral. This is derived from the suffix of the the
27
+ * "class" tag in the "pocketitems.xml" file. Use the `getPillEffectClass` helper function to
28
+ * determine the "power" of the pill.
29
+ *
30
+ * Due to limitations in the API, this function will not work properly for modded pill effects, and
31
+ * will always return `DEFAULT_PILL_EFFECT_TYPE` in those cases.
32
+ */
33
+ export declare function getPillEffectType(pillEffect: PillEffect | int): PillEffectType;
@@ -2,8 +2,20 @@
2
2
  local ____lualib = require("lualib_bundle")
3
3
  local Map = ____lualib.Map
4
4
  local ____exports = {}
5
+ local ____pillEffectClassMap = require("maps.pillEffectClassMap")
6
+ local PILL_EFFECT_CLASS_MAP = ____pillEffectClassMap.PILL_EFFECT_CLASS_MAP
5
7
  local ____pillEffectNameMap = require("maps.pillEffectNameMap")
6
8
  local PILL_EFFECT_NAME_MAP = ____pillEffectNameMap.PILL_EFFECT_NAME_MAP
9
+ local ____pillEffectTypeMap = require("maps.pillEffectTypeMap")
10
+ local PILL_EFFECT_TYPE_MAP = ____pillEffectTypeMap.PILL_EFFECT_TYPE_MAP
11
+ local ____PillEffectClass = require("types.PillEffectClass")
12
+ local DEFAULT_PILL_EFFECT_CLASS = ____PillEffectClass.DEFAULT_PILL_EFFECT_CLASS
13
+ local ____PillEffectType = require("types.PillEffectType")
14
+ local DEFAULT_PILL_EFFECT_TYPE = ____PillEffectType.DEFAULT_PILL_EFFECT_TYPE
15
+ function ____exports.getPillEffectClass(self, pillEffect)
16
+ local pillEffectClass = PILL_EFFECT_CLASS_MAP:get(pillEffect)
17
+ return pillEffectClass == nil and DEFAULT_PILL_EFFECT_CLASS or pillEffectClass
18
+ end
7
19
  function ____exports.getPillEffectName(self, pillEffect)
8
20
  local itemConfig = Isaac.GetItemConfig()
9
21
  local defaultName = "Unknown"
@@ -20,4 +32,8 @@ function ____exports.getPillEffectName(self, pillEffect)
20
32
  end
21
33
  return itemConfigPillEffect.Name
22
34
  end
35
+ function ____exports.getPillEffectType(self, pillEffect)
36
+ local pillEffectClass = PILL_EFFECT_TYPE_MAP:get(pillEffect)
37
+ return pillEffectClass == nil and DEFAULT_PILL_EFFECT_TYPE or pillEffectClass
38
+ end
23
39
  return ____exports
@@ -1,7 +1,7 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
+ export declare function getCollectibleTypesForTransformation(playerForm: PlayerForm): Set<PlayerForm>;
2
3
  /** Returns the number of items that a player has towards a particular transformation. */
3
4
  export declare function getPlayerNumTransformationCollectibles(player: EntityPlayer, playerForm: PlayerForm): int;
4
- export declare function getTransformationsForItem(collectibleType: CollectibleType | int): PlayerForm[];
5
5
  /**
6
6
  * Helper function to get a transformation name from a PlayerForm enum.
7
7
  *
@@ -12,3 +12,4 @@ export declare function getTransformationsForItem(collectibleType: CollectibleTy
12
12
  * ```
13
13
  */
14
14
  export declare function getTransformationName(transformation: PlayerForm): string;
15
+ export declare function getTransformationsForCollectibleType(collectibleType: CollectibleType | int): Set<PlayerForm>;
@@ -1,37 +1,104 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____lualib = require("lualib_bundle")
3
3
  local Map = ____lualib.Map
4
+ local __TS__New = ____lualib.__TS__New
4
5
  local Set = ____lualib.Set
6
+ local __TS__Iterator = ____lualib.__TS__Iterator
5
7
  local ____exports = {}
6
- local ____transformationMaps = require("maps.transformationMaps")
7
- local ITEM_TO_TRANSFORMATION_MAP = ____transformationMaps.ITEM_TO_TRANSFORMATION_MAP
8
- local TRANSFORMATIONS_NOT_BASED_ON_ITEMS = ____transformationMaps.TRANSFORMATIONS_NOT_BASED_ON_ITEMS
9
- local TRANSFORMATION_TO_ITEMS_MAP = ____transformationMaps.TRANSFORMATION_TO_ITEMS_MAP
10
8
  local ____transformationNameMap = require("maps.transformationNameMap")
11
9
  local TRANSFORMATION_NAME_MAP = ____transformationNameMap.TRANSFORMATION_NAME_MAP
12
- local ____array = require("functions.array")
13
- local arrayCopy = ____array.arrayCopy
10
+ local ____collectibles = require("functions.collectibles")
11
+ local collectibleHasTag = ____collectibles.collectibleHasTag
12
+ local getMaxCollectibleID = ____collectibles.getMaxCollectibleID
13
+ local ____set = require("functions.set")
14
+ local copySet = ____set.copySet
15
+ local TRANSFORMATION_TO_TAG_MAP = __TS__New(Map, {
16
+ {PlayerForm.PLAYERFORM_GUPPY, 32},
17
+ {PlayerForm.PLAYERFORM_LORD_OF_THE_FLIES, 64},
18
+ {PlayerForm.PLAYERFORM_MUSHROOM, 256},
19
+ {PlayerForm.PLAYERFORM_ANGEL, 1024},
20
+ {PlayerForm.PLAYERFORM_BOB, 128},
21
+ {PlayerForm.PLAYERFORM_DRUGS, 2},
22
+ {PlayerForm.PLAYERFORM_MOM, 4},
23
+ {PlayerForm.PLAYERFORM_BABY, 512},
24
+ {PlayerForm.PLAYERFORM_EVIL_ANGEL, 2048},
25
+ {PlayerForm.PLAYERFORM_POOP, 4096},
26
+ {PlayerForm.PLAYERFORM_BOOK_WORM, 8192},
27
+ {PlayerForm.PLAYERFORM_SPIDERBABY, 16384}
28
+ })
29
+ local TRANSFORMATIONS_NOT_BASED_ON_ITEMS = __TS__New(Set, {PlayerForm.PLAYERFORM_ADULTHOOD, PlayerForm.PLAYERFORM_STOMPY, PlayerForm.PLAYERFORM_FLIGHT})
30
+ local TRANSFORMATION_TO_COLLECTIBLE_TYPES_MAP = __TS__New(Map)
31
+ local COLLECTIBLE_TYPE_TO_TRANSFORMATION_MAP = __TS__New(Map)
32
+ local function initMaps(self)
33
+ local maxCollectibleID = getMaxCollectibleID(nil)
34
+ for ____, playerForm in __TS__Iterator(TRANSFORMATION_TO_TAG_MAP:keys()) do
35
+ TRANSFORMATION_TO_COLLECTIBLE_TYPES_MAP:set(
36
+ playerForm,
37
+ __TS__New(Set)
38
+ )
39
+ end
40
+ do
41
+ local collectibleType = 1
42
+ while collectibleType <= maxCollectibleID do
43
+ for ____, ____value in __TS__Iterator(TRANSFORMATION_TO_TAG_MAP:entries()) do
44
+ local playerForm = ____value[1]
45
+ local tag = ____value[2]
46
+ do
47
+ if not collectibleHasTag(nil, collectibleType, tag) then
48
+ goto __continue6
49
+ end
50
+ local collectibleTypesSet = TRANSFORMATION_TO_COLLECTIBLE_TYPES_MAP:get(playerForm)
51
+ if collectibleTypesSet == nil then
52
+ error("Failed to get the collectible types for transformation: " .. tostring(playerForm))
53
+ end
54
+ collectibleTypesSet:add(collectibleType)
55
+ local transformations = COLLECTIBLE_TYPE_TO_TRANSFORMATION_MAP:get(collectibleType)
56
+ if transformations == nil then
57
+ transformations = __TS__New(Set)
58
+ COLLECTIBLE_TYPE_TO_TRANSFORMATION_MAP:set(collectibleType, transformations)
59
+ end
60
+ transformations:add(playerForm)
61
+ end
62
+ ::__continue6::
63
+ end
64
+ collectibleType = collectibleType + 1
65
+ end
66
+ end
67
+ end
68
+ function ____exports.getCollectibleTypesForTransformation(self, playerForm)
69
+ if TRANSFORMATION_TO_COLLECTIBLE_TYPES_MAP.size == 0 then
70
+ initMaps(nil)
71
+ end
72
+ local collectibleTypes = TRANSFORMATION_TO_COLLECTIBLE_TYPES_MAP:get(playerForm)
73
+ return collectibleTypes == nil and __TS__New(Set) or copySet(nil, collectibleTypes)
74
+ end
14
75
  function ____exports.getPlayerNumTransformationCollectibles(self, player, playerForm)
15
76
  if TRANSFORMATIONS_NOT_BASED_ON_ITEMS:has(playerForm) then
16
77
  error(("The transformation of " .. tostring(playerForm)) .. " cannot be tracked by this function.")
17
78
  end
18
- local itemsForTransformation = TRANSFORMATION_TO_ITEMS_MAP:get(playerForm)
79
+ if TRANSFORMATION_TO_COLLECTIBLE_TYPES_MAP.size == 0 then
80
+ initMaps(nil)
81
+ end
82
+ local itemsForTransformation = TRANSFORMATION_TO_COLLECTIBLE_TYPES_MAP:get(playerForm)
19
83
  if itemsForTransformation == nil then
20
84
  error(("The transformation of " .. tostring(playerForm)) .. " is not a valid value of the PlayerForm enum.")
21
85
  end
22
86
  local numCollectibles = 0
23
- for ____, collectibleType in ipairs(itemsForTransformation) do
87
+ for ____, collectibleType in __TS__Iterator(itemsForTransformation:values()) do
24
88
  numCollectibles = numCollectibles + player:GetCollectibleNum(collectibleType)
25
89
  end
26
90
  return numCollectibles
27
91
  end
28
- function ____exports.getTransformationsForItem(self, collectibleType)
29
- local transformations = ITEM_TO_TRANSFORMATION_MAP:get(collectibleType)
30
- return transformations == nil and ({}) or arrayCopy(nil, transformations)
31
- end
32
92
  function ____exports.getTransformationName(self, transformation)
33
93
  local defaultName = "Unknown"
34
94
  local transformationName = TRANSFORMATION_NAME_MAP:get(transformation)
35
95
  return transformationName == nil and defaultName or transformationName
36
96
  end
97
+ function ____exports.getTransformationsForCollectibleType(self, collectibleType)
98
+ if COLLECTIBLE_TYPE_TO_TRANSFORMATION_MAP.size == 0 then
99
+ initMaps(nil)
100
+ end
101
+ local transformations = COLLECTIBLE_TYPE_TO_TRANSFORMATION_MAP:get(collectibleType)
102
+ return transformations == nil and __TS__New(Set) or copySet(nil, transformations)
103
+ end
37
104
  return ____exports
@@ -1,9 +1,6 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /// <reference types="typescript-to-lua/language-extensions" />
3
- /**
4
- * Using a Map constructor to copy a Map does not seem to work properly, so use this helper function
5
- * instead.
6
- */
3
+ /** Helper function to copy a map. (You can also use a Map constructor to accomplish this task.) */
7
4
  export declare function copyMap<K, V>(oldMap: Map<K, V>): Map<K, V>;
8
5
  /**
9
6
  * Helper function to get type safety on a switch statement.
package/dist/index.d.ts CHANGED
@@ -13,6 +13,7 @@ export * from "./functions/bitwise";
13
13
  export * from "./functions/cards";
14
14
  export * from "./functions/challenges";
15
15
  export * from "./functions/charge";
16
+ export * from "./functions/collectibleCacheFlag";
16
17
  export * from "./functions/collectibles";
17
18
  export * from "./functions/collectibleSet";
18
19
  export * from "./functions/color";
@@ -57,9 +58,10 @@ export * from "./functions/vector";
57
58
  export * from "./maps/cardNameMap";
58
59
  export * from "./maps/collectibleNameMap";
59
60
  export * from "./maps/gridEntityXMLMap";
61
+ export * from "./maps/pillEffectClassMap";
60
62
  export * from "./maps/pillEffectNameMap";
63
+ export * from "./maps/pillEffectTypeMap";
61
64
  export * from "./maps/roomShapeToTopLeftWallGridIndexMap";
62
- export * from "./maps/transformationMaps";
63
65
  export * from "./maps/transformationNameMap";
64
66
  export * from "./maps/trinketNameMap";
65
67
  export * from "./sets/cards";
package/dist/index.lua CHANGED
@@ -116,6 +116,14 @@ do
116
116
  end
117
117
  end
118
118
  end
119
+ do
120
+ local ____export = require("functions.collectibleCacheFlag")
121
+ for ____exportKey, ____exportValue in pairs(____export) do
122
+ if ____exportKey ~= "default" then
123
+ ____exports[____exportKey] = ____exportValue
124
+ end
125
+ end
126
+ end
119
127
  do
120
128
  local ____export = require("functions.collectibles")
121
129
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -462,6 +470,14 @@ do
462
470
  end
463
471
  end
464
472
  end
473
+ do
474
+ local ____export = require("maps.pillEffectClassMap")
475
+ for ____exportKey, ____exportValue in pairs(____export) do
476
+ if ____exportKey ~= "default" then
477
+ ____exports[____exportKey] = ____exportValue
478
+ end
479
+ end
480
+ end
465
481
  do
466
482
  local ____export = require("maps.pillEffectNameMap")
467
483
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -471,7 +487,7 @@ do
471
487
  end
472
488
  end
473
489
  do
474
- local ____export = require("maps.roomShapeToTopLeftWallGridIndexMap")
490
+ local ____export = require("maps.pillEffectTypeMap")
475
491
  for ____exportKey, ____exportValue in pairs(____export) do
476
492
  if ____exportKey ~= "default" then
477
493
  ____exports[____exportKey] = ____exportValue
@@ -479,7 +495,7 @@ do
479
495
  end
480
496
  end
481
497
  do
482
- local ____export = require("maps.transformationMaps")
498
+ local ____export = require("maps.roomShapeToTopLeftWallGridIndexMap")
483
499
  for ____exportKey, ____exportValue in pairs(____export) do
484
500
  if ____exportKey ~= "default" then
485
501
  ____exports[____exportKey] = ____exportValue
@@ -0,0 +1,3 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ import { PillEffectClass } from "../types/PillEffectClass";
3
+ export declare const PILL_EFFECT_CLASS_MAP: Map<PillEffect, PillEffectClass>;
@@ -0,0 +1,60 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____lualib = require("lualib_bundle")
3
+ local Map = ____lualib.Map
4
+ local __TS__New = ____lualib.__TS__New
5
+ local ____exports = {}
6
+ local ____PillEffectClass = require("types.PillEffectClass")
7
+ local PillEffectClass = ____PillEffectClass.PillEffectClass
8
+ ____exports.PILL_EFFECT_CLASS_MAP = __TS__New(Map, {
9
+ {PillEffect.PILLEFFECT_BAD_GAS, PillEffectClass.MINOR},
10
+ {PillEffect.PILLEFFECT_BAD_TRIP, PillEffectClass.MEDIUM},
11
+ {PillEffect.PILLEFFECT_BALLS_OF_STEEL, PillEffectClass.MEDIUM},
12
+ {PillEffect.PILLEFFECT_BOMBS_ARE_KEYS, PillEffectClass.MEDIUM},
13
+ {PillEffect.PILLEFFECT_EXPLOSIVE_DIARRHEA, PillEffectClass.MINOR},
14
+ {PillEffect.PILLEFFECT_FULL_HEALTH, PillEffectClass.MEDIUM},
15
+ {PillEffect.PILLEFFECT_HEALTH_DOWN, PillEffectClass.MAJOR},
16
+ {PillEffect.PILLEFFECT_HEALTH_UP, PillEffectClass.MAJOR},
17
+ {PillEffect.PILLEFFECT_I_FOUND_PILLS, PillEffectClass.JOKE},
18
+ {PillEffect.PILLEFFECT_PUBERTY, PillEffectClass.JOKE},
19
+ {PillEffect.PILLEFFECT_PRETTY_FLY, PillEffectClass.MEDIUM},
20
+ {PillEffect.PILLEFFECT_RANGE_DOWN, PillEffectClass.MAJOR},
21
+ {PillEffect.PILLEFFECT_RANGE_UP, PillEffectClass.MAJOR},
22
+ {PillEffect.PILLEFFECT_SPEED_DOWN, PillEffectClass.MAJOR},
23
+ {PillEffect.PILLEFFECT_SPEED_UP, PillEffectClass.MAJOR},
24
+ {PillEffect.PILLEFFECT_TEARS_DOWN, PillEffectClass.MAJOR},
25
+ {PillEffect.PILLEFFECT_TEARS_UP, PillEffectClass.MAJOR},
26
+ {PillEffect.PILLEFFECT_LUCK_DOWN, PillEffectClass.MAJOR},
27
+ {PillEffect.PILLEFFECT_LUCK_UP, PillEffectClass.MAJOR},
28
+ {PillEffect.PILLEFFECT_TELEPILLS, PillEffectClass.MAJOR},
29
+ {PillEffect.PILLEFFECT_48HOUR_ENERGY, PillEffectClass.MEDIUM},
30
+ {PillEffect.PILLEFFECT_HEMATEMESIS, PillEffectClass.MEDIUM},
31
+ {PillEffect.PILLEFFECT_PARALYSIS, PillEffectClass.MINOR},
32
+ {PillEffect.PILLEFFECT_SEE_FOREVER, PillEffectClass.MEDIUM},
33
+ {PillEffect.PILLEFFECT_PHEROMONES, PillEffectClass.MINOR},
34
+ {PillEffect.PILLEFFECT_AMNESIA, PillEffectClass.MEDIUM},
35
+ {PillEffect.PILLEFFECT_LEMON_PARTY, PillEffectClass.MINOR},
36
+ {PillEffect.PILLEFFECT_WIZARD, PillEffectClass.MINOR},
37
+ {PillEffect.PILLEFFECT_PERCS, PillEffectClass.MINOR},
38
+ {PillEffect.PILLEFFECT_ADDICTED, PillEffectClass.MINOR},
39
+ {PillEffect.PILLEFFECT_RELAX, PillEffectClass.JOKE},
40
+ {PillEffect.PILLEFFECT_QUESTIONMARK, PillEffectClass.MINOR},
41
+ {PillEffect.PILLEFFECT_LARGER, PillEffectClass.MINOR},
42
+ {PillEffect.PILLEFFECT_SMALLER, PillEffectClass.MINOR},
43
+ {PillEffect.PILLEFFECT_INFESTED_EXCLAMATION, PillEffectClass.MINOR},
44
+ {PillEffect.PILLEFFECT_INFESTED_QUESTION, PillEffectClass.MINOR},
45
+ {PillEffect.PILLEFFECT_POWER, PillEffectClass.MINOR},
46
+ {PillEffect.PILLEFFECT_RETRO_VISION, PillEffectClass.MINOR},
47
+ {PillEffect.PILLEFFECT_FRIENDS_TILL_THE_END, PillEffectClass.MINOR},
48
+ {PillEffect.PILLEFFECT_X_LAX, PillEffectClass.MINOR},
49
+ {PillEffect.PILLEFFECT_SOMETHINGS_WRONG, PillEffectClass.JOKE},
50
+ {PillEffect.PILLEFFECT_IM_DROWSY, PillEffectClass.MINOR},
51
+ {PillEffect.PILLEFFECT_IM_EXCITED, PillEffectClass.MINOR},
52
+ {PillEffect.PILLEFFECT_GULP, PillEffectClass.MEDIUM},
53
+ {PillEffect.PILLEFFECT_HORF, PillEffectClass.JOKE},
54
+ {PillEffect.PILLEFFECT_SUNSHINE, PillEffectClass.MINOR},
55
+ {PillEffect.PILLEFFECT_VURP, PillEffectClass.MEDIUM},
56
+ {PillEffect.PILLEFFECT_SHOT_SPEED_DOWN, PillEffectClass.MAJOR},
57
+ {PillEffect.PILLEFFECT_SHOT_SPEED_UP, PillEffectClass.MAJOR},
58
+ {PillEffect.PILLEFFECT_EXPERIMENTAL, PillEffectClass.MAJOR}
59
+ })
60
+ return ____exports
@@ -0,0 +1,3 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ import { PillEffectType } from "../types/PillEffectType";
3
+ export declare const PILL_EFFECT_TYPE_MAP: Map<PillEffect, PillEffectType>;
@@ -0,0 +1,60 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____lualib = require("lualib_bundle")
3
+ local Map = ____lualib.Map
4
+ local __TS__New = ____lualib.__TS__New
5
+ local ____exports = {}
6
+ local ____PillEffectType = require("types.PillEffectType")
7
+ local PillEffectType = ____PillEffectType.PillEffectType
8
+ ____exports.PILL_EFFECT_TYPE_MAP = __TS__New(Map, {
9
+ {PillEffect.PILLEFFECT_BAD_GAS, PillEffectType.POSITIVE},
10
+ {PillEffect.PILLEFFECT_BAD_TRIP, PillEffectType.NEGATIVE},
11
+ {PillEffect.PILLEFFECT_BALLS_OF_STEEL, PillEffectType.POSITIVE},
12
+ {PillEffect.PILLEFFECT_BOMBS_ARE_KEYS, PillEffectType.NEUTRAL},
13
+ {PillEffect.PILLEFFECT_EXPLOSIVE_DIARRHEA, PillEffectType.NEUTRAL},
14
+ {PillEffect.PILLEFFECT_FULL_HEALTH, PillEffectType.POSITIVE},
15
+ {PillEffect.PILLEFFECT_HEALTH_DOWN, PillEffectType.NEGATIVE},
16
+ {PillEffect.PILLEFFECT_HEALTH_UP, PillEffectType.POSITIVE},
17
+ {PillEffect.PILLEFFECT_I_FOUND_PILLS, PillEffectType.NEUTRAL},
18
+ {PillEffect.PILLEFFECT_PUBERTY, PillEffectType.NEUTRAL},
19
+ {PillEffect.PILLEFFECT_PRETTY_FLY, PillEffectType.POSITIVE},
20
+ {PillEffect.PILLEFFECT_RANGE_DOWN, PillEffectType.NEGATIVE},
21
+ {PillEffect.PILLEFFECT_RANGE_UP, PillEffectType.POSITIVE},
22
+ {PillEffect.PILLEFFECT_SPEED_DOWN, PillEffectType.NEGATIVE},
23
+ {PillEffect.PILLEFFECT_SPEED_UP, PillEffectType.POSITIVE},
24
+ {PillEffect.PILLEFFECT_TEARS_DOWN, PillEffectType.NEGATIVE},
25
+ {PillEffect.PILLEFFECT_TEARS_UP, PillEffectType.POSITIVE},
26
+ {PillEffect.PILLEFFECT_LUCK_DOWN, PillEffectType.NEGATIVE},
27
+ {PillEffect.PILLEFFECT_LUCK_UP, PillEffectType.POSITIVE},
28
+ {PillEffect.PILLEFFECT_TELEPILLS, PillEffectType.NEUTRAL},
29
+ {PillEffect.PILLEFFECT_48HOUR_ENERGY, PillEffectType.POSITIVE},
30
+ {PillEffect.PILLEFFECT_HEMATEMESIS, PillEffectType.NEUTRAL},
31
+ {PillEffect.PILLEFFECT_PARALYSIS, PillEffectType.NEGATIVE},
32
+ {PillEffect.PILLEFFECT_SEE_FOREVER, PillEffectType.POSITIVE},
33
+ {PillEffect.PILLEFFECT_PHEROMONES, PillEffectType.POSITIVE},
34
+ {PillEffect.PILLEFFECT_AMNESIA, PillEffectType.NEGATIVE},
35
+ {PillEffect.PILLEFFECT_LEMON_PARTY, PillEffectType.POSITIVE},
36
+ {PillEffect.PILLEFFECT_WIZARD, PillEffectType.NEGATIVE},
37
+ {PillEffect.PILLEFFECT_PERCS, PillEffectType.POSITIVE},
38
+ {PillEffect.PILLEFFECT_ADDICTED, PillEffectType.NEGATIVE},
39
+ {PillEffect.PILLEFFECT_RELAX, PillEffectType.NEUTRAL},
40
+ {PillEffect.PILLEFFECT_QUESTIONMARK, PillEffectType.NEGATIVE},
41
+ {PillEffect.PILLEFFECT_LARGER, PillEffectType.NEUTRAL},
42
+ {PillEffect.PILLEFFECT_SMALLER, PillEffectType.NEUTRAL},
43
+ {PillEffect.PILLEFFECT_INFESTED_EXCLAMATION, PillEffectType.POSITIVE},
44
+ {PillEffect.PILLEFFECT_INFESTED_QUESTION, PillEffectType.POSITIVE},
45
+ {PillEffect.PILLEFFECT_POWER, PillEffectType.POSITIVE},
46
+ {PillEffect.PILLEFFECT_RETRO_VISION, PillEffectType.NEGATIVE},
47
+ {PillEffect.PILLEFFECT_FRIENDS_TILL_THE_END, PillEffectType.POSITIVE},
48
+ {PillEffect.PILLEFFECT_X_LAX, PillEffectType.NEGATIVE},
49
+ {PillEffect.PILLEFFECT_SOMETHINGS_WRONG, PillEffectType.POSITIVE},
50
+ {PillEffect.PILLEFFECT_IM_DROWSY, PillEffectType.NEUTRAL},
51
+ {PillEffect.PILLEFFECT_IM_EXCITED, PillEffectType.NEUTRAL},
52
+ {PillEffect.PILLEFFECT_GULP, PillEffectType.POSITIVE},
53
+ {PillEffect.PILLEFFECT_HORF, PillEffectType.NEUTRAL},
54
+ {PillEffect.PILLEFFECT_SUNSHINE, PillEffectType.POSITIVE},
55
+ {PillEffect.PILLEFFECT_VURP, PillEffectType.POSITIVE},
56
+ {PillEffect.PILLEFFECT_SHOT_SPEED_DOWN, PillEffectType.NEGATIVE},
57
+ {PillEffect.PILLEFFECT_SHOT_SPEED_UP, PillEffectType.POSITIVE},
58
+ {PillEffect.PILLEFFECT_EXPERIMENTAL, PillEffectType.NEUTRAL}
59
+ })
60
+ return ____exports
@@ -11,12 +11,13 @@ local ____collectibles = require("functions.collectibles")
11
11
  local collectibleHasTag = ____collectibles.collectibleHasTag
12
12
  local getMaxCollectibleID = ____collectibles.getMaxCollectibleID
13
13
  function initMaps(self)
14
+ local maxCollectibleID = getMaxCollectibleID(nil)
14
15
  for ____, playerForm in __TS__Iterator(____exports.TRANSFORMATION_TO_TAG_MAP:keys()) do
15
16
  ____exports.TRANSFORMATION_TO_ITEMS_MAP:set(playerForm, {})
16
17
  end
17
18
  do
18
19
  local collectibleType = 1
19
- while collectibleType <= getMaxCollectibleID(nil) do
20
+ while collectibleType <= maxCollectibleID do
20
21
  for ____, ____value in __TS__Iterator(____exports.TRANSFORMATION_TO_TAG_MAP:entries()) do
21
22
  local playerForm = ____value[1]
22
23
  local tag = ____value[2]
@@ -1,7 +1,11 @@
1
- /** Equal to the "class" tag in the "pocketitems.xml" file. */
1
+ /**
2
+ * Equal to the number in the "class" tag in the "pocketitems.xml" file. The "+" or "-" part of the
3
+ * tag is contained within the `PillEffectType` enum.
4
+ */
2
5
  export declare enum PillEffectClass {
3
6
  JOKE = 0,
4
7
  MINOR = 1,
5
8
  MEDIUM = 2,
6
9
  MAJOR = 3
7
10
  }
11
+ export declare const DEFAULT_PILL_EFFECT_CLASS = PillEffectClass.MEDIUM;
@@ -9,4 +9,5 @@ ____exports.PillEffectClass.MEDIUM = 2
9
9
  ____exports.PillEffectClass[____exports.PillEffectClass.MEDIUM] = "MEDIUM"
10
10
  ____exports.PillEffectClass.MAJOR = 3
11
11
  ____exports.PillEffectClass[____exports.PillEffectClass.MAJOR] = "MAJOR"
12
+ ____exports.DEFAULT_PILL_EFFECT_CLASS = ____exports.PillEffectClass.MEDIUM
12
13
  return ____exports
@@ -1,5 +1,10 @@
1
+ /**
2
+ * Equal to the suffix of the "class" tag in the "pocketitems.xml" file. "+" is equal to `POSITIVE`,
3
+ * "-" is equal to `NEGATIVE`, and no suffix is equal to `NEUTRAL`.
4
+ */
1
5
  export declare enum PillEffectType {
2
- GOOD = 0,
3
- BAD = 1,
6
+ POSITIVE = 0,
7
+ NEGATIVE = 1,
4
8
  NEUTRAL = 2
5
9
  }
10
+ export declare const DEFAULT_PILL_EFFECT_TYPE = PillEffectType.NEUTRAL;
@@ -1,10 +1,11 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
3
  ____exports.PillEffectType = PillEffectType or ({})
4
- ____exports.PillEffectType.GOOD = 0
5
- ____exports.PillEffectType[____exports.PillEffectType.GOOD] = "GOOD"
6
- ____exports.PillEffectType.BAD = 1
7
- ____exports.PillEffectType[____exports.PillEffectType.BAD] = "BAD"
4
+ ____exports.PillEffectType.POSITIVE = 0
5
+ ____exports.PillEffectType[____exports.PillEffectType.POSITIVE] = "POSITIVE"
6
+ ____exports.PillEffectType.NEGATIVE = 1
7
+ ____exports.PillEffectType[____exports.PillEffectType.NEGATIVE] = "NEGATIVE"
8
8
  ____exports.PillEffectType.NEUTRAL = 2
9
9
  ____exports.PillEffectType[____exports.PillEffectType.NEUTRAL] = "NEUTRAL"
10
+ ____exports.DEFAULT_PILL_EFFECT_TYPE = ____exports.PillEffectType.NEUTRAL
10
11
  return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.14",
3
+ "version": "1.2.18",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "devDependencies": {
28
28
  "@zamiell/typescript-to-lua": "^1.4.0",
29
- "isaac-typescript-definitions": "^1.0.337",
29
+ "isaac-typescript-definitions": "^1.0.338",
30
30
  "isaacscript-lint": "^1.0.79",
31
31
  "isaacscript-tsconfig": "^1.1.8",
32
32
  "typedoc": "^0.22.11",