isaacscript-common 11.0.1 → 11.1.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.d.ts CHANGED
@@ -3611,7 +3611,7 @@ export declare function getLatestRoomDescription(): RoomDescription;
3611
3611
  * ["bar", 456],
3612
3612
  * ]);
3613
3613
  * const searchText = "f";
3614
- * const match = getMapPartialMatch(map, searchText); // match is now equal to 123
3614
+ * const match = getMapPartialMatch(map, searchText); // match is now equal to ["foo", 123]
3615
3615
  *
3616
3616
  * @returns If a match was found, returns a tuple of the map key and value. If a match was not
3617
3617
  * found, returns undefined.
@@ -6453,6 +6453,9 @@ export declare function isTear(variable: unknown): variable is EntityTear;
6453
6453
  * only use this function in the `POST_TEAR_INIT_VERY_LATE` callback or on frame 1+.
6454
6454
  *
6455
6455
  * If this function is called on frame 0, it will throw a run-time error.
6456
+ *
6457
+ * Note that this function does not work properly when the tear is from a Lead Pencil barrage. In
6458
+ * this case, it will always appear as if the tear is coming from a player.
6456
6459
  */
6457
6460
  export declare function isTearFromFamiliar(tear: EntityTear): boolean;
6458
6461
 
@@ -6466,6 +6469,9 @@ export declare function isTearFromFamiliar(tear: EntityTear): boolean;
6466
6469
  * only use this function in the `POST_TEAR_INIT_VERY_LATE` callback or on frame 1+.
6467
6470
  *
6468
6471
  * If this function is called on frame 0, it will throw a run-time error.
6472
+ *
6473
+ * Note that this function does not work properly when the tear is from a Lead Pencil barrage. In
6474
+ * this case, it will always appear as if the tear is coming from a player.
6469
6475
  */
6470
6476
  export declare function isTearFromPlayer(tear: EntityTear): boolean;
6471
6477
 
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 11.0.1
3
+ isaacscript-common 11.1.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -39258,6 +39258,9 @@ end
39258
39258
  -- only use this function in the `POST_TEAR_INIT_VERY_LATE` callback or on frame 1+.
39259
39259
  --
39260
39260
  -- If this function is called on frame 0, it will throw a run-time error.
39261
+ --
39262
+ -- Note that this function does not work properly when the tear is from a Lead Pencil barrage. In
39263
+ -- this case, it will always appear as if the tear is coming from a player.
39261
39264
  function ____exports.isTearFromFamiliar(self, tear)
39262
39265
  if tear.FrameCount == 0 then
39263
39266
  error("Failed to check if the given tear was from a player since the tear's frame count was equal to 0. (The \"isTearFromFamiliar\" function must only be used in the \"POST_TEAR_INIT_VERY_LATE\" callback or on frame 1 and onwards.)")
@@ -39277,6 +39280,9 @@ end
39277
39280
  -- only use this function in the `POST_TEAR_INIT_VERY_LATE` callback or on frame 1+.
39278
39281
  --
39279
39282
  -- If this function is called on frame 0, it will throw a run-time error.
39283
+ --
39284
+ -- Note that this function does not work properly when the tear is from a Lead Pencil barrage. In
39285
+ -- this case, it will always appear as if the tear is coming from a player.
39280
39286
  function ____exports.isTearFromPlayer(self, tear)
39281
39287
  if tear.FrameCount == 0 then
39282
39288
  error("Failed to check if the given tear was from a player since the tear's frame count was equal to 0. (The \"isTearFromPlayer\" function must only be used in the \"POST_TEAR_INIT_VERY_LATE\" callback or on frame 1 and onwards.)")
@@ -46950,7 +46956,7 @@ return ____exports
46950
46956
  ["package"] = function(...)
46951
46957
  return {
46952
46958
  name = "isaacscript-common",
46953
- version = "11.0.1",
46959
+ version = "11.1.0",
46954
46960
  description = "Helper functions and features for IsaacScript mods.",
46955
46961
  keywords = {"isaac", "rebirth", "afterbirth", "repentance"},
46956
46962
  homepage = "https://isaacscript.github.io/",
@@ -46997,7 +47003,7 @@ end
46997
47003
  -- ["bar", 456],
46998
47004
  -- ]);
46999
47005
  -- const searchText = "f";
47000
- -- const match = getMapPartialMatch(map, searchText); // match is now equal to 123
47006
+ -- const match = getMapPartialMatch(map, searchText); // match is now equal to ["foo", 123]
47001
47007
  --
47002
47008
  -- @returns If a match was found, returns a tuple of the map key and value. If a match was not
47003
47009
  -- found, returns undefined.
@@ -49818,6 +49824,142 @@ end
49818
49824
  function ____exports.isModdedPillEffect(self, pillEffect)
49819
49825
  return not ____exports.isVanillaPillEffect(nil, pillEffect)
49820
49826
  end
