isaacscript-common 8.4.6 → 8.7.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/enums/ModCallbackCustom.d.ts +2 -2
- package/dist/features/characterStats.d.ts.map +1 -1
- package/dist/features/characterStats.lua +1 -2
- package/dist/features/firstLast.d.ts +6 -3
- package/dist/features/firstLast.d.ts.map +1 -1
- package/dist/features/firstLast.lua +6 -3
- package/dist/features/playerInventory.d.ts +11 -3
- package/dist/features/playerInventory.d.ts.map +1 -1
- package/dist/features/playerInventory.lua +24 -11
- package/dist/functions/bosses.d.ts +8 -2
- package/dist/functions/bosses.d.ts.map +1 -1
- package/dist/functions/bosses.lua +14 -6
- package/dist/functions/collectibleCacheFlag.d.ts +1 -1
- package/dist/functions/collectibleCacheFlag.d.ts.map +1 -1
- package/dist/functions/collectibleCacheFlag.lua +1 -2
- package/dist/functions/collectibleSet.lua +32 -32
- package/dist/functions/collectibleTag.d.ts +1 -1
- package/dist/functions/collectibleTag.d.ts.map +1 -1
- package/dist/functions/collectibleTag.lua +1 -3
- package/dist/functions/collectibles.d.ts +10 -1
- package/dist/functions/collectibles.d.ts.map +1 -1
- package/dist/functions/collectibles.lua +17 -1
- package/dist/functions/eden.d.ts +1 -1
- package/dist/functions/eden.d.ts.map +1 -1
- package/dist/functions/eden.lua +1 -2
- package/dist/functions/flying.d.ts +1 -1
- package/dist/functions/flying.d.ts.map +1 -1
- package/dist/functions/flying.lua +5 -2
- package/dist/functions/input.d.ts +2 -2
- package/dist/functions/input.d.ts.map +1 -1
- package/dist/functions/input.lua +2 -4
- package/dist/functions/playerHealth.d.ts +93 -0
- package/dist/functions/playerHealth.d.ts.map +1 -1
- package/dist/functions/playerHealth.lua +216 -33
- package/dist/functions/players.d.ts +1 -111
- package/dist/functions/players.d.ts.map +1 -1
- package/dist/functions/players.lua +20 -279
- package/dist/functions/revive.d.ts.map +1 -1
- package/dist/functions/revive.lua +2 -1
- package/dist/functions/stats.d.ts +16 -0
- package/dist/functions/stats.d.ts.map +1 -1
- package/dist/functions/stats.lua +78 -0
- package/dist/functions/transformations.d.ts +1 -1
- package/dist/functions/transformations.d.ts.map +1 -1
- package/dist/functions/trinketCacheFlag.d.ts +1 -1
- package/dist/functions/trinketCacheFlag.d.ts.map +1 -1
- package/dist/functions/trinketCacheFlag.lua +1 -3
- package/dist/functions/trinketSet.lua +32 -32
- package/dist/functions/trinkets.d.ts +14 -0
- package/dist/functions/trinkets.d.ts.map +1 -1
- package/dist/functions/trinkets.lua +26 -0
- package/dist/index.d.ts +63 -36
- package/dist/sets/bossSets.d.ts +1 -0
- package/dist/sets/bossSets.d.ts.map +1 -1
- package/dist/sets/bossSets.lua +23 -0
- package/package.json +1 -1
- package/src/enums/ModCallbackCustom.ts +2 -2
- package/src/features/characterStats.ts +1 -2
- package/src/features/firstLast.ts +6 -3
- package/src/features/playerInventory.ts +37 -8
- package/src/functions/bosses.ts +18 -6
- package/src/functions/collectibleCacheFlag.ts +3 -3
- package/src/functions/collectibleSet.ts +32 -32
- package/src/functions/collectibleTag.ts +2 -3
- package/src/functions/collectibles.ts +25 -1
- package/src/functions/eden.ts +3 -3
- package/src/functions/flying.ts +4 -4
- package/src/functions/input.ts +4 -5
- package/src/functions/playerHealth.ts +269 -7
- package/src/functions/players.ts +1 -348
- package/src/functions/revive.ts +2 -6
- package/src/functions/stats.ts +75 -0
- package/src/functions/transformations.ts +1 -1
- package/src/functions/trinketCacheFlag.ts +2 -3
- package/src/functions/trinketSet.ts +32 -32
- package/src/functions/trinkets.ts +34 -0
- package/src/sets/bossSets.ts +33 -0
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
TrinketType,
|
|
5
5
|
} from "isaac-typescript-definitions";
|
|
6
6
|
import { itemConfig } from "../core/cachedClasses";
|
|
7
|
+
import { BLIND_ITEM_PNG_PATH } from "../core/constants";
|
|
7
8
|
import {
|
|
8
9
|
FIRST_TRINKET_TYPE,
|
|
9
10
|
LAST_VANILLA_TRINKET_TYPE,
|
|
@@ -29,6 +30,7 @@ import { irange } from "./utils";
|
|
|
29
30
|
*/
|
|
30
31
|
const GOLDEN_TRINKET_ADJUSTMENT = 32768;
|
|
31
32
|
|
|
33
|
+
const TRINKET_ANM2_PATH = "gfx/005.350_trinket.anm2";
|
|
32
34
|
const TRINKET_SPRITE_LAYER = 0;
|
|
33
35
|
|
|
34
36
|
/**
|
|
@@ -95,6 +97,23 @@ export function getTrinketDescription(trinketType: TrinketType): string {
|
|
|
95
97
|
return DEFAULT_TRINKET_DESCRIPTION;
|
|
96
98
|
}
|
|
97
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Helper function to get the path to a trinket PNG file. Returns the path to the question mark
|
|
102
|
+
* sprite (i.e. from Curse of the Blind) if the provided trinket type was not valid.
|
|
103
|
+
*
|
|
104
|
+
* Note that this does not return the file name, but the full path to the trinket's PNG file. The
|
|
105
|
+
* function is named "GfxFilename" to correspond to the associated `ItemConfigItem.GfxFileName`
|
|
106
|
+
* field.
|
|
107
|
+
*/
|
|
108
|
+
export function getTrinketGfxFilename(trinketType: TrinketType): string {
|
|
109
|
+
const itemConfigItem = itemConfig.GetTrinket(trinketType);
|
|
110
|
+
if (itemConfigItem === undefined) {
|
|
111
|
+
return BLIND_ITEM_PNG_PATH;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return itemConfigItem.GfxFileName;
|
|
115
|
+
}
|
|
116
|
+
|
|
98
117
|
/**
|
|
99
118
|
* Helper function to get the name of a trinket. Returns "Unknown" if the provided trinket type is
|
|
100
119
|
* not valid.
|
|
@@ -155,6 +174,21 @@ export function isVanillaTrinketType(trinketType: TrinketType): boolean {
|
|
|
155
174
|
return trinketType <= LAST_VANILLA_TRINKET_TYPE;
|
|
156
175
|
}
|
|
157
176
|
|
|
177
|
+
/**
|
|
178
|
+
* Helper function to generate a new sprite based on a collectible. If the provided collectible type
|
|
179
|
+
* is invalid, a sprite with a Curse of the Blind question mark will be returned.
|
|
180
|
+
*/
|
|
181
|
+
export function newTrinketSprite(trinketType: TrinketType): Sprite {
|
|
182
|
+
const sprite = Sprite();
|
|
183
|
+
sprite.Load(TRINKET_ANM2_PATH, false);
|
|
184
|
+
|
|
185
|
+
const gfxFileName = getTrinketGfxFilename(trinketType);
|
|
186
|
+
sprite.ReplaceSpritesheet(TRINKET_SPRITE_LAYER, gfxFileName);
|
|
187
|
+
sprite.LoadGraphics();
|
|
188
|
+
|
|
189
|
+
return sprite;
|
|
190
|
+
}
|
|
191
|
+
|
|
158
192
|
/**
|
|
159
193
|
* Helper function to change the sprite of a trinket entity.
|
|
160
194
|
*
|
package/src/sets/bossSets.ts
CHANGED
|
@@ -29,10 +29,16 @@ import {
|
|
|
29
29
|
WarVariant,
|
|
30
30
|
WidowVariant,
|
|
31
31
|
} from "isaac-typescript-definitions";
|
|
32
|
+
import { parseEntityTypeVariantString } from "../functions/entities";
|
|
33
|
+
import { copySet } from "../functions/set";
|
|
34
|
+
import { STORY_BOSSES_SET } from "./storyBossesSet";
|
|
32
35
|
|
|
33
36
|
// The "bosspools.xml" file does not actually correspond to the real boss pools, so these sets were
|
|
34
37
|
// determined through experimentation on v1.7.8a.
|
|
35
38
|
|
|
39
|
+
// We use sets of strings instead of tuples for these data structures because TypeScript/Lua does
|
|
40
|
+
// not have real tuples. If we store bosses as tuples, then we cannot do a set lookup in O(1).
|
|
41
|
+
|
|
36
42
|
/** Contains just the bosses in Basement (not e.g. Burning Basement). */
|
|
37
43
|
const BASEMENT_BOSSES_SET: ReadonlySet<string> = new Set([
|
|
38
44
|
`${EntityType.LARRY_JR}.${LarryJrVariant.LARRY_JR}`, // 19.0
|
|
@@ -468,3 +474,30 @@ export const ALL_BOSSES_SET: ReadonlySet<string> = new Set([
|
|
|
468
474
|
...ALL_STAGE_10_BOSSES_SET.values(),
|
|
469
475
|
...ALL_STAGE_11_BOSSES_SET.values(),
|
|
470
476
|
]);
|
|
477
|
+
|
|
478
|
+
export const ALL_BOSSES_EXCLUDING_STORY_BOSSES_SET =
|
|
479
|
+
getAllBossesExcludingStoryBossesSet();
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* Since story bosses are stored by entity type, we copy the existing bosses and filter them (to
|
|
483
|
+
* avoid having to hard-code story boss variants).
|
|
484
|
+
*/
|
|
485
|
+
function getAllBossesExcludingStoryBossesSet(): ReadonlySet<string> {
|
|
486
|
+
const allBossesExcludingStoryBossesSet = copySet(ALL_BOSSES_SET);
|
|
487
|
+
const allBosses = [...ALL_BOSSES_SET.values()];
|
|
488
|
+
for (const entityTypeVariantString of allBosses) {
|
|
489
|
+
const tuple = parseEntityTypeVariantString(entityTypeVariantString);
|
|
490
|
+
if (tuple === undefined) {
|
|
491
|
+
error(
|
|
492
|
+
"Failed to parse a boss tuple when constructing the story boss set.",
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
const [entityType, _variant] = tuple;
|
|
497
|
+
if (STORY_BOSSES_SET.has(entityType)) {
|
|
498
|
+
allBossesExcludingStoryBossesSet.delete(entityTypeVariantString);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
return allBossesExcludingStoryBossesSet;
|
|
503
|
+
}
|