isaacscript-common 8.4.4 → 8.5.0

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.
Files changed (85) hide show
  1. package/dist/callbacks/postCursedTeleport.lua +4 -4
  2. package/dist/callbacks/postPlayerFatalDamage.lua +7 -7
  3. package/dist/callbacks/postSacrifice.lua +2 -2
  4. package/dist/callbacks/postTrinketBreak.lua +2 -2
  5. package/dist/callbacks/subscriptions/postPlayerFatalDamage.d.ts +2 -2
  6. package/dist/callbacks/subscriptions/postPlayerFatalDamage.d.ts.map +1 -1
  7. package/dist/callbacks/subscriptions/postPlayerFatalDamage.lua +4 -4
  8. package/dist/features/characterStats.d.ts.map +1 -1
  9. package/dist/features/characterStats.lua +1 -2
  10. package/dist/features/customGridEntity.d.ts.map +1 -1
  11. package/dist/features/customGridEntity.lua +3 -36
  12. package/dist/features/extraConsoleCommands/init.d.ts.map +1 -1
  13. package/dist/features/extraConsoleCommands/init.lua +1 -1
  14. package/dist/features/firstLast.d.ts +6 -3
  15. package/dist/features/firstLast.d.ts.map +1 -1
  16. package/dist/features/firstLast.lua +6 -3
  17. package/dist/functions/bosses.d.ts +5 -2
  18. package/dist/functions/bosses.d.ts.map +1 -1
  19. package/dist/functions/bosses.lua +11 -6
  20. package/dist/functions/collectibleCacheFlag.d.ts +1 -1
  21. package/dist/functions/collectibleCacheFlag.d.ts.map +1 -1
  22. package/dist/functions/collectibleCacheFlag.lua +1 -2
  23. package/dist/functions/collectibleSet.lua +32 -32
  24. package/dist/functions/collectibleTag.d.ts +1 -1
  25. package/dist/functions/collectibleTag.d.ts.map +1 -1
  26. package/dist/functions/collectibleTag.lua +1 -3
  27. package/dist/functions/eden.d.ts +1 -1
  28. package/dist/functions/eden.d.ts.map +1 -1
  29. package/dist/functions/eden.lua +1 -2
  30. package/dist/functions/flag.d.ts +1 -1
  31. package/dist/functions/flag.lua +1 -1
  32. package/dist/functions/flying.d.ts +1 -1
  33. package/dist/functions/flying.d.ts.map +1 -1
  34. package/dist/functions/flying.lua +5 -2
  35. package/dist/functions/input.d.ts +2 -2
  36. package/dist/functions/input.d.ts.map +1 -1
  37. package/dist/functions/input.lua +2 -4
  38. package/dist/functions/playerHealth.d.ts +93 -0
  39. package/dist/functions/playerHealth.d.ts.map +1 -1
  40. package/dist/functions/playerHealth.lua +216 -33
  41. package/dist/functions/players.d.ts +1 -111
  42. package/dist/functions/players.d.ts.map +1 -1
  43. package/dist/functions/players.lua +20 -279
  44. package/dist/functions/revive.d.ts +1 -1
  45. package/dist/functions/revive.d.ts.map +1 -1
  46. package/dist/functions/revive.lua +5 -4
  47. package/dist/functions/stats.d.ts +16 -0
  48. package/dist/functions/stats.d.ts.map +1 -1
  49. package/dist/functions/stats.lua +78 -0
  50. package/dist/functions/transformations.d.ts +1 -1
  51. package/dist/functions/transformations.d.ts.map +1 -1
  52. package/dist/functions/trinketCacheFlag.d.ts +1 -1
  53. package/dist/functions/trinketCacheFlag.d.ts.map +1 -1
  54. package/dist/functions/trinketCacheFlag.lua +1 -3
  55. package/dist/functions/trinketSet.lua +32 -32
  56. package/dist/index.d.ts +22 -33
  57. package/dist/sets/bossSets.d.ts +1 -0
  58. package/dist/sets/bossSets.d.ts.map +1 -1
  59. package/dist/sets/bossSets.lua +19 -0
  60. package/package.json +2 -2
  61. package/src/callbacks/postCursedTeleport.ts +7 -7
  62. package/src/callbacks/postPlayerFatalDamage.ts +9 -16
  63. package/src/callbacks/postSacrifice.ts +5 -5
  64. package/src/callbacks/postTrinketBreak.ts +5 -5
  65. package/src/callbacks/subscriptions/postPlayerFatalDamage.ts +9 -9
  66. package/src/features/characterStats.ts +1 -2
  67. package/src/features/customGridEntity.ts +0 -55
  68. package/src/features/extraConsoleCommands/init.ts +8 -1
  69. package/src/features/firstLast.ts +6 -3
  70. package/src/functions/bosses.ts +15 -6
  71. package/src/functions/collectibleCacheFlag.ts +3 -3
  72. package/src/functions/collectibleSet.ts +32 -32
  73. package/src/functions/collectibleTag.ts +2 -3
  74. package/src/functions/eden.ts +3 -3
  75. package/src/functions/flag.ts +1 -1
  76. package/src/functions/flying.ts +4 -4
  77. package/src/functions/input.ts +4 -5
  78. package/src/functions/playerHealth.ts +269 -7
  79. package/src/functions/players.ts +1 -348
  80. package/src/functions/revive.ts +6 -10
  81. package/src/functions/stats.ts +75 -0
  82. package/src/functions/transformations.ts +1 -1
  83. package/src/functions/trinketCacheFlag.ts +2 -3
  84. package/src/functions/trinketSet.ts +32 -32
  85. package/src/sets/bossSets.ts +24 -0
