isaacscript-common 4.2.3 → 4.2.4

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.
@@ -196,6 +196,7 @@ commandFunctionsMap:set("listGrid", commands.listGrid)
196
196
  commandFunctionsMap:set("listGridAll", commands.listGridAll)
197
197
  commandFunctionsMap:set("lowHP", commands.lowHP)
198
198
  commandFunctionsMap:set("luck", commands.luck)
199
+ commandFunctionsMap:set("mana", commands.mana)
199
200
  commandFunctionsMap:set("map", commands.map)
200
201
  commandFunctionsMap:set("maxHearts", commands.maxHearts)
201
202
  commandFunctionsMap:set("mh", commands.mh)
@@ -209,6 +209,8 @@ export declare function listGridAll(params: string): void;
209
209
  export declare function lowHP(): void;
210
210
  /** Alias for "debug 9". */
211
211
  export declare function luck(): void;
212
+ /** Alias for the "poopMana" command. */
213
+ export declare function mana(params: string): void;
212
214
  /** Completely reveals the entire map, including the Ultra Secret Room. */
213
215
  export declare function map(): void;
214
216
  /**
@@ -148,6 +148,21 @@ function ____exports.oneHP(self)
148
148
  end
149
149
  printConsole(nil, "Set every NPC to 1 HP.")
150
150
  end
151
+ --- Gives a poop mana charge. This only affects Tainted Blue Baby. Provide a number to give a custom
152
+ -- amount of charges. (You can use negative numbers to remove charges.)
153
+ function ____exports.poopMana(self, params)
154
+ local charges = 1
155
+ if params ~= "" then
156
+ local num = tonumber(params)
157
+ if num == nil then
158
+ printConsole(nil, "That is an invalid amount of mana to add.")
159
+ return
160
+ end
161
+ charges = num
162
+ end
163
+ local player = Isaac.GetPlayer()
164
+ player:AddPoopMana(charges)
165
+ end
151
166
  --- Gives a half soul heart. Provide a number to give a custom amount of hearts. (You can use
152
167
  -- negative numbers to remove hearts.)
153
168
  function ____exports.soulHearts(self, params)
@@ -658,6 +673,10 @@ end
658
673
  function ____exports.luck(self)
659
674
  Isaac.ExecuteCommand("debug 9")
660
675
  end
676
+ --- Alias for the "poopMana" command.
677
+ function ____exports.mana(self, params)
678
+ ____exports.poopMana(nil, params)
679
+ end
661
680
  --- Completely reveals the entire map, including the Ultra Secret Room.
662
681
  function ____exports.map(self)
663
682
  local level = game:GetLevel()
@@ -776,21 +795,6 @@ function ____exports.pocket(self, params)
776
795
  local player = Isaac.GetPlayer()
777
796
  player:SetPocketActiveItem(collectibleType, ActiveSlot.POCKET)
778
797
  end
779
- --- Gives a poop mana charge. This only affects Tainted Blue Baby. Provide a number to give a custom
780
- -- amount of charges. (You can use negative numbers to remove charges.)
781
- function ____exports.poopMana(self, params)
782
- local charges = 1
783
- if params ~= "" then
784
- local num = tonumber(params)
785
- if num == nil then
786
- printConsole(nil, "That is an invalid amount of mana to add.")
787
- return
788
- end
789
- charges = num
790
- end
791
- local player = Isaac.GetPlayer()
792
- player:AddPoopMana(charges)
793
- end
794
798
  --- Alias for the "getPosition" command.
795
799
  function ____exports.positionCommand(self)
796
800
  ____exports.getPosition(nil)
@@ -20,6 +20,7 @@ local getPlayerBlackHearts = ____player.getPlayerBlackHearts
20
20
  local getPlayerHearts = ____player.getPlayerHearts
21
21
  local getPlayerSoulHearts = ____player.getPlayerSoulHearts
22
22
  local isCharacter = ____player.isCharacter
23
+ local isKeeper = ____player.isKeeper
23
24
  local setActiveItem = ____player.setActiveItem
24
25
  local ____utils = require("functions.utils")
25
26
  local ____repeat = ____utils["repeat"]
@@ -88,19 +89,24 @@ function ____exports.setPlayerHealth(self, player, playerHealth)
88
89
  end
89
90
  end
90
91
  )
91
- player:AddRottenHearts(playerHealth.rottenHearts)
92
- ____repeat(
93
- nil,
94
- playerHealth.hearts,
95
- function()
96
- player:AddHearts(1)
97
- if character == PlayerType.MAGDALENE_B then
98
- player:AddHearts(-1)
92
+ if isKeeper(nil, player) then
93
+ local numCoinsToHeal = playerHealth.hearts / 2
94
+ player:AddCoins(numCoinsToHeal)
95
+ else
96
+ player:AddRottenHearts(playerHealth.rottenHearts)
97
+ ____repeat(
98
+ nil,
99
+ playerHealth.hearts,
100
+ function()
101
+ player:AddHearts(1)
102
+ if character == PlayerType.MAGDALENE_B then
103
+ player:AddHearts(-1)
104
+ end
99
105
  end
100
- end
101
- )
102
- player:AddGoldenHearts(playerHealth.goldenHearts)
103
- player:AddBrokenHearts(playerHealth.brokenHearts)
106
+ )
107
+ player:AddGoldenHearts(playerHealth.goldenHearts)
108
+ player:AddBrokenHearts(playerHealth.brokenHearts)
109
+ end
104
110
  if character == PlayerType.BETHANY then
105
111
  player:SetSoulCharge(playerHealth.soulCharges)
106
112
  elseif character == PlayerType.BETHANY_B then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "4.2.3",
3
+ "version": "4.2.4",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -22,6 +22,6 @@
22
22
  "main": "index",
23
23
  "types": "index.d.ts",
24
24
  "dependencies": {
25
- "isaac-typescript-definitions": "^3.0.10"
25
+ "isaac-typescript-definitions": "^3.0.11"
26
26
  }
27
27
  }