49827
+ return ____exports
49828
+ end,
49829
+ ["src.objects.transformationNames"] = function(...)
49830
+ local ____exports = {}
49831
+ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
49832
+ local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
49833
+ ____exports.TRANSFORMATION_NAMES = {
49834
+ [PlayerForm.GUPPY] = "Guppy",
49835
+ [PlayerForm.BEELZEBUB] = "Beelzebub",
49836
+ [PlayerForm.FUN_GUY] = "Fun Guy",
49837
+ [PlayerForm.SERAPHIM] = "Seraphim",
49838
+ [PlayerForm.BOB] = "Bob",
49839
+ [PlayerForm.SPUN] = "Spun",
49840
+ [PlayerForm.YES_MOTHER] = "Yes Mother?",
49841
+ [PlayerForm.CONJOINED] = "Conjoined",
49842
+ [PlayerForm.LEVIATHAN] = "Leviathan",
49843
+ [PlayerForm.OH_CRAP] = "Oh Crap",
49844
+ [PlayerForm.BOOKWORM] = "Bookworm",
49845
+ [PlayerForm.ADULT] = "Adult",
49846
+ [PlayerForm.SPIDER_BABY] = "Spider Baby",
49847
+ [PlayerForm.STOMPY] = "Stompy"
49848
+ }
49849
+ return ____exports
49850
+ end,
49851
+ ["src.functions.transformations"] = function(...)
49852
+ local ____lualib = require("lualib_bundle")
49853
+ local Map = ____lualib.Map
49854
+ local __TS__New = ____lualib.__TS__New
49855
+ local Set = ____lualib.Set
49856
+ local __TS__Spread = ____lualib.__TS__Spread
49857
+ local __TS__Iterator = ____lualib.__TS__Iterator
49858
+ local ____exports = {}
49859
+ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
49860
+ local ItemConfigTag = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigTag
49861
+ local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
49862
+ local ____transformationNames = require("src.objects.transformationNames")
49863
+ local TRANSFORMATION_NAMES = ____transformationNames.TRANSFORMATION_NAMES
49864
+ local ____collectibles = require("src.functions.collectibles")
49865
+ local getCollectibleTags = ____collectibles.getCollectibleTags
49866
+ local ____collectibleTag = require("src.functions.collectibleTag")
49867
+ local getCollectibleTypesWithTag = ____collectibleTag.getCollectibleTypesWithTag
49868
+ local ____enums = require("src.functions.enums")
49869
+ local getEnumValues = ____enums.getEnumValues
49870
+ local ____flag = require("src.functions.flag")
49871
+ local hasFlag = ____flag.hasFlag
49872
+ local ____players = require("src.functions.players")
49873
+ local getPlayerCollectibleCount = ____players.getPlayerCollectibleCount
49874
+ local TRANSFORMATION_TO_TAG_MAP = __TS__New(Map, {
49875
+ {PlayerForm.GUPPY, ItemConfigTag.GUPPY},
49876
+ {PlayerForm.BEELZEBUB, ItemConfigTag.FLY},
49877
+ {PlayerForm.FUN_GUY, ItemConfigTag.MUSHROOM},
49878
+ {PlayerForm.SERAPHIM, ItemConfigTag.ANGEL},
49879
+ {PlayerForm.BOB, ItemConfigTag.BOB},
49880
+ {PlayerForm.SPUN, ItemConfigTag.SYRINGE},
49881
+ {PlayerForm.YES_MOTHER, ItemConfigTag.MOM},
49882
+ {PlayerForm.CONJOINED, ItemConfigTag.BABY},
49883
+ {PlayerForm.LEVIATHAN, ItemConfigTag.DEVIL},
49884
+ {PlayerForm.OH_CRAP, ItemConfigTag.POOP},
49885
+ {PlayerForm.BOOKWORM, ItemConfigTag.BOOK},
49886
+ {PlayerForm.SPIDER_BABY, ItemConfigTag.SPIDER}
49887
+ })
49888
+ local TRANSFORMATIONS_THAT_GRANT_FLYING = __TS__New(Set, {PlayerForm.GUPPY, PlayerForm.BEELZEBUB, PlayerForm.SERAPHIM, PlayerForm.LEVIATHAN})
49889
+ --- Helper function to get all of the collectible types in the game that count towards a particular
49890
+ -- transformation.
49891
+ --
49892
+ -- For example, to get all of the collectible types that count towards Guppy:
49893
+ --
49894
+ -- ```ts
49895
+ -- const guppyCollectibleTypes = getCollectibleTypesForTransformation(PlayerForm.GUPPY);
49896
+ -- ```
49897
+ function ____exports.getCollectibleTypesForTransformation(self, playerForm)
49898
+ local itemConfigTag = TRANSFORMATION_TO_TAG_MAP:get(playerForm)
49899
+ if itemConfigTag == nil then
49900
+ error(("Failed to get the collectible types for the transformation of " .. tostring(playerForm)) .. " because that transformation is not based on collectibles.")
49901
+ end
49902
+ return getCollectibleTypesWithTag(nil, itemConfigTag)
49903
+ end
49904
+ --- Returns the number of items that a player has towards a particular transformation.
49905
+ function ____exports.getPlayerNumCollectiblesForTransformation(self, player, playerForm)
49906
+ local collectibleTypes = ____exports.getCollectibleTypesForTransformation(nil, playerForm)
49907
+ return getPlayerCollectibleCount(
49908
+ nil,
49909
+ player,
49910
+ __TS__Spread(collectibleTypes:values())
49911
+ )
49912
+ end
49913
+ --- Returns a set of the player's current transformations.
49914
+ function ____exports.getPlayerTransformations(self, player)
49915
+ local transformations = __TS__New(Set)
49916
+ for ____, playerForm in ipairs(getEnumValues(nil, PlayerForm)) do
49917
+ if player:HasPlayerForm(playerForm) then
49918
+ transformations:add(playerForm)
49919
+ end
49920
+ end
49921
+ return transformations
49922
+ end
49923
+ --- Helper function to get a transformation name from a PlayerForm enum.
49924
+ --
49925
+ -- For example:
49926
+ --
49927
+ -- ```ts
49928
+ -- const transformationName = getTransformationName(PlayerForm.LORD_OF_THE_FLIES);
49929
+ -- // transformationName is "Beelzebub"
49930
+ -- ```
49931
+ function ____exports.getTransformationName(self, playerForm)
49932
+ return TRANSFORMATION_NAMES[playerForm]
49933
+ end
49934
+ function ____exports.getTransformationsForCollectibleType(self, collectibleType)
49935
+ local itemConfigTags = getCollectibleTags(nil, collectibleType)
49936
+ local playerForms = getEnumValues(nil, PlayerForm)
49937
+ local transformationSet = __TS__New(Set)
49938
+ for ____, playerForm in ipairs(playerForms) do
49939
+ do
49940
+ local itemConfigTag = TRANSFORMATION_TO_TAG_MAP:get(playerForm)
49941
+ if itemConfigTag == nil then
49942
+ goto __continue11
49943
+ end
49944
+ if hasFlag(nil, itemConfigTags, itemConfigTag) then
49945
+ transformationSet:add(playerForm)
49946
+ end
49947
+ end
49948
+ ::__continue11::
49949
+ end
49950
+ return transformationSet
49951
+ end
49952
+ function ____exports.hasFlyingTransformation(self, player)
49953
+ for ____, playerForm in __TS__Iterator(TRANSFORMATIONS_THAT_GRANT_FLYING:values()) do
49954
+ if player:HasPlayerForm(playerForm) then
49955
+ return true
49956
+ end
49957
+ end
49958
+ return false
49959
+ end
49960
+ function ____exports.isTransformationFlying(self, playerForm)
49961
+ return TRANSFORMATIONS_THAT_GRANT_FLYING:has(playerForm)
49962
+ end
49821
49963
  return ____exports
49822
49964
  end,
49823
49965
  ["src.maps.cardNameToTypeMap"] = function(...)
@@ -50287,6 +50429,45 @@ ____exports.ROOM_NAME_TO_TYPE_MAP = __TS__New(Map, {
50287
50429
  {"blue", RoomType.BLUE},
50288
50430
  {"ultraSecret", RoomType.ULTRA_SECRET}
50289
50431
  })