@@ -1,22 +1,5 @@
1
- import { ActiveSlot, CacheFlag, CollectibleType, PlayerType, TrinketType } from "isaac-typescript-definitions";
2
- import { HealthType } from "../enums/HealthType";
1
+ import { ActiveSlot, CollectibleType, PlayerType, TrinketType } from "isaac-typescript-definitions";
3
2
  export declare function addCollectibleCostume(player: EntityPlayer, collectibleType: CollectibleType): void;
4
- /**
5
- * Helper function to add a stat to a player based on the `CacheFlag` provided. Call this function
6
- * from the `EVALUATE_CACHE` callback.
7
- *
8
- * Note that for `CacheFlag.FIRE_DELAY`, the "amount" argument will be interpreted as the tear stat
9
- * to add (and not the amount to mutate `EntityPlayer.MaxFireDelay` by).
10
- *
11
- * This function supports the following cache flags:
12
- * - CacheFlag.DAMAGE (1 << 0)
13
- * - CacheFlag.FIRE_DELAY (1 << 1)
14
- * - CacheFlag.SHOT_SPEED (1 << 2)
15
- * - CacheFlag.RANGE (1 << 3)
16
- * - CacheFlag.SPEED (1 << 4)
17
- * - CacheFlag.LUCK (1 << 10)
18
- */
19
- export declare function addStat(player: EntityPlayer, cacheFlag: CacheFlag, amount: number): void;
20
3
  export declare function addTrinketCostume(player: EntityPlayer, trinketType: TrinketType): void;
21
4
  export declare function anyPlayerHasCollectible(collectibleType: CollectibleType): boolean;
22
5
  export declare function anyPlayerHasTrinket(trinketType: TrinketType): boolean;
@@ -37,33 +20,6 @@ export declare function anyPlayerIs(...matchingCharacters: PlayerType[]): boolea
37
20
  * - the player has Stompy (transformation 13)
38
21
  */
39
22
  export declare function canPlayerCrushRocks(player: EntityPlayer): boolean;
40
- /**
41
- * Returns whether or not all of the player's soul-heart-type hearts are black hearts.
42
- *
43
- * Note that this function does not consider red heart containers.
44
- *
45
- * For example:
46
- *
47
- * - If the player has one black heart, this function would return true.
48
- * - If the player has one soul heart and two black hearts, this function would return false.
49
- * - If the player has no black hearts, this function will return false.
50
- * - If the player has one red heart container and three black hearts, this function would return
51
- * true.
52
- */
53
- export declare function doesPlayerHaveAllBlackHearts(player: EntityPlayer): boolean;
54
- /**
55
- * Returns whether or not all of the player's soul-heart-type hearts are soul hearts.
56
- *
57
- * Note that this function does not consider red heart containers.
58
- *
59
- * For example:
60
- *
61
- * - If the player has two soul hearts and one black heart, this function would return false.
62
- * - If the player has no soul hearts, this function will return false.
63
- * - If the player has one red heart container and three soul hearts, this function would return
64
- * true.
65
- */
66
- export declare function doesPlayerHaveAllSoulHearts(player: EntityPlayer): boolean;
67
23
  /**
68
24
  * Helper function to find the active slot that the player has the corresponding collectible type
69
25
  * in. Returns undefined if the player does not have the collectible in any active slot.
@@ -95,20 +51,6 @@ export declare function getFinalPlayer(): EntityPlayer;
95
51
  * will be spawned on the same frame.
96
52
  */
97
53
  export declare function getNewestPlayer(): EntityPlayer;
98
- /**
99
- * Returns the number of slots that the player has remaining for new heart containers, accounting
100
- * for broken hearts. For example, if the player is Judas and has 1 red heart containers and 2 full
101
- * soul hearts and 3 broken hearts, then this function would return 6 (i.e. 12 - 1 - 2 - 3).
102
- */
103
- export declare function getPlayerAvailableHeartSlots(player: EntityPlayer): int;
104
- /**
105
- * Returns the number of black hearts that the player has, excluding any soul hearts. For example,
106
- * if the player has one full black heart, one full soul heart, and one half black heart, this
107
- * function returns 3.
108
- *
109
- * This is different from the `EntityPlayer.GetBlackHearts` method, since that returns a bitmask.
110
- */
111
- export declare function getPlayerBlackHearts(player: EntityPlayer): int;
112
54
  /**
113
55
  * Iterates over all players and checks if any are close enough to the specified position.
114
56
  *
@@ -129,27 +71,6 @@ export declare function getPlayerCollectibleCount(player: EntityPlayer, ...colle
129
71
  export declare function getPlayerCollectibleMap(player: EntityPlayer): Map<CollectibleType, int>;
130
72
  /** Helper function to get the player from a tear, laser, bomb, etc. */
131
73
  export declare function getPlayerFromTear(entity: Entity): EntityPlayer | undefined;
