isaacscript-common 1.2.137 → 1.2.140

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 (81) hide show
  1. package/dist/callbacks/postPlayerChangeHealth.lua +4 -64
  2. package/dist/constants.d.ts +2 -0
  3. package/dist/features/deployJSONRoom.lua +11 -22
  4. package/dist/features/disableInputs.lua +6 -20
  5. package/dist/features/disableSound.lua +4 -12
  6. package/dist/features/extraConsoleCommands/commands.d.ts +185 -13
  7. package/dist/features/extraConsoleCommands/commands.lua +491 -77
  8. package/dist/features/extraConsoleCommands/init.lua +72 -9
  9. package/dist/features/extraConsoleCommands/v.d.ts +5 -1
  10. package/dist/features/extraConsoleCommands/v.lua +7 -1
  11. package/dist/features/forgottenSwitch.lua +3 -8
  12. package/dist/features/getCollectibleItemPoolType.lua +4 -9
  13. package/dist/features/isPonyActive.lua +3 -8
  14. package/dist/features/preventCollectibleRotate.lua +3 -8
  15. package/dist/features/runInNFrames.lua +6 -20
  16. package/dist/features/saveDataManager/constants.d.ts +3 -0
  17. package/dist/features/saveDataManager/constants.lua +5 -0
  18. package/dist/features/saveDataManager/exports.lua +9 -18
  19. package/dist/features/saveDataManager/load.lua +4 -3
  20. package/dist/features/saveDataManager/main.lua +4 -10
  21. package/dist/features/saveDataManager/merge.lua +2 -2
  22. package/dist/features/saveDataManager/save.lua +3 -1
  23. package/dist/features/sirenHelpers.lua +4 -8
  24. package/dist/featuresInitialized.d.ts +1 -1
  25. package/dist/featuresInitialized.lua +5 -0
  26. package/dist/functions/cards.lua +12 -18
  27. package/dist/functions/challenges.lua +3 -2
  28. package/dist/functions/collectibles.lua +8 -14
  29. package/dist/functions/deepCopy.lua +2 -2
  30. package/dist/functions/log.lua +3 -0
  31. package/dist/functions/map.d.ts +4 -1
  32. package/dist/functions/map.lua +5 -1
  33. package/dist/functions/pills.lua +10 -15
  34. package/dist/functions/player.d.ts +4 -2
  35. package/dist/functions/player.lua +37 -81
  36. package/dist/functions/playerHealth.d.ts +3 -0
  37. package/dist/functions/playerHealth.lua +142 -0
  38. package/dist/functions/rooms.lua +4 -5
  39. package/dist/functions/transformations.lua +3 -3
  40. package/dist/functions/trinkets.lua +8 -14
  41. package/dist/index.d.ts +2 -0
  42. package/dist/index.lua +16 -0
  43. package/dist/maps/cardDescriptionMap.d.ts +4 -1
  44. package/dist/maps/cardDescriptionMap.lua +103 -102
  45. package/dist/maps/cardNameMap.d.ts +4 -1
  46. package/dist/maps/cardNameMap.lua +103 -102
  47. package/dist/maps/cardTypeMap.d.ts +3 -1
  48. package/dist/maps/cardTypeMap.lua +102 -102
  49. package/dist/maps/challengeNameMap.d.ts +4 -1
  50. package/dist/maps/challengeNameMap.lua +50 -50
  51. package/dist/maps/characterNameMap.d.ts +5 -0
  52. package/dist/maps/characterNameMap.lua +49 -0
  53. package/dist/maps/collectibleDescriptionMap.d.ts +1 -0
  54. package/dist/maps/collectibleDescriptionMap.lua +1 -0
  55. package/dist/maps/collectibleNameMap.d.ts +1 -0
  56. package/dist/maps/collectibleNameMap.lua +1 -0
  57. package/dist/maps/pillEffectClassMap.d.ts +4 -1
  58. package/dist/maps/pillEffectClassMap.lua +56 -55
  59. package/dist/maps/pillEffectNameMap.d.ts +4 -1
  60. package/dist/maps/pillEffectNameMap.lua +55 -55
  61. package/dist/maps/pillEffectTypeMap.d.ts +4 -1
  62. package/dist/maps/pillEffectTypeMap.lua +55 -55
  63. package/dist/maps/roomTypeMap.d.ts +3 -0
  64. package/dist/maps/roomTypeMap.lua +43 -0
  65. package/dist/maps/roomTypeNameMap.d.ts +5 -0
  66. package/dist/maps/roomTypeNameMap.lua +37 -0
  67. package/dist/maps/transformationNameMap.d.ts +4 -1
  68. package/dist/maps/transformationNameMap.lua +19 -20
  69. package/dist/maps/trinketDescriptionMap.d.ts +1 -0
  70. package/dist/maps/trinketDescriptionMap.lua +1 -0
  71. package/dist/maps/trinketNameMap.d.ts +1 -0
  72. package/dist/maps/trinketNameMap.lua +1 -0
  73. package/dist/types/CardType.d.ts +10 -8
  74. package/dist/types/CardType.lua +9 -7
  75. package/dist/types/HealthType.d.ts +4 -2
  76. package/dist/types/HealthType.lua +3 -1
  77. package/dist/types/PillEffectClass.d.ts +11 -5
  78. package/dist/types/PillEffectClass.lua +8 -5
  79. package/dist/types/PillEffectType.d.ts +10 -4
  80. package/dist/types/PillEffectType.lua +7 -4
  81. package/package.json +1 -1
