isaacscript-common 1.0.478 → 1.0.482

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.
@@ -21,7 +21,7 @@ function entityTakeDmgPlayer(self, tookDamage, damageAmount, _damageFlags, _dama
21
21
  if willPlayerRevive(nil, player) then
22
22
  return nil
23
23
  end
24
- if (not hasLostCurse(nil, player)) and (not damageIsFatal(nil, player, damageAmount)) then
24
+ if (not damageIsFatal(nil, player, damageAmount)) and (not hasLostCurse(nil, player)) then
25
25
  return nil
26
26
  end
27
27
  local shouldSustainDeath = postPlayerFatalDamage:fire(player)
@@ -31,6 +31,10 @@ function entityTakeDmgPlayer(self, tookDamage, damageAmount, _damageFlags, _dama
31
31
  return nil
32
32
  end
33
33
  function damageIsFatal(self, player, damageAmount)
34
+ local character = player:GetPlayerType()
35
+ if character == PlayerType.PLAYER_JACOB2_B then
36
+ return true
37
+ end
34
38
  local playerNumAllHearts = getPlayerNumAllHearts(nil, player)
35
39
  if damageAmount < playerNumAllHearts then
36
40
  return false
@@ -35,6 +35,11 @@ export declare const GRID_ENTITY_XML_MAP: Map<GridEntityXMLType, [GridEntityType
35
35
  export declare const GRID_INDEX_CENTER_OF_1X1_ROOM = 67;
36
36
  export declare const GAME_FRAMES_PER_SECOND = 30;
37
37
  export declare const ISAAC_FRAMES_PER_SECOND = 60;
38
+ /**
39
+ * This is the set of characters that look like The Lost and play the "LostDeath" animation when
40
+ * they die.
41
+ */
42
+ export declare const LOST_STYLE_PLAYER_TYPES: Set<PlayerType>;
38
43
  /** In a 2x2 room, there can be 8 doors. */
39
44
  export declare const MAX_NUM_DOORS = 8;
40
45
  /**
@@ -17,6 +17,7 @@ ____exports.GRID_ENTITY_XML_MAP = __TS__New(Map, {{1000, {GridEntityType.GRID_RO
17
17
  ____exports.GRID_INDEX_CENTER_OF_1X1_ROOM = 67
18
18
  ____exports.GAME_FRAMES_PER_SECOND = 30
19
19
  ____exports.ISAAC_FRAMES_PER_SECOND = 60
20
+ ____exports.LOST_STYLE_PLAYER_TYPES = __TS__New(Set, {PlayerType.PLAYER_THELOST, PlayerType.PLAYER_THESOUL, PlayerType.PLAYER_THELOST_B, PlayerType.PLAYER_JACOB2_B, PlayerType.PLAYER_THESOUL_B})
20
21
  ____exports.MAX_NUM_DOORS = 8
21
22
  ____exports.MAX_NUM_FAMILIARS = 64
22
23
  ____exports.MAX_NUM_INPUTS = 4
@@ -0,0 +1,45 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ /**
3
+ * This is a helper function to get a card name from a Card.
4
+ *
5
+ * Example:
6
+ * ```
7
+ * const card = Card.CARD_FOOL;
8
+ * const cardName = getCardName(card); // cardName is "0 - The Fool"
9
+ * ```
10
+ */
11
+ export declare function getCardDescription(card: Card | int): string;
12
+ /**
13
+ * This is a helper function to get a card name from a Card.
14
+ *
15
+ * Example:
16
+ * ```
17
+ * const card = Card.CARD_FOOL;
18
+ * const cardName = getCardName(card); // cardName is "0 - The Fool"
19
+ * ```
20
+ */
21
+ export declare function getCardName(card: Card | int): string;
22
+ /**
23
+ * Has an equal chance of returning any card (e.g. Fool, Reverse Fool, Wild Card, etc.). This will
24
+ * not return any runes or objects.
25
+ */
26
+ export declare function getRandomCard(seed?: number): Card;
27
+ /**
28
+ * Has an equal chance of returning any rune (e.g. Rune of Hagalaz, Blank Rune, Black Rune, Soul of
29
+ * Isaac, etc.). This will never return a Rune Shard.
30
+ */
31
+ export declare function getRandomRune(seed?: number): Card;
32
+ /**
33
+ * Returns true for entries in the Card enum that are not a rune or an object (e.g. Fool, Reverse
34
+ * Fool, Wild Card, etc.).
35
+ */
36
+ export declare function isCard(card: Card): boolean;
37
+ /**
38
+ * Returns true for entries in the Card enum that are not a card and not a rune (like Dice Shard).
39
+ */
40
+ export declare function isNotCardOrRune(card: Card): boolean;
41
+ /**
42
+ * Returns true for entries in the Card enum that are a rune. (e.g. Rune of Hagalaz, Blank Rune,
43
+ * Black Rune, Rune Shard, Soul of Isaac, etc.)
44
+ */
45
+ export declare function isRune(card: Card): boolean;
@@ -0,0 +1,77 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ local ____cardDescriptionMap = require("maps.cardDescriptionMap")
4
+ local CARD_DESCRIPTION_MAP = ____cardDescriptionMap.CARD_DESCRIPTION_MAP
5
+ local ____cardNameMap = require("maps.cardNameMap")
6
+ local CARD_NAME_MAP = ____cardNameMap.CARD_NAME_MAP
7
+ local ____random = require("functions.random")
8
+ local getRandomInt = ____random.getRandomInt
9
+ local nextSeed = ____random.nextSeed
10
+ function ____exports.isCard(self, card)
11
+ return ____exports.isNotCardOrRune(nil, card) and (not ____exports.isRune(nil, card))
12
+ end
13
+ function ____exports.isNotCardOrRune(self, card)
14
+ return ((card == Card.CARD_DICE_SHARD) or (card == Card.CARD_EMERGENCY_CONTACT)) or (card == Card.CARD_CRACKED_KEY)
15
+ end
16
+ function ____exports.isRune(self, card)
17
+ return (((card >= Card.RUNE_HAGALAZ) and (card <= Card.RUNE_BLACK)) or (card == Card.RUNE_SHARD)) or ((card >= Card.CARD_SOUL_ISAAC) and (card <= Card.CARD_SOUL_JACOB))
18
+ end
19
+ function ____exports.getCardDescription(self, card)
20
+ local itemConfig = Isaac.GetItemConfig()
21
+ local defaultDescription = "Unknown"
22
+ if type(card) ~= "number" then
23
+ return defaultDescription
24
+ end
25
+ local cardDescription = CARD_DESCRIPTION_MAP:get(card)
26
+ if cardDescription ~= nil then
27
+ return cardDescription
28
+ end
29
+ local itemConfigCard = itemConfig:GetCard(card)
30
+ if itemConfigCard == nil then
31
+ return defaultDescription
32
+ end
33
+ return itemConfigCard.Description
34
+ end
35
+ function ____exports.getCardName(self, card)
36
+ local itemConfig = Isaac.GetItemConfig()
37
+ local defaultName = "Unknown"
38
+ if type(card) ~= "number" then
39
+ return defaultName
40
+ end
41
+ local cardName = CARD_NAME_MAP:get(card)
42
+ if cardName ~= nil then
43
+ return cardName
44
+ end
45
+ local itemConfigCard = itemConfig:GetCard(card)
46
+ if itemConfigCard == nil then
47
+ return defaultName
48
+ end
49
+ return itemConfigCard.Name
50
+ end
51
+ function ____exports.getRandomCard(self, seed)
52
+ if seed == nil then
53
+ seed = Random()
54
+ end
55
+ local card
56
+ repeat
57
+ do
58
+ seed = nextSeed(nil, seed)
59
+ card = getRandomInt(nil, 1, Card.NUM_CARDS - 1)
60
+ end
61
+ until ____exports.isCard(nil, card)
62
+ return card
63
+ end
64
+ function ____exports.getRandomRune(self, seed)
65
+ if seed == nil then
66
+ seed = Random()
67
+ end
68
+ local card
69
+ repeat
70
+ do
71
+ seed = nextSeed(nil, seed)
72
+ card = getRandomInt(nil, 1, Card.NUM_CARDS - 1)
73
+ end
74
+ until not ((not ____exports.isRune(nil, card)) or (card == Card.RUNE_SHARD))
75
+ return card
76
+ end
77
+ return ____exports
@@ -0,0 +1,11 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ /**
3
+ * This is a helper function to get a pill effect name from a PillEffect.
4
+ *
5
+ * Example:
6
+ * ```
7
+ * const pillEffect = PillEffect.PILLEFFECT_BAD_GAS;
8
+ * const pillEffectName = getPillEffectName(pillEffect); // trinketName is "Bad Gas"
9
+ * ```
10
+ */
11
+ export declare function getPillEffectName(pillEffect: PillEffect | int): string;
@@ -0,0 +1,21 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ local ____pillEffectNameMap = require("maps.pillEffectNameMap")
4
+ local PILL_EFFECT_NAME_MAP = ____pillEffectNameMap.PILL_EFFECT_NAME_MAP
5
+ function ____exports.getPillEffectName(self, pillEffect)
6
+ local itemConfig = Isaac.GetItemConfig()
7
+ local defaultName = "Unknown"
8
+ if type(pillEffect) ~= "number" then
9
+ return defaultName
10
+ end
11
+ local pillEffectName = PILL_EFFECT_NAME_MAP:get(pillEffect)
12
+ if pillEffectName ~= nil then
13
+ return pillEffectName
14
+ end
15
+ local itemConfigPillEffect = itemConfig:GetPillEffect(pillEffect)
16
+ if itemConfigPillEffect == nil then
17
+ return defaultName
18
+ end
19
+ return itemConfigPillEffect.Name
20
+ end
21
+ return ____exports
@@ -31,7 +31,8 @@ export declare function getAzazelBrimstoneDistance(playerOrTearHeight: EntityPla
31
31
  export declare function getClosestPlayer(position: Vector): EntityPlayer;
32
32
  /**
33
33
  * Most characters have a 56 frame death animation (i.e. the "Death" animation).
34
- * The Lost and Tainted Lost use a 38 frame death animation (i.e. the "LostDeath" animation).
34
+ * The Lost and Tainted Lost have a 38 frame death animation (i.e. the "LostDeath" animation).
35
+ * Tainted Forgotten have a 20 frame death animation (i.e. the "ForgottenDeath" animation).
35
36
  */
36
37
  export declare function getDeathAnimationName(player: EntityPlayer): string;
37
38
  /**
@@ -2,6 +2,8 @@
2
2
  require("lualib_bundle");
3
3
  local ____exports = {}
4
4
  local EXCLUDED_CHARACTERS
5
+ local ____constants = require("constants")
6
+ local LOST_STYLE_PLAYER_TYPES = ____constants.LOST_STYLE_PLAYER_TYPES
5
7
  local ____HealthType = require("types.HealthType")
6
8
  local HealthType = ____HealthType.HealthType
7
9
  local ____PocketItemType = require("types.PocketItemType")
@@ -23,18 +25,18 @@ function ____exports.getPlayers(self, performExclusions)
23
25
  do
24
26
  local player = Isaac.GetPlayer(i)
25
27
  if player == nil then
26
- goto __continue53
28
+ goto __continue55
27
29
  end
28
30
  if ____exports.isChildPlayer(nil, player) then
29
- goto __continue53
31
+ goto __continue55
30
32
  end
31
33
  local character = player:GetPlayerType()
32
34
  if performExclusions and EXCLUDED_CHARACTERS:has(character) then
33
- goto __continue53
35
+ goto __continue55
34
36
  end
35
37
  __TS__ArrayPush(players, player)
36
38
  end
37
- ::__continue53::
39
+ ::__continue55::
38
40
  i = i + 1
39
41
  end
40
42
  end
@@ -135,8 +137,13 @@ function ____exports.getClosestPlayer(self, position)
135
137
  end
136
138
  function ____exports.getDeathAnimationName(self, player)
137
139
  local character = player:GetPlayerType()
138
- local isLostTypeCharacter = (((character == PlayerType.PLAYER_THELOST) or (character == PlayerType.PLAYER_THELOST_B)) or (character == PlayerType.PLAYER_THESOUL)) or (character == PlayerType.PLAYER_THESOUL_B)
139
- return (isLostTypeCharacter and "LostDeath") or "Death"
140
+ if LOST_STYLE_PLAYER_TYPES:has(character) then
141
+ return "LostDeath"
142
+ end
143
+ if character == PlayerType.PLAYER_THEFORGOTTEN_B then
144
+ return "ForgottenDeath"
145
+ end
146
+ return "Death"
140
147
  end
141
148
  function ____exports.getLastHeart(self, player)
142
149
  local hearts = player:GetHearts()
@@ -272,14 +279,14 @@ function ____exports.getPlayerIndexVanilla(self, playerToFind)
272
279
  do
273
280
  local player = Isaac.GetPlayer(i)
274
281
  if player == nil then
275
- goto __continue62
282
+ goto __continue64
276
283
  end
277
284
  local playerHash = GetPtrHash(player)
278
285
  if playerHash == playerToFindHash then
279
286
  return i
280
287
  end
281
288
  end
282
- ::__continue62::
289
+ ::__continue64::
283
290
  i = i + 1
284
291
  end
285
292
  end
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@ export * from "./features/saveDataManager/exports";
10
10
  export { hasSirenStolenFamiliar, setFamiliarNoSirenSteal, } from "./features/sirenHelpers";
11
11
  export * from "./functions/array";
12
12
  export * from "./functions/bitwise";
13
- export * from "./functions/card";
13
+ export * from "./functions/cards";
14
14
  export * from "./functions/charge";
15
15
  export * from "./functions/collectibles";
16
16
  export * from "./functions/collectibleSet";
@@ -29,9 +29,9 @@ export * from "./functions/log";
29
29
  export * from "./functions/math";
30
30
  export * from "./functions/npc";
31
31
  export * from "./functions/pickups";
32
+ export * from "./functions/pills";
32
33
  export * from "./functions/player";
33
34
  export * from "./functions/playerHealth";
34
- export * from "./functions/pocketItems";
35
35
  export * from "./functions/position";
36
36
  export * from "./functions/random";
37
37
  export * from "./functions/revive";
package/dist/index.lua CHANGED
@@ -93,7 +93,7 @@ do
93
93
  end
94
94
  end
95
95
  do
96
- local ____export = require("functions.card")
96
+ local ____export = require("functions.cards")
97
97
  for ____exportKey, ____exportValue in pairs(____export) do
98
98
  if ____exportKey ~= "default" then
99
99
  ____exports[____exportKey] = ____exportValue
@@ -239,7 +239,7 @@ do
239
239
  end
240
240
  end
241
241
  do
242
- local ____export = require("functions.player")
242
+ local ____export = require("functions.pills")
243
243
  for ____exportKey, ____exportValue in pairs(____export) do
244
244
  if ____exportKey ~= "default" then
245
245
  ____exports[____exportKey] = ____exportValue
@@ -247,7 +247,7 @@ do
247
247
  end
248
248
  end
249
249
  do
250
- local ____export = require("functions.playerHealth")
250
+ local ____export = require("functions.player")
251
251
  for ____exportKey, ____exportValue in pairs(____export) do
252
252
  if ____exportKey ~= "default" then
253
253
  ____exports[____exportKey] = ____exportValue
@@ -255,7 +255,7 @@ do
255
255
  end
256
256
  end
257
257
  do
258
- local ____export = require("functions.pocketItems")
258
+ local ____export = require("functions.playerHealth")
259
259
  for ____exportKey, ____exportValue in pairs(____export) do
260
260
  if ____exportKey ~= "default" then
261
261
  ____exports[____exportKey] = ____exportValue
@@ -0,0 +1,2 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare const CARD_DESCRIPTION_MAP: Map<Card, string>;
@@ -0,0 +1,5 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ require("lualib_bundle");
3
+ local ____exports = {}
4
+ ____exports.CARD_DESCRIPTION_MAP = __TS__New(Map, {{1, "Where journey begins"}, {2, "May you never miss your goal"}, {3, "Mother is watching you"}, {4, "May your rage bring power"}, {5, "Challenge me!"}, {6, "Two prayers for the lost"}, {7, "May you prosper and be in good health"}, {8, "May nothing stand before you"}, {9, "May your future become balanced"}, {10, "May you see what life has to offer"}, {11, "Spin the wheel of destiny"}, {12, "May your power bring rage"}, {13, "May you find enlightenment "}, {14, "Lay waste to all that oppose you "}, {15, "May you be pure in heart"}, {16, "Revel in the power of darkness"}, {17, "Destruction brings creation"}, {18, "May you find what you desire "}, {19, "May you find all you have lost"}, {20, "May the light heal and enlighten you"}, {21, "Judge lest ye be judged"}, {22, "Open your eyes and see"}, {23, "Item multiplier"}, {24, "Item multiplier"}, {25, "Item multiplier"}, {26, "Item multiplier"}, {27, "Convert all"}, {28, "Convert all"}, {29, "Convert all"}, {30, "Convert all"}, {31, "???"}, {32, "Destruction"}, {33, "Abundance"}, {34, "Passage"}, {35, "Purity"}, {36, "Vision"}, {37, "Change"}, {38, "Companionship"}, {39, "Resistance"}, {40, "???"}, {41, "Void"}, {42, "???"}, {43, "Charge it!"}, {44, "???"}, {45, "Something stinks..."}, {46, "A true ending?"}, {47, "Open Sesame"}, {48, "Double active"}, {49, "D6 + D20"}, {50, "Help from above"}, {51, "You feel protected"}, {52, "Become immense!"}, {53, "Draw 3 cards"}, {54, "Savor the moment"}, {55, "It still glows faintly"}, {56, "Let go and move on"}, {57, "May no harm come to you"}, {58, "Run"}, {59, "May your love bring protection"}, {60, "May you find a worthy opponent"}, {61, "Two prayers for the forgotten"}, {62, "May your heart shatter into pieces"}, {63, "May nothing walk past you"}, {64, "May your sins come back to torment you"}, {65, "May you see the value of all things in life"}, {66, "Throw the dice of fate"}, {67, "May you break their resolve"}, {68, "May your greed know no bounds"}, {69, "May life spring forth from the fallen"}, {70, "May your hunger be satiated"}, {71, "Bask in the light of your mercy"}, {72, "Creation brings destruction"}, {73, "May your loss bring fortune"}, {74, "May you remember lost memories"}, {75, "May the darkness swallow all around you"}, {76, "May you redeem those found wanting"}, {77, "Step into the abyss"}, {78, "???"}, {79, "<3"}, {80, "Again"}, {81, "Reroll... or not"}, {82, "Give me your love!"}, {83, "Opens the unopenable"}, {84, "Right behind you"}, {85, "Chemical warfare"}, {86, "Your very own murder"}, {87, "Slay a thousand"}, {88, "Demon rage!"}, {89, "Life after death"}, {90, "Embrace chaos"}, {91, "Leave your body behind"}, {92, "Motherhood"}, {93, "$$$"}, {94, "Bringer of calamity"}, {95, "Skeletal protector"}, {96, "Friends from beyond"}, {97, "Bound by blood"}})
5
+ return ____exports
@@ -1,2 +1,2 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
- export declare const TRINKET_DESCRIPTION_MAP: Map<CollectibleType, string>;
2
+ export declare const TRINKET_DESCRIPTION_MAP: Map<TrinketType, string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.478",
3
+ "version": "1.0.482",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",