132
- /**
133
- * Returns the number of red hearts that the player has, excluding any rotten hearts. For example,
134
- * if the player has one full black heart, one full soul heart, and one half black heart, this
135
- * function returns 3.
136
- *
137
- * This is different from the `EntityPlayer.GetHearts` method, since that returns a value that
138
- * includes rotten hearts.
139
- */
140
- export declare function getPlayerHearts(player: EntityPlayer): int;
141
- /**
142
- * Helper function that returns the type of the rightmost heart. This does not including golden
143
- * hearts or broken hearts, since they cannot be damaged directly.
144
- */
145
- export declare function getPlayerLastHeart(player: EntityPlayer): HealthType;
146
- /**
147
- * Returns the maximum heart containers that the provided player can have. Normally, this is 12, but
148
- * it can change depending on the character (e.g. Keeper) and other things (e.g. Mother's Kiss).
149
- * This function does not account for Broken Hearts; use the `getPlayerAvailableHeartSlots` helper
150
- * function for that.
151
- */
152
- export declare function getPlayerMaxHeartContainers(player: EntityPlayer): int;
153
74
  /**
154
75
  * Helper function to get the proper name of the player. Use this instead of the
155
76
  * `EntityPlayer.GetName` method because it accounts for Blue Baby, Lazarus II, and Tainted
@@ -166,15 +87,6 @@ export declare function getPlayerName(player: EntityPlayer): string;
166
87
  * function would report that they have 2 hits remaining.)
167
88
  */
168
89
  export declare function getPlayerNumHitsRemaining(player: EntityPlayer): int;
169
- /**
170
- * Returns the number of soul hearts that the player has, excluding any black hearts. For example,
171
- * if the player has one full black heart, one full soul heart, and one half black heart, this
172
- * function returns 2.
173
- *
174
- * This is different from the `EntityPlayer.GetSoulHearts` method, since that returns the combined
175
- * number of soul hearts and black hearts.
176
- */
177
- export declare function getPlayerSoulHearts(player: EntityPlayer): int;
178
90
  /**
179
91
  * Helper function to get all of the players that are a certain character.
180
92
  *
@@ -196,17 +108,6 @@ export declare function getPlayersWithCollectible(...collectibleTypes: Collectib
196
108
  * for. It only returns the players that have all of the trinkets.
197
109
  */
198
110
  export declare function getPlayersWithTrinket(...trinketTypes: TrinketType[]): EntityPlayer[];
199
- /**
200
- * Helper function to determine how many heart containers that Tainted Magdalene has that will not
201
- * be automatically depleted over time. By default, this is 2, but this function will return 4 so
202
- * that it is consistent with the `player.GetHearts` and `player.GetMaxHearts` methods.
203
- *
204
- * If Tainted Magdalene has Birthright, she will gained an additional non-temporary heart container.
205
- *
206
- * This function does not validate whether or not the provided player is Tainted Magdalene; that
207
- * should be accomplished before invoking this function.
208
- */
209
- export declare function getTaintedMagdaleneNonTemporaryMaxHearts(player: EntityPlayer): int;
210
111
  /**
211
112
  * Returns the total number of collectibles amongst all players. For example, if player 1 has 1 Sad
212
113
  * Onion and player 2 has 2 Sad Onions, then this function would return 3.
@@ -340,15 +241,4 @@ export declare function setBlindfold(player: EntityPlayer, enabled: boolean, mod
340
241
  * any costumes.
341
242
  */
342
243
  export declare function useActiveItemTemp(player: EntityPlayer, collectibleType: CollectibleType): void;
343
- /**
344
- * Helper function to see if a certain damage amount would deal "permanent" damage to Tainted
345
- * Magdalene.
346
- *
347
- * Tainted Magdalene has "permanent" health and "temporary" health. When standing still and doing
348
- * nothing, all of Tainted Magdalene's temporary health will eventually go away.
349
- *
350
- * Before using this function, it is expected that you check to see if the player is Tainted
351
- * Magdalene first, or else it will give a nonsensical result.
352
- */
353
- export declare function wouldDamageTaintedMagdaleneNonTemporaryHeartContainers(player: EntityPlayer, damageAmount: float): boolean;
354
244
  //# sourceMappingURL=players.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"players.d.ts","sourceRoot":"","sources":["../../src/functions/players.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAET,eAAe,EAIf,UAAU,EAEV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA6BjD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,CAC1B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,aAAa,UAAO,GACnB,IAAI,CAsBN;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAEN;AAED;;;;;;;;;GASG;AACH,wBAAgB,sDAAsD,CACpE,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,KAAK,GAClB,OAAO,CAyBT"}