@@ -10,8 +10,10 @@ local ____cachedClasses = require("cachedClasses")
10
10
  local itemConfig = ____cachedClasses.itemConfig
11
11
  local ____cardDescriptionMap = require("maps.cardDescriptionMap")
12
12
  local CARD_DESCRIPTION_MAP = ____cardDescriptionMap.CARD_DESCRIPTION_MAP
13
+ local DEFAULT_CARD_DESCRIPTION = ____cardDescriptionMap.DEFAULT_CARD_DESCRIPTION
13
14
  local ____cardNameMap = require("maps.cardNameMap")
14
15
  local CARD_NAME_MAP = ____cardNameMap.CARD_NAME_MAP
16
+ local DEFAULT_CARD_NAME = ____cardNameMap.DEFAULT_CARD_NAME
15
17
  local ____cardTypeMap = require("maps.cardTypeMap")
16
18
  local CARD_TYPE_MAP = ____cardTypeMap.CARD_TYPE_MAP
17
19
  local DEFAULT_CARD_TYPE = ____cardTypeMap.DEFAULT_CARD_TYPE
@@ -67,7 +69,7 @@ function ____exports.getCardsOfType(self, ...)
67
69
  return matchingCards
68
70
  end
69
71
  function ____exports.getCardType(self, card)
70
- local cardType = CARD_TYPE_MAP:get(card)
72
+ local cardType = CARD_TYPE_MAP[card]
71
73
  return cardType == nil and DEFAULT_CARD_TYPE or cardType
72
74
  end
73
75
  function ____exports.getMaxCards(self)
@@ -76,34 +78,26 @@ end
76
78
  CARD_TYPE_TO_CARDS_MAP = __TS__New(Map)
77
79
  CARD_SET = __TS__New(Set)
78
80
  function ____exports.getCardDescription(self, card)
79
- local defaultDescription = "Unknown"
80
- if type(card) ~= "number" then
81
- return defaultDescription
82
- end
83
- local cardDescription = CARD_DESCRIPTION_MAP:get(card)
81
+ local cardDescription = CARD_DESCRIPTION_MAP[card]
84
82
  if cardDescription ~= nil then
85
83
  return cardDescription
86
84
  end
87
85
  local itemConfigCard = itemConfig:GetCard(card)
88
- if itemConfigCard == nil then
89
- return defaultDescription
86
+ if itemConfigCard ~= nil then
87
+ return itemConfigCard.Description
90
88
  end
91
- return itemConfigCard.Description
89
+ return DEFAULT_CARD_DESCRIPTION
92
90
  end
93
91
  function ____exports.getCardName(self, card)
94
- local defaultName = "Unknown"
95
- if type(card) ~= "number" then
96
- return defaultName
97
- end
98
- local cardName = CARD_NAME_MAP:get(card)
99
- if cardName ~= nil then
92
+ local cardName = CARD_NAME_MAP[card]
93
+ if cardName ~= nil and cardName ~= DEFAULT_CARD_NAME then
100
94
  return cardName
101
95
  end
102
96
  local itemConfigCard = itemConfig:GetCard(card)
103
- if itemConfigCard == nil then
104
- return defaultName
97
+ if itemConfigCard ~= nil then
98
+ return itemConfigCard.Name
105
99
  end
106
- return itemConfigCard.Name
100
+ return DEFAULT_CARD_NAME
107
101
  end
108
102
  function ____exports.getRandomCard(self, seed, exceptions)
109
103
  if seed == nil then
@@ -2,8 +2,9 @@
2
2
  local ____exports = {}
3
3
  local ____challengeNameMap = require("maps.challengeNameMap")
4
4
  local CHALLENGE_NAME_MAP = ____challengeNameMap.CHALLENGE_NAME_MAP
5
+ local DEFAULT_CHALLENGE_NAME = ____challengeNameMap.DEFAULT_CHALLENGE_NAME
5
6
  function ____exports.getChallengeName(self, challenge)
6
- local challengeName = CHALLENGE_NAME_MAP:get(challenge)
7
- return challengeName == nil and "Unknown" or challengeName
7
+ local challengeName = CHALLENGE_NAME_MAP[challenge]
8
+ return challengeName == nil and DEFAULT_CHALLENGE_NAME or challengeName
8
9
  end
9
10
  return ____exports
@@ -8,8 +8,10 @@ local BLIND_ITEM_PNG_PATH = ____constants.BLIND_ITEM_PNG_PATH
8
8
  local SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES = ____constants.SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES
