isaacscript-common 30.9.0 → 30.10.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.
Files changed (54) hide show
  1. package/dist/index.rollup.d.ts +114 -83
  2. package/dist/isaacscript-common.lua +163 -98
  3. package/dist/src/arrays/cachedEnumValues.d.ts +2 -2
  4. package/dist/src/arrays/cachedEnumValues.d.ts.map +1 -1
  5. package/dist/src/arrays/cachedEnumValues.lua +3 -3
  6. package/dist/src/classes/ModUpgraded.d.ts +2 -2
  7. package/dist/src/classes/ModUpgraded.d.ts.map +1 -1
  8. package/dist/src/classes/callbacks/PostPlayerChangeStat.d.ts +2 -2
  9. package/dist/src/classes/callbacks/PostPlayerChangeStat.d.ts.map +1 -1
  10. package/dist/src/classes/callbacks/PostPlayerChangeStat.lua +2 -2
  11. package/dist/src/classes/features/other/EdenStartingStats.d.ts +30 -0
  12. package/dist/src/classes/features/other/EdenStartingStats.d.ts.map +1 -0
  13. package/dist/src/classes/features/other/EdenStartingStats.lua +54 -0
  14. package/dist/src/enums/ISCFeature.d.ts +29 -28
  15. package/dist/src/enums/ISCFeature.d.ts.map +1 -1
  16. package/dist/src/enums/ISCFeature.lua +30 -28
  17. package/dist/src/enums/{StatType.d.ts → PlayerStat.d.ts} +2 -2
  18. package/dist/src/enums/PlayerStat.d.ts.map +1 -0
  19. package/dist/src/enums/PlayerStat.lua +30 -0
  20. package/dist/src/features.d.ts +31 -28
  21. package/dist/src/features.d.ts.map +1 -1
  22. package/dist/src/features.lua +3 -0
  23. package/dist/src/functions/playerStats.d.ts +5 -3
  24. package/dist/src/functions/playerStats.d.ts.map +1 -1
  25. package/dist/src/functions/playerStats.lua +23 -18
  26. package/dist/src/index.d.ts +2 -2
  27. package/dist/src/index.d.ts.map +1 -1
  28. package/dist/src/index.lua +6 -6
  29. package/dist/src/interfaces/PlayerStats.d.ts +22 -0
  30. package/dist/src/interfaces/PlayerStats.d.ts.map +1 -0
  31. package/dist/src/interfaces/PlayerStats.lua +4 -0
  32. package/dist/src/interfaces/private/AddCallbackParametersCustom.d.ts +3 -3
  33. package/dist/src/interfaces/private/AddCallbackParametersCustom.d.ts.map +1 -1
  34. package/dist/src/shouldFire.d.ts +2 -2
  35. package/dist/src/shouldFire.d.ts.map +1 -1
  36. package/package.json +2 -2
  37. package/src/arrays/cachedEnumValues.ts +3 -2
  38. package/src/classes/ModUpgraded.ts +8 -4
  39. package/src/classes/callbacks/PostPlayerChangeStat.ts +4 -4
  40. package/src/classes/features/other/EdenStartingStats.ts +87 -0
  41. package/src/enums/ISCFeature.ts +1 -0
  42. package/src/enums/{StatType.ts → PlayerStat.ts} +1 -1
  43. package/src/features.ts +3 -0
  44. package/src/functions/playerStats.ts +25 -21
  45. package/src/index.ts +2 -2
  46. package/src/interfaces/PlayerStats.ts +22 -0
  47. package/src/interfaces/private/AddCallbackParametersCustom.ts +6 -6
  48. package/src/shouldFire.ts +2 -2
  49. package/dist/src/enums/StatType.d.ts.map +0 -1
  50. package/dist/src/enums/StatType.lua +0 -30
  51. package/dist/src/interfaces/StatTypeType.d.ts +0 -22
  52. package/dist/src/interfaces/StatTypeType.d.ts.map +0 -1
  53. package/dist/src/interfaces/StatTypeType.lua +0 -4
  54. package/src/interfaces/StatTypeType.ts +0 -22
@@ -491,7 +491,7 @@ declare interface AddCallbackParametersCustom {
491
491
  character?: PlayerType
492
492
  ];