1
+ {"version":3,"file":"players.d.ts","sourceRoot":"","sources":["../../src/functions/players.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,eAAe,EAIf,UAAU,EAEV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAetC,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAON;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,WAAW,GACvB,IAAI,CAON;AAED,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAGT;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAGrE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,kBAAkB,EAAE,UAAU,EAAE,GAAG,OAAO,CAIxE;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CASjE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,UAAU,GAAG,SAAS,CAMxB;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,kBAAkB,EAAE,YAAY,GAAG,KAAK,GACvC,KAAK,CAMP;AAED,+FAA+F;AAC/F,wBAAgB,aAAa,IAAI,UAAU,EAAE,CAG5C;AAED,wBAAgB,gBAAgB,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eAAe,EAAE,GACrC,IAAI,CAIN;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,YAAY,EACpB,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,OAAO,CAIT;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAa/D;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAalE;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAON;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAIlE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,WAAW,GACvB,IAAI,CAON;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,EAChC,UAAU,EAAE,UAAU,EACtB,MAAM,CAAC,EAAE,GAAG,EACZ,WAAW,UAAQ,GAClB,IAAI,CA6DN;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,aAAa,UAAO,GACnB,IAAI,CAsBN;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAEN"}
@@ -1,7 +1,7 @@
1
1
  local ____lualib = require("lualib_bundle")
2
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
2
3
  local Set = ____lualib.Set
3
4
  local __TS__New = ____lualib.__TS__New
4
- local __TS__ArraySome = ____lualib.__TS__ArraySome
5
5
  local __TS__ArrayFind = ____lualib.__TS__ArrayFind
6
6
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
7
7
  local Map = ____lualib.Map
@@ -11,7 +11,6 @@ local ____exports = {}
11
11
  local isTaintedModded
12
12
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
13
13
  local ActiveSlot = ____isaac_2Dtypescript_2Ddefinitions.ActiveSlot
14
- local CacheFlag = ____isaac_2Dtypescript_2Ddefinitions.CacheFlag
15
14
  local Challenge = ____isaac_2Dtypescript_2Ddefinitions.Challenge
16
15
  local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
17
16
  local FamiliarVariant = ____isaac_2Dtypescript_2Ddefinitions.FamiliarVariant
@@ -23,17 +22,10 @@ local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
23
22
  local ____cachedClasses = require("core.cachedClasses")
24
23
  local game = ____cachedClasses.game
25
24
  local itemConfig = ____cachedClasses.itemConfig
26
- local ____HealthType = require("enums.HealthType")
27
- local HealthType = ____HealthType.HealthType
28
25
  local ____array = require("functions.array")
29
26
  local getLastElement = ____array.getLastElement
30
27
  local sumArray = ____array.sumArray
31
- local ____bitwise = require("functions.bitwise")
32
- local countSetBits = ____bitwise.countSetBits
33
- local getKBitOfN = ____bitwise.getKBitOfN
34
- local getNumBitsOfN = ____bitwise.getNumBitsOfN
35
28
  local ____characters = require("functions.characters")
36
- local getCharacterMaxHeartContainers = ____characters.getCharacterMaxHeartContainers
37
29
  local getCharacterName = ____characters.getCharacterName
38
30
  local isVanillaCharacter = ____characters.isVanillaCharacter
39
31
  local ____collectibles = require("functions.collectibles")
@@ -46,8 +38,6 @@ local ____playerIndex = require("functions.playerIndex")
46
38
  local getAllPlayers = ____playerIndex.getAllPlayers
47
39
  local getPlayerIndexVanilla = ____playerIndex.getPlayerIndexVanilla
48
40
  local getPlayers = ____playerIndex.getPlayers
49
- local ____tears = require("functions.tears")
50
- local addTearsStat = ____tears.addTearsStat
51
41
  local ____types = require("functions.types")
52
42
  local isNumber = ____types.isNumber
53
43
  local ____utils = require("functions.utils")
@@ -60,47 +50,6 @@ function ____exports.getCharacters(self)
60
50
  function(____, player) return player:GetPlayerType() end
61
51
  )
62
52
  end
