isaacscript-common 24.1.1 → 25.0.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.
- package/dist/index.rollup.d.ts +8 -8
- package/dist/isaacscript-common.lua +10 -10
- package/dist/src/core/constantsFirstLast.d.ts.map +1 -1
- package/dist/src/core/constantsFirstLast.lua +8 -8
- package/dist/src/functions/enums.d.ts +1 -1
- package/dist/src/functions/enums.d.ts.map +1 -1
- package/dist/src/functions/enums.lua +1 -1
- package/package.json +1 -1
- package/src/core/constantsFirstLast.ts +9 -8
- package/src/functions/enums.ts +1 -1
package/dist/index.rollup.d.ts
CHANGED
|
@@ -5106,6 +5106,14 @@ export declare function getHearts(heartSubType?: HeartSubType): EntityPickupHear
|
|
|
5106
5106
|
*/
|
|
5107
5107
|
export declare function getHeartsUIWidth(): int;
|
|
5108
5108
|
|
|
5109
|
+
/**
|
|
5110
|
+
* Helper function to get the enum value with the highest value.
|
|
5111
|
+
*
|
|
5112
|
+
* Note that this is not necessarily the enum value that is declared last, since there is no way to
|
|
5113
|
+
* infer that at run-time.
|
|
5114
|
+
*/
|
|
5115
|
+
export declare function getHighestEnumValue<T>(transpiledEnum: T): T[keyof T];
|
|
5116
|
+
|
|
5109
5117
|
/**
|
|
5110
5118
|
* Helper function to get the corresponding horse pill color from a normal pill color.
|
|
5111
5119
|
*
|
|
@@ -5246,14 +5254,6 @@ export declare function getLasers(laserVariant?: LaserVariant, subType?: number)
|
|
|
5246
5254
|
*/
|
|
5247
5255
|
export declare function getLastElement<T>(array: T[]): T | undefined;
|
|
5248
5256
|
|
|
5249
|
-
/**
|
|
5250
|
-
* Helper function to get the enum value with the highest value.
|
|
5251
|
-
*
|
|
5252
|
-
* Note that this is not necessarily the enum value that is declared last, since there is no way to
|
|
5253
|
-
* infer that at run-time.
|
|
5254
|
-
*/
|
|
5255
|
-
export declare function getLastEnumValue<T>(transpiledEnum: T): T[keyof T];
|
|
5256
|
-
|
|
5257
5257
|
/**
|
|
5258
5258
|
* Helper function that returns the number of the final frame in a particular animation for a
|
|
5259
5259
|
* sprite. By default, it will use the currently playing animation, but you can also specify a
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common
|
|
3
|
+
isaacscript-common 25.0.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -16717,7 +16717,7 @@ function ____exports.getEnumValues(self, transpiledEnum)
|
|
|
16717
16717
|
end
|
|
16718
16718
|
)
|
|
16719
16719
|
end
|
|
16720
|
-
function ____exports.
|
|
16720
|
+
function ____exports.getHighestEnumValue(self, transpiledEnum)
|
|
16721
16721
|
local enumValues = ____exports.getEnumValues(nil, transpiledEnum)
|
|
16722
16722
|
local lastElement = enumValues[#enumValues]
|
|
16723
16723
|
if lastElement == nil then
|
|
@@ -17313,20 +17313,20 @@ local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
|
|
|
17313
17313
|
local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
|
|
17314
17314
|
local ____enums = require("src.functions.enums")
|
|
17315
17315
|
local getEnumLength = ____enums.getEnumLength
|
|
17316
|
-
local
|
|
17316
|
+
local getHighestEnumValue = ____enums.getHighestEnumValue
|
|
17317
17317
|
local ____utils = require("src.functions.utils")
|
|
17318
17318
|
local iRange = ____utils.iRange
|
|
17319
17319
|
____exports.FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION
|
|
17320
|
-
____exports.LAST_VANILLA_COLLECTIBLE_TYPE =
|
|
17320
|
+
____exports.LAST_VANILLA_COLLECTIBLE_TYPE = getHighestEnumValue(nil, CollectibleType)
|
|
17321
17321
|
____exports.NUM_VANILLA_COLLECTIBLE_TYPES = getEnumLength(nil, CollectibleType) - 1
|
|
17322
17322
|
____exports.FIRST_TRINKET_TYPE = TrinketType.SWALLOWED_PENNY
|
|
17323
|
-
____exports.LAST_VANILLA_TRINKET_TYPE =
|
|
17323
|
+
____exports.LAST_VANILLA_TRINKET_TYPE = getHighestEnumValue(nil, TrinketType)
|
|
17324
17324
|
____exports.NUM_VANILLA_TRINKET_TYPES = getEnumLength(nil, TrinketType) - 1
|
|
17325
17325
|
____exports.FIRST_CARD_TYPE = CardType.FOOL
|
|
17326
|
-
____exports.LAST_VANILLA_CARD_TYPE =
|
|
17326
|
+
____exports.LAST_VANILLA_CARD_TYPE = getHighestEnumValue(nil, CardType)
|
|
17327
17327
|
____exports.NUM_VANILLA_CARD_TYPES = getEnumLength(nil, CardType) - 1
|
|
17328
17328
|
____exports.FIRST_PILL_EFFECT = PillEffect.BAD_GAS
|
|
17329
|
-
____exports.LAST_VANILLA_PILL_EFFECT =
|
|
17329
|
+
____exports.LAST_VANILLA_PILL_EFFECT = getHighestEnumValue(nil, PillEffect)
|
|
17330
17330
|
____exports.NUM_VANILLA_PILL_EFFECTS = getEnumLength(nil, PillEffect)
|
|
17331
17331
|
____exports.FIRST_PILL_COLOR = PillColor.BLUE_BLUE
|
|
17332
17332
|
____exports.LAST_NORMAL_PILL_COLOR = PillColor.WHITE_YELLOW
|
|
@@ -17334,11 +17334,11 @@ ____exports.FIRST_HORSE_PILL_COLOR = PillColor.HORSE_BLUE_BLUE
|
|
|
17334
17334
|
____exports.LAST_HORSE_PILL_COLOR = PillColor.HORSE_WHITE_YELLOW
|
|
17335
17335
|
____exports.NUM_NORMAL_PILL_COLORS = #iRange(nil, ____exports.FIRST_PILL_COLOR, ____exports.LAST_NORMAL_PILL_COLOR)
|
|
17336
17336
|
____exports.FIRST_CHARACTER = PlayerType.ISAAC
|
|
17337
|
-
____exports.LAST_VANILLA_CHARACTER =
|
|
17337
|
+
____exports.LAST_VANILLA_CHARACTER = getHighestEnumValue(nil, PlayerType)
|
|
17338
17338
|
____exports.FIRST_ROOM_TYPE = RoomType.DEFAULT
|
|
17339
|
-
____exports.LAST_ROOM_TYPE =
|
|
17339
|
+
____exports.LAST_ROOM_TYPE = getHighestEnumValue(nil, RoomType)
|
|
17340
17340
|
____exports.FIRST_STAGE = LevelStage.BASEMENT_1
|
|
17341
|
-
____exports.LAST_STAGE =
|
|
17341
|
+
____exports.LAST_STAGE = getHighestEnumValue(nil, LevelStage)
|
|
17342
17342
|
return ____exports
|
|
17343
17343
|
end,
|
|
17344
17344
|
["src.core.constants"] = function(...)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constantsFirstLast.d.ts","sourceRoot":"","sources":["../../../src/core/constantsFirstLast.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAQtC,4CAA4C;AAC5C,eAAO,MAAM,sBAAsB,4BAA4B,CAAC;AAEhE;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,
|
|
1
|
+
{"version":3,"file":"constantsFirstLast.d.ts","sourceRoot":"","sources":["../../../src/core/constantsFirstLast.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAQtC,4CAA4C;AAC5C,eAAO,MAAM,sBAAsB,4BAA4B,CAAC;AAEhE;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,iBACJ,CAAC;AAEvC,4FAA4F;AAC5F,eAAO,MAAM,6BAA6B,QAAqC,CAAC;AAMhF,8CAA8C;AAC9C,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AAE9D,8CAA8C;AAC9C,eAAO,MAAM,yBAAyB,aAAmC,CAAC;AAE1E,oFAAoF;AACpF,eAAO,MAAM,yBAAyB,QAAiC,CAAC;AAMxE,4BAA4B;AAC5B,eAAO,MAAM,eAAe,gBAAgB,CAAC;AAE7C,uCAAuC;AACvC,eAAO,MAAM,sBAAsB,UAAgC,CAAC;AAEpE,oEAAoE;AACpE,eAAO,MAAM,sBAAsB,QAA8B,CAAC;AAMlE,qCAAqC;AACrC,eAAO,MAAM,iBAAiB,qBAAqB,CAAC;AAEpD,6CAA6C;AAC7C,eAAO,MAAM,wBAAwB,YAAkC,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,wBAAwB,QAA4B,CAAC;AAMlE,sCAAsC;AACtC,eAAO,MAAM,gBAAgB,sBAAsB,CAAC;AAEpD;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,yBAAyB,CAAC;AAE7D,4CAA4C;AAC5C,eAAO,MAAM,sBAAsB,4BAA4B,CAAC;AAEhE;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,+BAA+B,CAAC;AAElE,eAAO,MAAM,sBAAsB,QAG3B,CAAC;AAMT,mCAAmC;AACnC,eAAO,MAAM,eAAe,mBAAmB,CAAC;AAIhD,6CAA6C;AAC7C,eAAO,MAAM,sBAAsB,YAAkC,CAAC;AAMtE,eAAO,MAAM,eAAe,mBAAmB,CAAC;AAChD,eAAO,MAAM,cAAc,UAAgC,CAAC;AAM5D,eAAO,MAAM,WAAW,wBAAwB,CAAC;AACjD,eAAO,MAAM,UAAU,YAAkC,CAAC"}
|
|
@@ -10,7 +10,7 @@ local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
|
|
|
10
10
|
local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
|
|
11
11
|
local ____enums = require("src.functions.enums")
|
|
12
12
|
local getEnumLength = ____enums.getEnumLength
|
|
13
|
-
local
|
|
13
|
+
local getHighestEnumValue = ____enums.getHighestEnumValue
|
|
14
14
|
local ____utils = require("src.functions.utils")
|
|
15
15
|
local iRange = ____utils.iRange
|
|
16
16
|
--- Equal to `CollectibleType.SAD_ONION`.
|
|
@@ -19,25 +19,25 @@ ____exports.FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION
|
|
|
19
19
|
--
|
|
20
20
|
-- Note that this cannot be calculated from the length of the enum, because unlike all of the other
|
|
21
21
|
-- enums, collectible types are not contiguous.
|
|
22
|
-
____exports.LAST_VANILLA_COLLECTIBLE_TYPE =
|
|
22
|
+
____exports.LAST_VANILLA_COLLECTIBLE_TYPE = getHighestEnumValue(nil, CollectibleType)
|
|
23
23
|
--- Calculated from the `CollectibleType` enum. (`CollectibleType.NULL` is not included.)
|
|
24
24
|
____exports.NUM_VANILLA_COLLECTIBLE_TYPES = getEnumLength(nil, CollectibleType) - 1
|
|
25
25
|
--- Equal to `TrinketType.SWALLOWED_PENNY`.
|
|
26
26
|
____exports.FIRST_TRINKET_TYPE = TrinketType.SWALLOWED_PENNY
|
|
27
27
|
--- Calculated from the `TrinketType` enum.
|
|
28
|
-
____exports.LAST_VANILLA_TRINKET_TYPE =
|
|
28
|
+
____exports.LAST_VANILLA_TRINKET_TYPE = getHighestEnumValue(nil, TrinketType)
|
|
29
29
|
--- Calculated from the `TrinketType` enum. (`TrinketType.NULL` is not included.)
|
|
30
30
|
____exports.NUM_VANILLA_TRINKET_TYPES = getEnumLength(nil, TrinketType) - 1
|
|
31
31
|
--- Equal to `Card.FOOL`.
|
|
32
32
|
____exports.FIRST_CARD_TYPE = CardType.FOOL
|
|
33
33
|
--- Calculated from the `Card` enum.
|
|
34
|
-
____exports.LAST_VANILLA_CARD_TYPE =
|
|
34
|
+
____exports.LAST_VANILLA_CARD_TYPE = getHighestEnumValue(nil, CardType)
|
|
35
35
|
--- Calculated from the `Card` enum. `Card.NULL` is not included.
|
|
36
36
|
____exports.NUM_VANILLA_CARD_TYPES = getEnumLength(nil, CardType) - 1
|
|
37
37
|
--- Equal to `PillEffect.BAD_GAS`.
|
|
38
38
|
____exports.FIRST_PILL_EFFECT = PillEffect.BAD_GAS
|
|
39
39
|
--- Calculated from the `PillEffect` enum.
|
|
40
|
-
____exports.LAST_VANILLA_PILL_EFFECT =
|
|
40
|
+
____exports.LAST_VANILLA_PILL_EFFECT = getHighestEnumValue(nil, PillEffect)
|
|
41
41
|
--- Calculated from the `PillEffect` enum. (There is no `PillEffect.NULL` in the custom enum, so we
|
|
42
42
|
-- do not have to subtract one here.)
|
|
43
43
|
____exports.NUM_VANILLA_PILL_EFFECTS = getEnumLength(nil, PillEffect)
|
|
@@ -59,9 +59,9 @@ ____exports.NUM_NORMAL_PILL_COLORS = #iRange(nil, ____exports.FIRST_PILL_COLOR,
|
|
|
59
59
|
--- Equal to `PlayerType.ISAAC`.
|
|
60
60
|
____exports.FIRST_CHARACTER = PlayerType.ISAAC
|
|
61
61
|
--- Calculated from the `PlayerType` enum.
|
|
62
|
-
____exports.LAST_VANILLA_CHARACTER =
|
|
62
|
+
____exports.LAST_VANILLA_CHARACTER = getHighestEnumValue(nil, PlayerType)
|
|
63
63
|
____exports.FIRST_ROOM_TYPE = RoomType.DEFAULT
|
|
64
|
-
____exports.LAST_ROOM_TYPE =
|
|
64
|
+
____exports.LAST_ROOM_TYPE = getHighestEnumValue(nil, RoomType)
|
|
65
65
|
____exports.FIRST_STAGE = LevelStage.BASEMENT_1
|
|
66
|
-
____exports.LAST_STAGE =
|
|
66
|
+
____exports.LAST_STAGE = getHighestEnumValue(nil, LevelStage)
|
|
67
67
|
return ____exports
|
|
@@ -61,7 +61,7 @@ export declare function getEnumValues<T>(transpiledEnum: T): Array<T[keyof T]>;
|
|
|
61
61
|
* Note that this is not necessarily the enum value that is declared last, since there is no way to
|
|
62
62
|
* infer that at run-time.
|
|
63
63
|
*/
|
|
64
|
-
export declare function
|
|
64
|
+
export declare function getHighestEnumValue<T>(transpiledEnum: T): T[keyof T];
|
|
65
65
|
/**
|
|
66
66
|
* Helper function to get a random value from the provided enum.
|
|
67
67
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../src/functions/enums.ts"],"names":[],"mappings":";;;AAKA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,cAAc,EAAE,CAAC,GAChB,KAAK,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAmBzC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,GAAG,MAAM,EAAE,CAG1D;AAED,sEAAsE;AACtE,wBAAgB,aAAa,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,GAAG,GAAG,CAGvD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAGrE;AAED;;;;;GAKG;AACH,wBAAgB,
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../src/functions/enums.ts"],"names":[],"mappings":";;;AAKA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,cAAc,EAAE,CAAC,GAChB,KAAK,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAmBzC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,GAAG,MAAM,EAAE,CAG1D;AAED,sEAAsE;AACtE,wBAAgB,aAAa,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,GAAG,GAAG,CAGvD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAGrE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAWpE;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,cAAc,EAAE,CAAC,EACjB,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,UAAU,GAAE,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAM,GAC7D,CAAC,CAAC,MAAM,CAAC,CAAC,CAGZ;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAChC,kBAAkB,EAAE,MAAM,EAC1B,cAAc,EAAE,OAAO,GACtB,IAAI,CAQN;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,kBAAkB,EAAE,MAAM,EAC1B,cAAc,EAAE,CAAC,GAChB,IAAI,CAsBN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,4BAA4B,CAE1C,CAAC,SAAS,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,EAC/B,IAAI,SAAS,MAAM,GAAG,MAAM,KACzB,IAAI,CAAG"}
|
|
@@ -109,7 +109,7 @@ end
|
|
|
109
109
|
--
|
|
110
110
|
-- Note that this is not necessarily the enum value that is declared last, since there is no way to
|
|
111
111
|
-- infer that at run-time.
|
|
112
|
-
function ____exports.
|
|
112
|
+
function ____exports.getHighestEnumValue(self, transpiledEnum)
|
|
113
113
|
local enumValues = ____exports.getEnumValues(nil, transpiledEnum)
|
|
114
114
|
local lastElement = enumValues[#enumValues]
|
|
115
115
|
if lastElement == nil then
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
RoomType,
|
|
11
11
|
TrinketType,
|
|
12
12
|
} from "isaac-typescript-definitions";
|
|
13
|
-
import { getEnumLength,
|
|
13
|
+
import { getEnumLength, getHighestEnumValue } from "../functions/enums";
|
|
14
14
|
import { iRange } from "../functions/utils";
|
|
15
15
|
|
|
16
16
|
// ------------
|
|
@@ -26,7 +26,8 @@ export const FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION;
|
|
|
26
26
|
* Note that this cannot be calculated from the length of the enum, because unlike all of the other
|
|
27
27
|
* enums, collectible types are not contiguous.
|
|
28
28
|
*/
|
|
29
|
-
export const LAST_VANILLA_COLLECTIBLE_TYPE =
|
|
29
|
+
export const LAST_VANILLA_COLLECTIBLE_TYPE =
|
|
30
|
+
getHighestEnumValue(CollectibleType);
|
|
30
31
|
|
|
31
32
|
/** Calculated from the `CollectibleType` enum. (`CollectibleType.NULL` is not included.) */
|
|
32
33
|
export const NUM_VANILLA_COLLECTIBLE_TYPES = getEnumLength(CollectibleType) - 1;
|
|
@@ -39,7 +40,7 @@ export const NUM_VANILLA_COLLECTIBLE_TYPES = getEnumLength(CollectibleType) - 1;
|
|
|
39
40
|
export const FIRST_TRINKET_TYPE = TrinketType.SWALLOWED_PENNY;
|
|
40
41
|
|
|
41
42
|
/** Calculated from the `TrinketType` enum. */
|
|
42
|
-
export const LAST_VANILLA_TRINKET_TYPE =
|
|
43
|
+
export const LAST_VANILLA_TRINKET_TYPE = getHighestEnumValue(TrinketType);
|
|
43
44
|
|
|
44
45
|
/** Calculated from the `TrinketType` enum. (`TrinketType.NULL` is not included.) */
|
|
45
46
|
export const NUM_VANILLA_TRINKET_TYPES = getEnumLength(TrinketType) - 1;
|
|
@@ -52,7 +53,7 @@ export const NUM_VANILLA_TRINKET_TYPES = getEnumLength(TrinketType) - 1;
|
|
|
52
53
|
export const FIRST_CARD_TYPE = CardType.FOOL;
|
|
53
54
|
|
|
54
55
|
/** Calculated from the `Card` enum. */
|
|
55
|
-
export const LAST_VANILLA_CARD_TYPE =
|
|
56
|
+
export const LAST_VANILLA_CARD_TYPE = getHighestEnumValue(CardType);
|
|
56
57
|
|
|
57
58
|
/** Calculated from the `Card` enum. `Card.NULL` is not included. */
|
|
58
59
|
export const NUM_VANILLA_CARD_TYPES = getEnumLength(CardType) - 1;
|
|
@@ -65,7 +66,7 @@ export const NUM_VANILLA_CARD_TYPES = getEnumLength(CardType) - 1;
|
|
|
65
66
|
export const FIRST_PILL_EFFECT = PillEffect.BAD_GAS;
|
|
66
67
|
|
|
67
68
|
/** Calculated from the `PillEffect` enum. */
|
|
68
|
-
export const LAST_VANILLA_PILL_EFFECT =
|
|
69
|
+
export const LAST_VANILLA_PILL_EFFECT = getHighestEnumValue(PillEffect);
|
|
69
70
|
|
|
70
71
|
/**
|
|
71
72
|
* Calculated from the `PillEffect` enum. (There is no `PillEffect.NULL` in the custom enum, so we
|
|
@@ -114,18 +115,18 @@ export const FIRST_CHARACTER = PlayerType.ISAAC;
|
|
|
114
115
|
// It is not possible to determine "LAST_PLAYER_TYPE", since there is no associated config.
|
|
115
116
|
|
|
116
117
|
/** Calculated from the `PlayerType` enum. */
|
|
117
|
-
export const LAST_VANILLA_CHARACTER =
|
|
118
|
+
export const LAST_VANILLA_CHARACTER = getHighestEnumValue(PlayerType);
|
|
118
119
|
|
|
119
120
|
// ----------
|
|
120
121
|
// Room Types
|
|
121
122
|
// ----------
|
|
122
123
|
|
|
123
124
|
export const FIRST_ROOM_TYPE = RoomType.DEFAULT;
|
|
124
|
-
export const LAST_ROOM_TYPE =
|
|
125
|
+
export const LAST_ROOM_TYPE = getHighestEnumValue(RoomType);
|
|
125
126
|
|
|
126
127
|
// ------
|
|
127
128
|
// Stages
|
|
128
129
|
// ------
|
|
129
130
|
|
|
130
131
|
export const FIRST_STAGE = LevelStage.BASEMENT_1;
|
|
131
|
-
export const LAST_STAGE =
|
|
132
|
+
export const LAST_STAGE = getHighestEnumValue(LevelStage);
|
package/src/functions/enums.ts
CHANGED
|
@@ -97,7 +97,7 @@ export function getEnumValues<T>(transpiledEnum: T): Array<T[keyof T]> {
|
|
|
97
97
|
* Note that this is not necessarily the enum value that is declared last, since there is no way to
|
|
98
98
|
* infer that at run-time.
|
|
99
99
|
*/
|
|
100
|
-
export function
|
|
100
|
+
export function getHighestEnumValue<T>(transpiledEnum: T): T[keyof T] {
|
|
101
101
|
const enumValues = getEnumValues(transpiledEnum);
|
|
102
102
|
|
|
103
103
|
const lastElement = enumValues[enumValues.length - 1];
|