50432
+ return ____exports
50433
+ end,
50434
+ ["src.maps.transformationNameToPlayerForm"] = function(...)
50435
+ local ____lualib = require("lualib_bundle")
50436
+ local Map = ____lualib.Map
50437
+ local __TS__New = ____lualib.__TS__New
50438
+ local ____exports = {}
50439
+ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
50440
+ local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
50441
+ --- Maps transformation names to the values of the `PlayerForm` enum.
50442
+ ____exports.TRANSFORMATION_NAME_TO_PLAYER_FORM_MAP = __TS__New(Map, {
50443
+ {"guppy", PlayerForm.GUPPY},
50444
+ {"cat", PlayerForm.GUPPY},
50445
+ {"beelzebub", PlayerForm.BEELZEBUB},
50446
+ {"fly", PlayerForm.BEELZEBUB},
50447
+ {"funGuy", PlayerForm.FUN_GUY},
50448
+ {"mushroom", PlayerForm.FUN_GUY},
50449
+ {"seraphim", PlayerForm.SERAPHIM},
50450
+ {"angel", PlayerForm.SERAPHIM},
50451
+ {"bob", PlayerForm.BOB},
50452
+ {"poison", PlayerForm.BOB},
50453
+ {"spun", PlayerForm.SPUN},
50454
+ {"drugs", PlayerForm.SPUN},
50455
+ {"needles", PlayerForm.SPUN},
50456
+ {"yesMother", PlayerForm.YES_MOTHER},
50457
+ {"mother", PlayerForm.YES_MOTHER},
50458
+ {"mom", PlayerForm.YES_MOTHER},
50459
+ {"conjoined", PlayerForm.CONJOINED},
50460
+ {"triple", PlayerForm.CONJOINED},
50461
+ {"leviathan", PlayerForm.LEVIATHAN},
50462
+ {"devil", PlayerForm.LEVIATHAN},
50463
+ {"ohCrap", PlayerForm.OH_CRAP},
50464
+ {"crap", PlayerForm.OH_CRAP},
50465
+ {"poop", PlayerForm.OH_CRAP},
50466
+ {"bookWorm", PlayerForm.BOOKWORM},
50467
+ {"adult", PlayerForm.ADULT},
50468
+ {"spiderBaby", PlayerForm.SPIDER_BABY},
50469
+ {"stompy", PlayerForm.STOMPY}
50470
+ })
50290
50471
  return ____exports
50291
50472
  end,
50292
50473
  ["src.maps.trinketNameToTypeMap"] = function(...)
@@ -50766,6 +50947,7 @@ local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
50766
50947
  local GridRoom = ____isaac_2Dtypescript_2Ddefinitions.GridRoom
50767
50948
  local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
50768
50949
  local PillColor = ____isaac_2Dtypescript_2Ddefinitions.PillColor
50950
+ local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
50769
50951
  local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
50770
50952
  local StageType = ____isaac_2Dtypescript_2Ddefinitions.StageType
50771
50953
  local ____cachedClasses = require("src.core.cachedClasses")
@@ -50798,6 +50980,7 @@ local ____entitiesSpecific = require("src.functions.entitiesSpecific")
50798
50980
  local getNPCs = ____entitiesSpecific.getNPCs
50799
50981
  local ____enums = require("src.functions.enums")
50800
50982
  local getEnumValues = ____enums.getEnumValues
50983
+ local getLastEnumValue = ____enums.getLastEnumValue
50801
50984
  local ____flag = require("src.functions.flag")
50802
50985
  local addFlag = ____flag.addFlag
50803
50986
  local ____gridEntities = require("src.functions.gridEntities")
@@ -50836,10 +51019,15 @@ local ____run = require("src.functions.run")
50836
51019
  local onSetSeed = ____run.onSetSeed
50837
51020
  local restart = ____run.restart
50838
51021
  local setUnseeded = ____run.setUnseeded
51022
+ local ____set = require("src.functions.set")
51023
+ local getSortedSetValues = ____set.getSortedSetValues
50839
51024
  local ____spawnCollectible = require("src.functions.spawnCollectible")
50840
51025
  local spawnCollectibleFunction = ____spawnCollectible.spawnCollectible
50841
51026
  local ____stage = require("src.functions.stage")
50842
51027
  local setStage = ____stage.setStage
51028
+ local ____transformations = require("src.functions.transformations")
51029
+ local getCollectibleTypesForTransformation = ____transformations.getCollectibleTypesForTransformation
51030
+ local getTransformationName = ____transformations.getTransformationName
50843
51031
  local ____trinkets = require("src.functions.trinkets")
50844
51032
  local getGoldenTrinketType = ____trinkets.getGoldenTrinketType
50845
51033
  local ____types = require("src.functions.types")
@@ -50860,6 +51048,8 @@ local ____pillNameToEffectMap = require("src.maps.pillNameToEffectMap")
50860
51048
  local PILL_NAME_TO_EFFECT_MAP = ____pillNameToEffectMap.PILL_NAME_TO_EFFECT_MAP
50861
51049
  local ____roomNameToTypeMap = require("src.maps.roomNameToTypeMap")
50862
51050
  local ROOM_NAME_TO_TYPE_MAP = ____roomNameToTypeMap.ROOM_NAME_TO_TYPE_MAP
51051
+ local ____transformationNameToPlayerForm = require("src.maps.transformationNameToPlayerForm")
51052
+ local TRANSFORMATION_NAME_TO_PLAYER_FORM_MAP = ____transformationNameToPlayerForm.TRANSFORMATION_NAME_TO_PLAYER_FORM_MAP
50863
51053
  local ____trinketNameToTypeMap = require("src.maps.trinketNameToTypeMap")
50864
51054
  local TRINKET_NAME_TO_TYPE_MAP = ____trinketNameToTypeMap.TRINKET_NAME_TO_TYPE_MAP
50865
51055
  local ____firstLast = require("src.features.firstLast")
@@ -50954,6 +51144,56 @@ function ____exports.startingRoom(self)
50954
51144
  local startingRoomIndex = level:GetStartingRoomIndex()
50955
51145
  changeRoom(nil, startingRoomIndex)
50956
51146
  end
51147
+ --- Gives the specified transformation. Accepts either the transformation number or the partial name
51148
+ -- of the transformation.
51149
+ --
51150
+ -- For example:
51151
+ -- - transformation 1 - Gives the Beelzebub transformation.
51152
+ -- - transformation gup - Gives the Guppy transformation.
51153
+ function ____exports.transformation(self, params)
51154
+ if params == "" then
51155
+ printConsole(nil, "You must specify a transformation name or number.")
51156
+ return
51157
+ end
51158
+ local targetPlayerForm
51159
+ local num = tonumber(params)
51160
+ if num == nil then
51161
+ local match = getMapPartialMatch(nil, params, TRANSFORMATION_NAME_TO_PLAYER_FORM_MAP)
51162
+ if match == nil then
51163
+ printConsole(nil, "Unknown transformation: " .. params)
51164
+ return
51165
+ end
51166
+ targetPlayerForm = match[2]
51167
+ else
51168
+ local lastPlayerForm = getLastEnumValue(nil, PlayerForm)
51169
+ if num < PlayerForm.GUPPY or num > lastPlayerForm then
51170
+ printConsole(
51171
+ nil,
51172
+ "Invalid transformation number: " .. tostring(num)
51173
+ )
51174
+ return
51175
+ end
51176
+ targetPlayerForm = num
51177
+ end
51178
+ local transformationName = getTransformationName(nil, targetPlayerForm)
51179
+ local player = Isaac.GetPlayer()
51180
+ local collectibleTypesSet = getCollectibleTypesForTransformation(nil, targetPlayerForm)
51181
+ local collectiblesTypes = getSortedSetValues(nil, collectibleTypesSet)
51182
+ do
51183
+ local i = 0
51184
+ while i < 3 do
51185
+ local collectibleType = collectiblesTypes[i + 1]
51186
+ if collectibleType ~= nil then
51187
+ player:AddCollectible(collectibleType)
51188
+ end
51189
+ i = i + 1
51190
+ end
51191
+ end
51192
+ printConsole(
51193
+ nil,
51194
+ ((("Gave transformation: " .. transformationName) .. " (") .. tostring(targetPlayerForm)) .. ")"
51195
+ )
51196
+ end
50957
51197
  --- Adds a single charge to the player's specified active item. You must provide the active slot
