isaacscript-common 20.12.3 → 20.13.1

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.d.ts CHANGED
@@ -5158,6 +5158,28 @@ export declare function getMatchingGridEntities(gridEntityType: GridEntityType,
5158
5158
 
5159
5159
  export declare function getMoveActions(): ReadonlySet<ButtonAction>;
5160
5160
 
5161
+ /**
5162
+ * Helper function to get the current effect that the Mysterious Paper trinket is providing to the
5163
+ * player. Returns undefined if the player does not have the Mysterious Paper trinket.
5164
+ *
5165
+ * The Mysterious Paper trinket has four different effects:
5166
+ *
5167
+ * - The Polaroid (collectible)
5168
+ * - The Negative (collectible)
5169
+ * - A Missing Page (trinket)
5170
+ * - Missing Poster (trinket)
5171
+ *
5172
+ * It rotates between these four effects on every frame. Note that Mysterious Paper will cause the
5173
+ * `EntityPlayer.HasCollectible` and `EntityPlayer.HasTrinket` methods to return true for the
5174
+ * respective items on the particular frame, with the exception of the Missing Poster. (The player
5175
+ * will never "have" the Missing Poster, even on the correct corresponding frame.)
5176
+ *
5177
+ * @param player The player to look at.
5178
+ * @param frameCount Optional. The frame count that corresponds to time the effect will be active.
5179
+ * Default is the current frame.
5180
+ */
5181
+ export declare function getMysteriousPaperEffectForFrame(player: EntityPlayer, frameCount?: int): MysteriousPaperEffect | undefined;
5182
+
5161
5183
  /**
5162
5184
  * Helper function to get the first player with the lowest frame count. Useful to find a freshly
5163
5185
  * spawned player after using items like Esau Jr. Don't use this function if two or more players
@@ -11637,6 +11659,19 @@ export declare function movePlayersToCenter(radius?: float): void;
11637
11659
  */
11638
11660
  export declare const musicManager: MusicManager;
11639
11661
 
11662
+ /**
11663
+ * The possible effects that the Mysterious Paper trinket can grant.
11664
+ *
11665
+ * This enum has hard-coded values because they correspond to the specific in-game frame count of
11666
+ * the player.
11667
+ */
11668
+ export declare enum MysteriousPaperEffect {
11669
+ POLAROID = 0,
11670
+ NEGATIVE = 1,
11671
+ MISSING_PAGE = 2,
11672
+ MISSING_POSTER = 3
11673
+ }
11674
+
11640
11675
  /** This is near the top door. */
11641
11676
  export declare const NEW_FLOOR_STARTING_POSITION_GREED_MODE: Vector;
11642
11677
 
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 20.12.3
3
+ isaacscript-common 20.13.1
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -27210,6 +27210,19 @@ function ____exports.sumSet(self, set)
27210
27210
  local values = {__TS__Spread(set:values())}
27211
27211
  return sumArray(nil, values)
27212
27212
  end
27213
+ return ____exports
27214
+ end,
27215
+ ["src.enums.MysteriousPaperEffect"] = function(...)
27216
+ local ____exports = {}
27217
+ ____exports.MysteriousPaperEffect = {}
27218
+ ____exports.MysteriousPaperEffect.POLAROID = 0
27219
+ ____exports.MysteriousPaperEffect[____exports.MysteriousPaperEffect.POLAROID] = "POLAROID"
27220
+ ____exports.MysteriousPaperEffect.NEGATIVE = 1
27221
+ ____exports.MysteriousPaperEffect[____exports.MysteriousPaperEffect.NEGATIVE] = "NEGATIVE"
27222
+ ____exports.MysteriousPaperEffect.MISSING_PAGE = 2
27223
+ ____exports.MysteriousPaperEffect[____exports.MysteriousPaperEffect.MISSING_PAGE] = "MISSING_PAGE"
27224
+ ____exports.MysteriousPaperEffect.MISSING_POSTER = 3
27225
+ ____exports.MysteriousPaperEffect[____exports.MysteriousPaperEffect.MISSING_POSTER] = "MISSING_POSTER"
27213
27226
  return ____exports
27214
27227
  end,
27215
27228
  ["src.maps.trinketDescriptionMap"] = function(...)
@@ -27621,6 +27634,8 @@ local BLIND_ITEM_PNG_PATH = ____constants.BLIND_ITEM_PNG_PATH
27621
27634
  local ____constantsFirstLast = require("src.core.constantsFirstLast")
27622
27635
  local FIRST_TRINKET_TYPE = ____constantsFirstLast.FIRST_TRINKET_TYPE
27623
27636
  local LAST_VANILLA_TRINKET_TYPE = ____constantsFirstLast.LAST_VANILLA_TRINKET_TYPE
27637
+ local ____MysteriousPaperEffect = require("src.enums.MysteriousPaperEffect")
27638
+ local MysteriousPaperEffect = ____MysteriousPaperEffect.MysteriousPaperEffect
27624
27639
  local ____trinketDescriptionMap = require("src.maps.trinketDescriptionMap")
27625
27640
  local DEFAULT_TRINKET_DESCRIPTION = ____trinketDescriptionMap.DEFAULT_TRINKET_DESCRIPTION
27626
27641
  local TRINKET_DESCRIPTION_MAP = ____trinketDescriptionMap.TRINKET_DESCRIPTION_MAP
@@ -27629,6 +27644,8 @@ local DEFAULT_TRINKET_NAME = ____trinketTypeToNameMap.DEFAULT_TRINKET_NAME
27629
27644
  local TRINKET_TYPE_TO_NAME_MAP = ____trinketTypeToNameMap.TRINKET_TYPE_TO_NAME_MAP
27630
27645
  local ____entities = require("src.functions.entities")
27631
27646
  local getEntityID = ____entities.getEntityID
27647
+ local ____enums = require("src.functions.enums")
27648
+ local getEnumLength = ____enums.getEnumLength
27632
27649
  local ____flag = require("src.functions.flag")
27633
27650
  local hasFlag = ____flag.hasFlag
27634
27651
  local ____pickupVariants = require("src.functions.pickupVariants")
@@ -27645,11 +27662,21 @@ function ____exports.isVanillaTrinketType(self, trinketType)
27645
27662
  return trinketType <= LAST_VANILLA_TRINKET_TYPE
27646
27663
  end
27647
27664
  local GOLDEN_TRINKET_ADJUSTMENT = 32768
27665
+ local NUM_MYSTERIOUS_PAPER_EFFECTS = getEnumLength(nil, MysteriousPaperEffect)
27648
27666
  local TRINKET_ANM2_PATH = "gfx/005.350_trinket.anm2"
27649
27667
  local TRINKET_SPRITE_LAYER = 0
27650
27668
  function ____exports.getGoldenTrinketType(self, trinketType)
27651
27669
  return asNumber(nil, trinketType) + GOLDEN_TRINKET_ADJUSTMENT
27652
27670
  end
27671
+ function ____exports.getMysteriousPaperEffectForFrame(self, player, frameCount)
27672
+ if frameCount == nil then
27673
+ frameCount = player.FrameCount
27674
+ end
27675
+ if not player:HasTrinket(TrinketType.MYSTERIOUS_PAPER) then
27676
+ return nil
27677
+ end
27678
+ return frameCount % NUM_MYSTERIOUS_PAPER_EFFECTS
27679
+ end
27653
27680
  function ____exports.getOpenTrinketSlot(self, player)
27654
27681
  local maxTrinkets = player:GetMaxTrinkets()
27655
27682
  local trinketType1 = player:GetTrinket(TrinketSlot.SLOT_1)
@@ -29452,6 +29479,8 @@ local game = ____cachedClasses.game
29452
29479
  local ____constants = require("src.core.constants")
29453
29480
  local MAX_TAINTED_SAMSON_BERSERK_CHARGE = ____constants.MAX_TAINTED_SAMSON_BERSERK_CHARGE
29454
29481
  local TAINTED_SAMSON_BERSERK_CHARGE_FROM_TAKING_DAMAGE = ____constants.TAINTED_SAMSON_BERSERK_CHARGE_FROM_TAKING_DAMAGE
29482
+ local ____MysteriousPaperEffect = require("src.enums.MysteriousPaperEffect")
29483
+ local MysteriousPaperEffect = ____MysteriousPaperEffect.MysteriousPaperEffect
29455
29484
  local ____characters = require("src.functions.characters")
29456
29485
  local getCharacterDeathAnimationName = ____characters.getCharacterDeathAnimationName
29457
29486
  local ____playerHealth = require("src.functions.playerHealth")
@@ -29465,6 +29494,8 @@ local getLastFrameOfAnimation = ____sprites.getLastFrameOfAnimation
29465
29494
  local ____trinketGive = require("src.functions.trinketGive")
29466
29495
  local giveTrinketsBack = ____trinketGive.giveTrinketsBack
29467
29496
  local temporarilyRemoveTrinket = ____trinketGive.temporarilyRemoveTrinket
29497
+ local ____trinkets = require("src.functions.trinkets")
29498
+ local getMysteriousPaperEffectForFrame = ____trinkets.getMysteriousPaperEffectForFrame
29468
29499
  function ____exports.willReviveFromHeartbreak(self, player)
29469
29500
  if not player:HasCollectible(CollectibleType.HEARTBREAK) then
29470
29501
  return false
@@ -29528,13 +29559,16 @@ function ____exports.isDamageToPlayerFatal(self, player, amount, source, lastDam
29528
29559
  return true
29529
29560
  end
29530
29561
  function ____exports.willMysteriousPaperRevive(self, player)
29531
- local gameFrameCount = game:GetFrameCount()
29532
29562
  local sprite = player:GetSprite()
29533
29563
  local character = player:GetPlayerType()
29534
29564
  local animation = getCharacterDeathAnimationName(nil, character)
29535
29565
  local deathAnimationFrames = getLastFrameOfAnimation(nil, sprite, animation)
29536
- local frameOfDeath = gameFrameCount + deathAnimationFrames + 1
29537
- return frameOfDeath % 4 == 3
29566
+ local frameOfDeath = player.FrameCount + deathAnimationFrames
29567
+ local mysteriousPaperEffect = getMysteriousPaperEffectForFrame(nil, player, frameOfDeath)
29568
+ if mysteriousPaperEffect == nil then
29569
+ return false
29570
+ end
29571
+ return mysteriousPaperEffect == MysteriousPaperEffect.MISSING_POSTER
29538
29572
  end
29539
29573
  function ____exports.willPlayerRevive(self, player)
29540
29574
  local trinketSituation = temporarilyRemoveTrinket(nil, player, TrinketType.MYSTERIOUS_PAPER)
@@ -41831,6 +41865,8 @@ local ____roomData = require("src.functions.roomData")
41831
41865
  local getRoomSubType = ____roomData.getRoomSubType
41832
41866
  local ____string = require("src.functions.string")
41833
41867
  local removeCharactersBefore = ____string.removeCharactersBefore
41868
+ local ____ui = require("src.functions.ui")
41869
+ local getScreenCenterPos = ____ui.getScreenCenterPos
41834
41870
  local ____utils = require("src.functions.utils")
41835
41871
  local eRange = ____utils.eRange
41836
41872
  local ____bossNamePNGFileNames = require("src.objects.bossNamePNGFileNames")
@@ -42053,9 +42089,7 @@ function ____exports.versusScreenPostRender(self, v, pause, disableAllSound)
42053
42089
  finishVersusScreenAnimation(nil, v, pause, disableAllSound)
42054
42090
  return
42055
42091
  end
42056
- local room = game:GetRoom()
42057
- local centerPos = room:GetCenterPos()
42058
- local position = Isaac.WorldToRenderPosition(centerPos)
42092
+ local position = getScreenCenterPos(nil)
42059
42093
  versusScreenBackgroundSprite:RenderLayer(VersusScreenLayer.BACKGROUND, position)
42060
42094
  versusScreenBackgroundSprite:Update()
42061
42095
  versusScreenSprite:RenderLayer(VersusScreenLayer.OVERLAY, position)
@@ -51334,6 +51368,14 @@ do
51334
51368
  end
51335
51369
  end
51336
51370
  end
51371
+ do
51372
+ local ____export = require("src.enums.MysteriousPaperEffect")
51373
+ for ____exportKey, ____exportValue in pairs(____export) do
51374
+ if ____exportKey ~= "default" then
51375
+ ____exports[____exportKey] = ____exportValue
51376
+ end
51377
+ end
51378
+ end
51337
51379
  do
51338
51380
  local ____export = require("src.enums.PocketItemType")
51339
51381
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -52394,6 +52436,14 @@ do
52394
52436
  end
52395
52437
  end
52396
52438
  end
52439
+ do
52440
+ local ____export = require("src.enums.MysteriousPaperEffect")
52441
+ for ____exportKey, ____exportValue in pairs(____export) do
52442
+ if ____exportKey ~= "default" then
52443
+ ____exports[____exportKey] = ____exportValue
52444
+ end
52445
+ end
52446
+ end
52397
52447
  do
52398
52448
  local ____export = require("src.enums.PocketItemType")
52399
52449
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -1 +1 @@
1
- {"version":3,"file":"versusScreen.d.ts","sourceRoot":"","sources":["../../../../../../src/classes/features/other/customStages/versusScreen.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAOzE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAU/C,UAAU,gBAAgB;IACxB,GAAG,EAAE;QACH,uBAAuB,EAAE,OAAO,CAAC;KAClC,CAAC;CACH;AA8ED,wBAAgB,yBAAyB,CACvC,CAAC,EAAE,gBAAgB,EACnB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,eAAe,EAChC,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,GACzB,IAAI,CA0GN;AAiGD,wBAAgB,sBAAsB,CACpC,CAAC,EAAE,gBAAgB,EACnB,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,eAAe,GAC/B,IAAI,CAwCN"}
1
+ {"version":3,"file":"versusScreen.d.ts","sourceRoot":"","sources":["../../../../../../src/classes/features/other/customStages/versusScreen.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAOzE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAU/C,UAAU,gBAAgB;IACxB,GAAG,EAAE;QACH,uBAAuB,EAAE,OAAO,CAAC;KAClC,CAAC;CACH;AA8ED,wBAAgB,yBAAyB,CACvC,CAAC,EAAE,gBAAgB,EACnB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,eAAe,EAChC,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,GACzB,IAAI,CA0GN;AAiGD,wBAAgB,sBAAsB,CACpC,CAAC,EAAE,gBAAgB,EACnB,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,eAAe,GAC/B,IAAI,CAsCN"}
@@ -20,6 +20,8 @@ local ____roomData = require("src.functions.roomData")
20
20
  local getRoomSubType = ____roomData.getRoomSubType
21
21
  local ____string = require("src.functions.string")
22
22
  local removeCharactersBefore = ____string.removeCharactersBefore
23
+ local ____ui = require("src.functions.ui")
24
+ local getScreenCenterPos = ____ui.getScreenCenterPos
23
25
  local ____utils = require("src.functions.utils")
24
26
  local eRange = ____utils.eRange
25
27
  local ____bossNamePNGFileNames = require("src.objects.bossNamePNGFileNames")
@@ -254,9 +256,7 @@ function ____exports.versusScreenPostRender(self, v, pause, disableAllSound)
254
256
  finishVersusScreenAnimation(nil, v, pause, disableAllSound)
255
257
  return
256
258
  end
257
- local room = game:GetRoom()
258
- local centerPos = room:GetCenterPos()
259
- local position = Isaac.WorldToRenderPosition(centerPos)
259
+ local position = getScreenCenterPos(nil)
260
260
  versusScreenBackgroundSprite:RenderLayer(VersusScreenLayer.BACKGROUND, position)
261
261
  versusScreenBackgroundSprite:Update()
262
262
  versusScreenSprite:RenderLayer(VersusScreenLayer.OVERLAY, position)
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The possible effects that the Mysterious Paper trinket can grant.
3
+ *
4
+ * This enum has hard-coded values because they correspond to the specific in-game frame count of
5
+ * the player.
6
+ */
7
+ export declare enum MysteriousPaperEffect {
8
+ POLAROID = 0,
9
+ NEGATIVE = 1,
10
+ MISSING_PAGE = 2,
11
+ MISSING_POSTER = 3
12
+ }
13
+ //# sourceMappingURL=MysteriousPaperEffect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MysteriousPaperEffect.d.ts","sourceRoot":"","sources":["../../../src/enums/MysteriousPaperEffect.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,oBAAY,qBAAqB;IAC/B,QAAQ,IAAI;IACZ,QAAQ,IAAI;IACZ,YAAY,IAAI;IAChB,cAAc,IAAI;CACnB"}
@@ -0,0 +1,15 @@
1
+ local ____exports = {}
2
+ --- The possible effects that the Mysterious Paper trinket can grant.
3
+ --
4
+ -- This enum has hard-coded values because they correspond to the specific in-game frame count of
5
+ -- the player.
6
+ ____exports.MysteriousPaperEffect = {}
7
+ ____exports.MysteriousPaperEffect.POLAROID = 0
8
+ ____exports.MysteriousPaperEffect[____exports.MysteriousPaperEffect.POLAROID] = "POLAROID"
9
+ ____exports.MysteriousPaperEffect.NEGATIVE = 1
10
+ ____exports.MysteriousPaperEffect[____exports.MysteriousPaperEffect.NEGATIVE] = "NEGATIVE"
11
+ ____exports.MysteriousPaperEffect.MISSING_PAGE = 2
12
+ ____exports.MysteriousPaperEffect[____exports.MysteriousPaperEffect.MISSING_PAGE] = "MISSING_PAGE"
13
+ ____exports.MysteriousPaperEffect.MISSING_POSTER = 3
14
+ ____exports.MysteriousPaperEffect[____exports.MysteriousPaperEffect.MISSING_POSTER] = "MISSING_POSTER"
15
+ return ____exports
@@ -1 +1 @@
1
- {"version":3,"file":"revive.d.ts","sourceRoot":"","sources":["../../../src/functions/revive.ts"],"names":[],"mappings":";;;AAkBA;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,SAAS,EACjB,mBAAmB,EAAE,GAAG,GAAG,SAAS,GACnC,OAAO,CAuFT;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAavE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAa9D;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAYtE;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAe1E"}
1
+ {"version":3,"file":"revive.d.ts","sourceRoot":"","sources":["../../../src/functions/revive.ts"],"names":[],"mappings":";;;AAoBA;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,SAAS,EACjB,mBAAmB,EAAE,GAAG,GAAG,SAAS,GACnC,OAAO,CAuFT;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAmBvE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAa9D;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAYtE;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAe1E"}
@@ -10,6 +10,8 @@ local game = ____cachedClasses.game
10
10
  local ____constants = require("src.core.constants")
11
11
  local MAX_TAINTED_SAMSON_BERSERK_CHARGE = ____constants.MAX_TAINTED_SAMSON_BERSERK_CHARGE
12
12
  local TAINTED_SAMSON_BERSERK_CHARGE_FROM_TAKING_DAMAGE = ____constants.TAINTED_SAMSON_BERSERK_CHARGE_FROM_TAKING_DAMAGE
13
+ local ____MysteriousPaperEffect = require("src.enums.MysteriousPaperEffect")
14
+ local MysteriousPaperEffect = ____MysteriousPaperEffect.MysteriousPaperEffect
13
15
  local ____characters = require("src.functions.characters")
14
16
  local getCharacterDeathAnimationName = ____characters.getCharacterDeathAnimationName
15
17
  local ____playerHealth = require("src.functions.playerHealth")
@@ -23,6 +25,8 @@ local getLastFrameOfAnimation = ____sprites.getLastFrameOfAnimation
23
25
  local ____trinketGive = require("src.functions.trinketGive")
24
26
  local giveTrinketsBack = ____trinketGive.giveTrinketsBack
25
27
  local temporarilyRemoveTrinket = ____trinketGive.temporarilyRemoveTrinket
28
+ local ____trinkets = require("src.functions.trinkets")
29
+ local getMysteriousPaperEffectForFrame = ____trinkets.getMysteriousPaperEffectForFrame
26
30
  --- Helper function to determine if the player will be revived by the Heartbreak collectible if they
27
31
  -- take fatal damage. This is contingent on the character that they are playing as and the amount of
28
32
  -- broken hearts that they already have.
@@ -99,13 +103,16 @@ end
99
103
  -- Mysterious Paper rotates between the 4 items on every frame, in order. The formula for whether
100
104
  -- Mysterious Paper be Missing Power is: `gameFrameCount % 4 === 3`
101
105
  function ____exports.willMysteriousPaperRevive(self, player)
102
- local gameFrameCount = game:GetFrameCount()
103
106
  local sprite = player:GetSprite()
104
107
  local character = player:GetPlayerType()
105
108
  local animation = getCharacterDeathAnimationName(nil, character)
106
109
  local deathAnimationFrames = getLastFrameOfAnimation(nil, sprite, animation)
107
- local frameOfDeath = gameFrameCount + deathAnimationFrames + 1
108
- return frameOfDeath % 4 == 3
110
+ local frameOfDeath = player.FrameCount + deathAnimationFrames
111
+ local mysteriousPaperEffect = getMysteriousPaperEffectForFrame(nil, player, frameOfDeath)
112
+ if mysteriousPaperEffect == nil then
113
+ return false
114
+ end
115
+ return mysteriousPaperEffect == MysteriousPaperEffect.MISSING_POSTER
109
116
  end
110
117
  --- The `EntityPlayer.WillPlayerRevive` method does not properly account for Mysterious Paper, so use
111
118
  -- this helper function instead for more robust revival detection.
@@ -1,4 +1,5 @@
1
1
  import { CacheFlag, TrinketType } from "isaac-typescript-definitions";
2
+ import { MysteriousPaperEffect } from "../enums/MysteriousPaperEffect";
2
3
  /**
3
4
  * Helper function to get the corresponding golden trinket type from a normal trinket type.
4
5
  *
@@ -6,6 +7,27 @@ import { CacheFlag, TrinketType } from "isaac-typescript-definitions";
6
7
  * corresponds to the golden trinket sub-type for Swallowed Penny.
7
8
  */
8
9
  export declare function getGoldenTrinketType(trinketType: TrinketType): TrinketType;
10
+ /**
11
+ * Helper function to get the current effect that the Mysterious Paper trinket is providing to the
12
+ * player. Returns undefined if the player does not have the Mysterious Paper trinket.
13
+ *
14
+ * The Mysterious Paper trinket has four different effects:
15
+ *
16
+ * - The Polaroid (collectible)
17
+ * - The Negative (collectible)
18
+ * - A Missing Page (trinket)
19
+ * - Missing Poster (trinket)
20
+ *
21
+ * It rotates between these four effects on every frame. Note that Mysterious Paper will cause the
22
+ * `EntityPlayer.HasCollectible` and `EntityPlayer.HasTrinket` methods to return true for the
23
+ * respective items on the particular frame, with the exception of the Missing Poster. (The player
24
+ * will never "have" the Missing Poster, even on the correct corresponding frame.)
25
+ *
26
+ * @param player The player to look at.
27
+ * @param frameCount Optional. The frame count that corresponds to time the effect will be active.
28
+ * Default is the current frame.
29
+ */
30
+ export declare function getMysteriousPaperEffectForFrame(player: EntityPlayer, frameCount?: int): MysteriousPaperEffect | undefined;
9
31
  /**
10
32
  * Returns the slot number corresponding to where a trinket can be safely inserted.
11
33
  *
@@ -1 +1 @@
1
- {"version":3,"file":"trinkets.d.ts","sourceRoot":"","sources":["../../../src/functions/trinkets.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAGT,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAmCtC;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,WAAW,GAAG,WAAW,CAE1E;AAED;;;;;;;;;;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
10
10
  local ____constantsFirstLast = require("src.core.constantsFirstLast")
11
11
  local FIRST_TRINKET_TYPE = ____constantsFirstLast.FIRST_TRINKET_TYPE
12
12
  local LAST_VANILLA_TRINKET_TYPE = ____constantsFirstLast.LAST_VANILLA_TRINKET_TYPE
13
+ local ____MysteriousPaperEffect = require("src.enums.MysteriousPaperEffect")
14
+ local MysteriousPaperEffect = ____MysteriousPaperEffect.MysteriousPaperEffect
13
15
  local ____trinketDescriptionMap = require("src.maps.trinketDescriptionMap")
14
16
  local DEFAULT_TRINKET_DESCRIPTION = ____trinketDescriptionMap.DEFAULT_TRINKET_DESCRIPTION
15
17
  local TRINKET_DESCRIPTION_MAP = ____trinketDescriptionMap.TRINKET_DESCRIPTION_MAP
@@ -18,6 +20,8 @@ local DEFAULT_TRINKET_NAME = ____trinketTypeToNameMap.DEFAULT_TRINKET_NAME
18
20
  local TRINKET_TYPE_TO_NAME_MAP = ____trinketTypeToNameMap.TRINKET_TYPE_TO_NAME_MAP
19
21
  local ____entities = require("src.functions.entities")
20
22
  local getEntityID = ____entities.getEntityID
23
+ local ____enums = require("src.functions.enums")
24
+ local getEnumLength = ____enums.getEnumLength
21
25
  local ____flag = require("src.functions.flag")
22
26
  local hasFlag = ____flag.hasFlag
23
27
  local ____pickupVariants = require("src.functions.pickupVariants")
@@ -39,6 +43,7 @@ end
39
43
  --
40
44
  -- 1 << 15
41
45
  local GOLDEN_TRINKET_ADJUSTMENT = 32768
46
+ local NUM_MYSTERIOUS_PAPER_EFFECTS = getEnumLength(nil, MysteriousPaperEffect)
42
47
  local TRINKET_ANM2_PATH = "gfx/005.350_trinket.anm2"
43
48
  local TRINKET_SPRITE_LAYER = 0
44
49
  --- Helper function to get the corresponding golden trinket type from a normal trinket type.
@@ -48,6 +53,33 @@ local TRINKET_SPRITE_LAYER = 0
48
53
  function ____exports.getGoldenTrinketType(self, trinketType)
49
54
  return asNumber(nil, trinketType) + GOLDEN_TRINKET_ADJUSTMENT
50
55
  end
56
+ --- Helper function to get the current effect that the Mysterious Paper trinket is providing to the
57
+ -- player. Returns undefined if the player does not have the Mysterious Paper trinket.
58
+ --
59
+ -- The Mysterious Paper trinket has four different effects:
60
+ --
61
+ -- - The Polaroid (collectible)
62
+ -- - The Negative (collectible)
63
+ -- - A Missing Page (trinket)
64
+ -- - Missing Poster (trinket)
65
+ --
66
+ -- It rotates between these four effects on every frame. Note that Mysterious Paper will cause the
67
+ -- `EntityPlayer.HasCollectible` and `EntityPlayer.HasTrinket` methods to return true for the
68
+ -- respective items on the particular frame, with the exception of the Missing Poster. (The player
69
+ -- will never "have" the Missing Poster, even on the correct corresponding frame.)
70
+ --
71
+ -- @param player The player to look at.
72
+ -- @param frameCount Optional. The frame count that corresponds to time the effect will be active.
73
+ -- Default is the current frame.
74
+ function ____exports.getMysteriousPaperEffectForFrame(self, player, frameCount)
75
+ if frameCount == nil then
76
+ frameCount = player.FrameCount
77
+ end
78
+ if not player:HasTrinket(TrinketType.MYSTERIOUS_PAPER) then
79
+ return nil
80
+ end
81
+ return frameCount % NUM_MYSTERIOUS_PAPER_EFFECTS
82
+ end
51
83
  --- Returns the slot number corresponding to where a trinket can be safely inserted.
52
84
  --
53
85
  -- For example:
@@ -11,6 +11,7 @@ export * from "./enums/HealthType";
11
11
  export * from "./enums/ISCFeature";
12
12
  export * from "./enums/LadderSubTypeCustom";
13
13
  export * from "./enums/ModCallbackCustom";
14
+ export * from "./enums/MysteriousPaperEffect";
14
15
  export * from "./enums/PocketItemType";
15
16
  export * from "./enums/RockAltType";
16
17
  export * from "./enums/SaveDataKey";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAm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;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC"}
@@ -103,6 +103,14 @@ do
103
103
  end
104
104
  end
105
105
  end
106
+ do
107
+ local ____export = require("src.enums.MysteriousPaperEffect")
108
+ for ____exportKey, ____exportValue in pairs(____export) do
109
+ if ____exportKey ~= "default" then
110
+ ____exports[____exportKey] = ____exportValue
111
+ end
112
+ end
113
+ end
106
114
  do
107
115
  local ____export = require("src.enums.PocketItemType")
108
116
  for ____exportKey, ____exportValue in pairs(____export) do
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "20.12.3",
3
+ "version": "20.13.1",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -12,6 +12,7 @@ import { arrayRemove } from "../../../../functions/array";
12
12
  import { getBosses } from "../../../../functions/bosses";
13
13
  import { getRoomSubType } from "../../../../functions/roomData";
14
14
  import { removeCharactersBefore } from "../../../../functions/string";
15
+ import { getScreenCenterPos } from "../../../../functions/ui";
15
16
  import { eRange } from "../../../../functions/utils";
16
17
  import { CustomStage } from "../../../../interfaces/private/CustomStage";
17
18
  import { BOSS_NAME_PNG_FILE_NAMES } from "../../../../objects/bossNamePNGFileNames";
@@ -340,9 +341,7 @@ export function versusScreenPostRender(
340
341
  return;
341
342
  }
342
343
 
343
- const room = game.GetRoom();
344
- const centerPos = room.GetCenterPos();
345
- const position = Isaac.WorldToRenderPosition(centerPos);
344
+ const position = getScreenCenterPos();
346
345
 
347
346
  // First, we render the background.
348
347
  versusScreenBackgroundSprite.RenderLayer(
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The possible effects that the Mysterious Paper trinket can grant.
3
+ *
4
+ * This enum has hard-coded values because they correspond to the specific in-game frame count of
5
+ * the player.
6
+ */
7
+ export enum MysteriousPaperEffect {
8
+ POLAROID = 0,
9
+ NEGATIVE = 1,
10
+ MISSING_PAGE = 2,
11
+ MISSING_POSTER = 3,
12
+ }
@@ -10,11 +10,13 @@ import {
10
10
  MAX_TAINTED_SAMSON_BERSERK_CHARGE,
11
11
  TAINTED_SAMSON_BERSERK_CHARGE_FROM_TAKING_DAMAGE,
12
12
  } from "../core/constants";
13
+ import { MysteriousPaperEffect } from "../enums/MysteriousPaperEffect";
13
14
  import { getCharacterDeathAnimationName } from "./characters";
14
15
  import { getPlayerMaxHeartContainers } from "./playerHealth";
15
16
  import { getPlayerNumHitsRemaining, hasLostCurse, isKeeper } from "./players";
16
17
  import { getLastFrameOfAnimation } from "./sprites";
17
18
  import { giveTrinketsBack, temporarilyRemoveTrinket } from "./trinketGive";
19
+ import { getMysteriousPaperEffectForFrame } from "./trinkets";
18
20
 
19
21
  /**
20
22
  * Uses the player's current health and other miscellaneous things to determine if incoming damage
@@ -123,7 +125,6 @@ export function isDamageToPlayerFatal(
123
125
  * Mysterious Paper be Missing Power is: `gameFrameCount % 4 === 3`
124
126
  */
125
127
  export function willMysteriousPaperRevive(player: EntityPlayer): boolean {
126
- const gameFrameCount = game.GetFrameCount();
127
128
  const sprite = player.GetSprite();
128
129
 
129
130
  // We want to explicitly check the length of the death animation because we might be playing on a
@@ -131,10 +132,17 @@ export function willMysteriousPaperRevive(player: EntityPlayer): boolean {
131
132
  const character = player.GetPlayerType();
132
133
  const animation = getCharacterDeathAnimationName(character);
133
134
  const deathAnimationFrames = getLastFrameOfAnimation(sprite, animation);
134
- const frameOfDeath = gameFrameCount + deathAnimationFrames + 1;
135
- // (We add 1 because it takes one frame for the death animation to begin.)
135
+ const frameOfDeath = player.FrameCount + deathAnimationFrames;
136
+
137
+ const mysteriousPaperEffect = getMysteriousPaperEffectForFrame(
138
+ player,
139
+ frameOfDeath,
140
+ );
141
+ if (mysteriousPaperEffect === undefined) {
142
+ return false;
143
+ }
136
144
 
137
- return frameOfDeath % 4 === 3;
145
+ return mysteriousPaperEffect === MysteriousPaperEffect.MISSING_POSTER;
138
146
  }
139
147
 
140
148
  /**
@@ -10,6 +10,7 @@ import {
10
10
  FIRST_TRINKET_TYPE,
11
11
  LAST_VANILLA_TRINKET_TYPE,
12
12
  } from "../core/constantsFirstLast";
13
+ import { MysteriousPaperEffect } from "../enums/MysteriousPaperEffect";
13
14
  import {
14
15
  DEFAULT_TRINKET_DESCRIPTION,
15
16
  TRINKET_DESCRIPTION_MAP,
@@ -19,6 +20,7 @@ import {
19
20
  TRINKET_TYPE_TO_NAME_MAP,
20
21
  } from "../maps/trinketTypeToNameMap";
21
22
  import { getEntityID } from "./entities";
23
+ import { getEnumLength } from "./enums";
22
24
  import { hasFlag } from "./flag";
23
25
  import { isTrinket } from "./pickupVariants";
24
26
  import { isCharacter } from "./players";
@@ -35,6 +37,8 @@ import { iRange } from "./utils";
35
37
  */
36
38
  const GOLDEN_TRINKET_ADJUSTMENT = 32768;
37
39
 
40
+ const NUM_MYSTERIOUS_PAPER_EFFECTS = getEnumLength(MysteriousPaperEffect);
41
+
38
42
  const TRINKET_ANM2_PATH = "gfx/005.350_trinket.anm2";
39
43
  const TRINKET_SPRITE_LAYER = 0;
40
44
 
@@ -48,6 +52,41 @@ export function getGoldenTrinketType(trinketType: TrinketType): TrinketType {
48
52
  return asNumber(trinketType) + GOLDEN_TRINKET_ADJUSTMENT;
49
53
  }
50
54
 
55
+ /**
56
+ * Helper function to get the current effect that the Mysterious Paper trinket is providing to the
57
+ * player. Returns undefined if the player does not have the Mysterious Paper trinket.
58
+ *
59
+ * The Mysterious Paper trinket has four different effects:
60
+ *
61
+ * - The Polaroid (collectible)
62
+ * - The Negative (collectible)
63
+ * - A Missing Page (trinket)
64
+ * - Missing Poster (trinket)
65
+ *
66
+ * It rotates between these four effects on every frame. Note that Mysterious Paper will cause the
67
+ * `EntityPlayer.HasCollectible` and `EntityPlayer.HasTrinket` methods to return true for the
68
+ * respective items on the particular frame, with the exception of the Missing Poster. (The player
69
+ * will never "have" the Missing Poster, even on the correct corresponding frame.)
70
+ *
71
+ * @param player The player to look at.
72
+ * @param frameCount Optional. The frame count that corresponds to time the effect will be active.
73
+ * Default is the current frame.
74
+ */
75
+ export function getMysteriousPaperEffectForFrame(
76
+ player: EntityPlayer,
77
+ frameCount?: int,
78
+ ): MysteriousPaperEffect | undefined {
79
+ if (frameCount === undefined) {
80
+ frameCount = player.FrameCount;
81
+ }
82
+
83
+ if (!player.HasTrinket(TrinketType.MYSTERIOUS_PAPER)) {
84
+ return undefined;
85
+ }
86
+
87
+ return frameCount % NUM_MYSTERIOUS_PAPER_EFFECTS;
88
+ }
89
+
51
90
  /**
52
91
  * Returns the slot number corresponding to where a trinket can be safely inserted.
53
92
  *
package/src/index.ts CHANGED
@@ -11,6 +11,7 @@ export * from "./enums/HealthType";
11
11
  export * from "./enums/ISCFeature";
12
12
  export * from "./enums/LadderSubTypeCustom";
13
13
  export * from "./enums/ModCallbackCustom";
14
+ export * from "./enums/MysteriousPaperEffect";
14
15
  export * from "./enums/PocketItemType";
15
16
  export * from "./enums/RockAltType";
16
17
  export * from "./enums/SaveDataKey";