isaacscript-common 2.0.4 → 2.0.5

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.
@@ -6,6 +6,14 @@ import { ItemConfigPillEffectClass, ItemConfigPillEffectType, PillColor, PillEff
6
6
  * corresponds to the horse pill color for blue/blue.
7
7
  */
8
8
  export declare function getHorsePillColor(pillColor: PillColor): PillColor;
9
+ /**
10
+ * Helper function to get the corresponding normal pill color from a horse pill color.
11
+ *
12
+ * For example, passing 2049 would result in `PillColor.BLUE_BLUE`.
13
+ *
14
+ * If called with a non-horse pill color, this function will return back the same color.
15
+ */
16
+ export declare function getNormalPillColorFromHorse(pillColor: PillColor): PillColor;
9
17
  /**
10
18
  * Helper function to get a pill effect class from a PillEffect enum value. In this context, the
11
19
  * class is equal to the numerical prefix in the "class" tag in the "pocketitems.xml" file. Use the
@@ -1,4 +1,6 @@
1
1
  local ____exports = {}
2
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
+ local PillColor = ____isaac_2Dtypescript_2Ddefinitions.PillColor
2
4
  local ____cachedClasses = require("cachedClasses")
3
5
  local itemConfig = ____cachedClasses.itemConfig
4
6
  local ____pillEffectClasses = require("objects.pillEffectClasses")
@@ -17,6 +19,10 @@ local HORSE_PILL_ADJUSTMENT = 2048
17
19
  function ____exports.getHorsePillColor(self, pillColor)
18
20
  return pillColor + HORSE_PILL_ADJUSTMENT
19
21
  end
22
+ function ____exports.getNormalPillColorFromHorse(self, pillColor)
23
+ local normalPillColor = pillColor - HORSE_PILL_ADJUSTMENT
24
+ return normalPillColor > PillColor.NULL and normalPillColor or pillColor
25
+ end
20
26
  function ____exports.getPillEffectClass(self, pillEffect)
21
27
  local pillEffectClass = PILL_EFFECT_CLASSES[pillEffect]
22
28
  return pillEffectClass == nil and DEFAULT_PILL_EFFECT_CLASS or pillEffectClass
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",