50958
51198
  -- number. Provide a second number to give a custom amount of charges. (You can use negative numbers
50959
51199
  -- to remove charge.)
@@ -51626,6 +51866,10 @@ end
51626
51866
  function ____exports.playSound(self, params)
51627
51867
  ____exports.sound(nil, params)
51628
51868
  end
51869
+ --- Alias for the "transformation" command.
51870
+ function ____exports.playerForm(self, params)
51871
+ ____exports.transformation(nil, params)
51872
+ end
51629
51873
  --- Sets the player's pocket item to the specified collectible type.
51630
51874
  function ____exports.pocket(self, params)
51631
51875
  if params == "" then
@@ -54605,142 +54849,6 @@ function ____exports.nextSeed(self, seed)
54605
54849
  rng:Next()
54606
54850
  return rng:GetSeed()
54607
54851
  end
54608
- return ____exports
54609
- end,
54610
- ["src.objects.transformationNames"] = function(...)
54611
- local ____exports = {}
54612
- local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
54613
- local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
54614
- ____exports.TRANSFORMATION_NAMES = {
54615
- [PlayerForm.GUPPY] = "Guppy",
54616
- [PlayerForm.BEELZEBUB] = "Beelzebub",
54617
- [PlayerForm.FUN_GUY] = "Fun Guy",
54618
- [PlayerForm.SERAPHIM] = "Seraphim",
54619
- [PlayerForm.BOB] = "Bob",
54620
- [PlayerForm.SPUN] = "Spun",
54621
- [PlayerForm.YES_MOTHER] = "Yes Mother?",
54622
- [PlayerForm.CONJOINED] = "Conjoined",
54623
- [PlayerForm.LEVIATHAN] = "Leviathan",
54624
- [PlayerForm.OH_CRAP] = "Oh Crap",
54625
- [PlayerForm.BOOKWORM] = "Bookworm",
54626
- [PlayerForm.ADULT] = "Adult",
54627
- [PlayerForm.SPIDER_BABY] = "Spider Baby",
54628
- [PlayerForm.STOMPY] = "Stompy"
54629
- }
54630
- return ____exports
54631
- end,
54632
- ["src.functions.transformations"] = function(...)
54633
- local ____lualib = require("lualib_bundle")
54634
- local Map = ____lualib.Map
54635
- local __TS__New = ____lualib.__TS__New
54636
- local Set = ____lualib.Set
54637
- local __TS__Spread = ____lualib.__TS__Spread
54638
- local __TS__Iterator = ____lualib.__TS__Iterator
54639
- local ____exports = {}
54640
- local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
54641
- local ItemConfigTag = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigTag
54642
- local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
54643
- local ____transformationNames = require("src.objects.transformationNames")
54644
- local TRANSFORMATION_NAMES = ____transformationNames.TRANSFORMATION_NAMES
54645
- local ____collectibles = require("src.functions.collectibles")
54646
- local getCollectibleTags = ____collectibles.getCollectibleTags
54647
- local ____collectibleTag = require("src.functions.collectibleTag")
54648
- local getCollectibleTypesWithTag = ____collectibleTag.getCollectibleTypesWithTag
54649
- local ____enums = require("src.functions.enums")
54650
- local getEnumValues = ____enums.getEnumValues
54651
- local ____flag = require("src.functions.flag")
54652
- local hasFlag = ____flag.hasFlag
54653
- local ____players = require("src.functions.players")
54654
- local getPlayerCollectibleCount = ____players.getPlayerCollectibleCount
54655
- local TRANSFORMATION_TO_TAG_MAP = __TS__New(Map, {
54656
- {PlayerForm.GUPPY, ItemConfigTag.GUPPY},
54657
- {PlayerForm.BEELZEBUB, ItemConfigTag.FLY},
54658
- {PlayerForm.FUN_GUY, ItemConfigTag.MUSHROOM},
54659
- {PlayerForm.SERAPHIM, ItemConfigTag.ANGEL},
54660
- {PlayerForm.BOB, ItemConfigTag.BOB},
54661
- {PlayerForm.SPUN, ItemConfigTag.SYRINGE},
54662
- {PlayerForm.YES_MOTHER, ItemConfigTag.MOM},
54663
- {PlayerForm.CONJOINED, ItemConfigTag.BABY},
54664
- {PlayerForm.LEVIATHAN, ItemConfigTag.DEVIL},
54665
- {PlayerForm.OH_CRAP, ItemConfigTag.POOP},
54666
- {PlayerForm.BOOKWORM, ItemConfigTag.BOOK},
54667
- {PlayerForm.SPIDER_BABY, ItemConfigTag.SPIDER}
54668
- })
54669
- local TRANSFORMATIONS_THAT_GRANT_FLYING = __TS__New(Set, {PlayerForm.GUPPY, PlayerForm.BEELZEBUB, PlayerForm.SERAPHIM, PlayerForm.LEVIATHAN})
54670
- --- Helper function to get all of the collectible types in the game that count towards a particular
54671
- -- transformation.
54672
- --
54673
- -- For example, to get all of the collectible types that count towards Guppy:
54674
- --
54675
- -- ```ts
54676
- -- const guppyCollectibleTypes = getCollectibleTypesForTransformation(PlayerForm.GUPPY);
54677
- -- ```
54678
- function ____exports.getCollectibleTypesForTransformation(self, playerForm)
54679
- local itemConfigTag = TRANSFORMATION_TO_TAG_MAP:get(playerForm)
54680
- if itemConfigTag == nil then
54681
- error(("Failed to get the collectible types for the transformation of " .. tostring(playerForm)) .. " because that transformation is not based on collectibles.")
54682
- end
54683
- return getCollectibleTypesWithTag(nil, itemConfigTag)
54684
- end
54685
- --- Returns the number of items that a player has towards a particular transformation.
54686
- function ____exports.getPlayerNumCollectiblesForTransformation(self, player, playerForm)
54687
- local collectibleTypes = ____exports.getCollectibleTypesForTransformation(nil, playerForm)
54688
- return getPlayerCollectibleCount(
54689
- nil,
54690
- player,
54691
- __TS__Spread(collectibleTypes:values())
54692
- )
54693
- end
54694
- --- Returns a set of the player's current transformations.
54695
- function ____exports.getPlayerTransformations(self, player)
54696
- local transformations = __TS__New(Set)
54697
- for ____, playerForm in ipairs(getEnumValues(nil, PlayerForm)) do
54698
- if player:HasPlayerForm(playerForm) then
54699
- transformations:add(playerForm)
54700
- end
54701
- end
54702
- return transformations
54703
- end
54704
- --- Helper function to get a transformation name from a PlayerForm enum.
54705
- --
54706
- -- For example:
54707
- --
54708
- -- ```ts
54709
- -- const transformationName = getTransformationName(PlayerForm.LORD_OF_THE_FLIES);
54710
- -- // transformationName is "Beelzebub"
54711
- -- ```
54712
- function ____exports.getTransformationName(self, playerForm)
54713
- return TRANSFORMATION_NAMES[playerForm]
54714
- end
54715
- function ____exports.getTransformationsForCollectibleType(self, collectibleType)
54716
- local itemConfigTags = getCollectibleTags(nil, collectibleType)
54717
- local playerForms = getEnumValues(nil, PlayerForm)
54718
- local transformationSet = __TS__New(Set)
54719
- for ____, playerForm in ipairs(playerForms) do
54720
- do
54721
- local itemConfigTag = TRANSFORMATION_TO_TAG_MAP:get(playerForm)
54722
- if itemConfigTag == nil then
54723
- goto __continue11
54724
- end
54725
- if hasFlag(nil, itemConfigTags, itemConfigTag) then
54726
- transformationSet:add(playerForm)
54727
- end
54728
- end
54729
- ::__continue11::
54730
- end
54731
- return transformationSet
54732
- end
54733
- function ____exports.hasFlyingTransformation(self, player)
54734
- for ____, playerForm in __TS__Iterator(TRANSFORMATIONS_THAT_GRANT_FLYING:values()) do
54735
- if player:HasPlayerForm(playerForm) then
54736
- return true
54737
- end
54738
- end
54739
- return false
54740
- end
54741
- function ____exports.isTransformationFlying(self, playerForm)
54742
- return TRANSFORMATIONS_THAT_GRANT_FLYING:has(playerForm)
54743
- end
54744
54852
  return ____exports