9
9
  local ____collectibleDescriptionMap = require("maps.collectibleDescriptionMap")
10
10
  local COLLECTIBLE_DESCRIPTION_MAP = ____collectibleDescriptionMap.COLLECTIBLE_DESCRIPTION_MAP
11
+ local DEFAULT_COLLECTIBLE_DESCRIPTION = ____collectibleDescriptionMap.DEFAULT_COLLECTIBLE_DESCRIPTION
11
12
  local ____collectibleNameMap = require("maps.collectibleNameMap")
12
13
  local COLLECTIBLE_NAME_MAP = ____collectibleNameMap.COLLECTIBLE_NAME_MAP
14
+ local DEFAULT_COLLECTIBLE_NAME = ____collectibleNameMap.DEFAULT_COLLECTIBLE_NAME
13
15
  local ____flag = require("functions.flag")
14
16
  local hasFlag = ____flag.hasFlag
15
17
  local ____pickups = require("functions.pickups")
@@ -50,19 +52,15 @@ function ____exports.collectibleHasCacheFlag(self, collectibleType, cacheFlag)
50
52
  return hasFlag(nil, itemConfigItem.CacheFlags, cacheFlag)
51
53
  end
52
54
  function ____exports.getCollectibleDescription(self, collectibleType)
53
- local defaultDescription = "Unknown"
54
- if type(collectibleType) ~= "number" then
55
- return defaultDescription
56
- end
57
55
  local collectibleDescription = COLLECTIBLE_DESCRIPTION_MAP:get(collectibleType)
58
56
  if collectibleDescription ~= nil then
59
57
  return collectibleDescription
60
58
  end
61
59
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
62
- if itemConfigItem == nil then
63
- return defaultDescription
60
+ if itemConfigItem ~= nil then
61
+ return itemConfigItem.Description
64
62
  end
65
- return itemConfigItem.Description
63
+ return DEFAULT_COLLECTIBLE_DESCRIPTION
66
64
  end
67
65
  function ____exports.getCollectibleDevilHeartPrice(self, collectibleType, player)
68
66
  local maxHearts = player:GetMaxHearts()
@@ -116,19 +114,15 @@ function ____exports.getCollectibleMaxCharges(self, collectibleType)
116
114
  return itemConfigItem.MaxCharges
117
115
  end
118
116
  function ____exports.getCollectibleName(self, collectibleType)
119
- local defaultName = "Unknown"
120
- if type(collectibleType) ~= "number" then
121
- return defaultName
122
- end
123
117
  local collectibleName = COLLECTIBLE_NAME_MAP:get(collectibleType)
124
118
  if collectibleName ~= nil then
125
119
  return collectibleName
126
120
  end
127
121
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
128
- if itemConfigItem == nil then
129
- return defaultName
122
+ if itemConfigItem ~= nil then
123
+ return itemConfigItem.Name
130
124
  end
131
- return itemConfigItem.Name
125
+ return DEFAULT_COLLECTIBLE_NAME
132
126
  end
133
127
  function ____exports.getCollectiblePedestalType(self, collectible)
134
128
  if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
@@ -7,8 +7,8 @@ local __TS__InstanceOf = ____lualib.__TS__InstanceOf
7
7
  local __TS__Iterator = ____lualib.__TS__Iterator
8
8
  local ____exports = {}
9
9
  local isTSTLClass, copyClass, getNewClassFromMetatable, deepCopyValue, copyVector, checkMetatable, validateValue, TSTL_CLASS_KEYS
10
- local ____debug = require("features.saveDataManager.debug")
11
- local SAVE_DATA_MANAGER_DEBUG = ____debug.SAVE_DATA_MANAGER_DEBUG
10
+ local ____constants = require("features.saveDataManager.constants")
11
+ local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
12
12
  local ____DefaultMap = require("types.DefaultMap")
13
13
  local DefaultMap = ____DefaultMap.DefaultMap
14
14
  local ____SerializationBrand = require("types.private.SerializationBrand")
@@ -207,6 +207,7 @@ function ____exports.logEntities(includeBackgroundEffects, entityTypeFilter)
207
207
  debugString = debugString .. (" (DropSeed: " .. tostring(entity.DropSeed)) .. ")"
208
208
  debugString = debugString .. (((" (Position: " .. tostring(entity.Position.X)) .. ", ") .. tostring(entity.Position.Y)) .. ")"
209
209
  debugString = debugString .. (((" (Velocity: " .. tostring(entity.Velocity.X)) .. ", ") .. tostring(entity.Velocity.Y)) .. ")"
210
+ debugString = debugString .. (((" (HP: " .. tostring(entity.HitPoints)) .. " / ") .. tostring(entity.MaxHitPoints)) .. ")"
210
211
  ____exports.log(debugString)
211
212
  numMatchedEntities = numMatchedEntities + 1
212
213
  end
@@ -315,7 +316,9 @@ function ____exports.logRoom()
315
316
  if roomData == nil then
316
317
  ____exports.log("Current room data is undefined.")
317
318
  else