493
493
  [ModCallbackCustom.POST_PLAYER_CHANGE_STAT]: [
494
- callback: <T extends StatType>(player: EntityPlayer, statType: StatType, difference: int, oldValue: StatTypeType[T], newValue: StatTypeType[T]) => void,
494
+ callback: <T extends PlayerStat>(player: EntityPlayer, playerStat: PlayerStat, difference: int, oldValue: PlayerStats[T], newValue: PlayerStats[T]) => void,
495
495
  playerVariant?: PlayerVariant,
496
496
  character?: PlayerType
497
497
  ];
@@ -3877,6 +3877,32 @@ export declare function easeOutQuint(time: number): number;
3877
3877
  */
3878
3878
  export declare function easeOutSine(time: number): number;
3879
3879
 
3880
+ declare class EdenStartingStats extends Feature {
3881
+ /**
3882
+ * We must use the `POST_PLAYER_INIT` callback since the two random collectibles have not been
3883
+ * granted yet.
3884
+ */
3885
+ private postPlayerInit;
3886
+ /**
3887
+ * Helper function to get the value of the randomized starting stat for Eden. (At the beginning of
3888
+ * a run, Eden starts with randomized stats.)
3889
+ *
3890
+ * Returns undefined if passed a player that is not Eden.
3891
+ *
3892
+ * In order to use this function, you must upgrade your mod with `ISCFeature.EDEN_STARTING_STATS`.
3893
+ */
3894
+ getEdenStartingStat<T extends PlayerStat>(player: EntityPlayer, playerStat: T): PlayerStats[T] | undefined;
3895
+ /**
3896
+ * Helper function to get all of the stat values that Eden started with at the beginning of the
3897
+ * run.
3898
+ *
3899
+ * Returns undefined if passed a player that is not Eden.
3900
+ *
3901
+ * In order to use this function, you must upgrade your mod with `ISCFeature.EDEN_STARTING_STATS`.
3902
+ */
3903
+ getEdenStartingStats(player: EntityPlayer): Readonly<PlayerStats> | undefined;
3904
+ }
3905
+
3880
3906
  /**
3881
3907
  * When Eggies take fatal damage, they go into NPCState.STATE_SUICIDE and spawn 14 Swarm Spiders
3882
3908
  * while their StateFrame ticks upwards. The 14th spider appears when the StateFrame is at this
@@ -5968,7 +5994,10 @@ export declare function getPlayersOnKeyboard(): EntityPlayer[];
5968
5994
  export declare function getPlayerSoulHearts(player: EntityPlayer): int;
5969
5995
 
5970
5996
  /** Helper function to get the stat for a player corresponding to the `StatType`. */
5971
- export declare function getPlayerStat<T extends StatType>(player: EntityPlayer, statType: T): StatTypeType[T];
5997
+ export declare function getPlayerStat<T extends PlayerStat>(player: EntityPlayer, playerStat: T): PlayerStats[T];
5998
+
5999
+ /** Helper function to get all of the stat for a player. */
6000
+ export declare function getPlayerStats(player: EntityPlayer): PlayerStats;
5972
6001
 