54745
54853
  end,
54746
54854
  ["src.functions.trinketCacheFlag"] = function(...)
package/dist/package.lua CHANGED
@@ -1,6 +1,6 @@
1
1
  return {
2
2
  name = "isaacscript-common",
3
- version = "11.0.1",
3
+ version = "11.1.0",
4
4
  description = "Helper functions and features for IsaacScript mods.",
5
5
  keywords = {"isaac", "rebirth", "afterbirth", "repentance"},
6
6
  homepage = "https://isaacscript.github.io/",
@@ -268,6 +268,8 @@ export declare function pills(): void;
268
268
  export declare function planetarium(): void;
269
269
  /** Alias for the "sound" command. */
270
270
  export declare function playSound(params: string): void;
271
+ /** Alias for the "transformation" command. */
272
+ export declare function playerForm(params: string): void;
271
273
  /** Sets the player's pocket item to the specified collectible type. */
272
274
  export declare function pocket(params: string): void;
273
275
  /**
@@ -373,6 +375,15 @@ export declare function superSecretRoom(): void;
373
375
  export declare function tears(): void;
374
376
  /** Alias for the "runTests" command. */
375
377
  export declare function tests(): void;
378
+ /**
379
+ * Gives the specified transformation. Accepts either the transformation number or the partial name
380
+ * of the transformation.
381
+ *
382
+ * For example:
383
+ * - transformation 1 - Gives the Beelzebub transformation.
384
+ * - transformation gup - Gives the Guppy transformation.
385
+ */
386
+ export declare function transformation(params: string): void;
376
387
  /** Creates a trapdoor next to the player. */
377
388
  export declare function trapdoor(): void;
378
389
  /** Warps to the first Treasure Room on the floor. */
@@ -1 +1 @@
1
- {"version":3,"file":"listCommands.d.ts","sourceRoot":"","sources":["../../../../src/features/extraConsoleCommands/listCommands.ts"],"names":[],"mappings":"AAiIA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA2C/C;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,IAAI,CAEhC;AAED,gEAAgE;AAChE,wBAAgB,MAAM,IAAI,IAAI,CAK7B;AAED,sEAAsE;AACtE,wBAAgB,OAAO,IAAI,IAAI,CAkB9B;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEhD;AAED,+CAA+C;AAC/C,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED,4CAA4C;AAC5C,wBAAgB,KAAK,IAAI,IAAI,CAG5B;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAcjD;AAED,2CAA2C;AAC3C,wBAAgB,EAAE,IAAI,IAAI,CAEzB;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAczC;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAc1C;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAE/C;AAED,wCAAwC;AACxC,wBAAgB,IAAI,IAAI,IAAI,CAE3B;AAED,kEAAkE;AAClE,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED,iDAAiD;AACjD,wBAAgB,QAAQ,IAAI,IAAI,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AC/C,wBAAgB,YAAY,IAAI,IAAI,CAInC;AAED,yDAAyD;AACzD,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED;;;GAGG;AACH,wBAAgB,KAAK,IAAI,IAAI,CAQ5B;AAED,wCAAwC;AACxC,wBAAgB,KAAK,IAAI,IAAI,CAE5B;AAED,6CAA6C;AAC7C,wBAAgB,QAAQ,IAAI,IAAI,CAE/B;AAED,qDAAqD;AACrD,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED,yDAAyD;AACzD,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED,8CAA8C;AAC9C,wBAAgB,OAAO,IAAI,IAAI,CAG9B;AAED,sFAAsF;AACtF,wBAAgB,MAAM,IAAI,IAAI,CAQ7B;AAED,wFAAwF;AACxF,wBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEvC;AAED;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA0BzC"}
1
+ {"version":3,"file":"listCommands.d.ts","sourceRoot":"","sources":["../../../../src/features/extraConsoleCommands/listCommands.ts"],"names":[],"mappings":"AAwIA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA2C/C;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,IAAI,CAEhC;AAED,gEAAgE;AAChE,wBAAgB,MAAM,IAAI,IAAI,CAK7B;AAED,sEAAsE;AACtE,wBAAgB,OAAO,IAAI,IAAI,CAkB9B;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEhD;AAED,+CAA+C;AAC/C,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED,4CAA4C;AAC5C,wBAAgB,KAAK,IAAI,IAAI,CAG5B;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAcjD;AAED,2CAA2C;AA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Type = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
17
17
  local GridRoom = ____isaac_2Dtypescript_2Ddefinitions.GridRoom
18
18
  local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
19
19
  local PillColor = ____isaac_2Dtypescript_2Ddefinitions.PillColor
20
+ local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
20
21
  local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
21
22
  local StageType = ____isaac_2Dtypescript_2Ddefinitions.StageType
22
23
  local ____cachedClasses = require("src.core.cachedClasses")
@@ -49,6 +50,7 @@ local ____entitiesSpecific = require("src.functions.entitiesSpecific")
49
50
  local getNPCs = ____entitiesSpecific.getNPCs
50
51
  local ____enums = require("src.functions.enums")
51
52
  local getEnumValues = ____enums.getEnumValues
53
+ local getLastEnumValue = ____enums.getLastEnumValue
52
54
  local ____flag = require("src.functions.flag")
53
55
  local addFlag = ____flag.addFlag
54
56
  local ____gridEntities = require("src.functions.gridEntities")
@@ -87,10 +89,15 @@ local ____run = require("src.functions.run")
87
89
  local onSetSeed = ____run.onSetSeed
88
90
  local restart = ____run.restart
89
91
  local setUnseeded = ____run.setUnseeded
92
+ local ____set = require("src.functions.set")
93
+ local getSortedSetValues = ____set.getSortedSetValues
90
94
  local ____spawnCollectible = require("src.functions.spawnCollectible")
91
95
  local spawnCollectibleFunction = ____spawnCollectible.spawnCollectible
92
96
  local ____stage = require("src.functions.stage")
93
97
  local setStage = ____stage.setStage
98
+ local ____transformations = require("src.functions.transformations")
99
+ local getCollectibleTypesForTransformation = ____transformations.getCollectibleTypesForTransformation
100
+ local getTransformationName = ____transformations.getTransformationName
94
101
  local ____trinkets = require("src.functions.trinkets")
95
102
  local getGoldenTrinketType = ____trinkets.getGoldenTrinketType
96
103
  local ____types = require("src.functions.types")
@@ -111,6 +118,8 @@ local ____pillNameToEffectMap = require("src.maps.pillNameToEffectMap")
111
118
  local PILL_NAME_TO_EFFECT_MAP = ____pillNameToEffectMap.PILL_NAME_TO_EFFECT_MAP
112
119
  local ____roomNameToTypeMap = require("src.maps.roomNameToTypeMap")
113
120
  local ROOM_NAME_TO_TYPE_MAP = ____roomNameToTypeMap.ROOM_NAME_TO_TYPE_MAP
121
+ local ____transformationNameToPlayerForm = require("src.maps.transformationNameToPlayerForm")
122
+ local TRANSFORMATION_NAME_TO_PLAYER_FORM_MAP = ____transformationNameToPlayerForm.TRANSFORMATION_NAME_TO_PLAYER_FORM_MAP
114
123
  local ____trinketNameToTypeMap = require("src.maps.trinketNameToTypeMap")
115
124
  local TRINKET_NAME_TO_TYPE_MAP = ____trinketNameToTypeMap.TRINKET_NAME_TO_TYPE_MAP
116
125
  local ____firstLast = require("src.features.firstLast")
@@ -205,6 +214,56 @@ function ____exports.startingRoom(self)
205
214
  local startingRoomIndex = level:GetStartingRoomIndex()
206
215
  changeRoom(nil, startingRoomIndex)
207
216
  end
217
+ --- Gives the specified transformation. Accepts either the transformation number or the partial name
218
+ -- of the transformation.
219
+ --
220
+ -- For example:
221
+ -- - transformation 1 - Gives the Beelzebub transformation.
222
+ -- - transformation gup - Gives the Guppy transformation.
223
+ function ____exports.transformation(self, params)
224
+ if params == "" then
225
+ printConsole(nil, "You must specify a transformation name or number.")
226
+ return
227
+ end
228
+ local targetPlayerForm
229
+ local num = tonumber(params)
230
+ if num == nil then
231
+ local match = getMapPartialMatch(nil, params, TRANSFORMATION_NAME_TO_PLAYER_FORM_MAP)
232
+ if match == nil then
233
+ printConsole(nil, "Unknown transformation: " .. params)
234
+ return
235
+ end
236
+ targetPlayerForm = match[2]
237
+ else
238
+ local lastPlayerForm = getLastEnumValue(nil, PlayerForm)
239
+ if num < PlayerForm.GUPPY or num > lastPlayerForm then
240
+ printConsole(
241
+ nil,
242
+ "Invalid transformation number: " .. tostring(num)
243
+ )
244
+ return
245
+ end
246
+ targetPlayerForm = num
247
+ end
248
+ local transformationName = getTransformationName(nil, targetPlayerForm)
249
+ local player = Isaac.GetPlayer()
250
+ local collectibleTypesSet = getCollectibleTypesForTransformation(nil, targetPlayerForm)
251
+ local collectiblesTypes = getSortedSetValues(nil, collectibleTypesSet)
252
+ do
253
+ local i = 0
254
+ while i < 3 do
255
+ local collectibleType = collectiblesTypes[i + 1]
256
+ if collectibleType ~= nil then
257
+ player:AddCollectible(collectibleType)
258
+ end
259
+ i = i + 1
260
+ end
261
+ end
262
+ printConsole(
263
+ nil,
264
+ ((("Gave transformation: " .. transformationName) .. " (") .. tostring(targetPlayerForm)) .. ")"
265
+ )
266
+ end
208
267
  --- Adds a single charge to the player's specified active item. You must provide the active slot
209
268
  -- number. Provide a second number to give a custom amount of charges. (You can use negative numbers
210
269
  -- to remove charge.)
@@ -877,6 +936,10 @@ end
877
936
  function ____exports.playSound(self, params)
878
937
  ____exports.sound(nil, params)
879
938
  end
939
+ --- Alias for the "transformation" command.
940
+ function ____exports.playerForm(self, params)
941
+ ____exports.transformation(nil, params)
942
+ end
880
943
  --- Sets the player's pocket item to the specified collectible type.
881
944
  function ____exports.pocket(self, params)
882
945
  if params == "" then
@@ -13,7 +13,7 @@ export declare function copyMap<K, V>(oldMap: Map<K, V>): Map<K, V>;
13
13
  * ["bar", 456],
14
14
  * ]);