63
- --- Returns the number of black hearts that the player has, excluding any soul hearts. For example,
64
- -- if the player has one full black heart, one full soul heart, and one half black heart, this
65
- -- function returns 3.
66
- --
67
- -- This is different from the `EntityPlayer.GetBlackHearts` method, since that returns a bitmask.
68
- function ____exports.getPlayerBlackHearts(self, player)
69
- local blackHeartsBitmask = player:GetBlackHearts()
70
- local blackHeartBits = countSetBits(nil, blackHeartsBitmask)
71
- return blackHeartBits * 2
72
- end
73
- --- Returns the maximum heart containers that the provided player can have. Normally, this is 12, but
74
- -- it can change depending on the character (e.g. Keeper) and other things (e.g. Mother's Kiss).
75
- -- This function does not account for Broken Hearts; use the `getPlayerAvailableHeartSlots` helper
76
- -- function for that.
77
- function ____exports.getPlayerMaxHeartContainers(self, player)
78
- local character = player:GetPlayerType()
79
- local characterMaxHeartContainers = getCharacterMaxHeartContainers(nil, character)
80
- if character == PlayerType.MAGDALENE and player:HasCollectible(CollectibleType.BIRTHRIGHT) then
81
- local extraMaxHeartContainersFromBirthright = 6
82
- return characterMaxHeartContainers + extraMaxHeartContainersFromBirthright
83
- end
84
- if ____exports.isKeeper(nil, player) then
85
- local numMothersKisses = player:GetTrinketMultiplier(TrinketType.MOTHERS_KISS)
86
- local hasGreedsGullet = player:HasCollectible(CollectibleType.GREEDS_GULLET)
87
- local coins = player:GetNumCoins()
88
- local greedsGulletCoinContainers = hasGreedsGullet and math.floor(coins / 25) or 0
89
- return characterMaxHeartContainers + numMothersKisses + greedsGulletCoinContainers
90
- end
91
- return characterMaxHeartContainers
92
- end
93
- --- Returns the number of soul hearts that the player has, excluding any black hearts. For example,
94
- -- if the player has one full black heart, one full soul heart, and one half black heart, this
95
- -- function returns 2.
96
- --
97
- -- This is different from the `EntityPlayer.GetSoulHearts` method, since that returns the combined
98
- -- number of soul hearts and black hearts.
99
- function ____exports.getPlayerSoulHearts(self, player)
100
- local soulHearts = player:GetSoulHearts()
101
- local blackHearts = ____exports.getPlayerBlackHearts(nil, player)
102
- return soulHearts - blackHearts
103
- end
104
53
  --- Helper function to check if a player is a specific character (i.e. `PlayerType`).
105
54
  --
106
55
  -- This function is variadic, meaning that you can supply as many characters as you want to check
@@ -111,12 +60,6 @@ function ____exports.isCharacter(self, player, ...)
111
60
  local character = player:GetPlayerType()
112
61
  return characterSet:has(character)
113
62
  end
114
- --- Helper function for detecting when a player is Keeper or Tainted Keeper. Useful for situations
115
- -- where you want to know if the health is coin hearts, for example.
116
- function ____exports.isKeeper(self, player)
117
- local character = player:GetPlayerType()
118
- return character == PlayerType.KEEPER or character == PlayerType.KEEPER_B
119
- end
120
63
  function ____exports.isModdedPlayer(self, player)
121
64
  return not ____exports.isVanillaPlayer(nil, player)
122
65
  end
@@ -130,14 +73,6 @@ function ____exports.isVanillaPlayer(self, player)
130
73
  local character = player:GetPlayerType()
131
74
  return isVanillaCharacter(nil, character)
132
75
  end
133
- local STAT_CACHE_FLAGS_SET = __TS__New(Set, {
134
- CacheFlag.DAMAGE,
135
- CacheFlag.FIRE_DELAY,
136
- CacheFlag.SHOT_SPEED,
137
- CacheFlag.RANGE,
138
- CacheFlag.SPEED,
139
- CacheFlag.LUCK
140
- })
141
76
  function ____exports.addCollectibleCostume(self, player, collectibleType)
142
77
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
143
78
  if itemConfigItem == nil then
@@ -145,69 +80,6 @@ function ____exports.addCollectibleCostume(self, player, collectibleType)
145
80
  end
146
81
  player:AddCostume(itemConfigItem, false)
147
82
  end
148
- --- Helper function to add a stat to a player based on the `CacheFlag` provided. Call this function
149
- -- from the `EVALUATE_CACHE` callback.
150
- --
151
- -- Note that for `CacheFlag.FIRE_DELAY`, the "amount" argument will be interpreted as the tear stat
152
- -- to add (and not the amount to mutate `EntityPlayer.MaxFireDelay` by).
153
- --
154
- -- This function supports the following cache flags:
155
- -- - CacheFlag.DAMAGE (1 << 0)
156
- -- - CacheFlag.FIRE_DELAY (1 << 1)
157
- -- - CacheFlag.SHOT_SPEED (1 << 2)
158
- -- - CacheFlag.RANGE (1 << 3)
159
- -- - CacheFlag.SPEED (1 << 4)
160
- -- - CacheFlag.LUCK (1 << 10)
161
- function ____exports.addStat(self, player, cacheFlag, amount)
162
- if not STAT_CACHE_FLAGS_SET:has(cacheFlag) then
163
- error("You cannot add a stat to a player with the cache flag of: " .. tostring(cacheFlag))
164
- end
165
- repeat
166
- local ____switch6 = cacheFlag
167
- local ____cond6 = ____switch6 == CacheFlag.DAMAGE
168
- if ____cond6 then
169
- do
170
- player.Damage = player.Damage + amount
171
- break
172
- end
173
- end
174
- ____cond6 = ____cond6 or ____switch6 == CacheFlag.FIRE_DELAY
175
- if ____cond6 then
176
- do
177
- addTearsStat(nil, player, amount)
178
- break
179
- end
180
- end
181
- ____cond6 = ____cond6 or ____switch6 == CacheFlag.SHOT_SPEED
182
- if ____cond6 then
183
- do
184
- player.ShotSpeed = player.ShotSpeed + amount
185
- break
186
- end
187
- end
188
- ____cond6 = ____cond6 or ____switch6 == CacheFlag.RANGE
189
- if ____cond6 then
190
- do
191
- player.TearHeight = player.TearHeight + amount
192
- break
193
- end
194
- end
195
- ____cond6 = ____cond6 or ____switch6 == CacheFlag.SPEED
196
- if ____cond6 then
197
- do
198
- player.MoveSpeed = player.MoveSpeed + amount
199
- break
200
- end
201
- end
202
- ____cond6 = ____cond6 or ____switch6 == CacheFlag.LUCK
203
- if ____cond6 then
204
- do
205
- player.Luck = player.Luck + amount
206
- break
207
- end
208
- end
209
- until true
210
- end
211
83
  function ____exports.addTrinketCostume(self, player, trinketType)
212
84
  local itemConfigTrinket = itemConfig:GetTrinket(trinketType)
213
85
  if itemConfigTrinket == nil then
@@ -253,37 +125,6 @@ function ____exports.canPlayerCrushRocks(self, player)
253
125
  local effects = player:GetEffects()
254
126
  return player:HasCollectible(CollectibleType.LEO) or player:HasCollectible(CollectibleType.THUNDER_THIGHS) or effects:HasCollectibleEffect(CollectibleType.MEGA_MUSH) or player:HasPlayerForm(PlayerForm.STOMPY)
255
127
  end
256
- --- Returns whether or not all of the player's soul-heart-type hearts are black hearts.
257
- --
258
- -- Note that this function does not consider red heart containers.
259
- --
260
- -- For example:
261
- --
262
- -- - If the player has one black heart, this function would return true.
263
- -- - If the player has one soul heart and two black hearts, this function would return false.
264
- -- - If the player has no black hearts, this function will return false.
265
- -- - If the player has one red heart container and three black hearts, this function would return
266
- -- true.
267
- function ____exports.doesPlayerHaveAllBlackHearts(self, player)
268
- local soulHearts = ____exports.getPlayerSoulHearts(nil, player)
269
- local blackHearts = ____exports.getPlayerBlackHearts(nil, player)
270
- return blackHearts > 0 and soulHearts == 0
271
- end
272
- --- Returns whether or not all of the player's soul-heart-type hearts are soul hearts.
273
- --
274
- -- Note that this function does not consider red heart containers.
275
- --
276
- -- For example:
277
- --
278
- -- - If the player has two soul hearts and one black heart, this function would return false.
279
- -- - If the player has no soul hearts, this function will return false.
280
- -- - If the player has one red heart container and three soul hearts, this function would return
281
- -- true.
282
- function ____exports.doesPlayerHaveAllSoulHearts(self, player)
283
- local soulHearts = ____exports.getPlayerSoulHearts(nil, player)
284
- local blackHearts = ____exports.getPlayerBlackHearts(nil, player)
285
- return soulHearts > 0 and blackHearts == 0
286
- end
287
128
  --- Helper function to find the active slot that the player has the corresponding collectible type
288
129
  -- in. Returns undefined if the player does not have the collectible in any active slot.
289
130
  function ____exports.getActiveItemSlot(self, player, collectibleType)
@@ -364,20 +205,6 @@ function ____exports.getNewestPlayer(self)
364
205
  end
365
206
  return newestPlayer
366
207
  end
367
- --- Returns the number of slots that the player has remaining for new heart containers, accounting
368
- -- for broken hearts. For example, if the player is Judas and has 1 red heart containers and 2 full
369
- -- soul hearts and 3 broken hearts, then this function would return 6 (i.e. 12 - 1 - 2 - 3).
370
- function ____exports.getPlayerAvailableHeartSlots(self, player)
371
- local maxHeartContainers = ____exports.getPlayerMaxHeartContainers(nil, player)
372
- local effectiveMaxHearts = player:GetEffectiveMaxHearts()
373
- local normalAndBoneHeartContainers = effectiveMaxHearts / 2
374
- local soulHearts = player:GetSoulHearts()
375
- local soulHeartContainers = math.ceil(soulHearts / 2)
376
- local totalHeartContainers = normalAndBoneHeartContainers + soulHeartContainers
377
- local brokenHearts = player:GetBrokenHearts()
378
- local totalOccupiedHeartSlots = totalHeartContainers + brokenHearts
379
- return maxHeartContainers - totalOccupiedHeartSlots
380
- end
381
208
  --- Iterates over all players and checks if any are close enough to the specified position.
382
209
  --
383
210
  -- @returns The first player found when iterating upwards from index 0.
@@ -437,60 +264,6 @@ function ____exports.getPlayerFromTear(self, entity)
437
264
  end
438
265
  return nil
439
266
  end
440
- --- Returns the number of red hearts that the player has, excluding any rotten hearts. For example,
441
- -- if the player has one full black heart, one full soul heart, and one half black heart, this
442
- -- function returns 3.
443
- --
444
- -- This is different from the `EntityPlayer.GetHearts` method, since that returns a value that
445
- -- includes rotten hearts.
446
- function ____exports.getPlayerHearts(self, player)
447
- local rottenHearts = player:GetRottenHearts()
448
- local hearts = player:GetHearts()
449
- return hearts - rottenHearts * 2
450
- end
451
- --- Helper function that returns the type of the rightmost heart. This does not including golden
452
- -- hearts or broken hearts, since they cannot be damaged directly.
453
- function ____exports.getPlayerLastHeart(self, player)
454
- local hearts = player:GetHearts()
455
- local effectiveMaxHearts = player:GetEffectiveMaxHearts()
456
- local soulHearts = player:GetSoulHearts()
457
- local blackHearts = player:GetBlackHearts()
458
- local eternalHearts = player:GetEternalHearts()
459
- local boneHearts = player:GetBoneHearts()
460
- local rottenHearts = player:GetRottenHearts()
461
- local soulHeartSlots = soulHearts / 2
462
- local lastHeartIndex = boneHearts + soulHeartSlots - 1
463
- local isLastHeartBone = player:IsBoneHeart(lastHeartIndex)
464
- if isLastHeartBone then
465
- local isLastContainerEmpty = hearts <= effectiveMaxHearts - 2
466
- if isLastContainerEmpty then
467
- return HealthType.BONE
468
- end
469
- if rottenHearts > 0 then
470
- return HealthType.ROTTEN
471
- end
472
- if eternalHearts > 0 then
473
- return HealthType.ETERNAL
474
- end
475
- return HealthType.RED
476
- end
477
- if soulHearts > 0 then
478
- local numBits = getNumBitsOfN(nil, blackHearts)
479
- local finalBit = getKBitOfN(nil, numBits - 1, blackHearts)
480
- local isBlack = finalBit == 1
481
- if isBlack then
482
- return HealthType.BLACK
483
- end
484
- return HealthType.SOUL
485
- end
486
- if eternalHearts > 0 then
487
- return HealthType.ETERNAL
488
- end
489
- if rottenHearts > 0 then
490
- return HealthType.ROTTEN
491
- end
492
- return HealthType.RED
493
- end
494
267
  --- Helper function to get the proper name of the player. Use this instead of the
495
268
  -- `EntityPlayer.GetName` method because it accounts for Blue Baby, Lazarus II, and Tainted
496
269
  -- characters.
@@ -559,20 +332,6 @@ function ____exports.getPlayersWithTrinket(self, ...)
559
332
  ) end
