isaacscript-common 1.2.137 → 1.2.138

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.
@@ -3,16 +3,14 @@ local ____lualib = require("lualib_bundle")
3
3
  local Map = ____lualib.Map
4
4
  local __TS__New = ____lualib.__TS__New
5
5
  local ____exports = {}
6
- local hasSubscriptions, postPEffectUpdateReordered, getCurrentHealthValue, v
6
+ local hasSubscriptions, postPEffectUpdateReordered, v
7
7
  local ____exports = require("features.saveDataManager.exports")
8
8
  local saveDataManager = ____exports.saveDataManager
9
9
  local ____player = require("functions.player")
10
- local getBlackHearts = ____player.getBlackHearts
11
- local getHearts = ____player.getHearts
12
10
  local getPlayerIndex = ____player.getPlayerIndex
13
- local getSoulHearts = ____player.getSoulHearts
11
+ local ____playerHealth = require("functions.playerHealth")
12
+ local getPlayerHealthType = ____playerHealth.getPlayerHealthType
14
13
  local ____utils = require("functions.utils")
15
- local ensureAllCases = ____utils.ensureAllCases
16
14
  local getEnumValues = ____utils.getEnumValues
17
15
  local ____DefaultMap = require("types.DefaultMap")
18
16
  local DefaultMap = ____DefaultMap.DefaultMap
@@ -34,7 +32,7 @@ function postPEffectUpdateReordered(self, player)
34
32
  local playerHealthMap = v.run.playersHealthMap:getAndSetDefault(playerIndex)
35
33
  for ____, healthType in ipairs(getEnumValues(nil, HealthType)) do
36
34
  local storedHealthValue = playerHealthMap:get(healthType)
37
- local currentHealthValue = getCurrentHealthValue(nil, player, healthType)
35
+ local currentHealthValue = getPlayerHealthType(nil, player, healthType)
38
36
  playerHealthMap:set(healthType, currentHealthValue)
39
37
  if storedHealthValue ~= nil and storedHealthValue ~= currentHealthValue then
40
38
  local amount = currentHealthValue - storedHealthValue
@@ -42,64 +40,6 @@ function postPEffectUpdateReordered(self, player)
42
40
  end
43
41
  end
44
42
  end
