isaacscript-common 1.0.472 → 1.0.473

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.
@@ -21,6 +21,10 @@ export declare function deployJSONRoom(jsonRoom: JSONRoom, seed?: number): int;
21
21
  *
22
22
  * This function is meant to be used in the PostNewRoom callback.
23
23
  *
24
+ * Note that this function does not simply choose a random element in the provided array; it will
25
+ * properly account for each room weight using the algorithm from:
26
+ * https://stackoverflow.com/questions/1761626/weighted-random-numbers
27
+ *
24
28
  * @returns The iterated seed, which can be used in subsequent room deployments. (The seed is used
25
29
  * to spawn every entity contained within the custom room.)
26
30
  */
@@ -102,6 +102,7 @@ export declare function inCrawlspace(): boolean;
102
102
  * area.
103
103
  */
104
104
  export declare function inDeathCertificateArea(): boolean;
105
+ export declare function isDevilsCrownTreasureRoom(): boolean;
105
106
  export declare function inDimension(dimension: Dimension): boolean;
106
107
  /** Helper function to see if the current room shape is one of the four L room shapes. */
107
108
  export declare function inLRoom(): boolean;
@@ -11,6 +11,8 @@ local ____doors = require("functions.doors")
11
11
  local closeAllDoors = ____doors.closeAllDoors
12
12
  local getDoors = ____doors.getDoors
13
13
  local isHiddenSecretRoomDoor = ____doors.isHiddenSecretRoomDoor
14
+ local ____flag = require("functions.flag")
15
+ local hasFlag = ____flag.hasFlag
14
16
  function ____exports.getRoomIndex(self)
15
17
  local game = Game()
16
18
  local level = game:GetLevel()
@@ -164,6 +166,12 @@ function ____exports.inDeathCertificateArea(self)
164
166
  local roomSubType = ____exports.getRoomSubType(nil)
165
167
  return (roomStageID == 35) and ((roomSubType == 33) or (roomSubType == 33))
166
168
  end
169
+ function ____exports.isDevilsCrownTreasureRoom(self)
170
+ local game = Game()
171
+ local level = game:GetLevel()
172
+ local roomDesc = level:GetCurrentRoomDesc()
173
+ return hasFlag(nil, roomDesc.Flags, 2048)
174
+ end
167
175
  function ____exports.inDimension(self, dimension)
168
176
  return dimension == ____exports.getCurrentDimension(nil)
169
177
  end
@@ -202,14 +210,14 @@ function ____exports.setRoomCleared(self)
202
210
  ) do
203
211
  do
204
212
  if isHiddenSecretRoomDoor(nil, door) then
205
- goto __continue37
213
+ goto __continue38
206
214
  end
207
215
  door.State = DoorState.STATE_OPEN
208
216
  local sprite = door:GetSprite()
209
217
  sprite:Play("Opened", true)
210
218
  door.ExtraVisible = false
211
219
  end
212
- ::__continue37::
220
+ ::__continue38::
213
221
  end
214
222
  sfx:Stop(SoundEffect.SOUND_DOOR_HEAVY_OPEN)
215
223
  game:ShakeScreen(0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.472",
3
+ "version": "1.0.473",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -25,7 +25,7 @@
25
25
  "dist/**/*.d.ts"
26
26
  ],
27
27
  "devDependencies": {
28
- "isaac-typescript-definitions": "^1.0.281",
28
+ "isaac-typescript-definitions": "^1.0.282",
29
29
  "isaacscript-lint": "^1.0.67",
30
30
  "typedoc": "^0.22.10",
31
31
  "typescript": "4.4.4",