5973
6002
  /**
5974
6003
  * Helper function to get only the players that have a certain collectible.
@@ -7752,34 +7781,35 @@ export declare enum ISCFeature {
7752
7781
  DEPLOY_JSON_ROOM = 24,
7753
7782
  DISABLE_ALL_SOUND = 25,
7754
7783
  DISABLE_INPUTS = 26,
7755
- FADE_IN_REMOVER = 27,
7756
- FAST_RESET = 28,
7757
- FLYING_DETECTION = 29,
7758
- FORGOTTEN_SWITCH = 30,
7759
- EXTRA_CONSOLE_COMMANDS = 31,
7760
- ITEM_POOL_DETECTION = 32,
7761
- MODDED_ELEMENT_DETECTION = 33,
7762
- MODDED_ELEMENT_SETS = 34,
7763
- NO_SIREN_STEAL = 35,
7764
- PAUSE = 36,
7765
- PERSISTENT_ENTITIES = 37,
7766
- PICKUP_INDEX_CREATION = 38,
7767
- PLAYER_INVENTORY = 39,
7768
- PONY_DETECTION = 40,
7769
- PRESS_INPUT = 41,
7770
- PREVENT_CHILD_ENTITIES = 42,
7771
- PREVENT_COLLECTIBLE_ROTATION = 43,
7772
- PREVENT_GRID_ENTITY_RESPAWN = 44,
7773
- ROOM_CLEAR_FRAME = 45,
7774
- ROOM_HISTORY = 46,
7775
- RUN_IN_N_FRAMES = 47,
7776
- RUN_NEXT_ROOM = 48,
7777
- SAVE_DATA_MANAGER = 49,
7778
- SPAWN_ALT_ROCK_REWARDS = 50,
7779
- SPAWN_COLLECTIBLE = 51,
7780
- STAGE_HISTORY = 52,
7781
- START_AMBUSH = 53,
7782
- TAINTED_LAZARUS_PLAYERS = 54
7784
+ EDEN_STARTING_STATS = 27,
7785
+ FADE_IN_REMOVER = 28,
7786
+ FAST_RESET = 29,
7787
+ FLYING_DETECTION = 30,
7788
+ FORGOTTEN_SWITCH = 31,
7789
+ EXTRA_CONSOLE_COMMANDS = 32,
7790
+ ITEM_POOL_DETECTION = 33,
7791
+ MODDED_ELEMENT_DETECTION = 34,
7792
+ MODDED_ELEMENT_SETS = 35,
7793
+ NO_SIREN_STEAL = 36,
7794
+ PAUSE = 37,
7795
+ PERSISTENT_ENTITIES = 38,
7796
+ PICKUP_INDEX_CREATION = 39,
7797
+ PLAYER_INVENTORY = 40,
7798
+ PONY_DETECTION = 41,
7799
+ PRESS_INPUT = 42,
7800
+ PREVENT_CHILD_ENTITIES = 43,
7801
+ PREVENT_COLLECTIBLE_ROTATION = 44,
7802
+ PREVENT_GRID_ENTITY_RESPAWN = 45,
7803
+ ROOM_CLEAR_FRAME = 46,
7804
+ ROOM_HISTORY = 47,
7805
+ RUN_IN_N_FRAMES = 48,
7806
+ RUN_NEXT_ROOM = 49,
7807
+ SAVE_DATA_MANAGER = 50,
7808
+ SPAWN_ALT_ROCK_REWARDS = 51,
7809
+ SPAWN_COLLECTIBLE = 52,
7810
+ STAGE_HISTORY = 53,
7811
+ START_AMBUSH = 54,
7812
+ TAINTED_LAZARUS_PLAYERS = 55
7783
7813
  }
7784
7814
 
7785
7815
  /**
@@ -7816,6 +7846,7 @@ declare interface ISCFeatureToClass {
7816
7846
  [ISCFeature.DEPLOY_JSON_ROOM]: DeployJSONRoom;
7817
7847
  [ISCFeature.DISABLE_ALL_SOUND]: DisableAllSound;
7818
7848
  [ISCFeature.DISABLE_INPUTS]: DisableInputs;
7849
+ [ISCFeature.EDEN_STARTING_STATS]: EdenStartingStats;
7819
7850
  [ISCFeature.FADE_IN_REMOVER]: FadeInRemover;
7820
7851
  [ISCFeature.FAST_RESET]: FastReset;
7821
7852
  [ISCFeature.FLYING_DETECTION]: FlyingDetection;
@@ -12702,8 +12733,8 @@ export declare class ModUpgraded implements Mod {
12702
12733
  private callbacks;
12703
12734
  private features;
12704
12735
  constructor(mod: Mod, debug: boolean, timeThreshold?: float);
12705
- AddCallback<T extends ModCallback | string>(modCallback: T, ...args: T extends ModCallback ? AddCallbackParameters[T] : unknown[]): void;
12706
- AddPriorityCallback<T extends ModCallback | string>(modCallback: T, priority: CallbackPriority | int, ...args: T extends ModCallback ? AddCallbackParameters[T] : unknown[]): void;
12736
+ AddCallback<T extends keyof AddCallbackParameters | string>(modCallback: T, ...args: T extends keyof AddCallbackParameters ? AddCallbackParameters[T] : unknown[]): void;
12737
+ AddPriorityCallback<T extends keyof AddCallbackParameters | string>(modCallback: T, priority: CallbackPriority | int, ...args: T extends keyof AddCallbackParameters ? AddCallbackParameters[T] : unknown[]): void;
12707
12738
  HasData(): boolean;
12708
12739
  LoadData(): string;
12709
12740
  RemoveCallback<T extends ModCallback>(modCallback: T, callback: AddCallbackParameters[T][0]): void;
@@ -13463,6 +13494,56 @@ declare class PlayerReorderedCallbacks extends Feature {
13463
13494
  private postGameStartedReorderedLast;
13464
13495
  }
13465
13496
 
13497
+ /** This represents the kinds of stats that a player can have. */
13498
+ export declare enum PlayerStat {
13499
+ /** Corresponds to `CacheFlag.DAMAGE` (1 << 0) and `EntityPlayer.Damage`. */
13500
+ DAMAGE = 0,
13501
+ /** Corresponds to `CacheFlag.FIRE_DELAY` (1 << 1) and `EntityPlayer.MaxFireDelay`. */
13502
+ FIRE_DELAY = 1,
13503
+ /** Corresponds to `CacheFlag.SHOT_SPEED` (1 << 2) and `EntityPlayer.ShotSpeed`. */
13504
+ SHOT_SPEED = 2,
13505
+ /** Corresponds to `CacheFlag.RANGE` (1 << 3) and `EntityPlayer.TearHeight`. */
13506
+ TEAR_HEIGHT = 3,
13507
+ /** Corresponds to `CacheFlag.RANGE` (1 << 3) and `EntityPlayer.TearRange`. */
13508
+ TEAR_RANGE = 4,
13509
+ /** Corresponds to `CacheFlag.RANGE` (1 << 3) and `EntityPlayer.TearFallingAcceleration`. */
13510
+ TEAR_FALLING_ACCELERATION = 5,
13511
+ /** Corresponds to `CacheFlag.RANGE` (1 << 3) and `EntityPlayer.TearFallingSpeed`. */
13512
+ TEAR_FALLING_SPEED = 6,
13513
+ /** Corresponds to `CacheFlag.SPEED` (1 << 4) and `EntityPlayer.MoveSpeed`. */
13514
+ MOVE_SPEED = 7,
13515
+ /** Corresponds to `CacheFlag.TEAR_FLAG` (1 << 5) and `EntityPlayer.TearFlags`. */
13516
+ TEAR_FLAG = 8,
13517
+ /** Corresponds to `CacheFlag.TEAR_COLOR` (1 << 6) and `EntityPlayer.TearColor`. */
13518
+ TEAR_COLOR = 9,
13519
+ /** Corresponds to `CacheFlag.FLYING` (1 << 7) and `EntityPlayer.CanFly`. */
13520
+ FLYING = 10,
13521
+ /** Corresponds to `CacheFlag.LUCK` (1 << 10) and `EntityPlayer.Luck`. */
13522
+ LUCK = 11,
13523
+ /** Corresponds to `CacheFlag.SIZE` (1 << 11) and `EntityPlayer.SpriteScale`. */
13524
+ SIZE = 12
13525
+ }
13526
+
13527
+ /**
13528
+ * Contains every player stat along with its corresponding data type. For example, `StatType.DAMAGE`
13529
+ * is a `float` type.
13530
+ */
13531
+ export declare interface PlayerStats {
13532
+ [PlayerStat.DAMAGE]: float;
13533
+ [PlayerStat.FIRE_DELAY]: float;
13534
+ [PlayerStat.SHOT_SPEED]: float;
13535
+ [PlayerStat.TEAR_HEIGHT]: float;
13536
+ [PlayerStat.TEAR_RANGE]: float;
13537
+ [PlayerStat.TEAR_FALLING_ACCELERATION]: float;
13538
+ [PlayerStat.TEAR_FALLING_SPEED]: float;
13539
+ [PlayerStat.MOVE_SPEED]: float;
13540
+ [PlayerStat.TEAR_FLAG]: BitFlags<TearFlag>;
13541
+ [PlayerStat.TEAR_COLOR]: Color;
13542
+ [PlayerStat.FLYING]: boolean;
13543
+ [PlayerStat.LUCK]: float;
13544
+ [PlayerStat.SIZE]: Vector;
13545
+ }
13546
+
13466
13547
  /** This is used by the `getPocketItems` and related helper functions. */
