isaacscript-common 44.0.0 → 45.0.0
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/index.rollup.d.ts +31 -11
- package/dist/isaacscript-common.lua +5383 -5236
- package/dist/src/classes/features/other/{EdenStartingStats.d.ts → EdenStartingStatsHealth.d.ts} +17 -5
- package/dist/src/classes/features/other/EdenStartingStatsHealth.d.ts.map +1 -0
- package/dist/src/classes/features/other/EdenStartingStatsHealth.lua +75 -0
- package/dist/src/classes/features/other/ItemPoolDetection.d.ts.map +1 -1
- package/dist/src/classes/features/other/ItemPoolDetection.lua +2 -1
- package/dist/src/classes/features/other/Pause.lua +2 -2
- package/dist/src/classes/features/other/extraConsoleCommands/commands.lua +4 -3
- package/dist/src/enums/ISCFeature.d.ts +1 -1
- package/dist/src/enums/ISCFeature.d.ts.map +1 -1
- package/dist/src/enums/ISCFeature.lua +2 -2
- package/dist/src/features.d.ts +3 -3
- package/dist/src/features.d.ts.map +1 -1
- package/dist/src/features.lua +3 -3
- package/dist/src/functions/characters.d.ts +9 -2
- package/dist/src/functions/characters.d.ts.map +1 -1
- package/dist/src/functions/characters.lua +13 -4
- package/dist/src/functions/charge.lua +2 -2
- package/dist/src/functions/math.d.ts +1 -0
- package/dist/src/functions/math.d.ts.map +1 -1
- package/dist/src/functions/math.lua +1 -0
- package/dist/src/functions/playerCollectibles.d.ts +127 -0
- package/dist/src/functions/playerCollectibles.d.ts.map +1 -0
- package/dist/src/functions/playerCollectibles.lua +308 -0
- package/dist/src/functions/playerHealth.d.ts +1 -1
- package/dist/src/functions/playerHealth.d.ts.map +1 -1
- package/dist/src/functions/playerHealth.lua +10 -6
- package/dist/src/functions/playerTrinkets.d.ts +69 -0
- package/dist/src/functions/playerTrinkets.d.ts.map +1 -0
- package/dist/src/functions/playerTrinkets.lua +160 -0
- package/dist/src/functions/players.d.ts +5 -166
- package/dist/src/functions/players.d.ts.map +1 -1
- package/dist/src/functions/players.lua +20 -389
- package/dist/src/functions/trinketGive.lua +2 -2
- package/dist/src/functions/trinkets.d.ts +0 -30
- package/dist/src/functions/trinkets.d.ts.map +1 -1
- package/dist/src/functions/trinkets.lua +0 -71
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.lua +16 -0
- package/dist/src/objects/{characterStartingCollectibles.d.ts → characterStartingCollectibleTypes.d.ts} +2 -2
- package/dist/src/objects/characterStartingCollectibleTypes.d.ts.map +1 -0
- package/dist/src/objects/{characterStartingCollectibles.lua → characterStartingCollectibleTypes.lua} +1 -1
- package/dist/src/objects/characterStartingTrinketTypes.d.ts +46 -0
- package/dist/src/objects/characterStartingTrinketTypes.d.ts.map +1 -0
- package/dist/src/objects/characterStartingTrinketTypes.lua +49 -0
- package/package.json +1 -1
- package/src/classes/features/other/{EdenStartingStats.ts → EdenStartingStatsHealth.ts} +38 -5
- package/src/classes/features/other/ItemPoolDetection.ts +2 -4
- package/src/classes/features/other/Pause.ts +1 -1
- package/src/classes/features/other/extraConsoleCommands/commands.ts +3 -3
- package/src/enums/ISCFeature.ts +1 -1
- package/src/features.ts +3 -3
- package/src/functions/characters.ts +20 -4
- package/src/functions/charge.ts +1 -1
- package/src/functions/math.ts +1 -0
- package/src/functions/playerCollectibles.ts +372 -0
- package/src/functions/playerHealth.ts +23 -15
- package/src/functions/playerTrinkets.ts +184 -0
- package/src/functions/players.ts +16 -481
- package/src/functions/trinketGive.ts +1 -1
- package/src/functions/trinkets.ts +1 -84
- package/src/index.ts +2 -0
- package/src/objects/{characterStartingCollectibles.ts → characterStartingCollectibleTypes.ts} +1 -1
- package/src/objects/characterStartingTrinketTypes.ts +129 -0
- package/dist/src/classes/features/other/EdenStartingStats.d.ts.map +0 -1
- package/dist/src/classes/features/other/EdenStartingStats.lua +0 -54
- package/dist/src/objects/characterStartingCollectibles.d.ts.map +0 -1
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import type { CacheFlag } from "isaac-typescript-definitions";
|
|
2
|
-
import {
|
|
3
|
-
PlayerType,
|
|
4
|
-
TrinketSlot,
|
|
5
|
-
TrinketType,
|
|
6
|
-
} from "isaac-typescript-definitions";
|
|
7
|
-
import { TRINKET_SLOT_VALUES } from "../arrays/cachedEnumValues";
|
|
2
|
+
import { TrinketType } from "isaac-typescript-definitions";
|
|
8
3
|
import { itemConfig } from "../core/cachedClasses";
|
|
9
4
|
import { BLIND_ITEM_PNG_PATH } from "../core/constants";
|
|
10
5
|
import { LAST_VANILLA_TRINKET_TYPE } from "../core/constantsFirstLast";
|
|
@@ -21,7 +16,6 @@ import { getEntityID } from "./entities";
|
|
|
21
16
|
import { getEnumLength } from "./enums";
|
|
22
17
|
import { hasFlag } from "./flag";
|
|
23
18
|
import { isTrinket } from "./pickupVariants";
|
|
24
|
-
import { isCharacter } from "./players";
|
|
25
19
|
import { clearSprite } from "./sprites";
|
|
26
20
|
import { asNumber } from "./types";
|
|
27
21
|
|
|
@@ -84,57 +78,6 @@ export function getMysteriousPaperEffectForFrame(
|
|
|
84
78
|
return frameCount % NUM_MYSTERIOUS_PAPER_EFFECTS;
|
|
85
79
|
}
|
|
86
80
|
|
|
87
|
-
/**
|
|
88
|
-
* Returns the slot number corresponding to where a trinket can be safely inserted.
|
|
89
|
-
*
|
|
90
|
-
* For example:
|
|
91
|
-
*
|
|
92
|
-
* ```ts
|
|
93
|
-
* const player = Isaac.GetPlayer();
|
|
94
|
-
* const trinketSlot = getOpenTrinketSlotNum(player);
|
|
95
|
-
* if (trinketSlot !== undefined) {
|
|
96
|
-
* // They have one or more open trinket slots
|
|
97
|
-
* player.AddTrinket(TrinketType.SWALLOWED_PENNY);
|
|
98
|
-
* }
|
|
99
|
-
* ```
|
|
100
|
-
*/
|
|
101
|
-
export function getOpenTrinketSlot(player: EntityPlayer): int | undefined {
|
|
102
|
-
const maxTrinkets = player.GetMaxTrinkets();
|
|
103
|
-
const trinketType1 = player.GetTrinket(TrinketSlot.SLOT_1);
|
|
104
|
-
const trinketType2 = player.GetTrinket(TrinketSlot.SLOT_2);
|
|
105
|
-
|
|
106
|
-
if (maxTrinkets === 1) {
|
|
107
|
-
return trinketType1 === TrinketType.NULL ? 0 : undefined;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (maxTrinkets === 2) {
|
|
111
|
-
if (trinketType1 === TrinketType.NULL) {
|
|
112
|
-
return 0;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return trinketType2 === TrinketType.NULL ? 1 : undefined;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
error(`The player has an unknown number of trinket slots: ${maxTrinkets}`);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Helper function to get all of the trinkets that the player is currently holding. This will not
|
|
123
|
-
* include any smelted trinkets.
|
|
124
|
-
*/
|
|
125
|
-
export function getPlayerTrinkets(player: EntityPlayer): TrinketType[] {
|
|
126
|
-
const trinketTypes: TrinketType[] = [];
|
|
127
|
-
|
|
128
|
-
for (const trinketSlot of TRINKET_SLOT_VALUES) {
|
|
129
|
-
const trinketType = player.GetTrinket(trinketSlot);
|
|
130
|
-
if (trinketType !== TrinketType.NULL) {
|
|
131
|
-
trinketTypes.push(trinketType);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return trinketTypes;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
81
|
/**
|
|
139
82
|
* Helper function to get the in-game description for a trinket. Returns "Unknown" if the provided
|
|
140
83
|
* trinket type was not valid.
|
|
@@ -198,32 +141,6 @@ export function getTrinketName(trinketType: TrinketType): string {
|
|
|
198
141
|
return DEFAULT_TRINKET_NAME;
|
|
199
142
|
}
|
|
200
143
|
|
|
201
|
-
/** Helper function to check to see if the player is holding one or more trinkets. */
|
|
202
|
-
export function hasAnyTrinket(player: EntityPlayer): boolean {
|
|
203
|
-
const playerTrinketTypes = TRINKET_SLOT_VALUES.map((trinketSlot) =>
|
|
204
|
-
player.GetTrinket(trinketSlot),
|
|
205
|
-
);
|
|
206
|
-
return playerTrinketTypes.some(
|
|
207
|
-
(trinketType) => trinketType !== TrinketType.NULL,
|
|
208
|
-
);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Returns whether the player can hold an additional trinket, beyond what they are currently
|
|
213
|
-
* carrying. This takes into account items that modify the max number of trinkets, like Mom's Purse.
|
|
214
|
-
*
|
|
215
|
-
* If the player is the Tainted Soul, this always returns false, since that character cannot pick up
|
|
216
|
-
* items. (Only Tainted Forgotten can pick up items.)
|
|
217
|
-
*/
|
|
218
|
-
export function hasOpenTrinketSlot(player: EntityPlayer): boolean {
|
|
219
|
-
if (isCharacter(player, PlayerType.SOUL_B)) {
|
|
220
|
-
return false;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
const openTrinketSlot = getOpenTrinketSlot(player);
|
|
224
|
-
return openTrinketSlot !== undefined;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
144
|
export function isGoldenTrinketType(trinketType: TrinketType): boolean {
|
|
228
145
|
return asNumber(trinketType) > GOLDEN_TRINKET_ADJUSTMENT;
|
|
229
146
|
}
|
package/src/index.ts
CHANGED
|
@@ -86,9 +86,11 @@ export * from "./functions/pickups";
|
|
|
86
86
|
export * from "./functions/pickupsSpecific";
|
|
87
87
|
export * from "./functions/pills";
|
|
88
88
|
export * from "./functions/playerCenter";
|
|
89
|
+
export * from "./functions/playerCollectibles";
|
|
89
90
|
export * from "./functions/playerDataStructures";
|
|
90
91
|
export * from "./functions/playerHealth";
|
|
91
92
|
export * from "./functions/playerIndex";
|
|
93
|
+
export * from "./functions/playerTrinkets";
|
|
92
94
|
export * from "./functions/players";
|
|
93
95
|
export * from "./functions/pocketItems";
|
|
94
96
|
export * from "./functions/positionVelocity";
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { PlayerType, TrinketType } from "isaac-typescript-definitions";
|
|
2
|
+
|
|
3
|
+
export const CHARACTER_STARTING_TRINKET_TYPE = {
|
|
4
|
+
// -1
|
|
5
|
+
[PlayerType.POSSESSOR]: undefined,
|
|
6
|
+
|
|
7
|
+
// 0
|
|
8
|
+
[PlayerType.ISAAC]: undefined,
|
|
9
|
+
|
|
10
|
+
// 1
|
|
11
|
+
[PlayerType.MAGDALENE]: undefined,
|
|
12
|
+
|
|
13
|
+
// 2
|
|
14
|
+
[PlayerType.CAIN]: TrinketType.PAPER_CLIP,
|
|
15
|
+
|
|
16
|
+
// 3
|
|
17
|
+
[PlayerType.JUDAS]: undefined,
|
|
18
|
+
|
|
19
|
+
// 4
|
|
20
|
+
[PlayerType.BLUE_BABY]: undefined,
|
|
21
|
+
|
|
22
|
+
// 5
|
|
23
|
+
[PlayerType.EVE]: undefined,
|
|
24
|
+
|
|
25
|
+
// 6
|
|
26
|
+
[PlayerType.SAMSON]: TrinketType.CHILDS_HEART,
|
|
27
|
+
|
|
28
|
+
// 7
|
|
29
|
+
[PlayerType.AZAZEL]: undefined,
|
|
30
|
+
|
|
31
|
+
// 8
|
|
32
|
+
[PlayerType.LAZARUS]: undefined,
|
|
33
|
+
|
|
34
|
+
// 9
|
|
35
|
+
[PlayerType.EDEN]: undefined,
|
|
36
|
+
|
|
37
|
+
// 10
|
|
38
|
+
[PlayerType.LOST]: undefined,
|
|
39
|
+
|
|
40
|
+
// 11
|
|
41
|
+
[PlayerType.LAZARUS_2]: undefined,
|
|
42
|
+
|
|
43
|
+
// 12
|
|
44
|
+
[PlayerType.DARK_JUDAS]: undefined,
|
|
45
|
+
|
|
46
|
+
// 13
|
|
47
|
+
[PlayerType.LILITH]: undefined,
|
|
48
|
+
|
|
49
|
+
// 14
|
|
50
|
+
[PlayerType.KEEPER]: TrinketType.STORE_KEY,
|
|
51
|
+
|
|
52
|
+
// 15
|
|
53
|
+
[PlayerType.APOLLYON]: undefined,
|
|
54
|
+
|
|
55
|
+
// 16
|
|
56
|
+
[PlayerType.FORGOTTEN]: undefined,
|
|
57
|
+
|
|
58
|
+
// 17
|
|
59
|
+
[PlayerType.SOUL]: undefined,
|
|
60
|
+
|
|
61
|
+
// 18
|
|
62
|
+
[PlayerType.BETHANY]: undefined,
|
|
63
|
+
|
|
64
|
+
// 19
|
|
65
|
+
[PlayerType.JACOB]: undefined,
|
|
66
|
+
|
|
67
|
+
// 20
|
|
68
|
+
[PlayerType.ESAU]: undefined,
|
|
69
|
+
|
|
70
|
+
// 21
|
|
71
|
+
[PlayerType.ISAAC_B]: undefined,
|
|
72
|
+
|
|
73
|
+
// 22
|
|
74
|
+
[PlayerType.MAGDALENE_B]: undefined,
|
|
75
|
+
|
|
76
|
+
// 23
|
|
77
|
+
[PlayerType.CAIN_B]: undefined,
|
|
78
|
+
|
|
79
|
+
// 24
|
|
80
|
+
[PlayerType.JUDAS_B]: undefined,
|
|
81
|
+
|
|
82
|
+
// 25
|
|
83
|
+
[PlayerType.BLUE_BABY_B]: undefined,
|
|
84
|
+
|
|
85
|
+
// 26
|
|
86
|
+
[PlayerType.EVE_B]: undefined,
|
|
87
|
+
|
|
88
|
+
// 27
|
|
89
|
+
[PlayerType.SAMSON_B]: undefined,
|
|
90
|
+
|
|
91
|
+
// 28
|
|
92
|
+
[PlayerType.AZAZEL_B]: undefined,
|
|
93
|
+
|
|
94
|
+
// 29
|
|
95
|
+
[PlayerType.LAZARUS_B]: undefined,
|
|
96
|
+
|
|
97
|
+
// 30
|
|
98
|
+
[PlayerType.EDEN_B]: undefined,
|
|
99
|
+
|
|
100
|
+
// 31
|
|
101
|
+
[PlayerType.LOST_B]: undefined,
|
|
102
|
+
|
|
103
|
+
// 32
|
|
104
|
+
[PlayerType.LILITH_B]: undefined,
|
|
105
|
+
|
|
106
|
+
// 33
|
|
107
|
+
[PlayerType.KEEPER_B]: undefined,
|
|
108
|
+
|
|
109
|
+
// 34
|
|
110
|
+
[PlayerType.APOLLYON_B]: undefined,
|
|
111
|
+
|
|
112
|
+
// 35
|
|
113
|
+
[PlayerType.FORGOTTEN_B]: undefined,
|
|
114
|
+
|
|
115
|
+
// 36
|
|
116
|
+
[PlayerType.BETHANY_B]: undefined,
|
|
117
|
+
|
|
118
|
+
// 37
|
|
119
|
+
[PlayerType.JACOB_B]: undefined,
|
|
120
|
+
|
|
121
|
+
// 38
|
|
122
|
+
[PlayerType.LAZARUS_2_B]: undefined,
|
|
123
|
+
|
|
124
|
+
// 39
|
|
125
|
+
[PlayerType.JACOB_2_B]: undefined,
|
|
126
|
+
|
|
127
|
+
// 40
|
|
128
|
+
[PlayerType.SOUL_B]: undefined,
|
|
129
|
+
} as const satisfies Record<PlayerType, TrinketType | undefined>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EdenStartingStats.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/EdenStartingStats.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAO5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAQhD,qBAAa,iBAAkB,SAAQ,OAAO;IAc5C;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,cAAc,CAY7B;IAEF;;;;;;;OAOG;IAEI,mBAAmB,CAAC,CAAC,SAAS,UAAU,EAC7C,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,CAAC,GACZ,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS;IAS7B;;;;;;;OAOG;IAEI,oBAAoB,CACzB,MAAM,EAAE,YAAY,GACnB,QAAQ,CAAC,WAAW,CAAC,GAAG,SAAS;CAGrC"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
local ____lualib = require("lualib_bundle")
|
|
2
|
-
local Map = ____lualib.Map
|
|
3
|
-
local __TS__New = ____lualib.__TS__New
|
|
4
|
-
local __TS__Class = ____lualib.__TS__Class
|
|
5
|
-
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
6
|
-
local __TS__DecorateLegacy = ____lualib.__TS__DecorateLegacy
|
|
7
|
-
local ____exports = {}
|
|
8
|
-
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
9
|
-
local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
|
|
10
|
-
local ____decorators = require("src.decorators")
|
|
11
|
-
local Exported = ____decorators.Exported
|
|
12
|
-
local ____playerDataStructures = require("src.functions.playerDataStructures")
|
|
13
|
-
local mapGetPlayer = ____playerDataStructures.mapGetPlayer
|
|
14
|
-
local mapSetPlayer = ____playerDataStructures.mapSetPlayer
|
|
15
|
-
local ____players = require("src.functions.players")
|
|
16
|
-
local isEden = ____players.isEden
|
|
17
|
-
local ____stats = require("src.functions.stats")
|
|
18
|
-
local getPlayerStats = ____stats.getPlayerStats
|
|
19
|
-
local ____Feature = require("src.classes.private.Feature")
|
|
20
|
-
local Feature = ____Feature.Feature
|
|
21
|
-
local v = {run = {edenPlayerStats = __TS__New(Map)}}
|
|
22
|
-
____exports.EdenStartingStats = __TS__Class()
|
|
23
|
-
local EdenStartingStats = ____exports.EdenStartingStats
|
|
24
|
-
EdenStartingStats.name = "EdenStartingStats"
|
|
25
|
-
__TS__ClassExtends(EdenStartingStats, Feature)
|
|
26
|
-
function EdenStartingStats.prototype.____constructor(self)
|
|
27
|
-
Feature.prototype.____constructor(self)
|
|
28
|
-
self.v = v
|
|
29
|
-
self.postPlayerInit = function(____, player)
|
|
30
|
-
if not isEden(nil, player) then
|
|
31
|
-
return
|
|
32
|
-
end
|
|
33
|
-
local existingStatMap = mapGetPlayer(nil, v.run.edenPlayerStats, player)
|
|
34
|
-
if existingStatMap ~= nil then
|
|
35
|
-
return
|
|
36
|
-
end
|
|
37
|
-
local playerStats = getPlayerStats(nil, player)
|
|
38
|
-
mapSetPlayer(nil, v.run.edenPlayerStats, player, playerStats)
|
|
39
|
-
end
|
|
40
|
-
self.callbacksUsed = {{ModCallback.POST_PLAYER_INIT, self.postPlayerInit}}
|
|
41
|
-
end
|
|
42
|
-
function EdenStartingStats.prototype.getEdenStartingStat(self, player, playerStat)
|
|
43
|
-
local playerStats = mapGetPlayer(nil, v.run.edenPlayerStats, player)
|
|
44
|
-
if playerStats == nil then
|
|
45
|
-
return nil
|
|
46
|
-
end
|
|
47
|
-
return playerStats[playerStat]
|
|
48
|
-
end
|
|
49
|
-
__TS__DecorateLegacy({Exported}, EdenStartingStats.prototype, "getEdenStartingStat", true)
|
|
50
|
-
function EdenStartingStats.prototype.getEdenStartingStats(self, player)
|
|
51
|
-
return mapGetPlayer(nil, v.run.edenPlayerStats, player)
|
|
52
|
-
end
|
|
53
|
-
__TS__DecorateLegacy({Exported}, EdenStartingStats.prototype, "getEdenStartingStats", true)
|
|
54
|
-
return ____exports
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"characterStartingCollectibles.d.ts","sourceRoot":"","sources":["../../../src/objects/characterStartingCollectibles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAc,MAAM,8BAA8B,CAAC;AAE3E,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6IuB,CAAC"}
|