isaacscript-common 1.2.268 → 1.2.272
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/functions/boss.d.ts +32 -3
- package/dist/functions/boss.lua +86 -2
- package/dist/functions/entity.d.ts +18 -0
- package/dist/functions/entity.lua +37 -0
- package/dist/sets/bossSets.d.ts +1 -0
- package/dist/sets/bossSets.lua +30 -0
- package/package.json +1 -1
package/dist/functions/boss.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
import { EntityTypeNonNPC } from "../types/EntityTypeNonNPC";
|
|
2
3
|
/**
|
|
3
4
|
* Helper function to get all of the non-dead bosses in the room.
|
|
4
5
|
*
|
|
@@ -6,11 +7,21 @@
|
|
|
6
7
|
* Horn holes.
|
|
7
8
|
*/
|
|
8
9
|
export declare function getAliveBosses(matchingEntityType?: EntityType | int, matchingVariant?: int, matchingSubType?: int, ignoreFriendly?: boolean): EntityNPC[];
|
|
10
|
+
/**
|
|
11
|
+
* Helper function to get the set of every boss in the game.
|
|
12
|
+
*
|
|
13
|
+
* The set contains strings with the entity type and variant, separated by a period.
|
|
14
|
+
*
|
|
15
|
+
* Also see the `getBossSet` and `getCombinedBossSet` functions.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getAllBossesSet(): Set<string>;
|
|
9
18
|
/**
|
|
10
19
|
* Helper function to get the set of vanilla bosses for a particular stage and stage type
|
|
11
20
|
* combination.
|
|
12
21
|
*
|
|
13
|
-
*
|
|
22
|
+
* The set contains strings with the entity type and variant, separated by a period.
|
|
23
|
+
*
|
|
24
|
+
* Also see the `getAllBossesSet` and `getCombinedBossSet` functions.
|
|
14
25
|
*/
|
|
15
26
|
export declare function getBossSet(stage: int, stageType: StageType): ReadonlySet<string> | undefined;
|
|
16
27
|
/** Helper function to get all of the bosses in the room. */
|
|
@@ -20,8 +31,26 @@ export declare function getBosses(matchingEntityType?: EntityType | int, matchin
|
|
|
20
31
|
* types. For example, specifying a stage of 2 will return a set with all of the bosses for
|
|
21
32
|
* Basement, Cellar, Burning Basement, Downpour, and Dross.
|
|
22
33
|
*
|
|
23
|
-
*
|
|
34
|
+
* The set contains strings with the entity type and variant, separated by a period.
|
|
35
|
+
*
|
|
36
|
+
* Also see the `getAllBossesSet` and `getBossSet` functions.
|
|
24
37
|
*/
|
|
25
|
-
export declare function getCombinedBossSet(stage: int):
|
|
38
|
+
export declare function getCombinedBossSet(stage: int): Set<string> | undefined;
|
|
26
39
|
/** Helper function to check if the provided NPC is a Sin miniboss, such as Sloth or Lust. */
|
|
27
40
|
export declare function isSin(npc: EntityNPC): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Helper function to spawn a boss.
|
|
43
|
+
*
|
|
44
|
+
* Use this function instead of `spawnNPC` since it handles automatically spawning multiple segments
|
|
45
|
+
* for multi-segment bosses.
|
|
46
|
+
*
|
|
47
|
+
* By default, this will spawn Chub (and his variants) with 3 segments and other multi-segment
|
|
48
|
+
* bosses with 4 segments. You can customize this via the "numSegments" argument.
|
|
49
|
+
*/
|
|
50
|
+
export declare function spawnBoss<T extends number>(entityType: T extends EntityTypeNonNPC ? never : T, variant: int, subType: int, position: Vector, velocity?: Readonly<Vector>, spawner?: Entity | undefined, seed?: Seed | undefined, numSegments?: int): EntityNPC;
|
|
51
|
+
/**
|
|
52
|
+
* Helper function to spawn a boss with a specific seed.
|
|
53
|
+
*
|
|
54
|
+
* For more information, see the documentation for the `spawnBoss` function.
|
|
55
|
+
*/
|
|
56
|
+
export declare function spawnBossWithSeed(entityType: EntityType | int, variant: int, subType: int, position: Vector, seed: Seed, velocity?: Readonly<Vector>, spawner?: Entity | undefined, numSegments?: int): EntityNPC;
|
package/dist/functions/boss.lua
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local Set = ____lualib.Set
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
2
4
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
3
5
|
local ____exports = {}
|
|
6
|
+
local ____constants = require("constants")
|
|
7
|
+
local VectorZero = ____constants.VectorZero
|
|
4
8
|
local ____bossSets = require("sets.bossSets")
|
|
9
|
+
local ALL_BOSSES_SET = ____bossSets.ALL_BOSSES_SET
|
|
5
10
|
local STAGE_TO_COMBINED_BOSS_SET_MAP = ____bossSets.STAGE_TO_COMBINED_BOSS_SET_MAP
|
|
6
11
|
local STAGE_TO_STAGE_TYPE_TO_BOSS_SET_MAP = ____bossSets.STAGE_TO_STAGE_TYPE_TO_BOSS_SET_MAP
|
|
7
12
|
local ____sinEntityTypesSet = require("sets.sinEntityTypesSet")
|
|
8
13
|
local SIN_ENTITY_TYPES_SET = ____sinEntityTypesSet.SIN_ENTITY_TYPES_SET
|
|
9
14
|
local ____entitySpecific = require("functions.entitySpecific")
|
|
10
15
|
local getNPCs = ____entitySpecific.getNPCs
|
|
16
|
+
local spawnNPC = ____entitySpecific.spawnNPC
|
|
11
17
|
local ____npc = require("functions.npc")
|
|
12
18
|
local getAliveNPCs = ____npc.getAliveNPCs
|
|
19
|
+
local ____set = require("functions.set")
|
|
20
|
+
local copySet = ____set.copySet
|
|
21
|
+
local ____utils = require("functions.utils")
|
|
22
|
+
local ____repeat = ____utils["repeat"]
|
|
23
|
+
local BOSSES_THAT_REQUIRE_MULTIPLE_SPAWNS = __TS__New(Set, {EntityType.ENTITY_LARRYJR, EntityType.ENTITY_CHUB, EntityType.ENTITY_TURDLET})
|
|
13
24
|
function ____exports.getAliveBosses(self, matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
|
|
14
25
|
if ignoreFriendly == nil then
|
|
15
26
|
ignoreFriendly = false
|
|
@@ -26,12 +37,19 @@ function ____exports.getAliveBosses(self, matchingEntityType, matchingVariant, m
|
|
|
26
37
|
function(____, aliveNPC) return aliveNPC:IsBoss() end
|
|
27
38
|
)
|
|
28
39
|
end
|
|
40
|
+
function ____exports.getAllBossesSet(self)
|
|
41
|
+
return copySet(nil, ALL_BOSSES_SET)
|
|
42
|
+
end
|
|
29
43
|
function ____exports.getBossSet(self, stage, stageType)
|
|
30
44
|
local stageTypeMap = STAGE_TO_STAGE_TYPE_TO_BOSS_SET_MAP:get(stage)
|
|
31
45
|
if stageTypeMap == nil then
|
|
32
46
|
return nil
|
|
33
47
|
end
|
|
34
|
-
|
|
48
|
+
local bossSet = stageTypeMap:get(stageType)
|
|
49
|
+
if bossSet == nil then
|
|
50
|
+
return nil
|
|
51
|
+
end
|
|
52
|
+
return copySet(nil, bossSet)
|
|
35
53
|
end
|
|
36
54
|
function ____exports.getBosses(self, matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
|
|
37
55
|
if ignoreFriendly == nil then
|
|
@@ -50,9 +68,75 @@ function ____exports.getBosses(self, matchingEntityType, matchingVariant, matchi
|
|
|
50
68
|
)
|
|
51
69
|
end
|
|
52
70
|
function ____exports.getCombinedBossSet(self, stage)
|
|
53
|
-
|
|
71
|
+
local bossSet = STAGE_TO_COMBINED_BOSS_SET_MAP:get(stage)
|
|
72
|
+
if bossSet == nil then
|
|
73
|
+
return nil
|
|
74
|
+
end
|
|
75
|
+
return copySet(nil, bossSet)
|
|
54
76
|
end
|
|
55
77
|
function ____exports.isSin(self, npc)
|
|
56
78
|
return SIN_ENTITY_TYPES_SET:has(npc.Type)
|
|
57
79
|
end
|
|
80
|
+
function ____exports.spawnBoss(self, entityType, variant, subType, position, velocity, spawner, seed, numSegments)
|
|
81
|
+
if velocity == nil then
|
|
82
|
+
velocity = VectorZero
|
|
83
|
+
end
|
|
84
|
+
if spawner == nil then
|
|
85
|
+
spawner = nil
|
|
86
|
+
end
|
|
87
|
+
if seed == nil then
|
|
88
|
+
seed = nil
|
|
89
|
+
end
|
|
90
|
+
local npc = spawnNPC(
|
|
91
|
+
nil,
|
|
92
|
+
entityType,
|
|
93
|
+
variant,
|
|
94
|
+
subType,
|
|
95
|
+
position,
|
|
96
|
+
velocity,
|
|
97
|
+
spawner,
|
|
98
|
+
seed
|
|
99
|
+
)
|
|
100
|
+
if BOSSES_THAT_REQUIRE_MULTIPLE_SPAWNS:has(entityType) then
|
|
101
|
+
local numSegmentsDefined = numSegments == nil and 4 or numSegments
|
|
102
|
+
local numSegmentsToUse = entityType == EntityType.ENTITY_CHUB and 3 or numSegmentsDefined
|
|
103
|
+
local remainingSegmentsToSpawn = numSegmentsToUse - 1
|
|
104
|
+
____repeat(
|
|
105
|
+
nil,
|
|
106
|
+
remainingSegmentsToSpawn,
|
|
107
|
+
function()
|
|
108
|
+
spawnNPC(
|
|
109
|
+
nil,
|
|
110
|
+
entityType,
|
|
111
|
+
variant,
|
|
112
|
+
subType,
|
|
113
|
+
position,
|
|
114
|
+
velocity,
|
|
115
|
+
spawner,
|
|
116
|
+
seed
|
|
117
|
+
)
|
|
118
|
+
end
|
|
119
|
+
)
|
|
120
|
+
end
|
|
121
|
+
return npc
|
|
122
|
+
end
|
|
123
|
+
function ____exports.spawnBossWithSeed(self, entityType, variant, subType, position, seed, velocity, spawner, numSegments)
|
|
124
|
+
if velocity == nil then
|
|
125
|
+
velocity = VectorZero
|
|
126
|
+
end
|
|
127
|
+
if spawner == nil then
|
|
128
|
+
spawner = nil
|
|
129
|
+
end
|
|
130
|
+
return ____exports.spawnBoss(
|
|
131
|
+
nil,
|
|
132
|
+
entityType,
|
|
133
|
+
variant,
|
|
134
|
+
subType,
|
|
135
|
+
position,
|
|
136
|
+
velocity,
|
|
137
|
+
spawner,
|
|
138
|
+
seed,
|
|
139
|
+
numSegments
|
|
140
|
+
)
|
|
141
|
+
end
|
|
58
142
|
return ____exports
|
|
@@ -67,6 +67,24 @@ export declare function isEntityMoving(entity: Entity, threshold?: number): bool
|
|
|
67
67
|
* apply to non-story bosses, like Vanishing Twin. Also see the `STORY_BOSSES` constant.
|
|
68
68
|
*/
|
|
69
69
|
export declare function isStoryBoss(entityType: EntityType | int): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Helper function to parse a string that contains an entity type, a variant, and a sub-type,
|
|
72
|
+
* separated by periods.
|
|
73
|
+
*
|
|
74
|
+
* For example, passing "45.0.1" would return an array of [45, 0, 1].
|
|
75
|
+
*
|
|
76
|
+
* Returns undefined if the string cannot be parsed.
|
|
77
|
+
*/
|
|
78
|
+
export declare function parseEntityID(entityID: string): [entityType: EntityType | int, variant: int, subType: int] | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Helper function to parse a string that contains an entity type and a variant separated by a
|
|
81
|
+
* period.
|
|
82
|
+
*
|
|
83
|
+
* For example, passing "45.0" would return an array of [45, 0].
|
|
84
|
+
*
|
|
85
|
+
* Returns undefined if the string cannot be parsed.
|
|
86
|
+
*/
|
|
87
|
+
export declare function parseEntityTypeVariantString(entityTypeVariantString: string): [entityType: EntityType | int, variant: int] | undefined;
|
|
70
88
|
/**
|
|
71
89
|
* Helper function to remove all of the matching entities in the room.
|
|
72
90
|
*
|
|
@@ -2,6 +2,7 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local Set = ____lualib.Set
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
4
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
5
|
+
local __TS__StringSplit = ____lualib.__TS__StringSplit
|
|
5
6
|
local ____exports = {}
|
|
6
7
|
local ____cachedClasses = require("cachedClasses")
|
|
7
8
|
local game = ____cachedClasses.game
|
|
@@ -107,6 +108,42 @@ end
|
|
|
107
108
|
function ____exports.isStoryBoss(self, entityType)
|
|
108
109
|
return STORY_BOSSES_SET:has(entityType)
|
|
109
110
|
end
|
|
111
|
+
function ____exports.parseEntityID(self, entityID)
|
|
112
|
+
local entityIDArray = __TS__StringSplit(entityID, ".")
|
|
113
|
+
if #entityIDArray ~= 3 then
|
|
114
|
+
return nil
|
|
115
|
+
end
|
|
116
|
+
local entityTypeString, variantString, subTypeString = table.unpack(entityIDArray)
|
|
117
|
+
local entityType = tonumber(entityTypeString)
|
|
118
|
+
if entityType == nil then
|
|
119
|
+
return nil
|
|
120
|
+
end
|
|
121
|
+
local variant = tonumber(variantString)
|
|
122
|
+
if variant == nil then
|
|
123
|
+
return nil
|
|
124
|
+
end
|
|
125
|
+
local subType = tonumber(subTypeString)
|
|
126
|
+
if subType == nil then
|
|
127
|
+
return nil
|
|
128
|
+
end
|
|
129
|
+
return {entityType, variant, subType}
|
|
130
|
+
end
|
|
131
|
+
function ____exports.parseEntityTypeVariantString(self, entityTypeVariantString)
|
|
132
|
+
local entityTypeVariantArray = __TS__StringSplit(entityTypeVariantString, ".")
|
|
133
|
+
if #entityTypeVariantArray ~= 2 then
|
|
134
|
+
return nil
|
|
135
|
+
end
|
|
136
|
+
local entityTypeString, variantString = table.unpack(entityTypeVariantArray)
|
|
137
|
+
local entityType = tonumber(entityTypeString)
|
|
138
|
+
if entityType == nil then
|
|
139
|
+
return nil
|
|
140
|
+
end
|
|
141
|
+
local variant = tonumber(variantString)
|
|
142
|
+
if variant == nil then
|
|
143
|
+
return nil
|
|
144
|
+
end
|
|
145
|
+
return {entityType, variant}
|
|
146
|
+
end
|
|
110
147
|
function ____exports.removeAllMatchingEntities(self, entityType, entityVariant, entitySubType, cap)
|
|
111
148
|
if entityVariant == nil then
|
|
112
149
|
entityVariant = -1
|
package/dist/sets/bossSets.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
export declare const STAGE_TO_STAGE_TYPE_TO_BOSS_SET_MAP: ReadonlyMap<int, ReadonlyMap<int, ReadonlySet<string>>>;
|
|
3
3
|
export declare const STAGE_TO_COMBINED_BOSS_SET_MAP: ReadonlyMap<int, ReadonlySet<string>>;
|
|
4
|
+
export declare const ALL_BOSSES_SET: ReadonlySet<string>;
|
package/dist/sets/bossSets.lua
CHANGED
|
@@ -468,4 +468,34 @@ ____exports.STAGE_TO_COMBINED_BOSS_SET_MAP = __TS__New(Map, {
|
|
|
468
468
|
{10, ALL_STAGE_10_BOSSES_SET},
|
|
469
469
|
{11, ALL_STAGE_11_BOSSES_SET}
|
|
470
470
|
})
|
|
471
|
+
local ____Set_13 = Set
|
|
472
|
+
local ____array_12 = __TS__SparseArrayNew(__TS__Spread(ALL_BASEMENT_BOSSES_SET:values()))
|
|
473
|
+
__TS__SparseArrayPush(
|
|
474
|
+
____array_12,
|
|
475
|
+
__TS__Spread(ALL_CAVES_BOSSES_SET:values())
|
|
476
|
+
)
|
|
477
|
+
__TS__SparseArrayPush(
|
|
478
|
+
____array_12,
|
|
479
|
+
__TS__Spread(ALL_DEPTHS_BOSSES_SET:values())
|
|
480
|
+
)
|
|
481
|
+
__TS__SparseArrayPush(
|
|
482
|
+
____array_12,
|
|
483
|
+
__TS__Spread(ALL_WOMB_BOSSES_SET:values())
|
|
484
|
+
)
|
|
485
|
+
__TS__SparseArrayPush(
|
|
486
|
+
____array_12,
|
|
487
|
+
__TS__Spread(BLUE_WOMB_BOSSES_SET:values())
|
|
488
|
+
)
|
|
489
|
+
__TS__SparseArrayPush(
|
|
490
|
+
____array_12,
|
|
491
|
+
__TS__Spread(ALL_STAGE_10_BOSSES_SET:values())
|
|
492
|
+
)
|
|
493
|
+
__TS__SparseArrayPush(
|
|
494
|
+
____array_12,
|
|
495
|
+
__TS__Spread(ALL_STAGE_11_BOSSES_SET:values())
|
|
496
|
+
)
|
|
497
|
+
____exports.ALL_BOSSES_SET = __TS__New(
|
|
498
|
+
____Set_13,
|
|
499
|
+
{__TS__SparseArraySpread(____array_12)}
|
|
500
|
+
)
|
|
471
501
|
return ____exports
|