45
- function getCurrentHealthValue(self, player, healthType)
46
- repeat
47
- local ____switch11 = healthType
48
- local ____cond11 = ____switch11 == HealthType.RED
49
- if ____cond11 then
50
- do
51
- return getHearts(nil, player)
52
- end
53
- end
54
- ____cond11 = ____cond11 or ____switch11 == HealthType.SOUL
55
- if ____cond11 then
56
- do
57
- return getSoulHearts(nil, player)
58
- end
59
- end
60
- ____cond11 = ____cond11 or ____switch11 == HealthType.ETERNAL
61
- if ____cond11 then
62
- do
63
- return player:GetEternalHearts()
64
- end
65
- end
66
- ____cond11 = ____cond11 or ____switch11 == HealthType.BLACK
67
- if ____cond11 then
68
- do
69
- return getBlackHearts(nil, player)
70
- end
71
- end
72
- ____cond11 = ____cond11 or ____switch11 == HealthType.GOLDEN
73
- if ____cond11 then
74
- do
75
- return player:GetGoldenHearts()
76
- end
77
- end
78
- ____cond11 = ____cond11 or ____switch11 == HealthType.BONE
79
- if ____cond11 then
80
- do
81
- return player:GetBoneHearts()
82
- end
83
- end
84
- ____cond11 = ____cond11 or ____switch11 == HealthType.ROTTEN
85
- if ____cond11 then
86
- do
87
- return player:GetRottenHearts()
88
- end
89
- end
90
- ____cond11 = ____cond11 or ____switch11 == HealthType.MAX_HEARTS
91
- if ____cond11 then
92
- do
93
- return player:GetMaxHearts()
94
- end
95
- end
96
- do
97
- do
98
- return ensureAllCases(nil, healthType)
99
- end
100
- end
101
- until true
102
- end
103
43
  v = {run = {playersHealthMap = __TS__New(
104
44
  DefaultMap,
105
45
  function() return __TS__New(Map) end
@@ -5,16 +5,44 @@
5
5
  export declare function angel(): void;
6
6
  /** Activates the flags for the Ascent (i.e. Backwards Path). */
7
7
  export declare function ascent(): void;
8
+ /** Alias for the "blackhearts" command. */
9
+ export declare function bh(params: string): void;
10
+ /**
11
+ * Gives a half black heart. Provide a number to give a custom amount of hearts. (You can use
12
+ * negative numbers to remove hearts.)
13
+ */
14
+ export declare function blackHearts(params: string): void;
8
15
  /** Warps to the Black Market for the floor. */
9
16
  export declare function blackMarket(): void;
10
- /** Gives a bomb. Provide a number to give a custom amount of bombs. */
17
+ /**
18
+ * Gives a blood charge. This only affects Bethany. Provide a number to give a custom amount of
19
+ * charges. (You can use negative numbers to remove charges.)
20
+ */
21
+ export declare function bloodCharges(params: string): void;
22
+ /**
23
+ * Gives a bomb. Provide a number to give a custom amount of bombs. (You can use negative numbers to
24
+ * remove bombs.)
25
+ */
11
26
  export declare function bomb(params: string): void;
12
- /** Gives 99 bombs. */
13
- export declare function bombs(): void;
27
+ /**
28
+ * Gives 99 bombs. Provide a number to give a custom amount of bombs. (You can use negative numbers
29
+ * to remove bombs.)
30
+ */
31
+ export declare function bombs(params: string): void;
32
+ /**
33
+ * Gives a bone heart. Provide a number to give a custom amount of hearts. (You can use negative
34
+ * numbers to remove hearts.)
35
+ */
36
+ export declare function boneHearts(params: string): void;
14
37
  /** Warps to the first Boss Room on the floor. */
15
38
  export declare function boss(): void;
16
39
  /** Alias for the "blackmarket" command. */
17
40
  export declare function bm(): void;
41
+ /**
42
+ * Gives a broken heart. Provide a number to give a custom amount of hearts. (You can use negative
43
+ * numbers to remove hearts.)
44
+ */
45
+ export declare function brokenHearts(params: string): void;
18
46
  /**
19
47
  * Gives the specified card. Accepts either the card sub-type or the partial name of the card.
20
48
  *
@@ -38,12 +66,22 @@ export declare function chaosCardTears(): void;
38
66
  * - character ta - Restarts as Tainted Azazel.
39
67
  */
40
68
  export declare function characterCommand(params: string): void;
41
- /** Gives a coin. Provide a number to give a custom amount of coins. */
69
+ /**
70
+ * Gives a coin. Provide a number to give a custom amount of coins. (You can use negative numbers to
71
+ * remove coins.)
72
+ */
42
73
  export declare function coin(params: string): void;
43
- /** Gives 999 coins. */
44
- export declare function coins(): void;
74
+ /**
75
+ * Gives 999 coins. Provide a number to give a custom amount of coins. (You can use negative numbers
76
+ * to remove coins.)
77
+ */
78
+ export declare function coins(params: string): void;
45
79
  /** Creates a crawlspace next to the player. */
46
80
  export declare function crawlspace(): void;
81
+ /** Uses the D6. */
82
+ export declare function d6(): void;
83
+ /** Uses the D20. */
84
+ export declare function d20(): void;
47
85
  /** Toggles extremely high-damage tears. */
48
86
  export declare function damage(): void;
49
87
  /** Alias for the "devil" command. */
@@ -57,8 +95,15 @@ export declare function devil(): void;
57
95
  export declare function down(params: string): void;
58
96
  /** Logs the player's current temporary effects to the "log.txt" file. */
59
97
  export declare function effects(): void;
98
+ /** Alias for the "eternalhearts" command. */
99
+ export declare function eh(params: string): void;
60
100
  /** Alias for the "iamerror" command. */
61
101
  export declare function error(): void;
102
+ /**
103
+ * Gives an eternal heart. Provide a number to give a custom amount of hearts. (You can use negative
104
+ * numbers to remove hearts.)
105
+ */
106
+ export declare function eternalHearts(params: string): void;
62
107
  /** Alias for the "startingroom" command. */
63
108
  export declare function fool(): void;
64
109
  /** Alias for the "goldenbomb" command. */
@@ -69,12 +114,25 @@ export declare function goldenBomb(): void;
69
114
  export declare function goldKey(): void;
70
115
  /** Gives the player a golden key. */
71
116
  export declare function goldenKey(): void;
117
+ /** Alias for the "hearts" command. */
118
+ export declare function h(params: string): void;
119
+ /**
120
+ * Gives a half red heart. Provide a number to give a custom amount of hearts. (You can use
121
+ * negative numbers to remove hearts.)
122
+ */
123
+ export declare function hearts(params: string): void;
72
124
  /** Warps to the I AM ERROR room for the floor. */
73
125
  export declare function IAMERROR(): void;
74
- /** Gives a key. Provide a number to give a custom amount of key. */
126
+ /**
127
+ * Gives a key. Provide a number to give a custom amount of key. (You can use negative numbers to
128
+ * remove keys.)
129
+ */
75
130
  export declare function key(params: string): void;
76
- /** Gives 99 keys. */
77
- export declare function keys(): void;
131
+ /**
132
+ * Gives 99 keys. Provide a number to give a custom amount of coins. (You can use negative numbers
133
+ * to remove keys.)
134
+ */
135
+ export declare function keys(params: string): void;
78
136
  /**
79
137
  * Logs the entities in the room to the "log.txt" file. Provide a number to only log that specific
80
138
  * `EntityType`.
@@ -105,6 +163,13 @@ export declare function listGridAll(params: string): void;
105
163
  export declare function lowHP(): void;
106
164
  /** Alias for "debug 9". */
107
165
  export declare function luck(): void;
166
+ /**
167
+ * Gives a heart container. Provide a number to give a custom amount of heart containers. (You can
168
+ * use negative numbers to remove heart containers.)
169
+ */
170
+ export declare function maxHearts(params: string): void;
171
+ /** Alias for the "maxhearts" command. */
172
+ export declare function mh(params: string): void;
108
173
  /**
109
174
  * Gives a pill with the specified pill effect. Accepts either the effect ID or the partial name of
110
175
  * the effect.
@@ -122,8 +187,17 @@ export declare function planetarium(): void;
122
187
  export declare function pocket(params: string): void;
123
188
  /** Prints the current position of all players. */
124
189
  export declare function positionCommand(): void;
190
+ /** Alias for the "hearts" command. */
191
+ export declare function redHearts(params: string): void;
192
+ /** Alias for the "redhearts" command. */
193
+ export declare function rh(params: string): void;
125
194
  /** Logs information about the room to the "log.txt" file. */
126
195
  export declare function roomCommand(): void;
196
+ /**
197
+ * Gives a rotten heart. Provide a number to give a custom amount of hearts. (You can use negative
198
+ * numbers to remove hearts.)
199
+ */
200
+ export declare function rottenHearts(params: string): void;
127
201
  /**
128
202
  * Alias for the "stage" command.
129
203
  *
@@ -134,8 +208,22 @@ export declare function roomCommand(): void;
134
208
  export declare function s(params: string): void;
135
209
  /** Logs all of the current run's seed effects to the "log.txt" file. */
136
210
  export declare function seeds(): void;
211
+ /** Alias for the "soulhearts" command. */
212
+ export declare function sh(params: string): void;
137
213
  /** Warps to the first shop on the floor. */
138
214
  export declare function shop(): void;
215
+ /** Uses the Smelter to smelt the current player's trinket. */
216
+ export declare function smelt(): void;
217
+ /**
218
+ * Gives a soul charge. This only affects Tainted Bethany. Provide a number to give a custom amount
219
+ * of charges. (You can use negative numbers to remove charges.)
220
+ */
221
+ export declare function soulCharges(params: string): void;
222
+ /**
223
+ * Gives a half soul heart. Provide a number to give a custom amount of hearts. (You can use
224
+ * negative numbers to remove hearts.)
225
+ */
226
+ export declare function soulHearts(params: string): void;
139
227
  /**
140
228
  * Play the supplied sound effect.
141
229
  *
@@ -3,7 +3,7 @@ local ____lualib = require("lualib_bundle")
3
3
  local Map = ____lualib.Map
4
4
  local __TS__StringSlice = ____lualib.__TS__StringSlice
5
5
  local ____exports = {}
6
- local devilAngel, listEntities, listGridEntities, movePlayer, printEnabled, spawnTrapdoorOrCrawlspace, warpToRoomType, DEFAULT_MOVE_UNITS
6
+ local addHeart, devilAngel, listEntities, listGridEntities, movePlayer, printEnabled, spawnTrapdoorOrCrawlspace, warpToRoomType, DEFAULT_MOVE_UNITS
7
7
  local ____cachedClasses = require("cachedClasses")
8
8
  local game = ____cachedClasses.game
9
9
  local sfxManager = ____cachedClasses.sfxManager
@@ -24,6 +24,9 @@ local ____npc = require("functions.npc")
24
24
  local getNPCs = ____npc.getNPCs
25
25
  local ____player = require("functions.player")
26
26
  local getPlayers = ____player.getPlayers
27
+ local useActiveItemTemp = ____player.useActiveItemTemp
28
+ local ____playerHealth = require("functions.playerHealth")
29
+ local addPlayerHealthType = ____playerHealth.addPlayerHealthType
27
30
  local ____rooms = require("functions.rooms")
28
31
  local changeRoom = ____rooms.changeRoom
29
32
  local getRoomData = ____rooms.getRoomData
@@ -41,8 +44,13 @@ local ____characterMap = require("maps.characterMap")
41
44
  local CHARACTER_MAP = ____characterMap.CHARACTER_MAP
42
45
  local ____pillEffectMap = require("maps.pillEffectMap")
43
46
  local PILL_EFFECT_MAP = ____pillEffectMap.PILL_EFFECT_MAP
47
+ local ____HealthType = require("types.HealthType")
48
+ local HealthType = ____HealthType.HealthType
44
49
  local ____v = require("features.extraConsoleCommands.v")
45
50
  local v = ____v.default
51
+ function ____exports.blackHearts(self, params)
52
+ addHeart(nil, params, HealthType.BLACK)
53
+ end
46
54
  function ____exports.chaosCardTears(self)
47
55
  v.run.chaosCardTears = not v.run.chaosCardTears
48
56
  printEnabled(nil, v.run.chaosCardTears, "Chaos Card tears")
@@ -50,6 +58,9 @@ end
50
58
  function ____exports.devil(self)
51
59
  devilAngel(nil, true)
52
60
  end
61
+ function ____exports.eternalHearts(self, params)
62
+ addHeart(nil, params, HealthType.ETERNAL)
63
+ end
53
64
  function ____exports.goldenBomb(self)
54
65
  local player = Isaac.GetPlayer()
55
66
  player:AddGoldenBomb()
@@ -58,14 +69,33 @@ function ____exports.goldenKey(self)
58
69
  local player = Isaac.GetPlayer()
59
70
  player:AddGoldenKey()
60
71
  end
72
+ function ____exports.hearts(self, params)
73
+ addHeart(nil, params, HealthType.RED)
74
+ end
61
75
  function ____exports.IAMERROR(self)
62
76
  changeRoom(nil, GridRooms.ROOM_ERROR_IDX)
63
77
  end
78
+ function ____exports.soulHearts(self, params)
79
+ addHeart(nil, params, HealthType.SOUL)
80
+ end
64
81
  function ____exports.startingRoom(self)
65
82
  local level = game:GetLevel()
66
83
  local startingRoomIndex = level:GetStartingRoomIndex()
67
84
  changeRoom(nil, startingRoomIndex)
68
85
  end
86
+ function addHeart(self, params, healthType)
87
+ local numHearts = healthType == HealthType.MAX_HEARTS and 2 or 1
88
+ if params ~= "" then
89
+ local num = tonumber(params)
90
+ if num == nil then
91
+ printConsole(nil, "That is an invalid amount of hearts to add.")
92
+ return
93
+ end
94
+ numHearts = num
95
+ end
96
+ local player = Isaac.GetPlayer()
97
+ addPlayerHealthType(nil, player, healthType, numHearts)
98
+ end
69
99
  function devilAngel(self, useDevil)
70
100
  local level = game:GetLevel()
71
101
  local devilAngelRoomData = getRoomData(nil, GridRooms.ROOM_DEVIL_IDX)
@@ -153,9 +183,25 @@ function ____exports.ascent(self)
153
183
  game:SetStateFlag(GameStateFlag.STATE_BACKWARDS_PATH, true)
154
184
  printConsole(nil, "Set Ascent flags.")
155
185
  end
186
+ function ____exports.bh(self, params)
187
+ ____exports.blackHearts(nil, params)
188
+ end
156
189
  function ____exports.blackMarket(self)
157
190
  changeRoom(nil, GridRooms.ROOM_BLACK_MARKET_IDX)
158
191
  end
192
+ function ____exports.bloodCharges(self, params)
193
+ local charges = 1
194
+ if params ~= "" then
195
+ local num = tonumber(params)
196
+ if num == nil then
197
+ printConsole(nil, "That is an invalid amount of charges to add.")
198
+ return
199
+ end
200
+ charges = num
201
+ end
202
+ local player = Isaac.GetPlayer()
203
+ player:AddBloodCharge(charges)
204
+ end
159
205
  function ____exports.bomb(self, params)
160
206
  local numBombs = 1
161
207
  if params ~= "" then
@@ -169,9 +215,21 @@ function ____exports.bomb(self, params)
169
215
  local player = Isaac.GetPlayer()
170
216
  player:AddBombs(numBombs)
171
217
  end
172
- function ____exports.bombs(self)
218
+ function ____exports.bombs(self, params)
219
+ local numBombs = 99
220
+ if params ~= "" then
221
+ local num = tonumber(params)
222
+ if num == nil then
223
+ printConsole(nil, "That is an invalid amount of bombs to add.")
224
+ return
225
+ end
226
+ numBombs = num
227
+ end
173
228
  local player = Isaac.GetPlayer()
174
- player:AddBombs(99)
229
+ player:AddBombs(numBombs)
230
+ end
231
+ function ____exports.boneHearts(self, params)
232
+ addHeart(nil, params, HealthType.BONE)
175
233
  end
176
234
  function ____exports.boss(self)
177
235
  warpToRoomType(nil, RoomType.ROOM_BOSS, "Boss Room")
@@ -179,6 +237,9 @@ end
179
237
  function ____exports.bm(self)
180
238
  ____exports.blackMarket(nil)
181
239
  end
240
+ function ____exports.brokenHearts(self, params)
241
+ addHeart(nil, params, HealthType.BROKEN)
242
+ end
182
243
  function ____exports.card(self, params)
183
244
  if params == "" then
184
245
  printConsole(nil, "You must specify a card name or number.")
@@ -281,13 +342,30 @@ function ____exports.coin(self, params)
281
342
  local player = Isaac.GetPlayer()
282
343
  player:AddCoins(numCoins)
283
344
  end
284
- function ____exports.coins(self)
345
+ function ____exports.coins(self, params)
346
+ local numCoins = 999
347
+ if params ~= "" then
348
+ local num = tonumber(params)
349
+ if num == nil then
350
+ printConsole(nil, "That is an invalid amount of coins to add.")
351
+ return
352
+ end
353
+ numCoins = num
354
+ end
285
355
  local player = Isaac.GetPlayer()
286
- player:AddCoins(999)
356
+ player:AddCoins(numCoins)
287
357
  end
288
358
  function ____exports.crawlspace(self)
289
359
  spawnTrapdoorOrCrawlspace(nil, false)
290
360
  end
361
+ function ____exports.d6(self)
362
+ local player = Isaac.GetPlayer()
363
+ useActiveItemTemp(nil, player, CollectibleType.COLLECTIBLE_D6)
364
+ end
365
+ function ____exports.d20(self)
366
+ local player = Isaac.GetPlayer()
367
+ useActiveItemTemp(nil, player, CollectibleType.COLLECTIBLE_D20)
368
+ end
291
369
  function ____exports.damage(self)
292
370
  v.run.maxDamage = not v.run.maxDamage
293
371
  printEnabled(nil, v.run.maxDamage, "debug damage")
@@ -303,6 +381,9 @@ function ____exports.effects(self)
303
381
  logTemporaryEffects(player)
304
382
  printConsole(nil, "Logged the player's effects to the \"log.txt\" file.")
305
383
  end
384
+ function ____exports.eh(self, params)
385
+ ____exports.eternalHearts(nil, params)
386
+ end
306
387
  function ____exports.error(self)
307
388
  ____exports.IAMERROR(nil)
308
389
  end
@@ -315,6 +396,9 @@ end
315
396
  function ____exports.goldKey(self)
316
397
  ____exports.goldenKey(nil)
317
398
  end
399
+ function ____exports.h(self, params)
400
+ ____exports.hearts(nil, params)
401
+ end
318
402
  function ____exports.key(self, params)
319
403
  local numKeys = 1
320
404
  if params ~= "" then
@@ -328,9 +412,18 @@ function ____exports.key(self, params)
328
412
  local player = Isaac.GetPlayer()
329
413
  player:AddKeys(numKeys)
330
414
  end
331
- function ____exports.keys(self)
415
+ function ____exports.keys(self, params)
416
+ local numKeys = 99
417
+ if params ~= "" then
418
+ local num = tonumber(params)
419
+ if num == nil then
420
+ printConsole(nil, "That is an invalid amount of keys to add.")
421
+ return
422
+ end
423
+ numKeys = num
424
+ end
332
425
  local player = Isaac.GetPlayer()
333
- player:AddKeys(99)
426
+ player:AddKeys(numKeys)
334
427
  end
335
428
  function ____exports.list(self, params)
336
429
  listEntities(nil, params, false)
@@ -353,6 +446,12 @@ end
353
446
  function ____exports.luck(self)
354
447
  Isaac.ExecuteCommand("debug 9")
355
448
  end
449
+ function ____exports.maxHearts(self, params)
450
+ addHeart(nil, params, HealthType.MAX_HEARTS)
451
+ end
452
+ function ____exports.mh(self, params)
453
+ ____exports.maxHearts(nil, params)
454
+ end
356
455
  function ____exports.pill(self, params)
357
456
  if params == "" then
358
457
  printConsole(nil, "You must specify a pill name or number.")
@@ -442,9 +541,18 @@ function ____exports.positionCommand(self)
442
541
  )
443
542
  end
444
543
  end
544
+ function ____exports.redHearts(self, params)
545
+ ____exports.hearts(nil, params)
546
+ end
547
+ function ____exports.rh(self, params)
548
+ ____exports.redHearts(nil, params)
549
+ end
445
550
  function ____exports.roomCommand(self)
446
551
  logRoom()
447
552
  end
553
+ function ____exports.rottenHearts(self, params)
554
+ addHeart(nil, params, HealthType.ROTTEN)
555
+ end
448
556
  function ____exports.s(self, params)
449
557
  if params == "" then
450
558
  printConsole(nil, "You must specify a stage number.")
@@ -483,9 +591,29 @@ function ____exports.seeds(self)
483
591
  logAllSeedEffects()
484
592
  printConsole(nil, "Logged the seed effects to the \"log.txt\" file.")
485
593
  end
594
+ function ____exports.sh(self, params)
595
+ ____exports.soulHearts(nil, params)
596
+ end
486
597
  function ____exports.shop(self)
487
598
  warpToRoomType(nil, RoomType.ROOM_SHOP, "shop")
488
599
  end
600
+ function ____exports.smelt(self)
601
+ local player = Isaac.GetPlayer()
602
+ useActiveItemTemp(nil, player, CollectibleType.COLLECTIBLE_SMELTER)
603
+ end
604
+ function ____exports.soulCharges(self, params)
605
+ local charges = 1
606
+ if params ~= "" then
607
+ local num = tonumber(params)
608
+ if num == nil then
609
+ printConsole(nil, "That is an invalid amount of charges to add.")
610
+ return
611
+ end
612
+ charges = num
613
+ end
614
+ local player = Isaac.GetPlayer()
615
+ player:AddSoulCharge(charges)
616
+ end
489
617
  function ____exports.sound(self, params)
490
618
  local soundEffect = tonumber(params)
491
619
  if soundEffect == nil then
@@ -505,8 +633,8 @@ function ____exports.speed(self)
505
633
  local player = Isaac.GetPlayer()
506
634
  v.run.maxSpeed = not v.run.maxSpeed
507
635
  if v.run.maxSpeed and not player:HasCollectible(CollectibleType.COLLECTIBLE_FATE) then
508
- local eternalHearts = player:GetEternalHearts()
509
- if eternalHearts == 0 then
636
+ local numEternalHearts = player:GetEternalHearts()
637
+ if numEternalHearts == 0 then
510
638
  player:AddCollectible(CollectibleType.COLLECTIBLE_FATE)
511
639
  player:AddEternalHearts(-1)
512
640
  else
@@ -80,11 +80,16 @@ function ____exports.removeConsoleCommand(self, commandName)
80
80
  end
81
81
  commandFunctionsMap:set("angel", commands.angel)
82
82
  commandFunctionsMap:set("ascent", commands.ascent)
83
+ commandFunctionsMap:set("bh", commands.bh)
84
+ commandFunctionsMap:set("blackhearts", commands.blackHearts)
83
85
  commandFunctionsMap:set("blackmarket", commands.blackMarket)
86
+ commandFunctionsMap:set("bloodcharges", commands.bloodCharges)
84
87
  commandFunctionsMap:set("bomb", commands.bomb)
85
88
  commandFunctionsMap:set("bombs", commands.bombs)
89
+ commandFunctionsMap:set("bonehearts", commands.boneHearts)
86
90
  commandFunctionsMap:set("boss", commands.boss)
87
91
  commandFunctionsMap:set("bm", commands.bm)
92
+ commandFunctionsMap:set("brokenhearts", commands.brokenHearts)
88
93
  commandFunctionsMap:set("card", commands.card)
89
94
  commandFunctionsMap:set("cards", commands.cards)
90
95
  commandFunctionsMap:set("cc", commands.cc)
@@ -93,17 +98,23 @@ commandFunctionsMap:set("character", commands.characterCommand)
93
98
  commandFunctionsMap:set("coin", commands.coin)
94
99
  commandFunctionsMap:set("coins", commands.coins)
95
100
  commandFunctionsMap:set("crawlspace", commands.crawlspace)
101
+ commandFunctionsMap:set("d6", commands.d6)
102
+ commandFunctionsMap:set("d20", commands.d20)
96
103
  commandFunctionsMap:set("damage", commands.damage)
97
104
  commandFunctionsMap:set("dd", commands.dd)
98
105
  commandFunctionsMap:set("devil", commands.devil)
99
106
  commandFunctionsMap:set("down", commands.down)
100
107
  commandFunctionsMap:set("effects", commands.effects)
108
+ commandFunctionsMap:set("eh", commands.eh)
101
109
  commandFunctionsMap:set("error", commands.error)
110
+ commandFunctionsMap:set("eternalhearts", commands.eternalHearts)
102
111
  commandFunctionsMap:set("fool", commands.fool)
103
112
  commandFunctionsMap:set("goldbomb", commands.goldBomb)
104
113
  commandFunctionsMap:set("goldenbomb", commands.goldenBomb)
105
114
  commandFunctionsMap:set("goldkey", commands.goldKey)
106
115
  commandFunctionsMap:set("goldenkey", commands.goldenKey)
116
+ commandFunctionsMap:set("h", commands.h)
117
+ commandFunctionsMap:set("hearts", commands.hearts)
107
118
  commandFunctionsMap:set("iamerror", commands.IAMERROR)
108
119
  commandFunctionsMap:set("key", commands.key)
109
120
  commandFunctionsMap:set("keys", commands.keys)
@@ -113,15 +124,24 @@ commandFunctionsMap:set("listgrid", commands.listGrid)
113
124
  commandFunctionsMap:set("listgridall", commands.listGridAll)
114
125
  commandFunctionsMap:set("lowhp", commands.lowHP)
115
126
  commandFunctionsMap:set("luck", commands.luck)
127
+ commandFunctionsMap:set("maxhearts", commands.maxHearts)
128
+ commandFunctionsMap:set("mh", commands.mh)
116
129
  commandFunctionsMap:set("pill", commands.pill)
117
130
  commandFunctionsMap:set("pills", commands.pills)
118
131
  commandFunctionsMap:set("planetarium", commands.planetarium)
119
132
  commandFunctionsMap:set("pocket", commands.pocket)
120
133
  commandFunctionsMap:set("position", commands.positionCommand)
134
+ commandFunctionsMap:set("redhearts", commands.redHearts)
135
+ commandFunctionsMap:set("rh", commands.rh)
121
136
  commandFunctionsMap:set("room", commands.roomCommand)
137
+ commandFunctionsMap:set("rottenhearts", commands.rottenHearts)
122
138
  commandFunctionsMap:set("s", commands.s)
123
139
  commandFunctionsMap:set("seeds", commands.seeds)
140
+ commandFunctionsMap:set("sh", commands.sh)
124
141
  commandFunctionsMap:set("shop", commands.shop)
142
+ commandFunctionsMap:set("smelt", commands.smelt)
143
+ commandFunctionsMap:set("soulcharges", commands.soulCharges)
144
+ commandFunctionsMap:set("soulhearts", commands.soulHearts)
125
145
  commandFunctionsMap:set("sound", commands.sound)
126
146
  commandFunctionsMap:set("sounds", commands.sounds)
127
147
  commandFunctionsMap:set("spam", commands.spam)
@@ -101,8 +101,8 @@ export declare function getFinalPlayer(): EntityPlayer;
101
101
  */
102
102
  export declare function getHearts(player: EntityPlayer): int;
103
103
  /**
104
- * Helper function that returns the type of the rightmost heart, not including golden hearts since
105
- * they can't be damaged directly.
104
+ * Helper function that returns the type of the rightmost heart. This does not including golden
105
+ * hearts or broken hearts, since they cannot be damaged directly.
106
106
  */
107
107
  export declare function getLastHeart(player: EntityPlayer): HealthType;
108
108
  /**
@@ -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()
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * This represents the type of health that is either given or taken away from a player. Note that
3
- * we cannot use the HeartSubType enum for this purpose this since it has no value for max hearts.
3
+ * we cannot use the HeartSubType enum for this purpose this since it has no value for broken hearts
4
+ * or max hearts.
4
5
  */
5
6
  export declare enum HealthType {
6
7
  RED = 0,
@@ -10,5 +11,6 @@ export declare enum HealthType {
10
11
  GOLDEN = 4,
11
12
  BONE = 5,
12
13
  ROTTEN = 6,
13
- MAX_HEARTS = 7
14
+ BROKEN = 7,
15
+ MAX_HEARTS = 8
14
16
  }
@@ -15,6 +15,8 @@ ____exports.HealthType.BONE = 5
15
15
  ____exports.HealthType[____exports.HealthType.BONE] = "BONE"
16
16
  ____exports.HealthType.ROTTEN = 6
17
17
  ____exports.HealthType[____exports.HealthType.ROTTEN] = "ROTTEN"
18
- ____exports.HealthType.MAX_HEARTS = 7
18
+ ____exports.HealthType.BROKEN = 7
19
+ ____exports.HealthType[____exports.HealthType.BROKEN] = "BROKEN"
20
+ ____exports.HealthType.MAX_HEARTS = 8
19
21
  ____exports.HealthType[____exports.HealthType.MAX_HEARTS] = "MAX_HEARTS"
20
22
  return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.137",
3
+ "version": "1.2.138",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",