isaacscript-common 57.8.0 → 57.9.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 +2 -0
- package/dist/isaacscript-common.lua +38 -3
- package/dist/src/functions/pills.d.ts +1 -0
- package/dist/src/functions/pills.d.ts.map +1 -1
- package/dist/src/functions/pills.lua +7 -2
- package/dist/src/objects/pillEffectTypeToPillEffects.d.ts +9 -0
- package/dist/src/objects/pillEffectTypeToPillEffects.d.ts.map +1 -0
- package/dist/src/objects/pillEffectTypeToPillEffects.lua +28 -0
- package/package.json +1 -1
- package/src/functions/pills.ts +9 -2
- package/src/objects/pillEffectTypeToPillEffects.ts +41 -0
package/dist/index.rollup.d.ts
CHANGED
|
@@ -7841,6 +7841,8 @@ export declare function getUsableActiveItemSlots(player: EntityPlayer, collectib
|
|
|
7841
7841
|
*/
|
|
7842
7842
|
export declare function getVanillaCollectibleTypesOfQuality(quality: Quality): ReadonlySet<CollectibleType>;
|
|
7843
7843
|
|
|
7844
|
+
export declare function getVanillaPillEffectsOfType(pillEffectType: ItemConfigPillEffectType): readonly PillEffect[];
|
|
7845
|
+
|
|
7844
7846
|
/**
|
|
7845
7847
|
* Helper function to get the set of grid indexes that represent where the walls are supposed to be
|
|
7846
7848
|
* in a given room shape.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 57.
|
|
3
|
+
isaacscript-common 57.9.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -33213,6 +33213,36 @@ ____exports.PILL_EFFECT_TYPES = {
|
|
|
33213
33213
|
[PillEffect.SHOT_SPEED_UP] = ItemConfigPillEffectType.POSITIVE,
|
|
33214
33214
|
[PillEffect.EXPERIMENTAL] = ItemConfigPillEffectType.NEUTRAL
|
|
33215
33215
|
}
|
|
33216
|
+
return ____exports
|
|
33217
|
+
end,
|
|
33218
|
+
["src.objects.pillEffectTypeToPillEffects"] = function(...)
|
|
33219
|
+
local ____exports = {}
|
|
33220
|
+
local getPillEffectsOfType
|
|
33221
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
33222
|
+
local ItemConfigPillEffectType = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigPillEffectType
|
|
33223
|
+
local ____constantsVanilla = require("src.core.constantsVanilla")
|
|
33224
|
+
local VANILLA_PILL_EFFECTS = ____constantsVanilla.VANILLA_PILL_EFFECTS
|
|
33225
|
+
local ____array = require("src.functions.array")
|
|
33226
|
+
local filterMap = ____array.filterMap
|
|
33227
|
+
local ____pillEffectTypes = require("src.objects.pillEffectTypes")
|
|
33228
|
+
local PILL_EFFECT_TYPES = ____pillEffectTypes.PILL_EFFECT_TYPES
|
|
33229
|
+
function getPillEffectsOfType(self, matchingPillEffectType)
|
|
33230
|
+
return filterMap(
|
|
33231
|
+
nil,
|
|
33232
|
+
VANILLA_PILL_EFFECTS,
|
|
33233
|
+
function(____, pillEffect)
|
|
33234
|
+
local pillEffectType = PILL_EFFECT_TYPES[pillEffect]
|
|
33235
|
+
return pillEffectType == matchingPillEffectType and pillEffect or nil
|
|
33236
|
+
end
|
|
33237
|
+
)
|
|
33238
|
+
end
|
|
33239
|
+
____exports.PILL_EFFECT_TYPE_TO_PILL_EFFECTS = {
|
|
33240
|
+
[ItemConfigPillEffectType.NULL] = getPillEffectsOfType(nil, ItemConfigPillEffectType.NULL),
|
|
33241
|
+
[ItemConfigPillEffectType.POSITIVE] = getPillEffectsOfType(nil, ItemConfigPillEffectType.POSITIVE),
|
|
33242
|
+
[ItemConfigPillEffectType.NEGATIVE] = getPillEffectsOfType(nil, ItemConfigPillEffectType.NEGATIVE),
|
|
33243
|
+
[ItemConfigPillEffectType.NEUTRAL] = getPillEffectsOfType(nil, ItemConfigPillEffectType.NEUTRAL),
|
|
33244
|
+
[ItemConfigPillEffectType.MODDED] = getPillEffectsOfType(nil, ItemConfigPillEffectType.MODDED)
|
|
33245
|
+
}
|
|
33216
33246
|
return ____exports
|
|
33217
33247
|
end,
|
|
33218
33248
|
["src.functions.pills"] = function(...)
|
|
@@ -33242,6 +33272,8 @@ local PILL_EFFECT_CLASSES = ____pillEffectClasses.PILL_EFFECT_CLASSES
|
|
|
33242
33272
|
local ____pillEffectNames = require("src.objects.pillEffectNames")
|
|
33243
33273
|
local DEFAULT_PILL_EFFECT_NAME = ____pillEffectNames.DEFAULT_PILL_EFFECT_NAME
|
|
33244
33274
|
local PILL_EFFECT_NAMES = ____pillEffectNames.PILL_EFFECT_NAMES
|
|
33275
|
+
local ____pillEffectTypeToPillEffects = require("src.objects.pillEffectTypeToPillEffects")
|
|
33276
|
+
local PILL_EFFECT_TYPE_TO_PILL_EFFECTS = ____pillEffectTypeToPillEffects.PILL_EFFECT_TYPE_TO_PILL_EFFECTS
|
|
33245
33277
|
local ____pillEffectTypes = require("src.objects.pillEffectTypes")
|
|
33246
33278
|
local DEFAULT_PILL_EFFECT_TYPE = ____pillEffectTypes.DEFAULT_PILL_EFFECT_TYPE
|
|
33247
33279
|
local PILL_EFFECT_TYPES = ____pillEffectTypes.PILL_EFFECT_TYPES
|
|
@@ -33308,8 +33340,11 @@ function ____exports.getPillEffectName(self, pillEffect)
|
|
|
33308
33340
|
return DEFAULT_PILL_EFFECT_NAME
|
|
33309
33341
|
end
|
|
33310
33342
|
function ____exports.getPillEffectType(self, pillEffect)
|
|
33311
|
-
local
|
|
33312
|
-
return
|
|
33343
|
+
local pillEffectType = PILL_EFFECT_TYPES[pillEffect]
|
|
33344
|
+
return pillEffectType or DEFAULT_PILL_EFFECT_TYPE
|
|
33345
|
+
end
|
|
33346
|
+
function ____exports.getVanillaPillEffectsOfType(self, pillEffectType)
|
|
33347
|
+
return PILL_EFFECT_TYPE_TO_PILL_EFFECTS[pillEffectType]
|
|
33313
33348
|
end
|
|
33314
33349
|
function ____exports.isGoldPill(self, pillColor)
|
|
33315
33350
|
return pillColor == PillColor.GOLD or pillColor == PillColor.HORSE_GOLD
|
|
@@ -78,6 +78,7 @@ export declare function getPillEffectName(pillEffect: PillEffect): string;
|
|
|
78
78
|
* will always return `DEFAULT_PILL_EFFECT_TYPE` in those cases.
|
|
79
79
|
*/
|
|
80
80
|
export declare function getPillEffectType(pillEffect: PillEffect): ItemConfigPillEffectType;
|
|
81
|
+
export declare function getVanillaPillEffectsOfType(pillEffectType: ItemConfigPillEffectType): readonly PillEffect[];
|
|
81
82
|
/** Helper function to see if the given pill color is either a gold pill or a horse gold pill. */
|
|
82
83
|
export declare function isGoldPill(pillColor: PillColor): boolean;
|
|
83
84
|
/** Helper function to see if the given pill color is a horse pill. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pills.d.ts","sourceRoot":"","sources":["../../../src/functions/pills.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACxB,UAAU,EACX,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"pills.d.ts","sourceRoot":"","sources":["../../../src/functions/pills.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACxB,UAAU,EACX,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAqCzD;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,SAAS,EAAE,CAE9C;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAGxE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAEjE;AAED,4EAA4E;AAC5E,wBAAgB,kBAAkB,IAAI,SAAS,EAAE,CAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAM3E;AAED,oFAAoF;AACpF,wBAAgB,mBAAmB,IAAI,SAAS,EAAE,CAEjD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAGnE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,CAWxE;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,UAAU,GACrB,yBAAyB,CAQ3B;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAgBhE;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,UAAU,GACrB,wBAAwB,CAQ1B;AAED,wBAAgB,2BAA2B,CACzC,cAAc,EAAE,wBAAwB,GACvC,SAAS,UAAU,EAAE,CAEvB;AAED,iGAAiG;AACjG,wBAAgB,UAAU,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAExD;AAED,sEAAsE;AACtE,wBAAgB,WAAW,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAEzD;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAElE;AAED,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAEnE"}
|
|
@@ -24,6 +24,8 @@ local PILL_EFFECT_CLASSES = ____pillEffectClasses.PILL_EFFECT_CLASSES
|
|
|
24
24
|
local ____pillEffectNames = require("src.objects.pillEffectNames")
|
|
25
25
|
local DEFAULT_PILL_EFFECT_NAME = ____pillEffectNames.DEFAULT_PILL_EFFECT_NAME
|
|
26
26
|
local PILL_EFFECT_NAMES = ____pillEffectNames.PILL_EFFECT_NAMES
|
|
27
|
+
local ____pillEffectTypeToPillEffects = require("src.objects.pillEffectTypeToPillEffects")
|
|
28
|
+
local PILL_EFFECT_TYPE_TO_PILL_EFFECTS = ____pillEffectTypeToPillEffects.PILL_EFFECT_TYPE_TO_PILL_EFFECTS
|
|
27
29
|
local ____pillEffectTypes = require("src.objects.pillEffectTypes")
|
|
28
30
|
local DEFAULT_PILL_EFFECT_TYPE = ____pillEffectTypes.DEFAULT_PILL_EFFECT_TYPE
|
|
29
31
|
local PILL_EFFECT_TYPES = ____pillEffectTypes.PILL_EFFECT_TYPES
|
|
@@ -144,8 +146,11 @@ end
|
|
|
144
146
|
-- Due to limitations in the API, this function will not work properly for modded pill effects, and
|
|
145
147
|
-- will always return `DEFAULT_PILL_EFFECT_TYPE` in those cases.
|
|
146
148
|
function ____exports.getPillEffectType(self, pillEffect)
|
|
147
|
-
local
|
|
148
|
-
return
|
|
149
|
+
local pillEffectType = PILL_EFFECT_TYPES[pillEffect]
|
|
150
|
+
return pillEffectType or DEFAULT_PILL_EFFECT_TYPE
|
|
151
|
+
end
|
|
152
|
+
function ____exports.getVanillaPillEffectsOfType(self, pillEffectType)
|
|
153
|
+
return PILL_EFFECT_TYPE_TO_PILL_EFFECTS[pillEffectType]
|
|
149
154
|
end
|
|
150
155
|
--- Helper function to see if the given pill color is either a gold pill or a horse gold pill.
|
|
151
156
|
function ____exports.isGoldPill(self, pillColor)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PillEffect } from "isaac-typescript-definitions";
|
|
2
|
+
export declare const PILL_EFFECT_TYPE_TO_PILL_EFFECTS: {
|
|
3
|
+
readonly [-1]: readonly PillEffect[];
|
|
4
|
+
readonly 0: readonly PillEffect[];
|
|
5
|
+
readonly 1: readonly PillEffect[];
|
|
6
|
+
readonly 2: readonly PillEffect[];
|
|
7
|
+
readonly 3: readonly PillEffect[];
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=pillEffectTypeToPillEffects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pillEffectTypeToPillEffects.d.ts","sourceRoot":"","sources":["../../../src/objects/pillEffectTypeToPillEffects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAM/D,eAAO,MAAM,gCAAgC;;;;;;CAyB+B,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local getPillEffectsOfType
|
|
3
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
4
|
+
local ItemConfigPillEffectType = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigPillEffectType
|
|
5
|
+
local ____constantsVanilla = require("src.core.constantsVanilla")
|
|
6
|
+
local VANILLA_PILL_EFFECTS = ____constantsVanilla.VANILLA_PILL_EFFECTS
|
|
7
|
+
local ____array = require("src.functions.array")
|
|
8
|
+
local filterMap = ____array.filterMap
|
|
9
|
+
local ____pillEffectTypes = require("src.objects.pillEffectTypes")
|
|
10
|
+
local PILL_EFFECT_TYPES = ____pillEffectTypes.PILL_EFFECT_TYPES
|
|
11
|
+
function getPillEffectsOfType(self, matchingPillEffectType)
|
|
12
|
+
return filterMap(
|
|
13
|
+
nil,
|
|
14
|
+
VANILLA_PILL_EFFECTS,
|
|
15
|
+
function(____, pillEffect)
|
|
16
|
+
local pillEffectType = PILL_EFFECT_TYPES[pillEffect]
|
|
17
|
+
return pillEffectType == matchingPillEffectType and pillEffect or nil
|
|
18
|
+
end
|
|
19
|
+
)
|
|
20
|
+
end
|
|
21
|
+
____exports.PILL_EFFECT_TYPE_TO_PILL_EFFECTS = {
|
|
22
|
+
[ItemConfigPillEffectType.NULL] = getPillEffectsOfType(nil, ItemConfigPillEffectType.NULL),
|
|
23
|
+
[ItemConfigPillEffectType.POSITIVE] = getPillEffectsOfType(nil, ItemConfigPillEffectType.POSITIVE),
|
|
24
|
+
[ItemConfigPillEffectType.NEGATIVE] = getPillEffectsOfType(nil, ItemConfigPillEffectType.NEGATIVE),
|
|
25
|
+
[ItemConfigPillEffectType.NEUTRAL] = getPillEffectsOfType(nil, ItemConfigPillEffectType.NEUTRAL),
|
|
26
|
+
[ItemConfigPillEffectType.MODDED] = getPillEffectsOfType(nil, ItemConfigPillEffectType.MODDED)
|
|
27
|
+
}
|
|
28
|
+
return ____exports
|
package/package.json
CHANGED
package/src/functions/pills.ts
CHANGED
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
DEFAULT_PILL_EFFECT_NAME,
|
|
24
24
|
PILL_EFFECT_NAMES,
|
|
25
25
|
} from "../objects/pillEffectNames";
|
|
26
|
+
import { PILL_EFFECT_TYPE_TO_PILL_EFFECTS } from "../objects/pillEffectTypeToPillEffects";
|
|
26
27
|
import {
|
|
27
28
|
DEFAULT_PILL_EFFECT_TYPE,
|
|
28
29
|
PILL_EFFECT_TYPES,
|
|
@@ -188,11 +189,17 @@ export function getPillEffectType(
|
|
|
188
189
|
): ItemConfigPillEffectType {
|
|
189
190
|
// `ItemConfigPillEffect` does not contain the "class" tag, so we must manually compile a map of
|
|
190
191
|
// pill effect classes. Modded pill effects are not included in the map.
|
|
191
|
-
const
|
|
192
|
+
const pillEffectType = PILL_EFFECT_TYPES[pillEffect];
|
|
192
193
|
|
|
193
194
|
// Handle modded pill effects.
|
|
194
195
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
195
|
-
return
|
|
196
|
+
return pillEffectType ?? DEFAULT_PILL_EFFECT_TYPE;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export function getVanillaPillEffectsOfType(
|
|
200
|
+
pillEffectType: ItemConfigPillEffectType,
|
|
201
|
+
): readonly PillEffect[] {
|
|
202
|
+
return PILL_EFFECT_TYPE_TO_PILL_EFFECTS[pillEffectType];
|
|
196
203
|
}
|
|
197
204
|
|
|
198
205
|
/** Helper function to see if the given pill color is either a gold pill or a horse gold pill. */
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { PillEffect } from "isaac-typescript-definitions";
|
|
2
|
+
import { ItemConfigPillEffectType } from "isaac-typescript-definitions";
|
|
3
|
+
import { VANILLA_PILL_EFFECTS } from "../core/constantsVanilla";
|
|
4
|
+
import { filterMap } from "../functions/array";
|
|
5
|
+
import { PILL_EFFECT_TYPES } from "./pillEffectTypes";
|
|
6
|
+
|
|
7
|
+
export const PILL_EFFECT_TYPE_TO_PILL_EFFECTS = {
|
|
8
|
+
// -1
|
|
9
|
+
[ItemConfigPillEffectType.NULL]: getPillEffectsOfType(
|
|
10
|
+
ItemConfigPillEffectType.NULL,
|
|
11
|
+
),
|
|
12
|
+
|
|
13
|
+
// 0
|
|
14
|
+
[ItemConfigPillEffectType.POSITIVE]: getPillEffectsOfType(
|
|
15
|
+
ItemConfigPillEffectType.POSITIVE,
|
|
16
|
+
),
|
|
17
|
+
|
|
18
|
+
// 1
|
|
19
|
+
[ItemConfigPillEffectType.NEGATIVE]: getPillEffectsOfType(
|
|
20
|
+
ItemConfigPillEffectType.NEGATIVE,
|
|
21
|
+
),
|
|
22
|
+
|
|
23
|
+
// 2
|
|
24
|
+
[ItemConfigPillEffectType.NEUTRAL]: getPillEffectsOfType(
|
|
25
|
+
ItemConfigPillEffectType.NEUTRAL,
|
|
26
|
+
),
|
|
27
|
+
|
|
28
|
+
// 3
|
|
29
|
+
[ItemConfigPillEffectType.MODDED]: getPillEffectsOfType(
|
|
30
|
+
ItemConfigPillEffectType.MODDED,
|
|
31
|
+
),
|
|
32
|
+
} as const satisfies Record<ItemConfigPillEffectType, readonly PillEffect[]>;
|
|
33
|
+
|
|
34
|
+
function getPillEffectsOfType(
|
|
35
|
+
matchingPillEffectType: ItemConfigPillEffectType,
|
|
36
|
+
): readonly PillEffect[] {
|
|
37
|
+
return filterMap(VANILLA_PILL_EFFECTS, (pillEffect) => {
|
|
38
|
+
const pillEffectType = PILL_EFFECT_TYPES[pillEffect];
|
|
39
|
+
return pillEffectType === matchingPillEffectType ? pillEffect : undefined;
|
|
40
|
+
});
|
|
41
|
+
}
|