isaacscript-common 1.0.478 → 1.0.479
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.
- package/dist/functions/cards.d.ts +45 -0
- package/dist/functions/cards.lua +77 -0
- package/dist/functions/pills.d.ts +11 -0
- package/dist/functions/pills.lua +21 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.lua +4 -4
- package/dist/maps/cardDescriptionMap.d.ts +2 -0
- package/dist/maps/cardDescriptionMap.lua +5 -0
- package/dist/maps/trinketDescriptionMap.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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
|
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/
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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,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<
|
|
2
|
+
export declare const TRINKET_DESCRIPTION_MAP: Map<TrinketType, string>;
|