13467
13548
  export declare interface PocketItemDescription {
13468
13549
  slot: PocketItemSlot;
@@ -15568,7 +15649,7 @@ source: EntityRef,
15568
15649
  countdownFrames: int
15569
15650
  ] | [
15570
15651
  player: EntityPlayer,
15571
- statType: StatType,
15652
+ playerStat: PlayerStat,
15572
15653
  difference: int,
15573
15654
  oldValue: PossibleStatType,
15574
15655
  newValue: PossibleStatType
@@ -16340,56 +16421,6 @@ export declare type StartsWithLowercase<S> = S extends string ? Extract<S, Uncap
16340
16421
  /** Helper type to ensure that the given string starts with an uppercase letter. */
16341
16422
  export declare type StartsWithUppercase<S> = S extends string ? Extract<S, Capitalize<S>> : never;
16342
16423
 
16343
- /** This represents the kinds of stats that a player can have. */
16344
- export declare enum StatType {
16345
- /** Corresponds to `CacheFlag.DAMAGE` (1 << 0) and `EntityPlayer.Damage`. */
16346
- DAMAGE = 0,
16347
- /** Corresponds to `CacheFlag.FIRE_DELAY` (1 << 1) and `EntityPlayer.MaxFireDelay`. */
16348
- FIRE_DELAY = 1,
16349
- /** Corresponds to `CacheFlag.SHOT_SPEED` (1 << 2) and `EntityPlayer.ShotSpeed`. */
16350
- SHOT_SPEED = 2,
16351
- /** Corresponds to `CacheFlag.RANGE` (1 << 3) and `EntityPlayer.TearHeight`. */
16352
- TEAR_HEIGHT = 3,
16353
- /** Corresponds to `CacheFlag.RANGE` (1 << 3) and `EntityPlayer.TearRange`. */
16354
- TEAR_RANGE = 4,
16355
- /** Corresponds to `CacheFlag.RANGE` (1 << 3) and `EntityPlayer.TearFallingAcceleration`. */
16356
- TEAR_FALLING_ACCELERATION = 5,
16357
- /** Corresponds to `CacheFlag.RANGE` (1 << 3) and `EntityPlayer.TearFallingSpeed`. */
16358
- TEAR_FALLING_SPEED = 6,
16359
- /** Corresponds to `CacheFlag.SPEED` (1 << 4) and `EntityPlayer.MoveSpeed`. */
16360
- MOVE_SPEED = 7,
16361
- /** Corresponds to `CacheFlag.TEAR_FLAG` (1 << 5) and `EntityPlayer.TearFlags`. */
16362
- TEAR_FLAG = 8,
16363
- /** Corresponds to `CacheFlag.TEAR_COLOR` (1 << 6) and `EntityPlayer.TearColor`. */
16364
- TEAR_COLOR = 9,
16365
- /** Corresponds to `CacheFlag.FLYING` (1 << 7) and `EntityPlayer.CanFly`. */
16366
- FLYING = 10,
16367
- /** Corresponds to `CacheFlag.LUCK` (1 << 10) and `EntityPlayer.Luck`. */
16368
- LUCK = 11,
16369
- /** Corresponds to `CacheFlag.SIZE` (1 << 11) and `EntityPlayer.SpriteScale`. */
16370
- SIZE = 12
16371
- }
16372
-
16373
- /**
16374
- * This is an interface mapping a stat type to the data type. For example, `StatType.DAMAGE` is a
16375
- * `float` type.
16376
- */
16377
- export declare interface StatTypeType {
16378
- [StatType.DAMAGE]: float;
16379
- [StatType.FIRE_DELAY]: float;
16380
- [StatType.SHOT_SPEED]: float;
16381
- [StatType.TEAR_HEIGHT]: float;
16382
- [StatType.TEAR_RANGE]: float;
16383
- [StatType.TEAR_FALLING_ACCELERATION]: float;
16384
- [StatType.TEAR_FALLING_SPEED]: float;
16385
- [StatType.MOVE_SPEED]: float;
16386
- [StatType.TEAR_FLAG]: BitFlags<TearFlag>;
16387
- [StatType.TEAR_COLOR]: Color;
16388
- [StatType.FLYING]: boolean;
16389
- [StatType.LUCK]: float;
16390
- [StatType.SIZE]: Vector;
16391
- }
16392
-
16393
16424
  /**
16394
16425
  * Helper function to manually stop every vanilla sound effect. If you also want to stop custom
16395
16426
  * sound effects in addition to vanilla ones, then pass the `SoundEffectCustom` enum for your mod.