319
+ ____exports.log("Current room stage ID: " .. tostring(roomData.StageID))
318
320
  ____exports.log((((("Current room type/variant/sub-type: " .. tostring(roomData.Type)) .. ".") .. tostring(roomData.Variant)) .. ".") .. tostring(roomData.Subtype))
321
+ ____exports.log("Current room name: " .. roomData.Name)
319
322
  end
320
323
  ____exports.log("Current room grid index: " .. tostring(roomGridIndex))
321
324
  ____exports.log("Current room list index: " .. tostring(roomListIndex))
@@ -20,9 +20,12 @@ export declare function defaultMapGetNextSeed<K, A extends unknown[]>(map: Defau
20
20
  * ]);
21
21
  * const searchText = "f";
22
22
  * const match = getMapPartialMatch(map, searchText); // match is now equal to 123
23
+ *
24
+ * @returns If a match was found, returns a tuple of the map key and value. If a match was not
25
+ * found, returns undefined.
23
26
  * ```
24
27
  */
25
- export declare function getMapPartialMatch<T>(searchText: string, map: ReadonlyMap<string, T>): T | undefined;
28
+ export declare function getMapPartialMatch<T>(searchText: string, map: ReadonlyMap<string, T>): [string, T] | undefined;
26
29
  /**
27
30
  * Helper function to make using maps with `Seed` values easier. Use this instead of manually
28
31
  * getting the current value, incrementing it, and then setting it.
@@ -46,7 +46,11 @@ function ____exports.getMapPartialMatch(self, searchText, map)
46
46
  if matchingKey == nil then
47
47
  return nil
48
48
  end
49
- return map:get(matchingKey)
49
+ local value = map:get(matchingKey)
50
+ if value == nil then
51
+ return nil
52
+ end
53
+ return {matchingKey, value}
50
54
  end
51
55
  function ____exports.mapGetNextSeed(self, map, key)
52
56
  local seed = map:get(key)
@@ -3,39 +3,34 @@ local ____exports = {}
3
3
  local ____cachedClasses = require("cachedClasses")
4
4
  local itemConfig = ____cachedClasses.itemConfig
5
5
  local ____pillEffectClassMap = require("maps.pillEffectClassMap")
6
+ local DEFAULT_PILL_EFFECT_CLASS = ____pillEffectClassMap.DEFAULT_PILL_EFFECT_CLASS
6
7
  local PILL_EFFECT_CLASS_MAP = ____pillEffectClassMap.PILL_EFFECT_CLASS_MAP
7
8
  local ____pillEffectNameMap = require("maps.pillEffectNameMap")
9
+ local DEFAULT_PILL_EFFECT_NAME = ____pillEffectNameMap.DEFAULT_PILL_EFFECT_NAME
8
10
  local PILL_EFFECT_NAME_MAP = ____pillEffectNameMap.PILL_EFFECT_NAME_MAP
9
11
  local ____pillEffectTypeMap = require("maps.pillEffectTypeMap")
12
+ local DEFAULT_PILL_EFFECT_TYPE = ____pillEffectTypeMap.DEFAULT_PILL_EFFECT_TYPE
10
13
  local PILL_EFFECT_TYPE_MAP = ____pillEffectTypeMap.PILL_EFFECT_TYPE_MAP
11
- local ____PillEffectClass = require("types.PillEffectClass")
12
- local DEFAULT_PILL_EFFECT_CLASS = ____PillEffectClass.DEFAULT_PILL_EFFECT_CLASS
13
- local ____PillEffectType = require("types.PillEffectType")
14
- local DEFAULT_PILL_EFFECT_TYPE = ____PillEffectType.DEFAULT_PILL_EFFECT_TYPE
15
14
  function ____exports.getMaxPillEffects(self)
16
15
  return itemConfig:GetPillEffects().Size - 1
17
16
  end
18
17
  function ____exports.getPillEffectClass(self, pillEffect)
19
- local pillEffectClass = PILL_EFFECT_CLASS_MAP:get(pillEffect)
18
+ local pillEffectClass = PILL_EFFECT_CLASS_MAP[pillEffect]
20
19
  return pillEffectClass == nil and DEFAULT_PILL_EFFECT_CLASS or pillEffectClass
21
20
  end
22
21
  function ____exports.getPillEffectName(self, pillEffect)
23
- local defaultName = "Unknown"
24
- if type(pillEffect) ~= "number" then
25
- return defaultName
26
- end
27
- local pillEffectName = PILL_EFFECT_NAME_MAP:get(pillEffect)
28
- if pillEffectName ~= nil then
22
+ local pillEffectName = PILL_EFFECT_NAME_MAP[pillEffect]
23
+ if pillEffectName ~= nil and pillEffectName ~= DEFAULT_PILL_EFFECT_NAME then
29
24
  return pillEffectName
30
25
  end
31
26
  local itemConfigPillEffect = itemConfig:GetPillEffect(pillEffect)
32
- if itemConfigPillEffect == nil then
33
- return defaultName
27
+ if itemConfigPillEffect ~= nil then
28
+ return itemConfigPillEffect.Name
34
29
  end
35
- return itemConfigPillEffect.Name
30
+ return DEFAULT_PILL_EFFECT_NAME
36
31
  end
37
32
  function ____exports.getPillEffectType(self, pillEffect)
38
- local pillEffectClass = PILL_EFFECT_TYPE_MAP:get(pillEffect)
33
+ local pillEffectClass = PILL_EFFECT_TYPE_MAP[pillEffect]
39
34
  return pillEffectClass == nil and DEFAULT_PILL_EFFECT_TYPE or pillEffectClass
40
35
  end
41
36
  return ____exports
@@ -72,6 +72,8 @@ export declare function getBlackHearts(player: EntityPlayer): int;
72
72
  * Mother's Kiss; use the `getPlayerMaxHeartContainers` helper function for that.
73
73
  */
74
74
  export declare function getCharacterMaxHeartContainers(character: PlayerType | int): int;
75
+ /** Helper function to get the name of a character. Returns "unknown" for modded characters. */
76
+ export declare function getCharacterName(character: PlayerType | int): string;
75
77
  /** Helper function to get an array containing the characters of all of the current players. */
76
78
  export declare function getCharacters(): PlayerType[];
77
79
  export declare function getClosestPlayer(position: Vector): EntityPlayer;
@@ -101,8 +103,8 @@ export declare function getFinalPlayer(): EntityPlayer;
101
103
  */
102
104
  export declare function getHearts(player: EntityPlayer): int;
103
105
  /**
104
- * Helper function that returns the type of the rightmost heart, not including golden hearts since
105
- * they can't be damaged directly.
106
+ * Helper function that returns the type of the rightmost heart. This does not including golden
107
+ * hearts or broken hearts, since they cannot be damaged directly.
106
108
  */
107
109
  export declare function getLastHeart(player: EntityPlayer): HealthType;
108
110
  /**
@@ -11,7 +11,7 @@ local __TS__Iterator = ____lualib.__TS__Iterator
11
11
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
12
12
  local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
13
13
  local ____exports = {}
14
- local getPlayerIndexCollectibleType, getAdjustedPlayerName, isTaintedModded, DEFAULT_COLLECTIBLE_TYPE, EXCLUDED_CHARACTERS
14
+ local getPlayerIndexCollectibleType, isTaintedModded, DEFAULT_COLLECTIBLE_TYPE, EXCLUDED_CHARACTERS
15
15
  local ____cachedClasses = require("cachedClasses")
16
16
  local game = ____cachedClasses.game
17
17
  local itemConfig = ____cachedClasses.itemConfig
@@ -22,6 +22,9 @@ local CHARACTERS_WITH_NO_RED_HEARTS = ____constants.CHARACTERS_WITH_NO_RED_HEART
22
22
  local CHARACTERS_WITH_NO_SOUL_HEARTS = ____constants.CHARACTERS_WITH_NO_SOUL_HEARTS
23
23
  local LOST_STYLE_PLAYER_TYPES = ____constants.LOST_STYLE_PLAYER_TYPES
24
24
  local MAX_VANILLA_CHARACTER = ____constants.MAX_VANILLA_CHARACTER
25
+ local ____characterNameMap = require("maps.characterNameMap")
26
+ local CHARACTER_NAME_MAP = ____characterNameMap.CHARACTER_NAME_MAP
27
+ local DEFAULT_CHARACTER_NAME = ____characterNameMap.DEFAULT_CHARACTER_NAME
25
28
  local ____HealthType = require("types.HealthType")
26
29
  local HealthType = ____HealthType.HealthType
27
30
  local ____array = require("functions.array")
@@ -35,9 +38,6 @@ local ____collectibles = require("functions.collectibles")
35
38
  local getCollectibleMaxCharges = ____collectibles.getCollectibleMaxCharges
36
39
  local ____collectibleSet = require("functions.collectibleSet")
37
40
  local getCollectibleSet = ____collectibleSet.getCollectibleSet
38
- local ____string = require("functions.string")
39
- local stringContains = ____string.stringContains
40
- local trimPrefix = ____string.trimPrefix
41
41
  local ____utils = require("functions.utils")
42
42
  local ensureAllCases = ____utils.ensureAllCases
43
43
  local ____repeat = ____utils["repeat"]
@@ -100,15 +100,15 @@ end
100
100
  function getPlayerIndexCollectibleType(self, player, differentiateForgottenAndSoul)
101
101
  local character = player:GetPlayerType()
102
102
  repeat
103
- local ____switch69 = character
104
- local ____cond69 = ____switch69 == PlayerType.PLAYER_THESOUL
105
- if ____cond69 then
103
+ local ____switch71 = character
104
+ local ____cond71 = ____switch71 == PlayerType.PLAYER_THESOUL
105
+ if ____cond71 then
106
106
  do
107
107
  return differentiateForgottenAndSoul and CollectibleType.COLLECTIBLE_SPOON_BENDER or DEFAULT_COLLECTIBLE_TYPE
108
108
  end
109
109
  end
110
- ____cond69 = ____cond69 or ____switch69 == PlayerType.PLAYER_LAZARUS2_B
111
- if ____cond69 then
110
+ ____cond71 = ____cond71 or ____switch71 == PlayerType.PLAYER_LAZARUS2_B
111
+ if ____cond71 then
112
112
  do
113
113
  return CollectibleType.COLLECTIBLE_INNER_EYE
114
114
  end
@@ -136,53 +136,6 @@ function ____exports.getPlayerMaxHeartContainers(self, player)
136
136
  end
137
137
  return characterMaxHeartContainers
138
138
  end
139
- function getAdjustedPlayerName(self, player)
140
- local character = player:GetPlayerType()
141
- repeat
142
- local ____switch82 = character
143
- local ____cond82 = ____switch82 == PlayerType.PLAYER_BLUEBABY or ____switch82 == PlayerType.PLAYER_BLUEBABY_B
144
- if ____cond82 then
145
- do
146
- return "Blue Baby"
147
- end
148
- end
149
- ____cond82 = ____cond82 or ____switch82 == PlayerType.PLAYER_LAZARUS2
150
- if ____cond82 then
151
- do
152
- return "Lazarus II"
153
- end
154
- end
155
- ____cond82 = ____cond82 or ____switch82 == PlayerType.PLAYER_BLACKJUDAS
156
- if ____cond82 then
157
- do
158
- return "Dark Judas"
159
- end
160
- end
161
- ____cond82 = ____cond82 or ____switch82 == PlayerType.PLAYER_JACOB
162
- if ____cond82 then
163
- do
164
- return "Jacob & Esau"
165
- end
166
- end
167
- ____cond82 = ____cond82 or ____switch82 == PlayerType.PLAYER_LAZARUS2_B
168
- if ____cond82 then
169
- do
170
- return "Dead Tainted Lazarus"
171
- end
172
- end
173
- ____cond82 = ____cond82 or ____switch82 == PlayerType.PLAYER_JACOB2_B
174
- if ____cond82 then
175
- do
176
- return "Dead Tainted Jacob"
177
- end
178
- end
179
- do
180
- do
181
- return player:GetName()
182
- end
183
- end
184
- until true
185
- end
186
139
  function ____exports.getPlayers(self, performCharacterExclusions)
187
140
  if performCharacterExclusions == nil then
188
141
  performCharacterExclusions = false
@@ -223,16 +176,6 @@ function ____exports.isKeeper(self, player)
223
176
  local character = player:GetPlayerType()
224
177
  return character == PlayerType.PLAYER_KEEPER or character == PlayerType.PLAYER_KEEPER_B
225
178
  end
226
- function ____exports.isTainted(self, player)
227
- local character = player:GetPlayerType()
228
- local ____isVanillaCharacter_result_1
229
- if ____exports.isVanillaCharacter(nil, player) then
230
- ____isVanillaCharacter_result_1 = character >= PlayerType.PLAYER_ISAAC_B
231
- else
232
- ____isVanillaCharacter_result_1 = isTaintedModded(nil, player)
233
- end
234
- return ____isVanillaCharacter_result_1
235
- end
236
179
  function isTaintedModded(self, player)
237
180
  local character = player:GetPlayerType()
238
181
  local name = player:GetName()
@@ -318,6 +261,13 @@ function ____exports.getBlackHearts(self, player)
318
261
  local blackHeartBits = countSetBits(nil, blackHeartsBitmask)
319
262
  return blackHeartBits * 2
320
263
  end
264
+ function ____exports.getCharacterName(self, character)
265
+ if character >= PlayerType.NUM_PLAYER_TYPES then
266
+ return "unknown"
267
+ end
268
+ local characterName = CHARACTER_NAME_MAP[character]
269
+ return characterName == nil and DEFAULT_CHARACTER_NAME or characterName
270
+ end
321
271
  function ____exports.getClosestPlayer(self, position)
322
272
  local closestPlayer = nil
323
273
  local closestDistance = math.huge
@@ -476,12 +426,8 @@ function ____exports.getPlayerIndexVanilla(self, playerToFind)
476
426
  return nil
477
427
  end
478
428
  function ____exports.getPlayerName(self, player)
479
- local adjustedName = getAdjustedPlayerName(nil, player)
480
- if not ____exports.isTainted(nil, player) then
481
- return adjustedName
482
- end
483
- local baseName = trimPrefix(nil, adjustedName, "The ")
484
- return stringContains(nil, baseName, "Tainted") and baseName or "Tainted " .. baseName
429
+ local character = player:GetPlayerType()
430
+ return character >= PlayerType.NUM_PLAYER_TYPES and player:GetName() or ____exports.getCharacterName(nil, character)
485
431
  end
486
432
  function ____exports.getPlayerNumHitsRemaining(self, player)
487
433
  local hearts = player:GetHearts()
@@ -578,6 +524,16 @@ function ____exports.canTakeFreeDevilDeals(self, player)
578
524
  local character = player:GetPlayerType()
579
525
  return CHARACTERS_WITH_FREE_DEVIL_DEALS:has(character)
580
526
  end
527
+ function ____exports.isTainted(self, player)
528
+ local character = player:GetPlayerType()
529
+ local ____isVanillaCharacter_result_1
530
+ if ____exports.isVanillaCharacter(nil, player) then
531
+ ____isVanillaCharacter_result_1 = character >= PlayerType.PLAYER_ISAAC_B
532
+ else
533
+ ____isVanillaCharacter_result_1 = isTaintedModded(nil, player)
534
+ end
535
+ return ____isVanillaCharacter_result_1
536
+ end
581
537
  function ____exports.isTaintedLazarus(self, player)
582
538
  local character = player:GetPlayerType()
583
539
  return character == PlayerType.PLAYER_LAZARUS_B or character == PlayerType.PLAYER_LAZARUS2_B
@@ -620,9 +576,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
620
576
  itemPool:RemoveCollectible(collectibleType)
621
577
  end
622
578
  repeat
623
- local ____switch133 = activeSlot
624
- local ____cond133 = ____switch133 == ActiveSlot.SLOT_PRIMARY
625
- if ____cond133 then
579
+ local ____switch125 = activeSlot
580
+ local ____cond125 = ____switch125 == ActiveSlot.SLOT_PRIMARY
581
+ if ____cond125 then
626
582
  do
627
583
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
628
584
  player:RemoveCollectible(primaryCollectibleType)
@@ -631,8 +587,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
631
587
  break
632
588
  end
633
589
  end
634
- ____cond133 = ____cond133 or ____switch133 == ActiveSlot.SLOT_SECONDARY
635
- if ____cond133 then
590
+ ____cond125 = ____cond125 or ____switch125 == ActiveSlot.SLOT_SECONDARY
591
+ if ____cond125 then
636
592
  do
637
593
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
638
594
  player:RemoveCollectible(primaryCollectibleType)
@@ -647,16 +603,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
647
603
  break
648
604
  end
649
605
  end
650
- ____cond133 = ____cond133 or ____switch133 == ActiveSlot.SLOT_POCKET
651
- if ____cond133 then
606
+ ____cond125 = ____cond125 or ____switch125 == ActiveSlot.SLOT_POCKET
607
+ if ____cond125 then
652
608
  do
653
609
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
654
610
  player:SetActiveCharge(charge, activeSlot)
655
611
  break
656
612
  end
657
613
  end
658
- ____cond133 = ____cond133 or ____switch133 == ActiveSlot.SLOT_POCKET2
659
- if ____cond133 then
614
+ ____cond125 = ____cond125 or ____switch125 == ActiveSlot.SLOT_POCKET2
615
+ if ____cond125 then
660
616
  do
661
617
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
662
618
  break
@@ -1,5 +1,7 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
+ import { HealthType } from "../types/HealthType";
2
3
  import { PlayerHealth } from "../types/PlayerHealth";
4
+ export declare function addPlayerHealthType(player: EntityPlayer, healthType: HealthType, numHearts: int): void;
3
5
  /**
4
6
  * Helper function to get an inventory of the player's health. Use this in combination with the
5
7
  * `setPlayerHealth` function to restore the player's health back to a certain configuration at a
@@ -8,6 +10,7 @@ import { PlayerHealth } from "../types/PlayerHealth";
8
10
  * This is based on the `REVEL.StoreHealth` function in the Revelations mod.
9
11
  */
10
12
  export declare function getPlayerHealth(player: EntityPlayer): PlayerHealth;
13
+ export declare function getPlayerHealthType(player: EntityPlayer, healthType: HealthType): int;
11
14
  /**
12
15
  * Helper function to set a player's health to a specific state. You can use this in combination
13
16
  * with the `getPlayerHealth` function to restore the player's health back to a certain
@@ -5,9 +5,14 @@ local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
5
5
  local ____exports = {}
6
6
  local ____constants = require("constants")
7
7
  local MAX_PLAYER_HEART_CONTAINERS = ____constants.MAX_PLAYER_HEART_CONTAINERS
8
+ local ____HealthType = require("types.HealthType")
9
+ local HealthType = ____HealthType.HealthType
8
10
  local ____player = require("functions.player")
11
+ local getBlackHearts = ____player.getBlackHearts
9
12
  local getHearts = ____player.getHearts
13
+ local getSoulHearts = ____player.getSoulHearts
10
14
  local ____utils = require("functions.utils")
15
+ local ensureAllCases = ____utils.ensureAllCases
11
16
  local ____repeat = ____utils["repeat"]
12
17
  function ____exports.removeAllPlayerHealth(self, player)
13
18
  local character = player:GetPlayerType()
@@ -29,6 +34,79 @@ function ____exports.removeAllPlayerHealth(self, player)
29
34
  end
30
35
  end
31
36
  end
37
+ function ____exports.addPlayerHealthType(self, player, healthType, numHearts)
38
+ repeat
39
+ local ____switch3 = healthType
40
+ local ____cond3 = ____switch3 == HealthType.RED
41
+ if ____cond3 then
42
+ do
43
+ player:AddHearts(numHearts)
44
+ return
45
+ end
46
+ end
47
+ ____cond3 = ____cond3 or ____switch3 == HealthType.SOUL
48
+ if ____cond3 then
49
+ do
50
+ player:AddSoulHearts(numHearts)
51
+ return
52
+ end
53
+ end
54
+ ____cond3 = ____cond3 or ____switch3 == HealthType.ETERNAL
55
+ if ____cond3 then
56
+ do
57
+ player:AddEternalHearts(numHearts)
58
+ return
59
+ end
60
+ end
61
+ ____cond3 = ____cond3 or ____switch3 == HealthType.BLACK
62
+ if ____cond3 then
63
+ do
64
+ player:AddBlackHearts(numHearts)
65
+ return
66
+ end
67
+ end
68
+ ____cond3 = ____cond3 or ____switch3 == HealthType.GOLDEN
69
+ if ____cond3 then
70
+ do
71
+ player:AddGoldenHearts(numHearts)
72
+ return
73
+ end
74
+ end
75
+ ____cond3 = ____cond3 or ____switch3 == HealthType.BONE
76
+ if ____cond3 then
77
+ do
78
+ player:AddBoneHearts(numHearts)
79
+ return
80
+ end
81
+ end
82
+ ____cond3 = ____cond3 or ____switch3 == HealthType.ROTTEN
83
+ if ____cond3 then
84
+ do
85
+ player:AddRottenHearts(numHearts)
86
+ return
87
+ end
88
+ end
89
+ ____cond3 = ____cond3 or ____switch3 == HealthType.BROKEN
90
+ if ____cond3 then
91
+ do
92
+ player:AddBrokenHearts(numHearts)
93
+ return
94
+ end
95
+ end
96
+ ____cond3 = ____cond3 or ____switch3 == HealthType.MAX_HEARTS
97
+ if ____cond3 then
98
+ do
99
+ player:AddMaxHearts(numHearts, false)
100
+ return
101
+ end
102
+ end
103
+ do
104
+ do
105
+ ensureAllCases(nil, healthType)
106
+ end
107
+ end
108
+ until true
109
+ end
32
110
  function ____exports.getPlayerHealth(self, player)
33
111
  local character = player:GetPlayerType()
34
112
  local soulHeartTypes = {}
@@ -91,6 +169,70 @@ function ____exports.getPlayerHealth(self, player)
91
169
  soulHeartTypes = soulHeartTypes
92
170
  }
93
171
  end
172
+ function ____exports.getPlayerHealthType(self, player, healthType)
173
+ repeat
174
+ local ____switch25 = healthType
175
+ local ____cond25 = ____switch25 == HealthType.RED
176
+ if ____cond25 then
177
+ do
178
+ return getHearts(nil, player)
179
+ end
180
+ end
181
+ ____cond25 = ____cond25 or ____switch25 == HealthType.SOUL
182
+ if ____cond25 then
183
+ do
184
+ return getSoulHearts(nil, player)
185
+ end
186
+ end
187
+ ____cond25 = ____cond25 or ____switch25 == HealthType.ETERNAL
188
+ if ____cond25 then
189
+ do
190
+ return player:GetEternalHearts()
191
+ end
192
+ end
193
+ ____cond25 = ____cond25 or ____switch25 == HealthType.BLACK
194
+ if ____cond25 then
195
+ do
196
+ return getBlackHearts(nil, player)
197
+ end
198
+ end
199
+ ____cond25 = ____cond25 or ____switch25 == HealthType.GOLDEN
200
+ if ____cond25 then
201
+ do
202
+ return player:GetGoldenHearts()
203
+ end
204
+ end
205
+ ____cond25 = ____cond25 or ____switch25 == HealthType.BONE
206
+ if ____cond25 then
207
+ do
208
+ return player:GetBoneHearts()
209
+ end
210
+ end
211
+ ____cond25 = ____cond25 or ____switch25 == HealthType.ROTTEN
212
+ if ____cond25 then
213
+ do
214
+ return player:GetRottenHearts()
215
+ end
216
+ end
217
+ ____cond25 = ____cond25 or ____switch25 == HealthType.BROKEN
218
+ if ____cond25 then
219
+ do
220
+ return player:GetBrokenHearts()
221
+ end
222
+ end
223
+ ____cond25 = ____cond25 or ____switch25 == HealthType.MAX_HEARTS
224
+ if ____cond25 then
225
+ do
226
+ return player:GetMaxHearts()
227
+ end
228
+ end
229
+ do
230
+ do
231
+ return ensureAllCases(nil, healthType)
232
+ end
233
+ end
234
+ until true
235
+ end
94
236
  function ____exports.setPlayerHealth(self, player, playerHealth)
95
237
  local character = player:GetPlayerType()
96
238
  local subPlayer = player:GetSubPlayer()