isaacscript-common 47.2.0 → 47.4.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 +17 -0
- package/dist/isaacscript-common.lua +23 -1
- package/dist/src/arrays/cachedEnumValues.d.ts +2 -1
- package/dist/src/arrays/cachedEnumValues.d.ts.map +1 -1
- package/dist/src/arrays/cachedEnumValues.lua +2 -0
- package/dist/src/functions/run.d.ts +14 -0
- package/dist/src/functions/run.d.ts.map +1 -1
- package/dist/src/functions/run.lua +26 -0
- package/package.json +1 -1
- package/src/arrays/cachedEnumValues.ts +3 -0
- package/src/functions/run.ts +32 -0
package/dist/index.rollup.d.ts
CHANGED
|
@@ -74,6 +74,7 @@ import { RoomShape } from 'isaac-typescript-definitions';
|
|
|
74
74
|
import { RoomTransitionAnim } from 'isaac-typescript-definitions';
|
|
75
75
|
import { RoomType } from 'isaac-typescript-definitions';
|
|
76
76
|
import type { SackSubType } from 'isaac-typescript-definitions';
|
|
77
|
+
import { SeedEffect } from 'isaac-typescript-definitions';
|
|
77
78
|
import type { SlotVariant } from 'isaac-typescript-definitions';
|
|
78
79
|
import type { StageID } from 'isaac-typescript-definitions';
|
|
79
80
|
import { StageType } from 'isaac-typescript-definitions';
|
|
@@ -979,6 +980,9 @@ export declare function angleToDirection(angleDegrees: int): Direction;
|
|
|
979
980
|
/** Helper type to represent any class. (This is the same type as any class constructor.) */
|
|
980
981
|
export declare type AnyClass = new () => object;
|
|
981
982
|
|
|
983
|
+
/** Alias for the `anySeedEffectEnabled` function. */
|
|
984
|
+
export declare function anyEasterEggEnabled(): boolean;
|
|
985
|
+
|
|
982
986
|
/**
|
|
983
987
|
* A type union that matches `Entity`, `EntityBomb`, `EntityEffect`, and so on.
|
|
984
988
|
*
|
|
@@ -1051,6 +1055,11 @@ export declare function anyPlayerHoldingItem(): boolean;
|
|
|
1051
1055
|
*/
|
|
1052
1056
|
export declare function anyPlayerIs(...matchingCharacters: PlayerType[]): boolean;
|
|
1053
1057
|
|
|
1058
|
+
/**
|
|
1059
|
+
* Helper function to see if any seed effects (i.e. Easter Eggs) are enabled for the current run.
|
|
1060
|
+
*/
|
|
1061
|
+
export declare function anySeedEffectEnabled(): boolean;
|
|
1062
|
+
|
|
1054
1063
|
declare type Arr<N extends number, T extends unknown[] = []> = T["length"] extends N ? T : Arr<N, [...T, unknown]>;
|
|
1055
1064
|
|
|
1056
1065
|
declare type Arr_2<N extends number, T extends unknown[] = []> = T["length"] extends N ? T : Arr_2<N, [...T, unknown]>;
|
|
@@ -1347,6 +1356,9 @@ export declare function canPlayerCrushRocks(player: EntityPlayer): boolean;
|
|
|
1347
1356
|
/**
|
|
1348
1357
|
* Helper function to see if the current run can unlock achievements. For example, if playing on a
|
|
1349
1358
|
* set seed or in a victory lap, achievements are disabled.
|
|
1359
|
+
*
|
|
1360
|
+
* Under the hood, this is determined by spawning a Greed Donation Machine and then seeing if it
|
|
1361
|
+
* exists before removing it.
|
|
1350
1362
|
*/
|
|
1351
1363
|
export declare function canRunUnlockAchievements(): boolean;
|
|
1352
1364
|
|
|
@@ -7301,6 +7313,11 @@ export declare function getScreenTopLeftPos(): Readonly<Vector>;
|
|
|
7301
7313
|
|
|
7302
7314
|
export declare function getScreenTopRightPos(): Readonly<Vector>;
|
|
7303
7315
|
|
|
7316
|
+
/**
|
|
7317
|
+
* Helper function to get the seed effects (i.e. Easter Eggs) that are enabled for the current run.
|
|
7318
|
+
*/
|
|
7319
|
+
export declare function getSeedEffects(): SeedEffect[];
|
|
7320
|
+
|
|
7304
7321
|
/**
|
|
7305
7322
|
* Helper function to get all possible combinations of the given set. This includes the combination
|
|
7306
7323
|
* of an empty set.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 47.
|
|
3
|
+
isaacscript-common 47.4.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -20100,6 +20100,7 @@ local PillColor = ____isaac_2Dtypescript_2Ddefinitions.PillColor
|
|
|
20100
20100
|
local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
|
|
20101
20101
|
local PocketItemSlot = ____isaac_2Dtypescript_2Ddefinitions.PocketItemSlot
|
|
20102
20102
|
local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
|
|
20103
|
+
local SeedEffect = ____isaac_2Dtypescript_2Ddefinitions.SeedEffect
|
|
20103
20104
|
local SoundEffect = ____isaac_2Dtypescript_2Ddefinitions.SoundEffect
|
|
20104
20105
|
local TrinketSlot = ____isaac_2Dtypescript_2Ddefinitions.TrinketSlot
|
|
20105
20106
|
local ____HealthType = require("src.enums.HealthType")
|
|
@@ -20126,6 +20127,7 @@ ____exports.PILL_COLOR_VALUES = getEnumValues(nil, PillColor)
|
|
|
20126
20127
|
____exports.PLAYER_FORM_VALUES = getEnumValues(nil, PlayerForm)
|
|
20127
20128
|
____exports.POCKET_ITEM_SLOT_VALUES = getEnumValues(nil, PocketItemSlot)
|
|
20128
20129
|
____exports.ROOM_SHAPE_VALUES = getEnumValues(nil, RoomShape)
|
|
20130
|
+
____exports.SEED_EFFECTS = getEnumValues(nil, SeedEffect)
|
|
20129
20131
|
____exports.SERIALIZATION_BRAND_VALUES = getEnumValues(nil, SerializationBrand)
|
|
20130
20132
|
____exports.SOUND_EFFECT_VALUES = getEnumValues(nil, SoundEffect)
|
|
20131
20133
|
____exports.PLAYER_STAT_VALUES = getEnumValues(nil, PlayerStat)
|
|
@@ -22500,11 +22502,16 @@ end
|
|
|
22500
22502
|
return ____exports
|
|
22501
22503
|
end,
|
|
22502
22504
|
["src.functions.run"] = function(...)
|
|
22505
|
+
local ____lualib = require("lualib_bundle")
|
|
22506
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
22503
22507
|
local ____exports = {}
|
|
22504
22508
|
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
22505
22509
|
local Challenge = ____isaac_2Dtypescript_2Ddefinitions.Challenge
|
|
22506
22510
|
local Difficulty = ____isaac_2Dtypescript_2Ddefinitions.Difficulty
|
|
22511
|
+
local SeedEffect = ____isaac_2Dtypescript_2Ddefinitions.SeedEffect
|
|
22507
22512
|
local SlotVariant = ____isaac_2Dtypescript_2Ddefinitions.SlotVariant
|
|
22513
|
+
local ____cachedEnumValues = require("src.arrays.cachedEnumValues")
|
|
22514
|
+
local SEED_EFFECTS = ____cachedEnumValues.SEED_EFFECTS
|
|
22508
22515
|
local ____cachedClasses = require("src.core.cachedClasses")
|
|
22509
22516
|
local game = ____cachedClasses.game
|
|
22510
22517
|
local ____constants = require("src.core.constants")
|
|
@@ -22517,12 +22524,27 @@ local ____entitiesSpecific = require("src.functions.entitiesSpecific")
|
|
|
22517
22524
|
local spawnSlot = ____entitiesSpecific.spawnSlot
|
|
22518
22525
|
local ____log = require("src.functions.log")
|
|
22519
22526
|
local log = ____log.log
|
|
22527
|
+
function ____exports.anySeedEffectEnabled(self)
|
|
22528
|
+
local seeds = game:GetSeeds()
|
|
22529
|
+
local numSeedEffects = seeds:CountSeedEffects()
|
|
22530
|
+
return numSeedEffects > 0
|
|
22531
|
+
end
|
|
22532
|
+
function ____exports.anyEasterEggEnabled(self)
|
|
22533
|
+
return ____exports.anySeedEffectEnabled(nil)
|
|
22534
|
+
end
|
|
22520
22535
|
function ____exports.canRunUnlockAchievements(self)
|
|
22521
22536
|
local greedDonationMachine = spawnSlot(nil, SlotVariant.GREED_DONATION_MACHINE, 0, VectorZero)
|
|
22522
22537
|
local canUnlockAchievements = greedDonationMachine:Exists()
|
|
22523
22538
|
greedDonationMachine:Remove()
|
|
22524
22539
|
return canUnlockAchievements
|
|
22525
22540
|
end
|
|
22541
|
+
function ____exports.getSeedEffects(self)
|
|
22542
|
+
local seeds = game:GetSeeds()
|
|
22543
|
+
return __TS__ArrayFilter(
|
|
22544
|
+
SEED_EFFECTS,
|
|
22545
|
+
function(____, seedEffect) return seedEffect ~= SeedEffect.NORMAL and seeds:HasSeedEffect(seedEffect) end
|
|
22546
|
+
)
|
|
22547
|
+
end
|
|
22526
22548
|
function ____exports.isGreedMode(self)
|
|
22527
22549
|
return game.Difficulty == Difficulty.GREED or game.Difficulty == Difficulty.GREEDIER
|
|
22528
22550
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActiveSlot, CacheFlag, ControllerIndex, DoorSlot, DoorSlotFlag, GridEntityType, GridEntityXMLType, ItemConfigCardType, ItemConfigTag, ItemPoolType, Keyboard, PillColor, PlayerForm, PocketItemSlot, RoomShape, SoundEffect, TrinketSlot } from "isaac-typescript-definitions";
|
|
1
|
+
import { ActiveSlot, CacheFlag, ControllerIndex, DoorSlot, DoorSlotFlag, GridEntityType, GridEntityXMLType, ItemConfigCardType, ItemConfigTag, ItemPoolType, Keyboard, PillColor, PlayerForm, PocketItemSlot, RoomShape, SeedEffect, SoundEffect, TrinketSlot } from "isaac-typescript-definitions";
|
|
2
2
|
import { HealthType } from "../enums/HealthType";
|
|
3
3
|
import { PlayerStat } from "../enums/PlayerStat";
|
|
4
4
|
import { SerializationBrand } from "../enums/private/SerializationBrand";
|
|
@@ -18,6 +18,7 @@ export declare const PILL_COLOR_VALUES: readonly PillColor[];
|
|
|
18
18
|
export declare const PLAYER_FORM_VALUES: readonly PlayerForm[];
|
|
19
19
|
export declare const POCKET_ITEM_SLOT_VALUES: readonly PocketItemSlot[];
|
|
20
20
|
export declare const ROOM_SHAPE_VALUES: readonly RoomShape[];
|
|
21
|
+
export declare const SEED_EFFECTS: readonly SeedEffect[];
|
|
21
22
|
export declare const SERIALIZATION_BRAND_VALUES: readonly SerializationBrand[];
|
|
22
23
|
export declare const SOUND_EFFECT_VALUES: readonly SoundEffect[];
|
|
23
24
|
export declare const PLAYER_STAT_VALUES: readonly PlayerStat[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":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B,EAAE,SAAS,cAAc,EAC9B,CAAC;AAEhC,eAAO,MAAM,2BAA2B,EAAE,SAAS,iBAAiB,EAClC,CAAC;AAEnC,eAAO,MAAM,sBAAsB,EAAE,SAAS,aAAa,EAC7B,CAAC;AAE/B,eAAO,MAAM,4BAA4B,EAAE,SAAS,kBAAkB,EACnC,CAAC;AAEpC,eAAO,MAAM,qBAAqB,EAAE,SAAS,YAAY,EAC5B,CAAC;AAE9B,eAAO,MAAM,eAAe,EAAE,SAAS,QAAQ,EAA4B,CAAC;AAE5E,eAAO,MAAM,kBAAkB,EAAE,SAAS,UAAU,EACzB,CAAC;AAE5B,eAAO,MAAM,iBAAiB,EAAE,SAAS,SAAS,EAA6B,CAAC;AAEhF,eAAO,MAAM,kBAAkB,EAAE,SAAS,UAAU,EACzB,CAAC;AAE5B,eAAO,MAAM,uBAAuB,EAAE,SAAS,cAAc,EAC9B,CAAC;AAEhC,eAAO,MAAM,iBAAiB,EAAE,SAAS,SAAS,EAA6B,CAAC;AAEhF,eAAO,MAAM,YAAY,EAAE,SAAS,UAAU,EAA8B,CAAC;AAE7E,eAAO,MAAM,0BAA0B,EAAE,SAAS,kBAAkB,EACjC,CAAC;AAEpC,eAAO,MAAM,mBAAmB,EAAE,SAAS,WAAW,EAC1B,CAAC;AAE7B,eAAO,MAAM,kBAAkB,EAAE,SAAS,UAAU,EACzB,CAAC;AAE5B,eAAO,MAAM,mBAAmB,EAAE,SAAS,WAAW,EAC1B,CAAC"}
|
|
@@ -15,6 +15,7 @@ local PillColor = ____isaac_2Dtypescript_2Ddefinitions.PillColor
|
|
|
15
15
|
local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
|
|
16
16
|
local PocketItemSlot = ____isaac_2Dtypescript_2Ddefinitions.PocketItemSlot
|
|
17
17
|
local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
|
|
18
|
+
local SeedEffect = ____isaac_2Dtypescript_2Ddefinitions.SeedEffect
|
|
18
19
|
local SoundEffect = ____isaac_2Dtypescript_2Ddefinitions.SoundEffect
|
|
19
20
|
local TrinketSlot = ____isaac_2Dtypescript_2Ddefinitions.TrinketSlot
|
|
20
21
|
local ____HealthType = require("src.enums.HealthType")
|
|
@@ -41,6 +42,7 @@ ____exports.PILL_COLOR_VALUES = getEnumValues(nil, PillColor)
|
|
|
41
42
|
____exports.PLAYER_FORM_VALUES = getEnumValues(nil, PlayerForm)
|
|
42
43
|
____exports.POCKET_ITEM_SLOT_VALUES = getEnumValues(nil, PocketItemSlot)
|
|
43
44
|
____exports.ROOM_SHAPE_VALUES = getEnumValues(nil, RoomShape)
|
|
45
|
+
____exports.SEED_EFFECTS = getEnumValues(nil, SeedEffect)
|
|
44
46
|
____exports.SERIALIZATION_BRAND_VALUES = getEnumValues(nil, SerializationBrand)
|
|
45
47
|
____exports.SOUND_EFFECT_VALUES = getEnumValues(nil, SoundEffect)
|
|
46
48
|
____exports.PLAYER_STAT_VALUES = getEnumValues(nil, PlayerStat)
|
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import type { PlayerType } from "isaac-typescript-definitions";
|
|
2
|
+
import { SeedEffect } from "isaac-typescript-definitions";
|
|
3
|
+
/** Alias for the `anySeedEffectEnabled` function. */
|
|
4
|
+
export declare function anyEasterEggEnabled(): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Helper function to see if any seed effects (i.e. Easter Eggs) are enabled for the current run.
|
|
7
|
+
*/
|
|
8
|
+
export declare function anySeedEffectEnabled(): boolean;
|
|
2
9
|
/**
|
|
3
10
|
* Helper function to see if the current run can unlock achievements. For example, if playing on a
|
|
4
11
|
* set seed or in a victory lap, achievements are disabled.
|
|
12
|
+
*
|
|
13
|
+
* Under the hood, this is determined by spawning a Greed Donation Machine and then seeing if it
|
|
14
|
+
* exists before removing it.
|
|
5
15
|
*/
|
|
6
16
|
export declare function canRunUnlockAchievements(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Helper function to get the seed effects (i.e. Easter Eggs) that are enabled for the current run.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getSeedEffects(): SeedEffect[];
|
|
7
21
|
/**
|
|
8
22
|
* Helper function to check if the difficulty of the current run is equal to `Difficulty.GREED` or
|
|
9
23
|
* `Difficulty.GREEDIER`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/functions/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/functions/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAGL,UAAU,EAEX,MAAM,8BAA8B,CAAC;AAStC,qDAAqD;AACrD,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAK9C;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAUlD;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,UAAU,EAAE,CAO7C;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAKrC;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAMnC;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI,CAkBpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAUlC"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
1
3
|
local ____exports = {}
|
|
2
4
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
3
5
|
local Challenge = ____isaac_2Dtypescript_2Ddefinitions.Challenge
|
|
4
6
|
local Difficulty = ____isaac_2Dtypescript_2Ddefinitions.Difficulty
|
|
7
|
+
local SeedEffect = ____isaac_2Dtypescript_2Ddefinitions.SeedEffect
|
|
5
8
|
local SlotVariant = ____isaac_2Dtypescript_2Ddefinitions.SlotVariant
|
|
9
|
+
local ____cachedEnumValues = require("src.arrays.cachedEnumValues")
|
|
10
|
+
local SEED_EFFECTS = ____cachedEnumValues.SEED_EFFECTS
|
|
6
11
|
local ____cachedClasses = require("src.core.cachedClasses")
|
|
7
12
|
local game = ____cachedClasses.game
|
|
8
13
|
local ____constants = require("src.core.constants")
|
|
@@ -15,14 +20,35 @@ local ____entitiesSpecific = require("src.functions.entitiesSpecific")
|
|
|
15
20
|
local spawnSlot = ____entitiesSpecific.spawnSlot
|
|
16
21
|
local ____log = require("src.functions.log")
|
|
17
22
|
local log = ____log.log
|
|
23
|
+
--- Helper function to see if any seed effects (i.e. Easter Eggs) are enabled for the current run.
|
|
24
|
+
function ____exports.anySeedEffectEnabled(self)
|
|
25
|
+
local seeds = game:GetSeeds()
|
|
26
|
+
local numSeedEffects = seeds:CountSeedEffects()
|
|
27
|
+
return numSeedEffects > 0
|
|
28
|
+
end
|
|
29
|
+
--- Alias for the `anySeedEffectEnabled` function.
|
|
30
|
+
function ____exports.anyEasterEggEnabled(self)
|
|
31
|
+
return ____exports.anySeedEffectEnabled(nil)
|
|
32
|
+
end
|
|
18
33
|
--- Helper function to see if the current run can unlock achievements. For example, if playing on a
|
|
19
34
|
-- set seed or in a victory lap, achievements are disabled.
|
|
35
|
+
--
|
|
36
|
+
-- Under the hood, this is determined by spawning a Greed Donation Machine and then seeing if it
|
|
37
|
+
-- exists before removing it.
|
|
20
38
|
function ____exports.canRunUnlockAchievements(self)
|
|
21
39
|
local greedDonationMachine = spawnSlot(nil, SlotVariant.GREED_DONATION_MACHINE, 0, VectorZero)
|
|
22
40
|
local canUnlockAchievements = greedDonationMachine:Exists()
|
|
23
41
|
greedDonationMachine:Remove()
|
|
24
42
|
return canUnlockAchievements
|
|
25
43
|
end
|
|
44
|
+
--- Helper function to get the seed effects (i.e. Easter Eggs) that are enabled for the current run.
|
|
45
|
+
function ____exports.getSeedEffects(self)
|
|
46
|
+
local seeds = game:GetSeeds()
|
|
47
|
+
return __TS__ArrayFilter(
|
|
48
|
+
SEED_EFFECTS,
|
|
49
|
+
function(____, seedEffect) return seedEffect ~= SeedEffect.NORMAL and seeds:HasSeedEffect(seedEffect) end
|
|
50
|
+
)
|
|
51
|
+
end
|
|
26
52
|
--- Helper function to check if the difficulty of the current run is equal to `Difficulty.GREED` or
|
|
27
53
|
-- `Difficulty.GREEDIER`.
|
|
28
54
|
function ____exports.isGreedMode(self)
|
package/package.json
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
PlayerForm,
|
|
17
17
|
PocketItemSlot,
|
|
18
18
|
RoomShape,
|
|
19
|
+
SeedEffect,
|
|
19
20
|
SoundEffect,
|
|
20
21
|
TrinketSlot,
|
|
21
22
|
} from "isaac-typescript-definitions";
|
|
@@ -67,6 +68,8 @@ export const POCKET_ITEM_SLOT_VALUES: readonly PocketItemSlot[] =
|
|
|
67
68
|
|
|
68
69
|
export const ROOM_SHAPE_VALUES: readonly RoomShape[] = getEnumValues(RoomShape);
|
|
69
70
|
|
|
71
|
+
export const SEED_EFFECTS: readonly SeedEffect[] = getEnumValues(SeedEffect);
|
|
72
|
+
|
|
70
73
|
export const SERIALIZATION_BRAND_VALUES: readonly SerializationBrand[] =
|
|
71
74
|
getEnumValues(SerializationBrand);
|
|
72
75
|
|
package/src/functions/run.ts
CHANGED
|
@@ -2,8 +2,10 @@ import type { PlayerType } from "isaac-typescript-definitions";
|
|
|
2
2
|
import {
|
|
3
3
|
Challenge,
|
|
4
4
|
Difficulty,
|
|
5
|
+
SeedEffect,
|
|
5
6
|
SlotVariant,
|
|
6
7
|
} from "isaac-typescript-definitions";
|
|
8
|
+
import { SEED_EFFECTS } from "../arrays/cachedEnumValues";
|
|
7
9
|
import { game } from "../core/cachedClasses";
|
|
8
10
|
import { VectorZero } from "../core/constants";
|
|
9
11
|
import { FIRST_CHARACTER } from "../core/constantsFirstLast";
|
|
@@ -11,9 +13,27 @@ import { getCharacterName } from "./characters";
|
|
|
11
13
|
import { spawnSlot } from "./entitiesSpecific";
|
|
12
14
|
import { log } from "./log";
|
|
13
15
|
|
|
16
|
+
/** Alias for the `anySeedEffectEnabled` function. */
|
|
17
|
+
export function anyEasterEggEnabled(): boolean {
|
|
18
|
+
return anySeedEffectEnabled();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Helper function to see if any seed effects (i.e. Easter Eggs) are enabled for the current run.
|
|
23
|
+
*/
|
|
24
|
+
export function anySeedEffectEnabled(): boolean {
|
|
25
|
+
const seeds = game.GetSeeds();
|
|
26
|
+
const numSeedEffects = seeds.CountSeedEffects();
|
|
27
|
+
|
|
28
|
+
return numSeedEffects > 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
14
31
|
/**
|
|
15
32
|
* Helper function to see if the current run can unlock achievements. For example, if playing on a
|
|
16
33
|
* set seed or in a victory lap, achievements are disabled.
|
|
34
|
+
*
|
|
35
|
+
* Under the hood, this is determined by spawning a Greed Donation Machine and then seeing if it
|
|
36
|
+
* exists before removing it.
|
|
17
37
|
*/
|
|
18
38
|
export function canRunUnlockAchievements(): boolean {
|
|
19
39
|
const greedDonationMachine = spawnSlot(
|
|
@@ -27,6 +47,18 @@ export function canRunUnlockAchievements(): boolean {
|
|
|
27
47
|
return canUnlockAchievements;
|
|
28
48
|
}
|
|
29
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Helper function to get the seed effects (i.e. Easter Eggs) that are enabled for the current run.
|
|
52
|
+
*/
|
|
53
|
+
export function getSeedEffects(): SeedEffect[] {
|
|
54
|
+
const seeds = game.GetSeeds();
|
|
55
|
+
|
|
56
|
+
return SEED_EFFECTS.filter(
|
|
57
|
+
(seedEffect) =>
|
|
58
|
+
seedEffect !== SeedEffect.NORMAL && seeds.HasSeedEffect(seedEffect),
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
30
62
|
/**
|
|
31
63
|
* Helper function to check if the difficulty of the current run is equal to `Difficulty.GREED` or
|
|
32
64
|
* `Difficulty.GREEDIER`.
|