isaacscript-common 7.1.1 → 7.2.2
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/callbacks/itemPickup.d.ts.map +1 -1
- package/dist/callbacks/itemPickup.lua +3 -1
- package/dist/callbacks/postCustomDoorEnter.d.ts.map +1 -1
- package/dist/callbacks/postCustomDoorEnter.lua +14 -11
- package/dist/callbacks/postDiceRoomActivated.d.ts.map +1 -1
- package/dist/callbacks/postDiceRoomActivated.lua +5 -4
- package/dist/callbacks/postItemDischarged.lua +2 -1
- package/dist/callbacks/postSlotDestroyed.lua +3 -3
- package/dist/classes/DefaultMap.d.ts +5 -5
- package/dist/classes/DefaultMap.d.ts.map +1 -1
- package/dist/core/constants.d.ts +2 -2
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.lua +3 -1
- package/dist/core/constantsFirstLast.d.ts +2 -0
- package/dist/core/constantsFirstLast.d.ts.map +1 -1
- package/dist/core/constantsFirstLast.lua +36 -9
- package/dist/enums/AmbushType.d.ts +1 -0
- package/dist/enums/AmbushType.d.ts.map +1 -1
- package/dist/enums/AmbushType.lua +1 -0
- package/dist/enums/CornerType.d.ts +1 -0
- package/dist/enums/CornerType.d.ts.map +1 -1
- package/dist/enums/CornerType.lua +1 -0
- package/dist/enums/PocketItemType.d.ts +1 -0
- package/dist/enums/PocketItemType.d.ts.map +1 -1
- package/dist/enums/PocketItemType.lua +1 -0
- package/dist/enums/RockAltType.d.ts +1 -0
- package/dist/enums/RockAltType.d.ts.map +1 -1
- package/dist/enums/RockAltType.lua +1 -0
- package/dist/enums/SaveDataKey.d.ts +11 -0
- package/dist/enums/SaveDataKey.d.ts.map +1 -0
- package/dist/enums/{private/SaveDataKey.lua → SaveDataKey.lua} +2 -0
- package/dist/enums/SerializationType.d.ts +1 -0
- package/dist/enums/SerializationType.d.ts.map +1 -1
- package/dist/enums/SerializationType.lua +1 -0
- package/dist/enums/SlotDestructionType.d.ts +1 -0
- package/dist/enums/SlotDestructionType.d.ts.map +1 -1
- package/dist/enums/SlotDestructionType.lua +1 -0
- package/dist/enums/index.d.ts +1 -0
- package/dist/enums/index.d.ts.map +1 -1
- package/dist/enums/index.lua +8 -0
- package/dist/features/customGridEntity.d.ts.map +1 -1
- package/dist/features/customGridEntity.lua +3 -1
- package/dist/features/customStage/backdrop.d.ts +1 -1
- package/dist/features/customStage/backdrop.d.ts.map +1 -1
- package/dist/features/customStage/backdrop.lua +5 -3
- package/dist/features/customStage/customStageGridEntities.d.ts.map +1 -1
- package/dist/features/customStage/customStageGridEntities.lua +3 -1
- package/dist/features/customStage/exports.d.ts.map +1 -1
- package/dist/features/customStage/exports.lua +3 -1
- package/dist/features/customStage/init.lua +2 -2
- package/dist/features/customStage/shadows.d.ts.map +1 -1
- package/dist/features/customStage/shadows.lua +2 -1
- package/dist/features/deployJSONRoom.lua +13 -10
- package/dist/features/extraConsoleCommands/listCommands.d.ts.map +1 -1
- package/dist/features/extraConsoleCommands/listCommands.lua +8 -2
- package/dist/features/saveDataManager/exports.d.ts +2 -1
- package/dist/features/saveDataManager/exports.d.ts.map +1 -1
- package/dist/features/saveDataManager/main.d.ts +1 -1
- package/dist/features/saveDataManager/main.d.ts.map +1 -1
- package/dist/features/saveDataManager/main.lua +1 -1
- package/dist/functions/bitSet128.d.ts.map +1 -1
- package/dist/functions/bosses.d.ts.map +1 -1
- package/dist/functions/bosses.lua +3 -1
- package/dist/functions/cacheFlag.d.ts +23 -1
- package/dist/functions/cacheFlag.d.ts.map +1 -1
- package/dist/functions/cacheFlag.lua +78 -0
- package/dist/functions/collectibles.d.ts.map +1 -1
- package/dist/functions/deepCopy.lua +2 -1
- package/dist/functions/doors.d.ts.map +1 -1
- package/dist/functions/doors.lua +3 -1
- package/dist/functions/entities.lua +2 -1
- package/dist/functions/flying.lua +2 -2
- package/dist/functions/gridEntities.lua +2 -1
- package/dist/functions/gridEntitiesSpecific.d.ts.map +1 -1
- package/dist/functions/gridEntitiesSpecific.lua +5 -3
- package/dist/functions/index.d.ts +0 -1
- package/dist/functions/index.d.ts.map +1 -1
- package/dist/functions/index.lua +0 -8
- package/dist/functions/input.d.ts +5 -2
- package/dist/functions/input.d.ts.map +1 -1
- package/dist/functions/input.lua +11 -3
- package/dist/functions/kColor.d.ts.map +1 -1
- package/dist/functions/levelGrid.d.ts.map +1 -1
- package/dist/functions/levelGrid.lua +3 -1
- package/dist/functions/nextStage.d.ts.map +1 -1
- package/dist/functions/nextStage.lua +7 -5
- package/dist/functions/npcs.d.ts.map +1 -1
- package/dist/functions/npcs.lua +4 -2
- package/dist/functions/pills.d.ts.map +1 -1
- package/dist/functions/pills.lua +9 -3
- package/dist/functions/playerIndex.d.ts.map +1 -1
- package/dist/functions/playerIndex.lua +2 -1
- package/dist/functions/players.d.ts +1 -1
- package/dist/functions/players.d.ts.map +1 -1
- package/dist/functions/players.lua +13 -15
- package/dist/functions/pocketItems.d.ts.map +1 -1
- package/dist/functions/pocketItems.lua +3 -1
- package/dist/functions/rng.d.ts.map +1 -1
- package/dist/functions/rng.lua +3 -0
- package/dist/functions/rockAlt.d.ts.map +1 -1
- package/dist/functions/rockAlt.lua +11 -20
- package/dist/functions/rooms.d.ts +4 -4
- package/dist/functions/rooms.d.ts.map +1 -1
- package/dist/functions/rooms.lua +18 -16
- package/dist/functions/spawnCollectible.d.ts.map +1 -1
- package/dist/functions/stage.d.ts.map +1 -1
- package/dist/functions/stage.lua +8 -2
- package/dist/functions/trinkets.d.ts.map +1 -1
- package/dist/functions/trinkets.lua +4 -2
- package/dist/functions/types.d.ts +64 -0
- package/dist/functions/types.d.ts.map +1 -1
- package/dist/functions/types.lua +63 -0
- package/dist/functions/vector.d.ts.map +1 -1
- package/dist/interfaces/ChargeBarSprites.d.ts +1 -1
- package/dist/interfaces/Corner.d.ts +5 -0
- package/dist/interfaces/Corner.d.ts.map +1 -1
- package/dist/interfaces/CustomStageLua.d.ts +57 -0
- package/dist/interfaces/CustomStageLua.d.ts.map +1 -1
- package/dist/interfaces/GridEntityCustomData.d.ts +6 -0
- package/dist/interfaces/GridEntityCustomData.d.ts.map +1 -1
- package/dist/interfaces/JSONRoomsFile.d.ts +7 -3
- package/dist/interfaces/JSONRoomsFile.d.ts.map +1 -1
- package/dist/interfaces/PlayerHealth.d.ts +1 -1
- package/dist/interfaces/PlayerHealth.d.ts.map +1 -1
- package/dist/interfaces/PocketItemDescription.d.ts +1 -1
- package/dist/interfaces/PocketItemDescription.d.ts.map +1 -1
- package/dist/interfaces/RoomDescription.d.ts +1 -1
- package/dist/interfaces/RoomDescription.d.ts.map +1 -1
- package/dist/interfaces/StatTypeType.d.ts +4 -0
- package/dist/interfaces/StatTypeType.d.ts.map +1 -1
- package/dist/interfaces/TrinketSituation.d.ts +1 -1
- package/dist/interfaces/TrinketSituation.d.ts.map +1 -1
- package/dist/maps/keyboardToString.d.ts +4 -0
- package/dist/maps/keyboardToString.d.ts.map +1 -0
- package/dist/maps/keyboardToString.lua +73 -0
- package/dist/types/AnyEntity.d.ts +5 -0
- package/dist/types/AnyEntity.d.ts.map +1 -1
- package/dist/types/AnyGridEntity.d.ts +5 -0
- package/dist/types/AnyGridEntity.d.ts.map +1 -1
- package/dist/types/CollectibleIndex.d.ts +4 -3
- package/dist/types/CollectibleIndex.d.ts.map +1 -1
- package/dist/types/Immutable.d.ts +3 -1
- package/dist/types/Immutable.d.ts.map +1 -1
- package/dist/types/PickupIndex.d.ts +4 -2
- package/dist/types/PickupIndex.d.ts.map +1 -1
- package/dist/types/PlayerIndex.d.ts +3 -2
- package/dist/types/PlayerIndex.d.ts.map +1 -1
- package/dist/types/SerializedIsaacAPIClass.d.ts +6 -0
- package/dist/types/SerializedIsaacAPIClass.d.ts.map +1 -1
- package/dist/types/TSTLClass.d.ts +5 -0
- package/dist/types/TSTLClass.d.ts.map +1 -1
- package/dist/types/TrapdoorDestination.d.ts +3 -0
- package/dist/types/TrapdoorDestination.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/callbacks/itemPickup.ts +5 -2
- package/src/callbacks/postCustomDoorEnter.ts +18 -11
- package/src/callbacks/postDiceRoomActivated.ts +7 -12
- package/src/callbacks/postItemDischarged.ts +3 -1
- package/src/callbacks/postSlotDestroyed.ts +3 -2
- package/src/callbacks/reorderedCallbacks.ts +2 -2
- package/src/classes/DefaultMap.ts +8 -8
- package/src/core/constants.ts +3 -3
- package/src/core/constantsFirstLast.ts +29 -14
- package/src/enums/AmbushType.ts +1 -0
- package/src/enums/CornerType.ts +1 -0
- package/src/enums/PocketItemType.ts +1 -0
- package/src/enums/RockAltType.ts +1 -0
- package/src/enums/SaveDataKey.ts +10 -0
- package/src/enums/SerializationType.ts +1 -0
- package/src/enums/SlotDestructionType.ts +1 -0
- package/src/enums/index.ts +1 -0
- package/src/enums/indexTypeDoc.ts +1 -0
- package/src/features/customGridEntity.ts +2 -1
- package/src/features/customStage/backdrop.ts +5 -3
- package/src/features/customStage/customStageGridEntities.ts +2 -1
- package/src/features/customStage/exports.ts +5 -4
- package/src/features/customStage/init.ts +2 -2
- package/src/features/customStage/shadows.ts +2 -1
- package/src/features/deployJSONRoom.ts +14 -19
- package/src/features/extraConsoleCommands/listCommands.ts +3 -2
- package/src/features/fastReset.ts +1 -1
- package/src/features/indexTypeDoc.ts +2 -1
- package/src/features/saveDataManager/exports.ts +4 -4
- package/src/features/saveDataManager/main.ts +1 -1
- package/src/features/saveDataManager/save.ts +1 -1
- package/src/functions/bitSet128.ts +1 -5
- package/src/functions/bosses.ts +2 -1
- package/src/functions/cacheFlag.ts +90 -1
- package/src/functions/cards.ts +3 -3
- package/src/functions/collectibles.ts +2 -8
- package/src/functions/color.ts +1 -1
- package/src/functions/deepCopy.ts +2 -2
- package/src/functions/dimensions.ts +1 -1
- package/src/functions/doors.ts +2 -2
- package/src/functions/entities.ts +2 -2
- package/src/functions/flying.ts +1 -1
- package/src/functions/gridEntities.ts +2 -2
- package/src/functions/gridEntitiesSpecific.ts +4 -3
- package/src/functions/index.ts +0 -1
- package/src/functions/indexTypeDoc.ts +0 -1
- package/src/functions/input.ts +17 -4
- package/src/functions/jsonHelpers.ts +1 -1
- package/src/functions/kColor.ts +1 -5
- package/src/functions/levelGrid.ts +3 -2
- package/src/functions/nextStage.ts +6 -5
- package/src/functions/npcs.ts +3 -2
- package/src/functions/pills.ts +11 -9
- package/src/functions/playerIndex.ts +3 -1
- package/src/functions/players.ts +5 -6
- package/src/functions/pocketItems.ts +4 -4
- package/src/functions/rng.ts +8 -5
- package/src/functions/rockAlt.ts +28 -13
- package/src/functions/rooms.ts +27 -26
- package/src/functions/spawnCollectible.ts +1 -2
- package/src/functions/stage.ts +3 -2
- package/src/functions/trinkets.ts +6 -5
- package/src/functions/types.ts +100 -0
- package/src/functions/vector.ts +1 -5
- package/src/interfaces/ChargeBarSprites.ts +1 -1
- package/src/interfaces/Corner.ts +5 -0
- package/src/interfaces/CustomStageLua.ts +66 -0
- package/src/interfaces/GridEntityCustomData.ts +6 -0
- package/src/interfaces/JSONRoomsFile.ts +7 -3
- package/src/interfaces/PlayerHealth.ts +1 -1
- package/src/interfaces/PocketItemDescription.ts +1 -1
- package/src/interfaces/RoomDescription.ts +1 -1
- package/src/interfaces/StatTypeType.ts +4 -0
- package/src/interfaces/TrinketSituation.ts +1 -1
- package/src/maps/keyboardToString.ts +77 -0
- package/src/types/AnyEntity.ts +5 -0
- package/src/types/AnyGridEntity.ts +5 -0
- package/src/types/CollectibleIndex.ts +4 -3
- package/src/types/Immutable.ts +3 -1
- package/src/types/PickupIndex.ts +4 -2
- package/src/types/PlayerIndex.ts +3 -2
- package/src/types/SerializedIsaacAPIClass.ts +6 -0
- package/src/types/TSTLClass.ts +5 -0
- package/src/types/TrapdoorDestination.ts +3 -0
- package/dist/enums/private/SaveDataKey.d.ts +0 -7
- package/dist/enums/private/SaveDataKey.d.ts.map +0 -1
- package/dist/functions/collectibleCacheFlag.d.ts +0 -24
- package/dist/functions/collectibleCacheFlag.d.ts.map +0 -1
- package/dist/functions/collectibleCacheFlag.lua +0 -80
- package/src/enums/private/SaveDataKey.ts +0 -6
- package/src/functions/collectibleCacheFlag.ts +0 -90
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
removeGridEntities,
|
|
12
12
|
spawnGridEntityWithVariant,
|
|
13
13
|
} from "./gridEntities";
|
|
14
|
+
import { asNumber } from "./types";
|
|
14
15
|
|
|
15
16
|
// The `getDoors` function is not located here because doors are collected via the `Room.GetDoor`
|
|
16
17
|
// method instead, which is faster.
|
|
@@ -29,7 +30,7 @@ export function getPits(pitVariant: PitVariant = -1): GridEntityPit[] {
|
|
|
29
30
|
const pit = gridEntity.ToPit();
|
|
30
31
|
if (pit !== undefined) {
|
|
31
32
|
const gridEntityVariant = pit.GetVariant();
|
|
32
|
-
if ((pitVariant
|
|
33
|
+
if (asNumber(pitVariant) === -1 || pitVariant === gridEntityVariant) {
|
|
33
34
|
pits.push(pit);
|
|
34
35
|
}
|
|
35
36
|
}
|
|
@@ -54,7 +55,7 @@ export function getPoops(
|
|
|
54
55
|
const poop = gridEntity.ToPoop();
|
|
55
56
|
if (poop !== undefined) {
|
|
56
57
|
const gridEntityVariant = poop.GetVariant();
|
|
57
|
-
if ((poopVariant
|
|
58
|
+
if (asNumber(poopVariant) === -1 || poopVariant === gridEntityVariant) {
|
|
58
59
|
poops.push(poop);
|
|
59
60
|
}
|
|
60
61
|
}
|
|
@@ -80,7 +81,7 @@ export function getPressurePlates(
|
|
|
80
81
|
if (pressurePlate !== undefined) {
|
|
81
82
|
const gridEntityVariant = pressurePlate.GetVariant();
|
|
82
83
|
if (
|
|
83
|
-
(pressurePlateVariant
|
|
84
|
+
asNumber(pressurePlateVariant) === -1 ||
|
|
84
85
|
pressurePlateVariant === gridEntityVariant
|
|
85
86
|
) {
|
|
86
87
|
pressurePlates.push(pressurePlate);
|
package/src/functions/index.ts
CHANGED
|
@@ -13,7 +13,6 @@ export * from "./challenges";
|
|
|
13
13
|
export * from "./characters";
|
|
14
14
|
export * from "./charge";
|
|
15
15
|
export * from "./chargeBar";
|
|
16
|
-
export * from "./collectibleCacheFlag";
|
|
17
16
|
export * from "./collectibles";
|
|
18
17
|
export * from "./collectibleSet";
|
|
19
18
|
export * from "./collectibleTag";
|
|
@@ -13,7 +13,6 @@ export * as Challenges from "./challenges";
|
|
|
13
13
|
export * as Characters from "./characters";
|
|
14
14
|
export * as Charge from "./charge";
|
|
15
15
|
export * as ChargeBar from "./chargeBar";
|
|
16
|
-
export * as CollectibleCacheFlag from "./collectibleCacheFlag";
|
|
17
16
|
export * as Collectibles from "./collectibles";
|
|
18
17
|
export * as CollectibleSet from "./collectibleSet";
|
|
19
18
|
export * as CollectibleTag from "./collectibleTag";
|
package/src/functions/input.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
ControllerIndex,
|
|
5
5
|
Keyboard,
|
|
6
6
|
} from "isaac-typescript-definitions";
|
|
7
|
+
import { KEYBOARD_TO_STRING } from "../maps/keyboardToString";
|
|
7
8
|
import { getEnumValues } from "./enums";
|
|
8
9
|
import { copySet } from "./set";
|
|
9
10
|
import { trimPrefix } from "./string";
|
|
@@ -42,10 +43,10 @@ const SHOOTING_ACTIONS_SET: ReadonlySet<ButtonAction> = new Set(
|
|
|
42
43
|
);
|
|
43
44
|
|
|
44
45
|
/** Helper function to get the enum name for the specified `Controller` value. */
|
|
45
|
-
export function controllerToString(controller: Controller): string {
|
|
46
|
+
export function controllerToString(controller: Controller): string | undefined {
|
|
46
47
|
const key = Controller[controller];
|
|
47
48
|
if (key === undefined) {
|
|
48
|
-
return
|
|
49
|
+
return undefined;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
return trimPrefix(key, "BUTTON_");
|
|
@@ -133,6 +134,18 @@ export function isShootActionTriggeredOnAnyInput(): boolean {
|
|
|
133
134
|
);
|
|
134
135
|
}
|
|
135
136
|
|
|
136
|
-
|
|
137
|
-
|
|
137
|
+
/**
|
|
138
|
+
* Helper function to get the string that would be typed if someone pressed the corresponding key.
|
|
139
|
+
*/
|
|
140
|
+
export function keyboardToString(
|
|
141
|
+
keyboard: Keyboard,
|
|
142
|
+
uppercase: boolean,
|
|
143
|
+
): string | undefined {
|
|
144
|
+
const tuple = KEYBOARD_TO_STRING.get(keyboard);
|
|
145
|
+
if (tuple === undefined) {
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const [lowercaseCharacter, uppercaseCharacter] = tuple;
|
|
150
|
+
return uppercase ? uppercaseCharacter : lowercaseCharacter;
|
|
138
151
|
}
|
|
@@ -2,7 +2,7 @@ import * as jsonLua from "../lib/jsonLua";
|
|
|
2
2
|
import { logError } from "./log";
|
|
3
3
|
|
|
4
4
|
function tryDecode(this: void, jsonString: string) {
|
|
5
|
-
return jsonLua.decode(jsonString) as LuaMap
|
|
5
|
+
return jsonLua.decode(jsonString) as LuaMap<AnyNotNil, unknown>;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
function tryEncode(this: void, luaTable: unknown) {
|
package/src/functions/kColor.ts
CHANGED
|
@@ -34,11 +34,7 @@ export function deserializeKColor(kColor: SerializedKColor): KColor {
|
|
|
34
34
|
);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const [r, g, b, a] = getNumbersFromTable(
|
|
38
|
-
kColor as LuaMap<string, unknown>,
|
|
39
|
-
OBJECT_NAME,
|
|
40
|
-
...KEYS,
|
|
41
|
-
);
|
|
37
|
+
const [r, g, b, a] = getNumbersFromTable(kColor, OBJECT_NAME, ...KEYS);
|
|
42
38
|
|
|
43
39
|
if (r === undefined) {
|
|
44
40
|
error(
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
} from "./roomData";
|
|
38
38
|
import { getRooms, getRoomsInsideGrid } from "./rooms";
|
|
39
39
|
import { getGridIndexDelta } from "./roomShape";
|
|
40
|
+
import { asNumber } from "./types";
|
|
40
41
|
|
|
41
42
|
const LEFT = -1;
|
|
42
43
|
const UP = -LEVEL_GRID_ROW_WIDTH;
|
|
@@ -177,8 +178,8 @@ export function getNewRoomCandidatesForLevel(): Array<
|
|
|
177
178
|
(room) =>
|
|
178
179
|
room.Data !== undefined &&
|
|
179
180
|
room.Data.Type === RoomType.DEFAULT &&
|
|
180
|
-
room.Data.Subtype !== (DownpourRoomSubType.MIRROR
|
|
181
|
-
room.Data.Subtype !== (MinesRoomSubType.MINESHAFT_ENTRANCE
|
|
181
|
+
room.Data.Subtype !== asNumber(DownpourRoomSubType.MIRROR) &&
|
|
182
|
+
room.Data.Subtype !== asNumber(MinesRoomSubType.MINESHAFT_ENTRANCE),
|
|
182
183
|
);
|
|
183
184
|
|
|
184
185
|
const newRoomCandidates: Array<[int, DoorSlot, int]> = [];
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
calculateStageTypeRepentance,
|
|
14
14
|
onRepentanceStage,
|
|
15
15
|
} from "./stage";
|
|
16
|
+
import { asNumber } from "./types";
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Helper function to get the stage that a trapdoor or heaven door would take the player to, based
|
|
@@ -53,7 +54,7 @@ export function getNextStage(): LevelStage {
|
|
|
53
54
|
case GridRoom.SECRET_EXIT: {
|
|
54
55
|
if (repentanceStage) {
|
|
55
56
|
// e.g. From Downpour 2 to Mines 1, etc.
|
|
56
|
-
return (stage
|
|
57
|
+
return asNumber(stage) + 1;
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
if (stage === LevelStage.DEPTHS_2) {
|
|
@@ -109,7 +110,7 @@ export function getNextStage(): LevelStage {
|
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
// By default, go to the next floor.
|
|
112
|
-
return (stage
|
|
113
|
+
return asNumber(stage) + 1;
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
function getNextStageBackwardsPath(
|
|
@@ -118,7 +119,7 @@ function getNextStageBackwardsPath(
|
|
|
118
119
|
): LevelStage {
|
|
119
120
|
// If we have no stage history to work with, then default to the previous stage.
|
|
120
121
|
if (!areFeaturesInitialized()) {
|
|
121
|
-
return (stage
|
|
122
|
+
return asNumber(stage) - 1;
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
const visitedDownpour1 = hasVisitedStage(
|
|
@@ -234,7 +235,7 @@ function getNextStageBackwardsPath(
|
|
|
234
235
|
return LevelStage.DEPTHS_1;
|
|
235
236
|
}
|
|
236
237
|
|
|
237
|
-
return (stage
|
|
238
|
+
return asNumber(stage) - 1;
|
|
238
239
|
}
|
|
239
240
|
|
|
240
241
|
/**
|
|
@@ -262,7 +263,7 @@ export function getNextStageType(upwards = false): StageType {
|
|
|
262
263
|
}
|
|
263
264
|
|
|
264
265
|
// Second, handle the special case of being in a specific off-grid room.
|
|
265
|
-
if (roomGridIndex === (GridRoom.SECRET_EXIT
|
|
266
|
+
if (roomGridIndex === asNumber(GridRoom.SECRET_EXIT)) {
|
|
266
267
|
return calculateStageTypeRepentance(nextStage);
|
|
267
268
|
}
|
|
268
269
|
|
package/src/functions/npcs.ts
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
} from "isaac-typescript-definitions";
|
|
18
18
|
import { EGGY_STATE_FRAME_OF_FINAL_SPIDER } from "../core/constants";
|
|
19
19
|
import { getNPCs } from "./entitiesSpecific";
|
|
20
|
+
import { asNumber } from "./types";
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Used to filter out certain NPCs when determining of an NPC is "alive" and/or should keep the
|
|
@@ -125,7 +126,7 @@ export function isDaddyLongLegsChildStompEntity(npc: EntityNPC): boolean {
|
|
|
125
126
|
export function isDyingEggyWithNoSpidersLeft(npc: EntityNPC): boolean {
|
|
126
127
|
return (
|
|
127
128
|
npc.Type === EntityType.HOPPER &&
|
|
128
|
-
npc.Variant === (HopperVariant.EGGY
|
|
129
|
+
npc.Variant === asNumber(HopperVariant.EGGY) &&
|
|
129
130
|
npc.State === NpcState.SUICIDE &&
|
|
130
131
|
npc.StateFrame >= EGGY_STATE_FRAME_OF_FINAL_SPIDER
|
|
131
132
|
);
|
|
@@ -140,7 +141,7 @@ export function isDyingEggyWithNoSpidersLeft(npc: EntityNPC): boolean {
|
|
|
140
141
|
export function isRaglingDeathPatch(npc: EntityNPC): boolean {
|
|
141
142
|
return (
|
|
142
143
|
npc.Type === EntityType.RAGLING &&
|
|
143
|
-
npc.Variant === (RaglingVariant.RAG_MANS_RAGLING
|
|
144
|
+
npc.Variant === asNumber(RaglingVariant.RAG_MANS_RAGLING) &&
|
|
144
145
|
// They go to `STATE_SPECIAL` when they are patches on the ground.
|
|
145
146
|
npc.State === NpcState.SPECIAL
|
|
146
147
|
);
|
package/src/functions/pills.ts
CHANGED
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
PILL_EFFECT_TYPES,
|
|
31
31
|
} from "../objects/pillEffectTypes";
|
|
32
32
|
import { getEnumValues } from "./enums";
|
|
33
|
+
import { asNumber, asPillColor } from "./types";
|
|
33
34
|
import { irange } from "./utils";
|
|
34
35
|
|
|
35
36
|
/**
|
|
@@ -55,7 +56,7 @@ export function getAllPillColors(): PillColor[] {
|
|
|
55
56
|
* Helper function to get an array with every valid pill effect. This includes modded pill effects.
|
|
56
57
|
*/
|
|
57
58
|
export function getAllPillEffects(): PillEffect[] {
|
|
58
|
-
return irange(FIRST_PILL_EFFECT, LAST_PILL_EFFECT)
|
|
59
|
+
return irange(FIRST_PILL_EFFECT, LAST_PILL_EFFECT);
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
/**
|
|
@@ -74,12 +75,12 @@ export function getFalsePHDPillEffect(pillEffect: PillEffect): PillEffect {
|
|
|
74
75
|
* corresponds to the horse pill color for blue/blue.
|
|
75
76
|
*/
|
|
76
77
|
export function getHorsePillColor(pillColor: PillColor): PillColor {
|
|
77
|
-
return pillColor + HORSE_PILL_ADJUSTMENT;
|
|
78
|
+
return asNumber(pillColor) + HORSE_PILL_ADJUSTMENT;
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
/** Helper function to get an array with every non-gold horse pill color. */
|
|
81
82
|
export function getHorsePillColors(): PillColor[] {
|
|
82
|
-
return irange(FIRST_HORSE_PILL_COLOR, LAST_HORSE_PILL_COLOR)
|
|
83
|
+
return irange(FIRST_HORSE_PILL_COLOR, LAST_HORSE_PILL_COLOR);
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
/**
|
|
@@ -92,7 +93,7 @@ export function getModdedPillEffects(): PillEffect[] {
|
|
|
92
93
|
return [];
|
|
93
94
|
}
|
|
94
95
|
|
|
95
|
-
return irange(FIRST_MODDED_PILL_EFFECT, LAST_PILL_EFFECT)
|
|
96
|
+
return irange(FIRST_MODDED_PILL_EFFECT, LAST_PILL_EFFECT);
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
/**
|
|
@@ -103,15 +104,16 @@ export function getModdedPillEffects(): PillEffect[] {
|
|
|
103
104
|
* If called with a non-horse pill color, this function will return back the same color.
|
|
104
105
|
*/
|
|
105
106
|
export function getNormalPillColorFromHorse(pillColor: PillColor): PillColor {
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
const normalPillColor = asPillColor(
|
|
108
|
+
asNumber(pillColor) - HORSE_PILL_ADJUSTMENT,
|
|
109
|
+
);
|
|
108
110
|
|
|
109
111
|
return normalPillColor > PillColor.NULL ? normalPillColor : pillColor;
|
|
110
112
|
}
|
|
111
113
|
|
|
112
114
|
/** Helper function to get an array with every non-gold and non-horse pill color. */
|
|
113
115
|
export function getNormalPillColors(): PillColor[] {
|
|
114
|
-
return irange(FIRST_PILL_COLOR, LAST_NORMAL_PILL_COLOR)
|
|
116
|
+
return irange(FIRST_PILL_COLOR, LAST_NORMAL_PILL_COLOR);
|
|
115
117
|
}
|
|
116
118
|
|
|
117
119
|
/**
|
|
@@ -197,9 +199,9 @@ export function getPillEffectType(
|
|
|
197
199
|
|
|
198
200
|
/** Helper function to get an array with every vanilla pill effect. */
|
|
199
201
|
export function getVanillaPillEffects(): PillEffect[] {
|
|
200
|
-
return irange(FIRST_PILL_EFFECT, LAST_VANILLA_PILL_EFFECT)
|
|
202
|
+
return irange(FIRST_PILL_EFFECT, LAST_VANILLA_PILL_EFFECT);
|
|
201
203
|
}
|
|
202
204
|
|
|
203
205
|
export function isHorsePill(pillColor: PillColor): boolean {
|
|
204
|
-
return pillColor >
|
|
206
|
+
return asNumber(pillColor) > HORSE_PILL_ADJUSTMENT;
|
|
205
207
|
}
|
|
@@ -96,9 +96,11 @@ export function getPlayerIndex(
|
|
|
96
96
|
let playerToUse = player;
|
|
97
97
|
const isSubPlayer = player.IsSubPlayer();
|
|
98
98
|
if (isSubPlayer) {
|
|
99
|
+
const subPlayer = player as EntitySubPlayer;
|
|
100
|
+
|
|
99
101
|
// The "getSubPlayerParent" function will return undefined in the situation where we are on Dead
|
|
100
102
|
// Tainted Lazarus in the `POST_PLAYER_INIT` callback.
|
|
101
|
-
const playerParent = getSubPlayerParent(
|
|
103
|
+
const playerParent = getSubPlayerParent(subPlayer);
|
|
102
104
|
if (playerParent !== undefined) {
|
|
103
105
|
playerToUse = playerParent;
|
|
104
106
|
}
|
package/src/functions/players.ts
CHANGED
|
@@ -23,6 +23,7 @@ import { getCollectibleArray } from "./collectibleSet";
|
|
|
23
23
|
import { getEnumValues } from "./enums";
|
|
24
24
|
import { getPlayerIndexVanilla, getPlayers } from "./playerIndex";
|
|
25
25
|
import { addTearsStat } from "./tears";
|
|
26
|
+
import { isNumber } from "./types";
|
|
26
27
|
import { repeat } from "./utils";
|
|
27
28
|
|
|
28
29
|
const STAT_CACHE_FLAGS_SET: ReadonlySet<CacheFlag> = new Set([
|
|
@@ -225,16 +226,14 @@ export function getActiveItemSlot(
|
|
|
225
226
|
* Helper function to get how long Azazel's Brimstone laser should be. You can pass either an
|
|
226
227
|
* `EntityPlayer` object or a tear height stat.
|
|
227
228
|
*
|
|
228
|
-
* The formula for calculating it is: 32 - 2.5 *
|
|
229
|
+
* The formula for calculating it is: 32 - 2.5 * tearHeight
|
|
229
230
|
*/
|
|
230
231
|
export function getAzazelBrimstoneDistance(
|
|
231
232
|
playerOrTearHeight: EntityPlayer | float,
|
|
232
233
|
): float {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
tearHeight = player.TearHeight;
|
|
237
|
-
}
|
|
234
|
+
const tearHeight = isNumber(playerOrTearHeight)
|
|
235
|
+
? playerOrTearHeight
|
|
236
|
+
: playerOrTearHeight.TearHeight;
|
|
238
237
|
|
|
239
238
|
return 32 - 2.5 * tearHeight;
|
|
240
239
|
}
|
|
@@ -10,6 +10,7 @@ import { PocketItemType } from "../enums/PocketItemType";
|
|
|
10
10
|
import { PocketItemDescription } from "../interfaces/PocketItemDescription";
|
|
11
11
|
import { getEnumValues } from "./enums";
|
|
12
12
|
import { isCharacter } from "./players";
|
|
13
|
+
import { asNumber } from "./types";
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Helper function to get the `PocketItemSlot` that the player's pocket active collectible item is
|
|
@@ -63,8 +64,8 @@ export function getPocketItems(player: EntityPlayer): PocketItemDescription[] {
|
|
|
63
64
|
let pocketItemIdentified = false;
|
|
64
65
|
let pocketItem2Identified = false;
|
|
65
66
|
for (const slot of pocketItemSlots) {
|
|
66
|
-
const card = player.GetCard(slot
|
|
67
|
-
const pillColor = player.GetPill(slot
|
|
67
|
+
const card = player.GetCard(slot);
|
|
68
|
+
const pillColor = player.GetPill(slot);
|
|
68
69
|
|
|
69
70
|
if (card !== Card.NULL) {
|
|
70
71
|
pocketItems.push({
|
|
@@ -106,8 +107,7 @@ export function getPocketItems(player: EntityPlayer): PocketItemDescription[] {
|
|
|
106
107
|
});
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
|
|
110
|
-
if (slot + 1 === maxPocketItems) {
|
|
110
|
+
if (asNumber(slot) + 1 === maxPocketItems) {
|
|
111
111
|
break;
|
|
112
112
|
}
|
|
113
113
|
}
|
package/src/functions/rng.ts
CHANGED
|
@@ -41,11 +41,14 @@ export function deserializeRNG(rng: SerializedRNG): RNG {
|
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
const [seed] = getNumbersFromTable(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
const [seed] = getNumbersFromTable(rng, OBJECT_NAME, ...KEYS);
|
|
45
|
+
|
|
46
|
+
if (seed === undefined) {
|
|
47
|
+
error(
|
|
48
|
+
`Failed to deserialize a ${OBJECT_NAME} object since the provided object did not have a value for: seed`,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
49
52
|
return newRNG(seed as Seed);
|
|
50
53
|
}
|
|
51
54
|
|
package/src/functions/rockAlt.ts
CHANGED
|
@@ -41,6 +41,13 @@ const ROCK_ALT_CHANCES = {
|
|
|
41
41
|
} as const;
|
|
42
42
|
|
|
43
43
|
const COIN_VELOCITY_MULTIPLIER = 2;
|
|
44
|
+
|
|
45
|
+
/** Matches the vanilla value, according to Fly's decompilation. */
|
|
46
|
+
const FIND_FREE_INITIAL_STEP = 70;
|
|
47
|
+
|
|
48
|
+
/** Matches the vanilla value, according to Fly's decompilation. */
|
|
49
|
+
const FART_RADIUS = DISTANCE_OF_GRID_TILE * 3;
|
|
50
|
+
|
|
44
51
|
const POLYP_PROJECTILE_SPEED = 10;
|
|
45
52
|
const POLYP_NUM_PROJECTILES = 6;
|
|
46
53
|
|
|
@@ -128,6 +135,8 @@ export function spawnRockAltReward(
|
|
|
128
135
|
}
|
|
129
136
|
|
|
130
137
|
function spawnRockAltRewardUrn(position: Vector, rng: RNG): boolean {
|
|
138
|
+
const room = game.GetRoom();
|
|
139
|
+
|
|
131
140
|
const chance = getRandom(rng);
|
|
132
141
|
let totalChance = 0;
|
|
133
142
|
|
|
@@ -171,11 +180,11 @@ function spawnRockAltRewardUrn(position: Vector, rng: RNG): boolean {
|
|
|
171
180
|
// Since the detrimental effect is the final option, we don't need to check the chance.
|
|
172
181
|
const numEnemiesChance = getRandom(rng);
|
|
173
182
|
const numEnemies = numEnemiesChance < 0.5 ? 1 : 2;
|
|
174
|
-
const length = DISTANCE_OF_GRID_TILE * 3;
|
|
175
183
|
repeat(numEnemies, () => {
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
184
|
+
const targetPos = room.FindFreePickupSpawnPosition(
|
|
185
|
+
position,
|
|
186
|
+
FIND_FREE_INITIAL_STEP,
|
|
187
|
+
);
|
|
179
188
|
EntityNPC.ThrowSpider(position, undefined, targetPos, false, 0);
|
|
180
189
|
});
|
|
181
190
|
return true;
|
|
@@ -253,7 +262,8 @@ function spawnRockAltRewardMushroom(position: Vector, rng: RNG): boolean {
|
|
|
253
262
|
}
|
|
254
263
|
|
|
255
264
|
// Since the detrimental effect is the final option, we don't need to check the chance.
|
|
256
|
-
|
|
265
|
+
game.Fart(position);
|
|
266
|
+
game.ButterBeanFart(position, FART_RADIUS, undefined);
|
|
257
267
|
return true;
|
|
258
268
|
}
|
|
259
269
|
|
|
@@ -383,6 +393,8 @@ function spawnRockAltRewardPolyp(position: Vector, rng: RNG): boolean {
|
|
|
383
393
|
}
|
|
384
394
|
|
|
385
395
|
function spawnRockAltRewardBucketDownpour(position: Vector, rng: RNG): boolean {
|
|
396
|
+
const room = game.GetRoom();
|
|
397
|
+
|
|
386
398
|
const chance = getRandom(rng);
|
|
387
399
|
let totalChance = 0;
|
|
388
400
|
|
|
@@ -430,11 +442,12 @@ function spawnRockAltRewardBucketDownpour(position: Vector, rng: RNG): boolean {
|
|
|
430
442
|
|
|
431
443
|
const numEnemiesChance = getRandom(rng);
|
|
432
444
|
const numEnemies = numEnemiesChance < 0.5 ? 1 : 2;
|
|
433
|
-
const jumpDistance = DISTANCE_OF_GRID_TILE * 3;
|
|
434
445
|
repeat(numEnemies, () => {
|
|
435
|
-
const
|
|
436
|
-
|
|
437
|
-
|
|
446
|
+
const targetPos = room.FindFreePickupSpawnPosition(
|
|
447
|
+
position,
|
|
448
|
+
FIND_FREE_INITIAL_STEP,
|
|
449
|
+
);
|
|
450
|
+
|
|
438
451
|
// If the room has water, Spiders will automatically be replaced with Striders.
|
|
439
452
|
const spider = EntityNPC.ThrowSpider(
|
|
440
453
|
position,
|
|
@@ -455,6 +468,8 @@ function spawnRockAltRewardBucketDownpour(position: Vector, rng: RNG): boolean {
|
|
|
455
468
|
}
|
|
456
469
|
|
|
457
470
|
function spawnRockAltRewardBucketDross(position: Vector, rng: RNG): boolean {
|
|
471
|
+
const room = game.GetRoom();
|
|
472
|
+
|
|
458
473
|
const chance = getRandom(rng);
|
|
459
474
|
let totalChance = 0;
|
|
460
475
|
|
|
@@ -502,11 +517,11 @@ function spawnRockAltRewardBucketDross(position: Vector, rng: RNG): boolean {
|
|
|
502
517
|
|
|
503
518
|
const numEnemiesChance = getRandom(rng);
|
|
504
519
|
const numEnemies = numEnemiesChance < 0.5 ? 1 : 2;
|
|
505
|
-
const jumpDistance = DISTANCE_OF_GRID_TILE * 3;
|
|
506
520
|
repeat(numEnemies, () => {
|
|
507
|
-
const
|
|
508
|
-
|
|
509
|
-
|
|
521
|
+
const targetPos = room.FindFreePickupSpawnPosition(
|
|
522
|
+
position,
|
|
523
|
+
FIND_FREE_INITIAL_STEP,
|
|
524
|
+
);
|
|
510
525
|
const spider = EntityNPC.ThrowSpider(
|
|
511
526
|
position,
|
|
512
527
|
undefined,
|
package/src/functions/rooms.ts
CHANGED
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
StageID,
|
|
17
17
|
} from "isaac-typescript-definitions";
|
|
18
18
|
import { game, sfxManager } from "../core/cachedClasses";
|
|
19
|
-
import { MAX_LEVEL_GRID_INDEX
|
|
19
|
+
import { MAX_LEVEL_GRID_INDEX } from "../core/constants";
|
|
20
20
|
import { ROOM_TYPE_NAMES } from "../objects/roomTypeNames";
|
|
21
21
|
import { MINE_SHAFT_ROOM_SUB_TYPE_SET } from "../sets/mineShaftRoomSubTypesSet";
|
|
22
|
-
import { inDimension } from "./dimensions";
|
|
22
|
+
import { getAllDimensions, inDimension } from "./dimensions";
|
|
23
23
|
import {
|
|
24
24
|
closeAllDoors,
|
|
25
25
|
getDoors,
|
|
@@ -45,7 +45,8 @@ import {
|
|
|
45
45
|
} from "./roomData";
|
|
46
46
|
import { reloadRoom } from "./roomTransition";
|
|
47
47
|
import { getGotoCommand } from "./stage";
|
|
48
|
-
import {
|
|
48
|
+
import { asNumber } from "./types";
|
|
49
|
+
import { irange } from "./utils";
|
|
49
50
|
|
|
50
51
|
/**
|
|
51
52
|
* Helper function for quickly switching to a new room without playing a particular animation. Use
|
|
@@ -207,7 +208,7 @@ export function getRoomsInsideGrid(
|
|
|
207
208
|
const level = game.GetLevel();
|
|
208
209
|
|
|
209
210
|
const dimensions = includeExtraDimensionalRooms
|
|
210
|
-
? (
|
|
211
|
+
? getAllDimensions()
|
|
211
212
|
: [Dimension.CURRENT];
|
|
212
213
|
|
|
213
214
|
/** We use a map instead of an array because room shapes occupy more than one room grid index. */
|
|
@@ -284,8 +285,10 @@ export function inAngelShop(): boolean {
|
|
|
284
285
|
const roomType = room.GetType();
|
|
285
286
|
const roomSubType = getRoomSubType();
|
|
286
287
|
|
|
287
|
-
|
|
288
|
-
|
|
288
|
+
return (
|
|
289
|
+
roomType === RoomType.ANGEL &&
|
|
290
|
+
roomSubType === asNumber(AngelRoomSubType.SHOP)
|
|
291
|
+
);
|
|
289
292
|
}
|
|
290
293
|
|
|
291
294
|
export function inBeastRoom(): boolean {
|
|
@@ -294,8 +297,8 @@ export function inBeastRoom(): boolean {
|
|
|
294
297
|
const roomSubType = getRoomSubType();
|
|
295
298
|
|
|
296
299
|
return (
|
|
297
|
-
|
|
298
|
-
|
|
300
|
+
roomType === RoomType.DUNGEON &&
|
|
301
|
+
roomSubType === asNumber(DungeonSubType.BEAST_ROOM)
|
|
299
302
|
);
|
|
300
303
|
}
|
|
301
304
|
|
|
@@ -312,7 +315,7 @@ export function inBossRoomOf(bossID: BossID): boolean {
|
|
|
312
315
|
return (
|
|
313
316
|
roomType === RoomType.BOSS &&
|
|
314
317
|
roomStageID === StageID.SPECIAL_ROOMS &&
|
|
315
|
-
roomSubType === bossID
|
|
318
|
+
roomSubType === asNumber(bossID)
|
|
316
319
|
);
|
|
317
320
|
}
|
|
318
321
|
|
|
@@ -326,13 +329,14 @@ export function inCrawlSpace(): boolean {
|
|
|
326
329
|
const roomType = room.GetType();
|
|
327
330
|
const roomSubType = getRoomSubType();
|
|
328
331
|
|
|
329
|
-
|
|
330
|
-
|
|
332
|
+
return (
|
|
333
|
+
roomType === RoomType.DUNGEON &&
|
|
334
|
+
roomSubType === asNumber(DungeonSubType.NORMAL)
|
|
335
|
+
);
|
|
331
336
|
}
|
|
332
337
|
|
|
333
338
|
/**
|
|
334
|
-
*
|
|
335
|
-
* with the Death Certificate area.
|
|
339
|
+
* Helper function to detect if the current room is one of the room in the Death Certificate area.
|
|
336
340
|
*/
|
|
337
341
|
export function inDeathCertificateArea(): boolean {
|
|
338
342
|
const roomStageID = getRoomStageID();
|
|
@@ -340,17 +344,16 @@ export function inDeathCertificateArea(): boolean {
|
|
|
340
344
|
|
|
341
345
|
return (
|
|
342
346
|
roomStageID === StageID.HOME &&
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
// eslint-disable-next-line isaacscript/strict-enums
|
|
346
|
-
roomSubType === HomeRoomSubType.DEATH_CERTIFICATE_ITEMS)
|
|
347
|
+
(roomSubType === asNumber(HomeRoomSubType.DEATH_CERTIFICATE_ENTRANCE) ||
|
|
348
|
+
roomSubType === asNumber(HomeRoomSubType.DEATH_CERTIFICATE_ITEMS))
|
|
347
349
|
);
|
|
348
350
|
}
|
|
349
351
|
|
|
350
352
|
/**
|
|
351
353
|
* Helper function to detect if the current room is a Treasure Room created when entering with a
|
|
352
|
-
* Devil's Crown trinket.
|
|
353
|
-
*
|
|
354
|
+
* Devil's Crown trinket.
|
|
355
|
+
*
|
|
356
|
+
* Under the hood, this checks for `RoomDescriptorFlag.DEVIL_TREASURE`.
|
|
354
357
|
*/
|
|
355
358
|
export function inDevilsCrownTreasureRoom(): boolean {
|
|
356
359
|
const roomDescriptor = getRoomDescriptorReadOnly();
|
|
@@ -368,8 +371,7 @@ export function inDoubleTrouble(): boolean {
|
|
|
368
371
|
export function inGenesisRoom(): boolean {
|
|
369
372
|
const roomGridIndex = getRoomGridIndex();
|
|
370
373
|
|
|
371
|
-
|
|
372
|
-
return roomGridIndex === GridRoom.GENESIS;
|
|
374
|
+
return roomGridIndex === asNumber(GridRoom.GENESIS);
|
|
373
375
|
}
|
|
374
376
|
|
|
375
377
|
/** Helper function to determine if the current room shape is one of the four L room shapes. */
|
|
@@ -388,8 +390,7 @@ export function inLRoom(): boolean {
|
|
|
388
390
|
export function inMegaSatanRoom(): boolean {
|
|
389
391
|
const roomGridIndex = getRoomGridIndex();
|
|
390
392
|
|
|
391
|
-
|
|
392
|
-
return roomGridIndex === GridRoom.MEGA_SATAN;
|
|
393
|
+
return roomGridIndex === asNumber(GridRoom.MEGA_SATAN);
|
|
393
394
|
}
|
|
394
395
|
|
|
395
396
|
/**
|
|
@@ -420,7 +421,7 @@ export function inMinibossRoomOf(minibossID: MinibossID): boolean {
|
|
|
420
421
|
return (
|
|
421
422
|
roomType === RoomType.MINI_BOSS &&
|
|
422
423
|
roomStageID === StageID.SPECIAL_ROOMS &&
|
|
423
|
-
roomSubType === minibossID
|
|
424
|
+
roomSubType === asNumber(minibossID)
|
|
424
425
|
);
|
|
425
426
|
}
|
|
426
427
|
|
|
@@ -434,8 +435,7 @@ export function inMinibossRoomOf(minibossID: MinibossID): boolean {
|
|
|
434
435
|
export function inSecretShop(): boolean {
|
|
435
436
|
const roomGridIndex = getRoomGridIndex();
|
|
436
437
|
|
|
437
|
-
|
|
438
|
-
return roomGridIndex === GridRoom.SECRET_SHOP;
|
|
438
|
+
return roomGridIndex === asNumber(GridRoom.SECRET_SHOP);
|
|
439
439
|
}
|
|
440
440
|
|
|
441
441
|
/**
|
|
@@ -498,6 +498,7 @@ export function roomUpdateSafe(): void {
|
|
|
498
498
|
/** Helper function to set the backdrop of the current room. */
|
|
499
499
|
export function setBackdrop(backdropType: BackdropType): void {
|
|
500
500
|
game.ShowHallucination(0, backdropType);
|
|
501
|
+
sfxManager.Stop(SoundEffect.DEATH_CARD);
|
|
501
502
|
}
|
|
502
503
|
|
|
503
504
|
/**
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CollectibleType,
|
|
3
|
-
PickupPrice,
|
|
4
3
|
PickupVariant,
|
|
5
4
|
PlayerType,
|
|
6
5
|
} from "isaac-typescript-definitions";
|
|
@@ -65,7 +64,7 @@ export function spawnCollectible(
|
|
|
65
64
|
|
|
66
65
|
// We can set the price to any arbitrary value; it will auto-update to the true price on the
|
|
67
66
|
// next frame.
|
|
68
|
-
collectible.Price = 15
|
|
67
|
+
collectible.Price = 15;
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
if (isQuestCollectible(collectibleType) && areFeaturesInitialized()) {
|