isaacscript-common 1.2.12 → 1.2.13

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.
@@ -217,6 +217,8 @@ export declare function canTakeFreeDevilDeals(player: EntityPlayer): boolean;
217
217
  export declare function isTainted(player: EntityPlayer): boolean;
218
218
  /** Helper function for detecting when a player is Tainted Lazarus or Dead Tainted Lazarus. */
219
219
  export declare function isTaintedLazarus(player: EntityPlayer): boolean;
220
+ export declare function isModdedCharacter(player: EntityPlayer): boolean;
221
+ export declare function isVanillaCharacter(player: EntityPlayer): boolean;
220
222
  export declare function removeCollectibleCostume(player: EntityPlayer, collectibleType: CollectibleType | int): void;
221
223
  /**
222
224
  * Helper function to remove the Dead Eye multiplier from a player.
@@ -9,7 +9,7 @@ local __TS__Iterator = ____lualib.__TS__Iterator
9
9
  local __TS__ArrayPush = ____lualib.__TS__ArrayPush
10
10
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
11
11
  local ____exports = {}
12
- local getAdjustedPlayerName, EXCLUDED_CHARACTERS
12
+ local getAdjustedPlayerName, isTaintedModded, EXCLUDED_CHARACTERS
13
13
  local ____constants = require("constants")
14
14
  local CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART = ____constants.CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART
15
15
  local CHARACTERS_WITH_FREE_DEVIL_DEALS = ____constants.CHARACTERS_WITH_FREE_DEVIL_DEALS
@@ -17,6 +17,7 @@ local CHARACTERS_WITH_NO_RED_HEARTS = ____constants.CHARACTERS_WITH_NO_RED_HEART
17
17
  local CHARACTERS_WITH_NO_SOUL_HEARTS = ____constants.CHARACTERS_WITH_NO_SOUL_HEARTS
18
18
  local LOST_STYLE_PLAYER_TYPES = ____constants.LOST_STYLE_PLAYER_TYPES
19
19
  local MAX_PLAYER_HEART_CONTAINERS = ____constants.MAX_PLAYER_HEART_CONTAINERS
20
+ local MAX_VANILLA_CHARACTER = ____constants.MAX_VANILLA_CHARACTER
20
21
  local ____HealthType = require("types.HealthType")
21
22
  local HealthType = ____HealthType.HealthType
22
23
  local ____array = require("functions.array")
@@ -149,7 +150,26 @@ function ____exports.isChildPlayer(self, player)
149
150
  end
150
151
  function ____exports.isTainted(self, player)
151
152
  local character = player:GetPlayerType()
152
- return character >= PlayerType.PLAYER_ISAAC_B
153
+ local ____isVanillaCharacter_result_0
154
+ if ____exports.isVanillaCharacter(nil, player) then
155
+ ____isVanillaCharacter_result_0 = character >= PlayerType.PLAYER_ISAAC_B
156
+ else
157
+ ____isVanillaCharacter_result_0 = isTaintedModded(nil, player)
158
+ end
159
+ return ____isVanillaCharacter_result_0
160
+ end
161
+ function isTaintedModded(self, player)
162
+ local character = player:GetPlayerType()
163
+ local name = player:GetName()
164
+ local taintedCharacter = Isaac.GetPlayerTypeByName(name, true)
165
+ return character == taintedCharacter
166
+ end
167
+ function ____exports.isModdedCharacter(self, player)
168
+ local character = player:GetPlayerType()
169
+ return character > MAX_VANILLA_CHARACTER
170
+ end
171
+ function ____exports.isVanillaCharacter(self, player)
172
+ return not ____exports.isModdedCharacter(nil, player)
153
173
  end
154
174
  EXCLUDED_CHARACTERS = __TS__New(Set, {PlayerType.PLAYER_ESAU, PlayerType.PLAYER_THESOUL_B})
155
175
  function ____exports.addCollectibleCostume(self, player, collectibleType)
@@ -524,9 +544,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
524
544
  itemPool:RemoveCollectible(collectibleType)
525
545
  end
526
546
  repeat
527
- local ____switch121 = activeSlot
528
- local ____cond121 = ____switch121 == ActiveSlot.SLOT_PRIMARY
529
- if ____cond121 then
547
+ local ____switch124 = activeSlot
548
+ local ____cond124 = ____switch124 == ActiveSlot.SLOT_PRIMARY
549
+ if ____cond124 then
530
550
  do
531
551
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
532
552
  player:RemoveCollectible(primaryCollectibleType)
@@ -535,8 +555,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
535
555
  break
536
556
  end
537
557
  end
538
- ____cond121 = ____cond121 or ____switch121 == ActiveSlot.SLOT_SECONDARY
539
- if ____cond121 then
558
+ ____cond124 = ____cond124 or ____switch124 == ActiveSlot.SLOT_SECONDARY
559
+ if ____cond124 then
540
560
  do
541
561
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
542
562
  player:RemoveCollectible(primaryCollectibleType)
@@ -551,16 +571,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
551
571
  break
552
572
  end
553
573
  end
554
- ____cond121 = ____cond121 or ____switch121 == ActiveSlot.SLOT_POCKET
555
- if ____cond121 then
574
+ ____cond124 = ____cond124 or ____switch124 == ActiveSlot.SLOT_POCKET
575
+ if ____cond124 then
556
576
  do
557
577
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
558
578
  player:SetActiveCharge(charge, activeSlot)
559
579
  break
560
580
  end
561
581
  end
562
- ____cond121 = ____cond121 or ____switch121 == ActiveSlot.SLOT_POCKET2
563
- if ____cond121 then
582
+ ____cond124 = ____cond124 or ____switch124 == ActiveSlot.SLOT_POCKET2
583
+ if ____cond124 then
564
584
  do
565
585
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
566
586
  break
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.12",
3
+ "version": "1.2.13",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",