isaacscript-common 1.0.486 → 1.0.490
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/README.md +2 -0
- package/dist/callbacks/itemPickup.lua +2 -6
- package/dist/callbacks/postBombInitLate.lua +6 -8
- package/dist/callbacks/postCursedTeleport.lua +8 -10
- package/dist/callbacks/postEffectInitLate.lua +6 -8
- package/dist/callbacks/postEsauJr.lua +2 -4
- package/dist/callbacks/postFamiliarInitLate.lua +6 -8
- package/dist/callbacks/postFlip.lua +2 -4
- package/dist/callbacks/postGridEntity.lua +8 -18
- package/dist/callbacks/postKnifeInitLate.lua +6 -8
- package/dist/callbacks/postLaserInitLate.lua +6 -8
- package/dist/callbacks/postNPCInitLate.lua +6 -8
- package/dist/callbacks/postPickupCollect.lua +1 -5
- package/dist/callbacks/postPickupInitLate.lua +6 -8
- package/dist/callbacks/postPlayerChangeHealth.lua +9 -13
- package/dist/callbacks/postPlayerChangeType.lua +1 -5
- package/dist/callbacks/postPlayerFatalDamage.lua +2 -2
- package/dist/callbacks/postPlayerInitLate.lua +1 -5
- package/dist/callbacks/postPlayerReordered.lua +1 -1
- package/dist/callbacks/postProjectileInitLate.lua +6 -8
- package/dist/callbacks/postPurchase.lua +10 -14
- package/dist/callbacks/postSacrifice.lua +3 -3
- package/dist/callbacks/postSlotInitUpdate.lua +3 -11
- package/dist/callbacks/postSlotRenderBroken.lua +2 -8
- package/dist/callbacks/postTearInitLate.lua +6 -8
- package/dist/callbacks/postTransformation.lua +1 -5
- package/dist/callbacks/reorderedCallbacks.lua +4 -4
- package/dist/callbacks/subscriptions/postBombInitLate.lua +3 -3
- package/dist/callbacks/subscriptions/postCursedTeleport.lua +1 -1
- package/dist/callbacks/subscriptions/postCustomRevive.lua +3 -3
- package/dist/callbacks/subscriptions/postEffectInitLate.lua +3 -3
- package/dist/callbacks/subscriptions/postEsauJr.lua +1 -1
- package/dist/callbacks/subscriptions/postFamiliarInitLate.lua +3 -3
- package/dist/callbacks/subscriptions/postFirstEsauJr.lua +1 -1
- package/dist/callbacks/subscriptions/postFirstFlip.lua +1 -1
- package/dist/callbacks/subscriptions/postFlip.lua +1 -1
- package/dist/callbacks/subscriptions/postGameStartedReordered.lua +1 -1
- package/dist/callbacks/subscriptions/postGridEntityInit.lua +3 -3
- package/dist/callbacks/subscriptions/postGridEntityRemove.lua +3 -3
- package/dist/callbacks/subscriptions/postGridEntityUpdate.lua +3 -3
- package/dist/callbacks/subscriptions/postItemPickup.lua +5 -5
- package/dist/callbacks/subscriptions/postKnifeInitLate.lua +3 -3
- package/dist/callbacks/subscriptions/postLaserInitLate.lua +3 -3
- package/dist/callbacks/subscriptions/postNPCInitLate.lua +3 -3
- package/dist/callbacks/subscriptions/postNewLevelReordered.lua +1 -1
- package/dist/callbacks/subscriptions/postNewRoomReordered.lua +1 -1
- package/dist/callbacks/subscriptions/postPickupCollect.lua +3 -3
- package/dist/callbacks/subscriptions/postPickupInitLate.lua +3 -3
- package/dist/callbacks/subscriptions/postPlayerChangeHealth.lua +3 -3
- package/dist/callbacks/subscriptions/postPlayerChangeType.lua +1 -1
- package/dist/callbacks/subscriptions/postPlayerFatalDamage.lua +3 -3
- package/dist/callbacks/subscriptions/postPlayerInitLate.lua +3 -3
- package/dist/callbacks/subscriptions/postPlayerInitReordered.lua +3 -3
- package/dist/callbacks/subscriptions/postPlayerRenderReordered.lua +3 -3
- package/dist/callbacks/subscriptions/postPlayerUpdateReordered.lua +3 -3
- package/dist/callbacks/subscriptions/postProjectileInitLate.lua +3 -3
- package/dist/callbacks/subscriptions/postPurchase.lua +8 -2
- package/dist/callbacks/subscriptions/postSacrifice.lua +1 -1
- package/dist/callbacks/subscriptions/postSlotDestroyed.lua +3 -3
- package/dist/callbacks/subscriptions/postSlotInit.lua +3 -3
- package/dist/callbacks/subscriptions/postSlotRender.lua +3 -3
- package/dist/callbacks/subscriptions/postSlotUpdate.lua +3 -3
- package/dist/callbacks/subscriptions/postTearInitLate.lua +3 -3
- package/dist/callbacks/subscriptions/postTransformation.lua +3 -3
- package/dist/callbacks/subscriptions/preCustomRevive.lua +1 -1
- package/dist/callbacks/subscriptions/preItemPickup.lua +5 -5
- package/dist/constants.d.ts +0 -6
- package/dist/constants.lua +38 -6
- package/dist/features/deployJSONRoom.lua +90 -61
- package/dist/features/disableInputs.lua +9 -3
- package/dist/features/forgottenSwitch.lua +1 -1
- package/dist/features/getCollectibleItemPoolType.lua +10 -14
- package/dist/features/preventCollectibleRotate.lua +3 -9
- package/dist/features/saveDataManager/load.lua +2 -6
- package/dist/features/saveDataManager/main.lua +1 -1
- package/dist/features/saveDataManager/merge.lua +2 -4
- package/dist/features/sirenHelpers.lua +5 -5
- package/dist/functions/array.d.ts +19 -7
- package/dist/functions/array.lua +32 -19
- package/dist/functions/bitwise.lua +1 -1
- package/dist/functions/cards.d.ts +17 -11
- package/dist/functions/cards.lua +40 -30
- package/dist/functions/charge.lua +10 -12
- package/dist/functions/collectibles.d.ts +23 -2
- package/dist/functions/collectibles.lua +26 -21
- package/dist/functions/color.lua +9 -1
- package/dist/functions/deepCopy.lua +42 -22
- package/dist/functions/deepCopyTests.lua +12 -20
- package/dist/functions/doors.lua +7 -19
- package/dist/functions/entity.lua +7 -1
- package/dist/functions/flag.lua +1 -1
- package/dist/functions/gridEntity.lua +15 -10
- package/dist/functions/input.lua +14 -18
- package/dist/functions/jsonRoom.lua +3 -9
- package/dist/functions/language.lua +9 -1
- package/dist/functions/log.lua +18 -46
- package/dist/functions/math.lua +15 -17
- package/dist/functions/npc.lua +15 -17
- package/dist/functions/pickups.d.ts +7 -2
- package/dist/functions/pickups.lua +19 -3
- package/dist/functions/pills.d.ts +1 -1
- package/dist/functions/player.lua +25 -47
- package/dist/functions/playerHealth.lua +19 -9
- package/dist/functions/pocketItems.lua +10 -10
- package/dist/functions/random.lua +2 -2
- package/dist/functions/revive.lua +4 -4
- package/dist/functions/rooms.lua +15 -18
- package/dist/functions/spawnCollectible.lua +10 -2
- package/dist/functions/sprite.lua +2 -2
- package/dist/functions/stage.lua +6 -6
- package/dist/functions/tears.lua +1 -1
- package/dist/functions/transformations.lua +4 -10
- package/dist/functions/trinketGive.lua +2 -2
- package/dist/functions/trinkets.d.ts +6 -2
- package/dist/functions/trinkets.lua +3 -5
- package/dist/functions/ui.lua +3 -3
- package/dist/functions/util.lua +4 -8
- package/dist/functions/vector.lua +8 -8
- package/dist/index.d.ts +3 -0
- package/dist/index.lua +24 -0
- package/dist/lualib_bundle.lua +603 -555
- package/dist/maps/cardDescriptionMap.lua +99 -1
- package/dist/maps/cardNameMap.lua +99 -1
- package/dist/maps/collectibleDescriptionMap.lua +722 -1
- package/dist/maps/collectibleNameMap.lua +722 -1
- package/dist/maps/gridEntityXMLMap.d.ts +6 -0
- package/dist/maps/gridEntityXMLMap.lua +40 -0
- package/dist/maps/pillEffectNameMap.lua +52 -1
- package/dist/maps/roomTypeToItemPoolMap.d.ts +2 -0
- package/dist/maps/roomTypeToItemPoolMap.lua +19 -0
- package/dist/maps/transformationMap.lua +19 -12
- package/dist/maps/trinketDescriptionMap.lua +190 -1
- package/dist/maps/trinketNameMap.lua +190 -1
- package/dist/sets/cards.d.ts +25 -0
- package/dist/sets/cards.lua +106 -0
- package/dist/types/ModUpgraded.lua +82 -166
- package/dist/types/PocketItemDescription.d.ts +1 -0
- package/package.json +5 -5
|
@@ -23,15 +23,15 @@ function checkReturnFamiliarToPlayer(self, npc)
|
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
function blacklistEntryExists(self, incomingFamiliarVariant, incomingFamiliarSubType)
|
|
26
|
+
local familiarSubType
|
|
27
|
+
local familiarVariant
|
|
26
28
|
for ____, ____value in ipairs(v.run.familiarBlacklist) do
|
|
27
|
-
local familiarVariant
|
|
28
29
|
familiarVariant = ____value[1]
|
|
29
|
-
local familiarSubType
|
|
30
30
|
familiarSubType = ____value[2]
|
|
31
|
-
if
|
|
31
|
+
if incomingFamiliarVariant == familiarVariant and familiarSubType == incomingFamiliarSubType then
|
|
32
32
|
return true
|
|
33
33
|
end
|
|
34
|
-
if
|
|
34
|
+
if incomingFamiliarVariant == familiarVariant and familiarSubType == nil then
|
|
35
35
|
return true
|
|
36
36
|
end
|
|
37
37
|
end
|
|
@@ -59,7 +59,7 @@ local function getSirenHelper(self, familiar)
|
|
|
59
59
|
local familiarHash = GetPtrHash(familiar)
|
|
60
60
|
local sirenHelpers = Isaac.FindByType(EntityType.ENTITY_SIREN_HELPER)
|
|
61
61
|
for ____, sirenHelper in ipairs(sirenHelpers) do
|
|
62
|
-
if
|
|
62
|
+
if sirenHelper.Target ~= nil and GetPtrHash(sirenHelper.Target) == familiarHash then
|
|
63
63
|
return sirenHelper
|
|
64
64
|
end
|
|
65
65
|
end
|
|
@@ -28,16 +28,28 @@ export declare function arrayShuffleInPlace<T>(array: T[], seed?: number): void;
|
|
|
28
28
|
export declare function arraySum(array: int[]): int;
|
|
29
29
|
export declare function arrayToString<T>(array: T[]): string;
|
|
30
30
|
/**
|
|
31
|
-
* Shallow copies and removes the specified element from the array. Returns the copied array. If
|
|
32
|
-
* specified element
|
|
31
|
+
* Shallow copies and removes the specified element(s) from the array. Returns the copied array. If
|
|
32
|
+
* the specified element(s) are not found in the array, it will simply return a shallow copy of the
|
|
33
|
+
* array.
|
|
34
|
+
*
|
|
35
|
+
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
33
36
|
*/
|
|
34
|
-
export declare function arrayRemove<T>(originalArray: T[],
|
|
37
|
+
export declare function arrayRemove<T>(originalArray: T[], ...elements: T[]): T[];
|
|
35
38
|
/**
|
|
36
|
-
* Removes the specified element from the array. If the specified element
|
|
37
|
-
* this function will do nothing. Returns whether or not
|
|
39
|
+
* Removes the specified element(s) from the array. If the specified element(s) are not found in the
|
|
40
|
+
* array, this function will do nothing. Returns whether or not one or more elements were found.
|
|
41
|
+
*
|
|
42
|
+
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
43
|
+
*/
|
|
44
|
+
export declare function arrayRemoveInPlace<T>(array: T[], ...elements: T[]): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Helper function to get a random element from the provided array.
|
|
47
|
+
*
|
|
48
|
+
* @param array The array to get an element from.
|
|
49
|
+
* @param seed Optional. The seed used to select the random element. `Random()` by default.
|
|
50
|
+
* @param exceptions Optional. An array of elements to skip over if selected.
|
|
38
51
|
*/
|
|
39
|
-
export declare function
|
|
40
|
-
export declare function getRandomArrayElement<T>(array: T[], seed?: number): T;
|
|
52
|
+
export declare function getRandomArrayElement<T>(array: T[], seed?: number, exceptions?: T[]): T;
|
|
41
53
|
export declare function getRandomArrayIndex<T>(array: T[], seed?: number): int;
|
|
42
54
|
/**
|
|
43
55
|
* Since Lua uses tables for every non-primitive data structure, it is non-trivial to determine if a
|
package/dist/functions/array.lua
CHANGED
|
@@ -14,7 +14,9 @@ function ____exports.arrayShuffleInPlace(self, array, seed)
|
|
|
14
14
|
currentIndex = currentIndex - 1
|
|
15
15
|
seed = nextSeed(nil, seed)
|
|
16
16
|
randomIndex = ____exports.getRandomArrayIndex(nil, array, seed)
|
|
17
|
-
|
|
17
|
+
local ____temp_0 = {array[randomIndex + 1], array[currentIndex + 1]}
|
|
18
|
+
array[currentIndex + 1] = ____temp_0[1]
|
|
19
|
+
array[randomIndex + 1] = ____temp_0[2]
|
|
18
20
|
end
|
|
19
21
|
end
|
|
20
22
|
function ____exports.getRandomArrayIndex(self, array, seed)
|
|
@@ -68,9 +70,7 @@ function ____exports.arrayShuffle(self, originalArray, seed)
|
|
|
68
70
|
if seed == nil then
|
|
69
71
|
seed = Random()
|
|
70
72
|
end
|
|
71
|
-
local array = {
|
|
72
|
-
table.unpack(originalArray)
|
|
73
|
-
}
|
|
73
|
+
local array = {table.unpack(originalArray)}
|
|
74
74
|
____exports.arrayShuffleInPlace(nil, array, seed)
|
|
75
75
|
return array
|
|
76
76
|
end
|
|
@@ -91,28 +91,41 @@ function ____exports.arrayToString(self, array)
|
|
|
91
91
|
end
|
|
92
92
|
return ("[" .. table.concat(strings, ", " or ",")) .. "]"
|
|
93
93
|
end
|
|
94
|
-
function ____exports.arrayRemove(self, originalArray,
|
|
95
|
-
local
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
function ____exports.arrayRemove(self, originalArray, ...)
|
|
95
|
+
local elements = {...}
|
|
96
|
+
local array = {table.unpack(originalArray)}
|
|
97
|
+
for ____, element in ipairs(elements) do
|
|
98
|
+
local index = __TS__ArrayIndexOf(array, element)
|
|
99
|
+
__TS__ArraySplice(array, index, 1)
|
|
100
|
+
end
|
|
100
101
|
return array
|
|
101
102
|
end
|
|
102
|
-
function ____exports.arrayRemoveInPlace(self, array,
|
|
103
|
-
local
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
function ____exports.arrayRemoveInPlace(self, array, ...)
|
|
104
|
+
local elements = {...}
|
|
105
|
+
local removedOneOrMoreElements = false
|
|
106
|
+
for ____, element in ipairs(elements) do
|
|
107
|
+
local index = __TS__ArrayIndexOf(array, element)
|
|
108
|
+
if index > -1 then
|
|
109
|
+
removedOneOrMoreElements = true
|
|
110
|
+
__TS__ArraySplice(array, index, 1)
|
|
111
|
+
end
|
|
106
112
|
end
|
|
107
|
-
|
|
108
|
-
return true
|
|
113
|
+
return removedOneOrMoreElements
|
|
109
114
|
end
|
|
110
|
-
function ____exports.getRandomArrayElement(self, array, seed)
|
|
115
|
+
function ____exports.getRandomArrayElement(self, array, seed, exceptions)
|
|
111
116
|
if seed == nil then
|
|
112
117
|
seed = Random()
|
|
113
118
|
end
|
|
114
|
-
|
|
115
|
-
|
|
119
|
+
if exceptions == nil then
|
|
120
|
+
exceptions = {}
|
|
121
|
+
end
|
|
122
|
+
local arrayWithoutExceptions = ____exports.arrayRemove(
|
|
123
|
+
nil,
|
|
124
|
+
array,
|
|
125
|
+
table.unpack(exceptions)
|
|
126
|
+
)
|
|
127
|
+
local randomIndex = ____exports.getRandomArrayIndex(nil, arrayWithoutExceptions, seed)
|
|
128
|
+
return arrayWithoutExceptions[randomIndex + 1]
|
|
116
129
|
end
|
|
117
130
|
function ____exports.isArray(self, ____table)
|
|
118
131
|
local metatable = getmetatable(____table)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Helper function to get a card name from a Card.
|
|
4
4
|
*
|
|
5
5
|
* Example:
|
|
6
6
|
* ```
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export declare function getCardDescription(card: Card | int): string;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Helper function to get a card name from a Card.
|
|
14
14
|
*
|
|
15
15
|
* Example:
|
|
16
16
|
* ```
|
|
@@ -21,25 +21,31 @@ export declare function getCardDescription(card: Card | int): string;
|
|
|
21
21
|
export declare function getCardName(card: Card | int): string;
|
|
22
22
|
/**
|
|
23
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.
|
|
24
|
+
* not return any runes or objects like Dice Shard.
|
|
25
|
+
*
|
|
26
|
+
* @param seed Optional. The seed with which to select the random card. `Random()` by default.
|
|
27
|
+
* @param exceptions Optional. An array of cards to not select.
|
|
25
28
|
*/
|
|
26
|
-
export declare function getRandomCard(seed?: number): Card;
|
|
29
|
+
export declare function getRandomCard(seed?: number, exceptions?: Card[]): Card;
|
|
27
30
|
/**
|
|
28
31
|
* Has an equal chance of returning any rune (e.g. Rune of Hagalaz, Blank Rune, Black Rune, Soul of
|
|
29
32
|
* Isaac, etc.). This will never return a Rune Shard.
|
|
33
|
+
*
|
|
34
|
+
* @param seed Optional. The seed with which to select the random rune. `Random()` by default.
|
|
35
|
+
* @param exceptions Optional. An array of runes to not select.
|
|
30
36
|
*/
|
|
31
|
-
export declare function getRandomRune(seed?: number): Card;
|
|
37
|
+
export declare function getRandomRune(seed?: number, exceptions?: Card[]): Card;
|
|
32
38
|
/**
|
|
33
|
-
* Returns true for entries in the Card enum that are not a rune
|
|
34
|
-
* Fool, Wild Card, etc.).
|
|
39
|
+
* Returns true for entries in the Card enum that are not a rune and not an object (e.g. Fool,
|
|
40
|
+
* Reverse Fool, Wild Card, etc.).
|
|
35
41
|
*/
|
|
36
42
|
export declare function isCard(card: Card): boolean;
|
|
37
43
|
/**
|
|
38
|
-
* Returns true for entries in the Card enum that are
|
|
44
|
+
* Returns true for entries in the Card enum that are an object (like Dice Shard).
|
|
39
45
|
*/
|
|
40
|
-
export declare function
|
|
46
|
+
export declare function isPocketItemObject(card: Card): boolean;
|
|
41
47
|
/**
|
|
42
|
-
* Returns true for entries in the Card enum that are a rune
|
|
43
|
-
* Black Rune, Rune Shard, Soul of Isaac, etc.)
|
|
48
|
+
* Returns true for entries in the Card enum that are a rune (e.g. Rune of Hagalaz, Blank Rune,
|
|
49
|
+
* Black Rune, Rune Shard, Soul of Isaac, etc.).
|
|
44
50
|
*/
|
|
45
51
|
export declare function isRune(card: Card): boolean;
|
package/dist/functions/cards.lua
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
require("lualib_bundle");
|
|
2
3
|
local ____exports = {}
|
|
3
4
|
local ____cardDescriptionMap = require("maps.cardDescriptionMap")
|
|
4
5
|
local CARD_DESCRIPTION_MAP = ____cardDescriptionMap.CARD_DESCRIPTION_MAP
|
|
5
6
|
local ____cardNameMap = require("maps.cardNameMap")
|
|
6
7
|
local CARD_NAME_MAP = ____cardNameMap.CARD_NAME_MAP
|
|
7
|
-
local
|
|
8
|
-
local
|
|
9
|
-
local
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
8
|
+
local ____cards = require("sets.cards")
|
|
9
|
+
local CARDS = ____cards.CARDS
|
|
10
|
+
local CARD_SET = ____cards.CARD_SET
|
|
11
|
+
local POCKET_ITEM_OBJECT_SET = ____cards.POCKET_ITEM_OBJECT_SET
|
|
12
|
+
local RUNES = ____cards.RUNES
|
|
13
|
+
local RUNE_SET = ____cards.RUNE_SET
|
|
14
|
+
local ____array = require("functions.array")
|
|
15
|
+
local arrayRemove = ____array.arrayRemove
|
|
16
|
+
local getRandomArrayElement = ____array.getRandomArrayElement
|
|
19
17
|
function ____exports.getCardDescription(self, card)
|
|
20
18
|
local itemConfig = Isaac.GetItemConfig()
|
|
21
19
|
local defaultDescription = "Unknown"
|
|
@@ -48,30 +46,42 @@ function ____exports.getCardName(self, card)
|
|
|
48
46
|
end
|
|
49
47
|
return itemConfigCard.Name
|
|
50
48
|
end
|
|
51
|
-
function ____exports.getRandomCard(self, seed)
|
|
49
|
+
function ____exports.getRandomCard(self, seed, exceptions)
|
|
52
50
|
if seed == nil then
|
|
53
51
|
seed = Random()
|
|
54
52
|
end
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
if exceptions == nil then
|
|
54
|
+
exceptions = {}
|
|
55
|
+
end
|
|
56
|
+
local cardsWithoutExceptions = arrayRemove(
|
|
57
|
+
nil,
|
|
58
|
+
CARDS,
|
|
59
|
+
table.unpack(exceptions)
|
|
60
|
+
)
|
|
61
|
+
return getRandomArrayElement(nil, cardsWithoutExceptions, seed)
|
|
63
62
|
end
|
|
64
|
-
function ____exports.getRandomRune(self, seed)
|
|
63
|
+
function ____exports.getRandomRune(self, seed, exceptions)
|
|
65
64
|
if seed == nil then
|
|
66
65
|
seed = Random()
|
|
67
66
|
end
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
if exceptions == nil then
|
|
68
|
+
exceptions = {}
|
|
69
|
+
end
|
|
70
|
+
__TS__ArrayPush(exceptions, Card.RUNE_SHARD)
|
|
71
|
+
local runesWithoutExceptions = arrayRemove(
|
|
72
|
+
nil,
|
|
73
|
+
RUNES,
|
|
74
|
+
table.unpack(exceptions)
|
|
75
|
+
)
|
|
76
|
+
return getRandomArrayElement(nil, runesWithoutExceptions, seed)
|
|
77
|
+
end
|
|
78
|
+
function ____exports.isCard(self, card)
|
|
79
|
+
return CARD_SET:has(card)
|
|
80
|
+
end
|
|
81
|
+
function ____exports.isPocketItemObject(self, card)
|
|
82
|
+
return POCKET_ITEM_OBJECT_SET:has(card)
|
|
83
|
+
end
|
|
84
|
+
function ____exports.isRune(self, card)
|
|
85
|
+
return RUNE_SET:has(card)
|
|
76
86
|
end
|
|
77
87
|
return ____exports
|
|
@@ -43,19 +43,19 @@ function getNumChargesToAdd(self, player, activeSlot, ignoreBigRoomDoubleCharge)
|
|
|
43
43
|
local batteryCharge = player:GetBatteryCharge(activeSlot)
|
|
44
44
|
local hasBattery = player:HasCollectible(CollectibleType.COLLECTIBLE_BATTERY)
|
|
45
45
|
local maxCharges = getCollectibleMaxCharges(nil, activeItem)
|
|
46
|
-
if
|
|
46
|
+
if not hasBattery and activeCharge == maxCharges then
|
|
47
47
|
return 0
|
|
48
48
|
end
|
|
49
|
-
if hasBattery and
|
|
49
|
+
if hasBattery and batteryCharge == maxCharges then
|
|
50
50
|
return 0
|
|
51
51
|
end
|
|
52
|
-
if
|
|
52
|
+
if not hasBattery and activeCharge + 1 == maxCharges then
|
|
53
53
|
return 1
|
|
54
54
|
end
|
|
55
|
-
if hasBattery and
|
|
55
|
+
if hasBattery and batteryCharge + 1 == maxCharges then
|
|
56
56
|
return 1
|
|
57
57
|
end
|
|
58
|
-
if
|
|
58
|
+
if roomShape >= RoomShape.ROOMSHAPE_2x2 and not ignoreBigRoomDoubleCharge then
|
|
59
59
|
return 2
|
|
60
60
|
end
|
|
61
61
|
return 1
|
|
@@ -70,10 +70,10 @@ function getNumChargesWithAAAModifier(self, player, activeSlot, chargesToAdd)
|
|
|
70
70
|
if not hasAAABattery then
|
|
71
71
|
return chargesToAdd
|
|
72
72
|
end
|
|
73
|
-
if
|
|
73
|
+
if not hasBattery and activeCharge + chargesToAdd == maxCharges - 1 then
|
|
74
74
|
return maxCharges + 1
|
|
75
75
|
end
|
|
76
|
-
if hasBattery and
|
|
76
|
+
if hasBattery and batteryCharge + chargesToAdd == maxCharges - 1 then
|
|
77
77
|
return maxCharges + 1
|
|
78
78
|
end
|
|
79
79
|
return chargesToAdd
|
|
@@ -83,7 +83,7 @@ function ____exports.playChargeSoundEffect(self, player, activeSlot)
|
|
|
83
83
|
for ____, soundEffect in ipairs({SoundEffect.SOUND_BATTERYCHARGE, SoundEffect.SOUND_BEEP}) do
|
|
84
84
|
sfx:Stop(soundEffect)
|
|
85
85
|
end
|
|
86
|
-
local chargeSoundEffect =
|
|
86
|
+
local chargeSoundEffect = shouldPlayFullRechargeSound(nil, player, activeSlot) and SoundEffect.SOUND_BATTERYCHARGE or SoundEffect.SOUND_BEEP
|
|
87
87
|
sfx:Play(chargeSoundEffect)
|
|
88
88
|
end
|
|
89
89
|
function shouldPlayFullRechargeSound(self, player, activeSlot)
|
|
@@ -95,15 +95,13 @@ function shouldPlayFullRechargeSound(self, player, activeSlot)
|
|
|
95
95
|
if not hasBattery then
|
|
96
96
|
return not player:NeedsCharge(activeSlot)
|
|
97
97
|
end
|
|
98
|
-
return
|
|
98
|
+
return not player:NeedsCharge(activeSlot) or activeCharge == maxCharges and batteryCharge == 0
|
|
99
99
|
end
|
|
100
100
|
function ____exports.addRoomClearCharges(self, ignoreBigRoomDoubleCharge)
|
|
101
101
|
if ignoreBigRoomDoubleCharge == nil then
|
|
102
102
|
ignoreBigRoomDoubleCharge = false
|
|
103
103
|
end
|
|
104
|
-
for ____, player in ipairs(
|
|
105
|
-
getPlayers(nil)
|
|
106
|
-
) do
|
|
104
|
+
for ____, player in ipairs(getPlayers(nil)) do
|
|
107
105
|
____exports.addRoomClearCharge(nil, player, ignoreBigRoomDoubleCharge)
|
|
108
106
|
end
|
|
109
107
|
end
|
|
@@ -1,17 +1,38 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
export declare function collectibleHasTag(collectibleType: CollectibleType | int, tag: ItemConfigTag): boolean;
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Helper function to get the in-game description for a collectible. Returns "Unknown" if the
|
|
5
|
+
* provided collectible type was not valid.
|
|
6
|
+
*/
|
|
4
7
|
export declare function getCollectibleDescription(collectibleType: CollectibleType | int): string;
|
|
5
8
|
/**
|
|
6
9
|
* Helper function to get the heart cost that a collectible item would be if it were being offered
|
|
7
10
|
* in a Devil Room deal. Returns 0 if passed CollectibleType.COLLECTIBLE_NULL.
|
|
8
11
|
*/
|
|
9
12
|
export declare function getCollectibleDevilHeartPrice(collectibleType: CollectibleType | int, player: EntityPlayer): PickupPrice;
|
|
13
|
+
/**
|
|
14
|
+
* Helper function to get the path to a collectible's sprite. Returns
|
|
15
|
+
* "gfx/items/collectibles/questionmark.png" if the provided collectible type was not valid.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getCollectibleGfxFilename(collectibleType: CollectibleType | int): string;
|
|
18
|
+
/**
|
|
19
|
+
* Helper function to get the initial amount of charges that a collectible has. Returns 0 if the
|
|
20
|
+
* provided collectible type was not valid.
|
|
21
|
+
*/
|
|
10
22
|
export declare function getCollectibleInitCharges(collectibleType: CollectibleType | int): int;
|
|
23
|
+
/**
|
|
24
|
+
* Helper function to get the `ItemType` of a collectible. Returns `ItemType.ITEM_NULL` if the
|
|
25
|
+
* provided collectible type was not valid.
|
|
26
|
+
*/
|
|
11
27
|
export declare function getCollectibleItemType(collectibleType: CollectibleType | int): ItemType;
|
|
28
|
+
/**
|
|
29
|
+
* Helper function to get the maximum amount of charges that a collectible has. Returns 0 if the
|
|
30
|
+
* provided collectible type was not valid.
|
|
31
|
+
*/
|
|
12
32
|
export declare function getCollectibleMaxCharges(collectibleType: CollectibleType | int): int;
|
|
13
33
|
/**
|
|
14
|
-
*
|
|
34
|
+
* Helper function to get the name of a collectible. Returns "Unknown" if the provided collectible
|
|
35
|
+
* type is not valid.
|
|
15
36
|
*
|
|
16
37
|
* Example:
|
|
17
38
|
* ```
|
|
@@ -10,9 +10,7 @@ local ____entity = require("functions.entity")
|
|
|
10
10
|
local removeAllMatchingEntities = ____entity.removeAllMatchingEntities
|
|
11
11
|
function ____exports.setCollectibleSprite(self, collectible, pngPath)
|
|
12
12
|
if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
|
|
13
|
-
error(
|
|
14
|
-
"You cannot set a collectible sprite for pickups of variant: " .. tostring(collectible.Variant)
|
|
15
|
-
)
|
|
13
|
+
error("You cannot set a collectible sprite for pickups of variant: " .. tostring(collectible.Variant))
|
|
16
14
|
end
|
|
17
15
|
local sprite = collectible:GetSprite()
|
|
18
16
|
sprite:ReplaceSpritesheet(COLLECTIBLE_SPRITE_LAYER, pngPath)
|
|
@@ -59,8 +57,16 @@ function ____exports.getCollectibleDevilHeartPrice(self, collectibleType, player
|
|
|
59
57
|
if itemConfigItem == nil then
|
|
60
58
|
return defaultPickupPrice
|
|
61
59
|
end
|
|
62
|
-
local twoHeartPrice =
|
|
63
|
-
return
|
|
60
|
+
local twoHeartPrice = maxHearts == 2 and PickupPrice.PRICE_ONE_HEART_AND_TWO_SOULHEARTS or PickupPrice.PRICE_TWO_HEARTS
|
|
61
|
+
return itemConfigItem.DevilPrice == 2 and twoHeartPrice or PickupPrice.PRICE_ONE_HEART
|
|
62
|
+
end
|
|
63
|
+
function ____exports.getCollectibleGfxFilename(self, collectibleType)
|
|
64
|
+
local itemConfig = Isaac.GetItemConfig()
|
|
65
|
+
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
66
|
+
if itemConfigItem == nil then
|
|
67
|
+
return "unknown.png"
|
|
68
|
+
end
|
|
69
|
+
return itemConfigItem.GfxFileName
|
|
64
70
|
end
|
|
65
71
|
function ____exports.getCollectibleInitCharges(self, collectibleType)
|
|
66
72
|
local itemConfig = Isaac.GetItemConfig()
|
|
@@ -121,11 +127,11 @@ function ____exports.getMaxCollectibleID(self)
|
|
|
121
127
|
return itemConfig:GetCollectibles().Size - 1
|
|
122
128
|
end
|
|
123
129
|
function ____exports.isGlitchedCollectible(self, entity)
|
|
124
|
-
return
|
|
130
|
+
return entity.Type == EntityType.ENTITY_PICKUP and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE and entity.SubType > GLITCHED_ITEM_THRESHOLD
|
|
125
131
|
end
|
|
126
132
|
function ____exports.isPassiveCollectible(self, collectibleType)
|
|
127
133
|
local itemType = ____exports.getCollectibleItemType(nil, collectibleType)
|
|
128
|
-
return
|
|
134
|
+
return itemType == ItemType.ITEM_PASSIVE or itemType == ItemType.ITEM_FAMILIAR
|
|
129
135
|
end
|
|
130
136
|
function ____exports.isQuestCollectible(self, collectibleType)
|
|
131
137
|
return ____exports.collectibleHasTag(nil, collectibleType, 32768)
|
|
@@ -135,32 +141,31 @@ function ____exports.removeAllCollectibles(self)
|
|
|
135
141
|
end
|
|
136
142
|
function ____exports.removeCollectiblePickupDelay(self, collectible)
|
|
137
143
|
if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
|
|
138
|
-
error(
|
|
139
|
-
"You cannot remove pickup delay for pickups of variant: " .. tostring(collectible.Variant)
|
|
140
|
-
)
|
|
144
|
+
error("You cannot remove pickup delay for pickups of variant: " .. tostring(collectible.Variant))
|
|
141
145
|
end
|
|
142
146
|
collectible.Wait = 0
|
|
143
147
|
end
|
|
144
148
|
function ____exports.removeCollectibleFromItemTracker(self, collectibleType)
|
|
145
149
|
local collectibleName = ____exports.getCollectibleName(nil, collectibleType)
|
|
146
|
-
Isaac.DebugString(
|
|
147
|
-
((("Removing collectible " .. tostring(collectibleType)) .. " (") .. collectibleName) .. ") on player 0 (Player)"
|
|
148
|
-
)
|
|
150
|
+
Isaac.DebugString(((("Removing collectible " .. tostring(collectibleType)) .. " (") .. collectibleName) .. ") on player 0 (Player)")
|
|
149
151
|
end
|
|
150
152
|
function ____exports.setCollectibleBlind(self, collectible)
|
|
151
153
|
if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
|
|
152
|
-
error(
|
|
153
|
-
"You cannot set a collectible to be blind for pickups of variant: " .. tostring(collectible.Variant)
|
|
154
|
-
)
|
|
154
|
+
error("You cannot set a collectible to be blind for pickups of variant: " .. tostring(collectible.Variant))
|
|
155
155
|
end
|
|
156
156
|
____exports.setCollectibleSprite(nil, collectible, BLIND_ITEM_PNG_PATH)
|
|
157
157
|
end
|
|
158
158
|
function ____exports.setCollectibleSubType(self, collectible, newCollectibleType)
|
|
159
159
|
if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
|
|
160
|
-
error(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
160
|
+
error("You cannot set a collectible sub type for pickups of variant: " .. tostring(collectible.Variant))
|
|
161
|
+
end
|
|
162
|
+
collectible:Morph(
|
|
163
|
+
EntityType.ENTITY_PICKUP,
|
|
164
|
+
PickupVariant.PICKUP_COLLECTIBLE,
|
|
165
|
+
newCollectibleType,
|
|
166
|
+
true,
|
|
167
|
+
true,
|
|
168
|
+
true
|
|
169
|
+
)
|
|
165
170
|
end
|
|
166
171
|
return ____exports
|
package/dist/functions/color.lua
CHANGED
|
@@ -7,7 +7,15 @@ function ____exports.getDefaultKColor(self)
|
|
|
7
7
|
return KColor(1, 1, 1, 1)
|
|
8
8
|
end
|
|
9
9
|
function ____exports.copyColor(self, color)
|
|
10
|
-
return Color(
|
|
10
|
+
return Color(
|
|
11
|
+
color.R,
|
|
12
|
+
color.G,
|
|
13
|
+
color.B,
|
|
14
|
+
color.A,
|
|
15
|
+
color.RO,
|
|
16
|
+
color.GO,
|
|
17
|
+
color.BO
|
|
18
|
+
)
|
|
11
19
|
end
|
|
12
20
|
function ____exports.copyKColor(self, kColor)
|
|
13
21
|
return KColor(kColor.Red, kColor.Green, kColor.Blue, kColor.Alpha)
|