560
333
  )
561
334
  end
562
- --- Helper function to determine how many heart containers that Tainted Magdalene has that will not
563
- -- be automatically depleted over time. By default, this is 2, but this function will return 4 so
564
- -- that it is consistent with the `player.GetHearts` and `player.GetMaxHearts` methods.
565
- --
566
- -- If Tainted Magdalene has Birthright, she will gained an additional non-temporary heart container.
567
- --
568
- -- This function does not validate whether or not the provided player is Tainted Magdalene; that
569
- -- should be accomplished before invoking this function.
570
- function ____exports.getTaintedMagdaleneNonTemporaryMaxHearts(self, player)
571
- local maxHearts = player:GetMaxHearts()
572
- local hasBirthright = player:HasCollectible(CollectibleType.BIRTHRIGHT)
573
- local maxNonTemporaryMaxHearts = hasBirthright and 6 or 4
574
- return math.min(maxHearts, maxNonTemporaryMaxHearts)
575
- end
576
335
  --- Returns the total number of collectibles amongst all players. For example, if player 1 has 1 Sad
577
336
  -- Onion and player 2 has 2 Sad Onions, then this function would return 3.
578
337
  function ____exports.getTotalPlayerCollectibles(self, collectibleType)
@@ -641,6 +400,12 @@ function ____exports.isJacobOrEsau(self, player)
641
400
  local character = player:GetPlayerType()
