isaacscript-common 1.2.276 → 1.2.277
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 +3 -2
- package/dist/functions/boss.lua +42 -4
- package/package.json +1 -1
package/dist/functions/boss.d.ts
CHANGED
|
@@ -44,8 +44,9 @@ export declare function isSin(npc: EntityNPC): boolean;
|
|
|
44
44
|
* Use this function instead of `spawnNPC` since it handles automatically spawning multiple segments
|
|
45
45
|
* for multi-segment bosses.
|
|
46
46
|
*
|
|
47
|
-
* By default, this will spawn Chub (and his variants) with 3 segments
|
|
48
|
-
* bosses with 4 segments. You can
|
|
47
|
+
* By default, this will spawn Chub (and his variants) with 3 segments, Lokii with 2 copies,
|
|
48
|
+
* Gurglings/Turdlings with 2 copies, and other multi-segment bosses with 4 segments. You can
|
|
49
|
+
* customize this via the "numSegments" argument.
|
|
49
50
|
*/
|
|
50
51
|
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
|
/**
|
package/dist/functions/boss.lua
CHANGED
|
@@ -3,6 +3,7 @@ local Set = ____lualib.Set
|
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
4
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
5
5
|
local ____exports = {}
|
|
6
|
+
local getNumBossSegments, DEFAULT_BOSS_MULTI_SEGMENTS
|
|
6
7
|
local ____constants = require("constants")
|
|
7
8
|
local VectorZero = ____constants.VectorZero
|
|
8
9
|
local ____bossSets = require("sets.bossSets")
|
|
@@ -20,7 +21,45 @@ local ____set = require("functions.set")
|
|
|
20
21
|
local copySet = ____set.copySet
|
|
21
22
|
local ____utils = require("functions.utils")
|
|
22
23
|
local ____repeat = ____utils["repeat"]
|
|
23
|
-
|
|
24
|
+
function getNumBossSegments(self, entityType, variant, numSegments)
|
|
25
|
+
if numSegments ~= nil then
|
|
26
|
+
return numSegments
|
|
27
|
+
end
|
|
28
|
+
repeat
|
|
29
|
+
local ____switch18 = entityType
|
|
30
|
+
local ____cond18 = ____switch18 == EntityType.ENTITY_CHUB
|
|
31
|
+
if ____cond18 then
|
|
32
|
+
do
|
|
33
|
+
return 3
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
____cond18 = ____cond18 or ____switch18 == EntityType.ENTITY_LOKI
|
|
37
|
+
if ____cond18 then
|
|
38
|
+
do
|
|
39
|
+
return variant == 1 and 2 or 1
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
____cond18 = ____cond18 or ____switch18 == EntityType.ENTITY_GURGLING
|
|
43
|
+
if ____cond18 then
|
|
44
|
+
do
|
|
45
|
+
return 2
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
do
|
|
49
|
+
do
|
|
50
|
+
return DEFAULT_BOSS_MULTI_SEGMENTS
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
until true
|
|
54
|
+
end
|
|
55
|
+
local BOSSES_THAT_REQUIRE_MULTIPLE_SPAWNS = __TS__New(Set, {
|
|
56
|
+
EntityType.ENTITY_LARRYJR,
|
|
57
|
+
EntityType.ENTITY_CHUB,
|
|
58
|
+
EntityType.ENTITY_LOKI,
|
|
59
|
+
EntityType.ENTITY_GURGLING,
|
|
60
|
+
EntityType.ENTITY_TURDLET
|
|
61
|
+
})
|
|
62
|
+
DEFAULT_BOSS_MULTI_SEGMENTS = 4
|
|
24
63
|
function ____exports.getAliveBosses(self, matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
|
|
25
64
|
if ignoreFriendly == nil then
|
|
26
65
|
ignoreFriendly = false
|
|
@@ -98,9 +137,8 @@ function ____exports.spawnBoss(self, entityType, variant, subType, position, vel
|
|
|
98
137
|
seed
|
|
99
138
|
)
|
|
100
139
|
if BOSSES_THAT_REQUIRE_MULTIPLE_SPAWNS:has(entityType) then
|
|
101
|
-
local
|
|
102
|
-
local
|
|
103
|
-
local remainingSegmentsToSpawn = numSegmentsToUse - 1
|
|
140
|
+
local numBossSegments = getNumBossSegments(nil, entityType, variant, numSegments)
|
|
141
|
+
local remainingSegmentsToSpawn = numBossSegments - 1
|
|
104
142
|
____repeat(
|
|
105
143
|
nil,
|
|
106
144
|
remainingSegmentsToSpawn,
|