15
15
  * const searchText = "f";
16
- * const match = getMapPartialMatch(map, searchText); // match is now equal to 123
16
+ * const match = getMapPartialMatch(map, searchText); // match is now equal to ["foo", 123]
17
17
  *
18
18
  * @returns If a match was found, returns a tuple of the map key and value. If a match was not
19
19
  * found, returns undefined.
@@ -30,7 +30,7 @@ end
30
30
  -- ["bar", 456],
31
31
  -- ]);
32
32
  -- const searchText = "f";
33
- -- const match = getMapPartialMatch(map, searchText); // match is now equal to 123
33
+ -- const match = getMapPartialMatch(map, searchText); // match is now equal to ["foo", 123]
34
34
  --
35
35
  -- @returns If a match was found, returns a tuple of the map key and value. If a match was not
36
36
  -- found, returns undefined.
@@ -33,6 +33,9 @@ export declare function getTearsStat(fireDelay: float): float;
33
33
  * only use this function in the `POST_TEAR_INIT_VERY_LATE` callback or on frame 1+.
34
34
  *
35
35
  * If this function is called on frame 0, it will throw a run-time error.
36
+ *
37
+ * Note that this function does not work properly when the tear is from a Lead Pencil barrage. In
38
+ * this case, it will always appear as if the tear is coming from a player.
36
39
  */
37
40
  export declare function isTearFromFamiliar(tear: EntityTear): boolean;
38
41
  /**
@@ -45,6 +48,9 @@ export declare function isTearFromFamiliar(tear: EntityTear): boolean;
45
48
  * only use this function in the `POST_TEAR_INIT_VERY_LATE` callback or on frame 1+.
46
49
  *
47
50
  * If this function is called on frame 0, it will throw a run-time error.
51
+ *
52
+ * Note that this function does not work properly when the tear is from a Lead Pencil barrage. In
53
+ * this case, it will always appear as if the tear is coming from a player.
48
54
  */
49
55
  export declare function isTearFromPlayer(tear: EntityTear): boolean;
50
56
  //# sourceMappingURL=tears.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tears.d.ts","sourceRoot":"","sources":["../../../src/functions/tears.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,GAAG,IAAI,CAKzE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAEpD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAgB5D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAgB1D"}