642
401
  return character == PlayerType.JACOB or character == PlayerType.ESAU
643
402
  end
403
+ --- Helper function for detecting when a player is Keeper or Tainted Keeper. Useful for situations
404
+ -- where you want to know if the health is coin hearts, for example.
405
+ function ____exports.isKeeper(self, player)
406
+ local character = player:GetPlayerType()
407
+ return character == PlayerType.KEEPER or character == PlayerType.KEEPER_B
408
+ end
644
409
  --- Helper function for detecting when a player is The Lost or Tainted Lost.
645
410
  function ____exports.isLost(self, player)
646
411
  local character = player:GetPlayerType()
@@ -690,7 +455,7 @@ function ____exports.removeAllActiveItems(self, player)
690
455
  do
691
456
  local collectibleType = player:GetActiveItem(activeSlot)
692
457
  if collectibleType == CollectibleType.NULL then
693
- goto __continue114
458
+ goto __continue86
694
459
  end
695
460
  local hasCollectible
696
461
  repeat
@@ -700,7 +465,7 @@ function ____exports.removeAllActiveItems(self, player)
700
465
  end
701
466
  until not hasCollectible
702
467
  end
703
- ::__continue114::
468
+ ::__continue86::
704
469
  end
705
470
  end
706
471
  --- Helper function to remove all of the held trinkets from a player.
@@ -712,7 +477,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
712
477
  do
713
478
  local trinketType = player:GetTrinket(trinketSlot)
714
479
  if trinketType == TrinketType.NULL then
715
- goto __continue119
480
+ goto __continue91
716
481
  end
717
482
  local hasTrinket
718
483
  repeat
@@ -722,7 +487,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
722
487
  end
723
488
  until not hasTrinket
724
489
  end
725
- ::__continue119::
490
+ ::__continue91::
726
491
  end
727
492
  end
728
493
  --- Helper function to remove a collectible costume from a player. Use this helper function to avoid
@@ -785,9 +550,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
785
550
  itemPool:RemoveCollectible(collectibleType)
786
551
  end
787
552
  repeat
788
- local ____switch132 = activeSlot
789
- local ____cond132 = ____switch132 == ActiveSlot.PRIMARY
790
- if ____cond132 then
553
+ local ____switch104 = activeSlot
554
+ local ____cond104 = ____switch104 == ActiveSlot.PRIMARY
555
+ if ____cond104 then
791
556
  do
792
557
  if primaryCollectibleType ~= CollectibleType.NULL then
793
558
  player:RemoveCollectible(primaryCollectibleType)
@@ -796,8 +561,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
796
561
  break
797
562
  end
798
563
  end
799
- ____cond132 = ____cond132 or ____switch132 == ActiveSlot.SECONDARY
800
- if ____cond132 then
564
+ ____cond104 = ____cond104 or ____switch104 == ActiveSlot.SECONDARY
565
+ if ____cond104 then
801
566
  do
802
567
  if primaryCollectibleType ~= CollectibleType.NULL then
803
568
  player:RemoveCollectible(primaryCollectibleType)
@@ -812,16 +577,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
812
577
  break
813
578
  end
814
579
  end
815
- ____cond132 = ____cond132 or ____switch132 == ActiveSlot.POCKET
816
- if ____cond132 then
580
+ ____cond104 = ____cond104 or ____switch104 == ActiveSlot.POCKET
581
+ if ____cond104 then
817
582
  do
818
583
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
819
584
  player:SetActiveCharge(charge, activeSlot)
820
585
  break
821
586
  end
822
587
  end