1
+ {"version":3,"file":"tears.d.ts","sourceRoot":"","sources":["../../../src/functions/tears.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,GAAG,IAAI,CAKzE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAEpD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAgB5D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAgB1D"}
@@ -33,6 +33,9 @@ end
33
33
  -- only use this function in the `POST_TEAR_INIT_VERY_LATE` callback or on frame 1+.
34
34
  --
35
35
  -- If this function is called on frame 0, it will throw a run-time error.
36
+ --
37
+ -- Note that this function does not work properly when the tear is from a Lead Pencil barrage. In
38
+ -- this case, it will always appear as if the tear is coming from a player.
36
39
  function ____exports.isTearFromFamiliar(self, tear)
37
40
  if tear.FrameCount == 0 then
38
41
  error("Failed to check if the given tear was from a player since the tear's frame count was equal to 0. (The \"isTearFromFamiliar\" function must only be used in the \"POST_TEAR_INIT_VERY_LATE\" callback or on frame 1 and onwards.)")
@@ -52,6 +55,9 @@ end
52
55
  -- only use this function in the `POST_TEAR_INIT_VERY_LATE` callback or on frame 1+.
53
56
  --
54
57
  -- If this function is called on frame 0, it will throw a run-time error.
58
+ --
59
+ -- Note that this function does not work properly when the tear is from a Lead Pencil barrage. In
60
+ -- this case, it will always appear as if the tear is coming from a player.
55
61
  function ____exports.isTearFromPlayer(self, tear)
56
62
  if tear.FrameCount == 0 then
57
63
  error("Failed to check if the given tear was from a player since the tear's frame count was equal to 0. (The \"isTearFromPlayer\" function must only be used in the \"POST_TEAR_INIT_VERY_LATE\" callback or on frame 1 and onwards.)")
@@ -0,0 +1,4 @@
1
+ import { PlayerForm } from "isaac-typescript-definitions";
2
+ /** Maps transformation names to the values of the `PlayerForm` enum. */
3
+ export declare const TRANSFORMATION_NAME_TO_PLAYER_FORM_MAP: ReadonlyMap<string, PlayerForm>;
4
+ //# sourceMappingURL=transformationNameToPlayerForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformationNameToPlayerForm.d.ts","sourceRoot":"","sources":["../../../src/maps/transformationNameToPlayerForm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,wEAAwE;AACxE,eAAO,MAAM,sCAAsC,EAAE,WAAW,CAC9D,MAAM,EACN,UAAU,CA6BV,CAAC"}
@@ -0,0 +1,37 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local Map = ____lualib.Map
3
+ local __TS__New = ____lualib.__TS__New
4
+ local ____exports = {}
5
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
+ local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
7
+ --- Maps transformation names to the values of the `PlayerForm` enum.
8
+ ____exports.TRANSFORMATION_NAME_TO_PLAYER_FORM_MAP = __TS__New(Map, {
9
+ {"guppy", PlayerForm.GUPPY},
10
+ {"cat", PlayerForm.GUPPY},
11
+ {"beelzebub", PlayerForm.BEELZEBUB},
12
+ {"fly", PlayerForm.BEELZEBUB},
13
+ {"funGuy", PlayerForm.FUN_GUY},
14
+ {"mushroom", PlayerForm.FUN_GUY},
15
+ {"seraphim", PlayerForm.SERAPHIM},
16
+ {"angel", PlayerForm.SERAPHIM},
17
+ {"bob", PlayerForm.BOB},
18
+ {"poison", PlayerForm.BOB},
19
+ {"spun", PlayerForm.SPUN},
20
+ {"drugs", PlayerForm.SPUN},
21
+ {"needles", PlayerForm.SPUN},
22
+ {"yesMother", PlayerForm.YES_MOTHER},
23
+ {"mother", PlayerForm.YES_MOTHER},
24
+ {"mom", PlayerForm.YES_MOTHER},
25
+ {"conjoined", PlayerForm.CONJOINED},
26
+ {"triple", PlayerForm.CONJOINED},
27
+ {"leviathan", PlayerForm.LEVIATHAN},
28
+ {"devil", PlayerForm.LEVIATHAN},
29
+ {"ohCrap", PlayerForm.OH_CRAP},
30
+ {"crap", PlayerForm.OH_CRAP},
31
+ {"poop", PlayerForm.OH_CRAP},
32
+ {"bookWorm", PlayerForm.BOOKWORM},
33
+ {"adult", PlayerForm.ADULT},
34
+ {"spiderBaby", PlayerForm.SPIDER_BABY},
35
+ {"stompy", PlayerForm.STOMPY}
36
+ })
37
+ return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "11.0.1",
3
+ "version": "11.1.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -45,6 +45,7 @@ import {
45
45
  LevelStage,
46
46
  PillColor,
47
47
  PillEffect,
48
+ PlayerForm,
48
49
  PlayerType,
49
50
  RoomType,
50
51
  SoundEffect,
@@ -70,7 +71,7 @@ import { addCharge } from "../../functions/charge";
70
71
  import { isValidCollectibleType } from "../../functions/collectibles";
71
72
  import { runDeepCopyTests } from "../../functions/deepCopyTests";
72
73
  import { getNPCs } from "../../functions/entitiesSpecific";
73
- import { getEnumValues } from "../../functions/enums";
74
+ import { getEnumValues, getLastEnumValue } from "../../functions/enums";
74
75
  import { addFlag } from "../../functions/flag";
75
76
  import { spawnGridEntity } from "../../functions/gridEntities";
76
77
  import { getRoomGridIndexesForType } from "../../functions/levelGrid";
@@ -99,8 +100,13 @@ import { gridCoordinatesToWorldPosition } from "../../functions/roomGrid";
99
100
  import { changeRoom } from "../../functions/rooms";
100
101
  import { reloadRoom as reloadRoomFunction } from "../../functions/roomTransition";
101
102
  import { onSetSeed, restart, setUnseeded } from "../../functions/run";
103
+ import { getSortedSetValues } from "../../functions/set";
102
104
  import { spawnCollectible as spawnCollectibleFunction } from "../../functions/spawnCollectible";
103
105
  import { setStage } from "../../functions/stage";
106
+ import {
107
+ getCollectibleTypesForTransformation,
108
+ getTransformationName,
109
+ } from "../../functions/transformations";
104
110
  import { getGoldenTrinketType } from "../../functions/trinkets";
105
111
  import {
106
112
  asCardType,
@@ -113,6 +119,7 @@ import { CHARACTER_NAME_TO_TYPE_MAP } from "../../maps/characterNameToTypeMap";
113
119
  import { COLLECTIBLE_NAME_TO_TYPE_MAP } from "../../maps/collectibleNameToTypeMap";
114
120
  import { PILL_NAME_TO_EFFECT_MAP } from "../../maps/pillNameToEffectMap";
115
121
  import { ROOM_NAME_TO_TYPE_MAP } from "../../maps/roomNameToTypeMap";
122
+ import { TRANSFORMATION_NAME_TO_PLAYER_FORM_MAP } from "../../maps/transformationNameToPlayerForm";
116
123
  import { TRINKET_NAME_TO_TYPE_MAP } from "../../maps/trinketNameToTypeMap";
117
124
  import { getLastCardType, getLastPillEffect } from "../firstLast";
118
125
  import {
@@ -1000,6 +1007,11 @@ export function playSound(params: string): void {
1000
1007
  sound(params);
1001
1008
  }
1002
1009
 
1010
+ /** Alias for the "transformation" command. */
1011
+ export function playerForm(params: string): void {
1012
+ transformation(params);
1013
+ }
1014
+
1003
1015
  /** Sets the player's pocket item to the specified collectible type. */
1004
1016
  export function pocket(params: string): void {
1005
1017
  if (params === "") {
@@ -1456,6 +1468,60 @@ export function tests(): void {
1456
1468
  runTests();
1457
1469
  }
1458
1470
 
1471
+ /**
1472
+ * Gives the specified transformation. Accepts either the transformation number or the partial name
1473
+ * of the transformation.
1474
+ *
1475
+ * For example:
1476
+ * - transformation 1 - Gives the Beelzebub transformation.
1477
+ * - transformation gup - Gives the Guppy transformation.
1478
+ */
1479
+ export function transformation(params: string): void {
1480
+ if (params === "") {
1481
+ printConsole("You must specify a transformation name or number.");
1482
+ return;
1483
+ }
1484
+
1485
+ let targetPlayerForm: PlayerForm;
1486
+ const num = tonumber(params) as PlayerForm | undefined;
1487
+ if (num === undefined) {
1488
+ const match = getMapPartialMatch(
1489
+ params,
1490
+ TRANSFORMATION_NAME_TO_PLAYER_FORM_MAP,
1491
+ );
1492
+ if (match === undefined) {
1493
+ printConsole(`Unknown transformation: ${params}`);
1494
+ return;
1495
+ }
1496
+
1497
+ targetPlayerForm = match[1];
1498
+ } else {
1499
+ const lastPlayerForm = getLastEnumValue(PlayerForm);
1500
+ if (num < PlayerForm.GUPPY || num > lastPlayerForm) {
1501
+ printConsole(`Invalid transformation number: ${num}`);
1502
+ return;
1503
+ }
1504
+
1505
+ targetPlayerForm = num;
1506
+ }
1507
+
1508
+ const transformationName = getTransformationName(targetPlayerForm);
1509
+ const player = Isaac.GetPlayer();
1510
+ const collectibleTypesSet =
1511
+ getCollectibleTypesForTransformation(targetPlayerForm);
1512
+ const collectiblesTypes = getSortedSetValues(collectibleTypesSet);
1513
+ for (let i = 0; i < 3; i++) {
1514
+ const collectibleType = collectiblesTypes[i];
1515
+ if (collectibleType !== undefined) {
1516
+ player.AddCollectible(collectibleType);
1517
+ }
1518
+ }
1519
+
1520
+ printConsole(
1521
+ `Gave transformation: ${transformationName} (${targetPlayerForm})`,
1522
+ );
1523
+ }
1524
+
1459
1525
  /** Creates a trapdoor next to the player. */
1460
1526
  export function trapdoor(): void {
1461
1527
  spawnTrapdoorOrCrawlSpace(true);
@@ -24,7 +24,7 @@ export function copyMap<K, V>(oldMap: Map<K, V>): Map<K, V> {
24
24
  * ["bar", 456],
25
25
  * ]);
26
26
  * const searchText = "f";
27
- * const match = getMapPartialMatch(map, searchText); // match is now equal to 123
27
+ * const match = getMapPartialMatch(map, searchText); // match is now equal to ["foo", 123]
28
28
  *
29
29
  * @returns If a match was found, returns a tuple of the map key and value. If a match was not
30
30
  * found, returns undefined.
@@ -42,6 +42,9 @@ export function getTearsStat(fireDelay: float): float {
42
42
  * only use this function in the `POST_TEAR_INIT_VERY_LATE` callback or on frame 1+.
43
43
  *
44
44
  * If this function is called on frame 0, it will throw a run-time error.
45
+ *
46
+ * Note that this function does not work properly when the tear is from a Lead Pencil barrage. In
47
+ * this case, it will always appear as if the tear is coming from a player.
45
48
  */
46
49
  export function isTearFromFamiliar(tear: EntityTear): boolean {
47
50
  if (tear.FrameCount === 0) {
@@ -71,6 +74,9 @@ export function isTearFromFamiliar(tear: EntityTear): boolean {
71
74
  * only use this function in the `POST_TEAR_INIT_VERY_LATE` callback or on frame 1+.
72
75
  *
73
76
  * If this function is called on frame 0, it will throw a run-time error.
77
+ *
78
+ * Note that this function does not work properly when the tear is from a Lead Pencil barrage. In
79
+ * this case, it will always appear as if the tear is coming from a player.
74
80
  */
75
81
  export function isTearFromPlayer(tear: EntityTear): boolean {
76
82
  if (tear.FrameCount === 0) {
@@ -0,0 +1,35 @@
1
+ import { PlayerForm } from "isaac-typescript-definitions";
2
+
3
+ /** Maps transformation names to the values of the `PlayerForm` enum. */
4
+ export const TRANSFORMATION_NAME_TO_PLAYER_FORM_MAP: ReadonlyMap<
5
+ string,
6
+ PlayerForm
7
+ > = new Map([
8
+ ["guppy", PlayerForm.GUPPY], // 0
9
+ ["cat", PlayerForm.GUPPY], // 0
10
+ ["beelzebub", PlayerForm.BEELZEBUB], // 1
11
+ ["fly", PlayerForm.BEELZEBUB], // 1
12
+ ["funGuy", PlayerForm.FUN_GUY], // 2
13
+ ["mushroom", PlayerForm.FUN_GUY], // 2
14
+ ["seraphim", PlayerForm.SERAPHIM], // 3
15
+ ["angel", PlayerForm.SERAPHIM], // 3
16
+ ["bob", PlayerForm.BOB], // 4
17
+ ["poison", PlayerForm.BOB], // 4
18
+ ["spun", PlayerForm.SPUN], // 5
19
+ ["drugs", PlayerForm.SPUN], // 5
20
+ ["needles", PlayerForm.SPUN], // 5
21
+ ["yesMother", PlayerForm.YES_MOTHER], // 6
22
+ ["mother", PlayerForm.YES_MOTHER], // 6
23
+ ["mom", PlayerForm.YES_MOTHER], // 6
24
+ ["conjoined", PlayerForm.CONJOINED], // 7
25
+ ["triple", PlayerForm.CONJOINED], // 7
26
+ ["leviathan", PlayerForm.LEVIATHAN], // 8
27
+ ["devil", PlayerForm.LEVIATHAN], // 8
28
+ ["ohCrap", PlayerForm.OH_CRAP], // 9
29
+ ["crap", PlayerForm.OH_CRAP], // 9
30
+ ["poop", PlayerForm.OH_CRAP], // 9
31
+ ["bookWorm", PlayerForm.BOOKWORM], // 10
32
+ ["adult", PlayerForm.ADULT], // 11
33
+ ["spiderBaby", PlayerForm.SPIDER_BABY], // 12
34
+ ["stompy", PlayerForm.STOMPY], // 13
35
+ ]);