823
- ____cond132 = ____cond132 or ____switch132 == ActiveSlot.POCKET_SINGLE_USE
824
- if ____cond132 then
588
+ ____cond104 = ____cond104 or ____switch104 == ActiveSlot.POCKET_SINGLE_USE
589
+ if ____cond104 then
825
590
  do
826
591
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
827
592
  break
@@ -870,28 +635,4 @@ function ____exports.useActiveItemTemp(self, player, collectibleType)
870
635
  -1
871
636
  )
872
637
  end
873
- --- Helper function to see if a certain damage amount would deal "permanent" damage to Tainted
874
- -- Magdalene.
875
- --
876
- -- Tainted Magdalene has "permanent" health and "temporary" health. When standing still and doing
877
- -- nothing, all of Tainted Magdalene's temporary health will eventually go away.
878
- --
879
- -- Before using this function, it is expected that you check to see if the player is Tainted
880
- -- Magdalene first, or else it will give a nonsensical result.
881
- function ____exports.wouldDamageTaintedMagdaleneNonTemporaryHeartContainers(self, player, damageAmount)
882
- local soulHearts = player:GetSoulHearts()
883
- if soulHearts > 0 then
884
- return false
885
- end
886
- local boneHearts = player:GetBoneHearts()
887
- if boneHearts > 0 then
888
- return false
889
- end
890
- local hearts = player:GetHearts()
891
- local rottenHearts = player:GetRottenHearts()
892
- local effectiveDamageAmount = damageAmount + math.min(rottenHearts, damageAmount)
893
- local heartsAfterDamage = hearts - effectiveDamageAmount
894
- local nonTemporaryMaxHearts = ____exports.getTaintedMagdaleneNonTemporaryMaxHearts(nil, player)
895
- return heartsAfterDamage < nonTemporaryMaxHearts
896
- end
897
638
  return ____exports
@@ -5,7 +5,7 @@
5
5
  * Uses the player's current health and other miscellaneous things to determine if incoming damage
6
6
  * will be fatal.
7
7
  */
8
- export declare function isDamageToPlayerFatal(player: EntityPlayer, damageAmount: int, damageSource: EntityRef, lastDamageGameFrame: int | undefined): boolean;
8
+ export declare function isDamageToPlayerFatal(player: EntityPlayer, amount: int, source: EntityRef, lastDamageGameFrame: int | undefined): boolean;
9
9
  /**
10
10
  * Assuming that we are on the frame of fatal damage, this function returns whether or not
11
11
  * Mysterious Paper would rotate to Missing Poster on the frame that the "Game Over" screen would
@@ -1 +1 @@
1
- {"version":3,"file":"revive.d.ts","sourceRoot":"","sources":["../../src/functions/revive.ts"],"names":[],"mappings":";;;AAsBA;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,GAAG,EACjB,YAAY,EAAE,SAAS,EACvB,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":";;;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"}
@@ -12,8 +12,9 @@ local MAX_TAINTED_SAMSON_BERSERK_CHARGE = ____constants.MAX_TAINTED_SAMSON_BERSE
12
12
  local TAINTED_SAMSON_BERSERK_CHARGE_FROM_TAKING_DAMAGE = ____constants.TAINTED_SAMSON_BERSERK_CHARGE_FROM_TAKING_DAMAGE
13
13
  local ____characters = require("functions.characters")
14
14
  local getCharacterDeathAnimationName = ____characters.getCharacterDeathAnimationName
15
+ local ____playerHealth = require("functions.playerHealth")
16
+ local getPlayerMaxHeartContainers = ____playerHealth.getPlayerMaxHeartContainers
15
17
  local ____players = require("functions.players")
16
- local getPlayerMaxHeartContainers = ____players.getPlayerMaxHeartContainers
17
18
  local getPlayerNumHitsRemaining = ____players.getPlayerNumHitsRemaining
18
19
  local hasLostCurse = ____players.hasLostCurse
19
20
  local isKeeper = ____players.isKeeper
@@ -48,12 +49,12 @@ function ____exports.willReviveFromSpiritShackles(self, player)
48
49
  end
49
50
  --- Uses the player's current health and other miscellaneous things to determine if incoming damage
50
51
  -- will be fatal.
51
- function ____exports.isDamageToPlayerFatal(self, player, damageAmount, damageSource, lastDamageGameFrame)
52
+ function ____exports.isDamageToPlayerFatal(self, player, amount, source, lastDamageGameFrame)
52
53
  local gameFrameCount = game:GetFrameCount()
53
54
  local character = player:GetPlayerType()
54
55
  local effects = player:GetEffects()
55
56
  local isBerserk = effects:HasCollectibleEffect(CollectibleType.BERSERK)
56
- if character == PlayerType.JACOB_B and damageSource.Type == EntityType.DARK_ESAU then
57
+ if character == PlayerType.JACOB_B and source.Type == EntityType.DARK_ESAU then
57
58
  return false
58
59
  end
59
60
  if isBerserk then
@@ -73,7 +74,7 @@ function ____exports.isDamageToPlayerFatal(self, player, damageAmount, damageSou
73
74
  return true
74
75
  end
75
76
  local playerNumAllHearts = getPlayerNumHitsRemaining(nil, player)
76
- if damageAmount < playerNumAllHearts then
77
+ if amount < playerNumAllHearts then
77
78
  return false
78
79
  end
79
80
  if ____exports.willReviveFromHeartbreak(nil, player) then