isaacscript-common 84.0.1 → 84.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/arrays/cachedEnumValues.js +33 -0
- package/dist/callbackClasses.js +289 -0
- package/dist/callbacks.js +181 -0
- package/dist/classes/DefaultMap.js +171 -0
- package/dist/classes/ModFeature.js +244 -0
- package/dist/classes/ModUpgraded.js +324 -0
- package/dist/classes/callbacks/EntityTakeDmgFilter.js +19 -0
- package/dist/classes/callbacks/EntityTakeDmgPlayer.js +29 -0
- package/dist/classes/callbacks/InputActionFilter.js +24 -0
- package/dist/classes/callbacks/InputActionPlayer.js +37 -0
- package/dist/classes/callbacks/PostAmbushFinished.js +40 -0
- package/dist/classes/callbacks/PostAmbushStarted.js +40 -0
- package/dist/classes/callbacks/PostBombExploded.js +24 -0
- package/dist/classes/callbacks/PostBombInitFilter.js +21 -0
- package/dist/classes/callbacks/PostBombInitLate.js +31 -0
- package/dist/classes/callbacks/PostBombRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostBombUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostBoneSwing.js +53 -0
- package/dist/classes/callbacks/PostCollectibleEmpty.js +50 -0
- package/dist/classes/callbacks/PostCursedTeleport.js +119 -0
- package/dist/classes/callbacks/PostCustomRevive.js +17 -0
- package/dist/classes/callbacks/PostDiceRoomActivated.js +50 -0
- package/dist/classes/callbacks/PostDoorRender.js +24 -0
- package/dist/classes/callbacks/PostDoorUpdate.js +24 -0
- package/dist/classes/callbacks/PostEffectInitFilter.js +21 -0
- package/dist/classes/callbacks/PostEffectInitLate.js +31 -0
- package/dist/classes/callbacks/PostEffectRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostEffectStateChanged.js +34 -0
- package/dist/classes/callbacks/PostEffectUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostEntityKillFilter.js +21 -0
- package/dist/classes/callbacks/PostEsauJr.js +12 -0
- package/dist/classes/callbacks/PostFamiliarInitFilter.js +21 -0
- package/dist/classes/callbacks/PostFamiliarInitLate.js +31 -0
- package/dist/classes/callbacks/PostFamiliarRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostFamiliarStateChanged.js +34 -0
- package/dist/classes/callbacks/PostFamiliarUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostFirstEsauJr.js +12 -0
- package/dist/classes/callbacks/PostFirstFlip.js +12 -0
- package/dist/classes/callbacks/PostFlip.js +12 -0
- package/dist/classes/callbacks/PostGameEndFilter.js +21 -0
- package/dist/classes/callbacks/PostGameStartedReordered.js +14 -0
- package/dist/classes/callbacks/PostGameStartedReorderedLast.js +14 -0
- package/dist/classes/callbacks/PostGreedModeWave.js +35 -0
- package/dist/classes/callbacks/PostGridEntityBroken.js +14 -0
- package/dist/classes/callbacks/PostGridEntityCollision.js +28 -0
- package/dist/classes/callbacks/PostGridEntityCustomBroken.js +14 -0
- package/dist/classes/callbacks/PostGridEntityCustomCollision.js +24 -0
- package/dist/classes/callbacks/PostGridEntityCustomInit.js +14 -0
- package/dist/classes/callbacks/PostGridEntityCustomRemove.js +18 -0
- package/dist/classes/callbacks/PostGridEntityCustomRender.js +14 -0
- package/dist/classes/callbacks/PostGridEntityCustomStateChanged.js +14 -0
- package/dist/classes/callbacks/PostGridEntityCustomUpdate.js +14 -0
- package/dist/classes/callbacks/PostGridEntityInit.js +14 -0
- package/dist/classes/callbacks/PostGridEntityRemove.js +19 -0
- package/dist/classes/callbacks/PostGridEntityRender.js +14 -0
- package/dist/classes/callbacks/PostGridEntityStateChanged.js +14 -0
- package/dist/classes/callbacks/PostGridEntityUpdate.js +14 -0
- package/dist/classes/callbacks/PostHolyMantleRemoved.js +43 -0
- package/dist/classes/callbacks/PostItemDischarge.js +122 -0
- package/dist/classes/callbacks/PostItemPickup.js +14 -0
- package/dist/classes/callbacks/PostKeyboardChanged.js +46 -0
- package/dist/classes/callbacks/PostKnifeInitFilter.js +21 -0
- package/dist/classes/callbacks/PostKnifeInitLate.js +31 -0
- package/dist/classes/callbacks/PostKnifeRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostKnifeUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostLaserInitFilter.js +21 -0
- package/dist/classes/callbacks/PostLaserInitLate.js +31 -0
- package/dist/classes/callbacks/PostLaserRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostLaserUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostNPCDeathFilter.js +21 -0
- package/dist/classes/callbacks/PostNPCInitFilter.js +21 -0
- package/dist/classes/callbacks/PostNPCInitLate.js +31 -0
- package/dist/classes/callbacks/PostNPCRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostNPCStateChanged.js +34 -0
- package/dist/classes/callbacks/PostNPCUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostNewLevelReordered.js +14 -0
- package/dist/classes/callbacks/PostNewRoomEarly.js +74 -0
- package/dist/classes/callbacks/PostNewRoomReordered.js +14 -0
- package/dist/classes/callbacks/PostPEffectUpdateReordered.js +14 -0
- package/dist/classes/callbacks/PostPickupChanged.js +14 -0
- package/dist/classes/callbacks/PostPickupCollect.js +38 -0
- package/dist/classes/callbacks/PostPickupInitFilter.js +21 -0
- package/dist/classes/callbacks/PostPickupInitFirst.js +33 -0
- package/dist/classes/callbacks/PostPickupInitLate.js +31 -0
- package/dist/classes/callbacks/PostPickupRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostPickupSelectionFilter.js +29 -0
- package/dist/classes/callbacks/PostPickupStateChanged.js +34 -0
- package/dist/classes/callbacks/PostPickupUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostPitRender.js +24 -0
- package/dist/classes/callbacks/PostPitUpdate.js +24 -0
- package/dist/classes/callbacks/PostPlayerChangeHealth.js +47 -0
- package/dist/classes/callbacks/PostPlayerChangeStat.js +79 -0
- package/dist/classes/callbacks/PostPlayerChangeType.js +36 -0
- package/dist/classes/callbacks/PostPlayerCollectibleAdded.js +14 -0
- package/dist/classes/callbacks/PostPlayerCollectibleRemoved.js +14 -0
- package/dist/classes/callbacks/PostPlayerFatalDamage.js +83 -0
- package/dist/classes/callbacks/PostPlayerInitFirst.js +41 -0
- package/dist/classes/callbacks/PostPlayerInitLate.js +33 -0
- package/dist/classes/callbacks/PostPlayerRenderReordered.js +14 -0
- package/dist/classes/callbacks/PostPlayerUpdateReordered.js +14 -0
- package/dist/classes/callbacks/PostPoopRender.js +24 -0
- package/dist/classes/callbacks/PostPoopUpdate.js +24 -0
- package/dist/classes/callbacks/PostPressurePlateRender.js +24 -0
- package/dist/classes/callbacks/PostPressurePlateUpdate.js +24 -0
- package/dist/classes/callbacks/PostProjectileInitFilter.js +21 -0
- package/dist/classes/callbacks/PostProjectileInitLate.js +31 -0
- package/dist/classes/callbacks/PostProjectileKill.js +52 -0
- package/dist/classes/callbacks/PostProjectileRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostProjectileUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostPurchase.js +90 -0
- package/dist/classes/callbacks/PostRockRender.js +24 -0
- package/dist/classes/callbacks/PostRockUpdate.js +24 -0
- package/dist/classes/callbacks/PostRoomClearChanged.js +46 -0
- package/dist/classes/callbacks/PostSacrifice.js +36 -0
- package/dist/classes/callbacks/PostSlotAnimationChanged.js +14 -0
- package/dist/classes/callbacks/PostSlotCollision.js +25 -0
- package/dist/classes/callbacks/PostSlotDestroyed.js +14 -0
- package/dist/classes/callbacks/PostSlotInit.js +14 -0
- package/dist/classes/callbacks/PostSlotRender.js +14 -0
- package/dist/classes/callbacks/PostSlotUpdate.js +14 -0
- package/dist/classes/callbacks/PostSpikesRender.js +24 -0
- package/dist/classes/callbacks/PostSpikesUpdate.js +24 -0
- package/dist/classes/callbacks/PostTNTRender.js +24 -0
- package/dist/classes/callbacks/PostTNTUpdate.js +24 -0
- package/dist/classes/callbacks/PostTearInitFilter.js +21 -0
- package/dist/classes/callbacks/PostTearInitLate.js +31 -0
- package/dist/classes/callbacks/PostTearInitVeryLate.js +35 -0
- package/dist/classes/callbacks/PostTearKill.js +52 -0
- package/dist/classes/callbacks/PostTearRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostTearUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostTransformation.js +47 -0
- package/dist/classes/callbacks/PostTrinketBreak.js +70 -0
- package/dist/classes/callbacks/PostUsePillFilter.js +76 -0
- package/dist/classes/callbacks/PreBerserkDeath.js +41 -0
- package/dist/classes/callbacks/PreBombCollisionFilter.js +19 -0
- package/dist/classes/callbacks/PreCustomRevive.js +14 -0
- package/dist/classes/callbacks/PreEntitySpawnFilter.js +24 -0
- package/dist/classes/callbacks/PreFamiliarCollisionFilter.js +19 -0
- package/dist/classes/callbacks/PreGetPedestal.js +46 -0
- package/dist/classes/callbacks/PreItemPickup.js +14 -0
- package/dist/classes/callbacks/PreKnifeCollisionFilter.js +19 -0
- package/dist/classes/callbacks/PreNPCCollisionFilter.js +19 -0
- package/dist/classes/callbacks/PreNPCUpdateFilter.js +19 -0
- package/dist/classes/callbacks/PreNewLevel.js +51 -0
- package/dist/classes/callbacks/PreProjectileCollisionFilter.js +19 -0
- package/dist/classes/callbacks/PreRoomEntitySpawnFilter.js +26 -0
- package/dist/classes/callbacks/PreTearCollisionFilter.js +19 -0
- package/dist/classes/features/callbackLogic/CustomGridEntities.js +359 -0
- package/dist/classes/features/callbackLogic/CustomRevive.js +170 -0
- package/dist/classes/features/callbackLogic/EsauJrDetection.js +70 -0
- package/dist/classes/features/callbackLogic/FlipDetection.js +61 -0
- package/dist/classes/features/callbackLogic/GameReorderedCallbacks.js +220 -0
- package/dist/classes/features/callbackLogic/GridEntityCollisionDetection.js +62 -0
- package/dist/classes/features/callbackLogic/GridEntityRenderDetection.js +35 -0
- package/dist/classes/features/callbackLogic/GridEntityUpdateDetection.js +147 -0
- package/dist/classes/features/callbackLogic/ItemPickupDetection.js +68 -0
- package/dist/classes/features/callbackLogic/PickupChangeDetection.js +43 -0
- package/dist/classes/features/callbackLogic/PlayerCollectibleDetection.js +193 -0
- package/dist/classes/features/callbackLogic/PlayerReorderedCallbacks.js +109 -0
- package/dist/classes/features/callbackLogic/SlotDestroyedDetection.js +95 -0
- package/dist/classes/features/callbackLogic/SlotRenderDetection.js +48 -0
- package/dist/classes/features/callbackLogic/SlotUpdateDetection.js +52 -0
- package/dist/classes/features/other/CharacterHealthConversion.js +112 -0
- package/dist/classes/features/other/CharacterStats.js +68 -0
- package/dist/classes/features/other/CollectibleItemPoolType.js +75 -0
- package/dist/classes/features/other/CustomHotkeys.js +144 -0
- package/dist/classes/features/other/CustomItemPools.js +128 -0
- package/dist/classes/features/other/CustomPickups.js +118 -0
- package/dist/classes/features/other/CustomStages.js +471 -0
- package/dist/classes/features/other/CustomTrapdoors.js +596 -0
- package/dist/classes/features/other/DebugDisplay.js +699 -0
- package/dist/classes/features/other/DeployJSONRoom.js +301 -0
- package/dist/classes/features/other/DisableAllSound.js +90 -0
- package/dist/classes/features/other/DisableInputs.js +249 -0
- package/dist/classes/features/other/EdenStartingStatsHealth.js +197 -0
- package/dist/classes/features/other/ExtraConsoleCommands.js +292 -0
- package/dist/classes/features/other/FadeInRemover.js +67 -0
- package/dist/classes/features/other/FastReset.js +88 -0
- package/dist/classes/features/other/FlyingDetection.js +64 -0
- package/dist/classes/features/other/ForgottenSwitch.js +43 -0
- package/dist/classes/features/other/ItemPoolDetection.js +187 -0
- package/dist/classes/features/other/ModdedElementDetection.js +399 -0
- package/dist/classes/features/other/ModdedElementSets.js +1251 -0
- package/dist/classes/features/other/NoSirenSteal.js +88 -0
- package/dist/classes/features/other/Pause.js +197 -0
- package/dist/classes/features/other/PersistentEntities.js +168 -0
- package/dist/classes/features/other/PickupIndexCreation.js +229 -0
- package/dist/classes/features/other/PlayerCollectibleTracking.js +102 -0
- package/dist/classes/features/other/PonyDetection.js +86 -0
- package/dist/classes/features/other/PressInput.js +71 -0
- package/dist/classes/features/other/PreventChildEntities.js +60 -0
- package/dist/classes/features/other/PreventGridEntityRespawn.js +159 -0
- package/dist/classes/features/other/RerunDetection.js +69 -0
- package/dist/classes/features/other/RoomClearFrame.js +94 -0
- package/dist/classes/features/other/RoomHistory.js +196 -0
- package/dist/classes/features/other/RunInNFrames.js +323 -0
- package/dist/classes/features/other/RunNextRoom.js +53 -0
- package/dist/classes/features/other/RunNextRun.js +60 -0
- package/dist/classes/features/other/SaveDataManager.js +383 -0
- package/dist/classes/features/other/SpawnRockAltRewards.js +469 -0
- package/dist/classes/features/other/StageHistory.js +244 -0
- package/dist/classes/features/other/StartAmbush.js +62 -0
- package/dist/classes/features/other/TaintedLazarusPlayers.js +115 -0
- package/dist/classes/features/other/UnlockAchievementsDetection.js +60 -0
- package/dist/classes/features/other/customStages/backdrop.js +195 -0
- package/dist/classes/features/other/customStages/constants.js +19 -0
- package/dist/classes/features/other/customStages/gridEntities.js +177 -0
- package/dist/classes/features/other/customStages/shadows.js +67 -0
- package/dist/classes/features/other/customStages/streakText.js +222 -0
- package/dist/classes/features/other/customStages/utils.js +65 -0
- package/dist/classes/features/other/customStages/v.js +27 -0
- package/dist/classes/features/other/customStages/versusScreen.js +227 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayBomb.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayDoor.js +22 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayEffect.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayFamiliar.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayKnife.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayLaser.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayNPC.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayPickup.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayPit.js +22 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayPlayer.js +25 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayPoop.js +22 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayPressurePlate.js +25 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayProjectile.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayRock.js +22 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplaySlot.js +22 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplaySpikes.js +22 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayTNT.js +22 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayTear.js +23 -0
- package/dist/classes/features/other/debugDisplay/utils.js +13 -0
- package/dist/classes/features/other/extraConsoleCommands/commands.js +1598 -0
- package/dist/classes/features/other/extraConsoleCommands/subroutines.js +135 -0
- package/dist/classes/features/other/extraConsoleCommands/v.js +30 -0
- package/dist/classes/features/other/saveDataManager/constants.js +4 -0
- package/dist/classes/features/other/saveDataManager/glowingHourGlass.js +106 -0
- package/dist/classes/features/other/saveDataManager/loadFromDisk.js +69 -0
- package/dist/classes/features/other/saveDataManager/restoreDefaults.js +69 -0
- package/dist/classes/features/other/saveDataManager/saveToDisk.js +46 -0
- package/dist/classes/private/CustomCallback.js +59 -0
- package/dist/classes/private/Feature.js +39 -0
- package/dist/core/cachedClasses.js +61 -0
- package/dist/core/constants.js +289 -0
- package/dist/core/constantsFirstLast.js +98 -0
- package/dist/core/constantsVanilla.js +131 -0
- package/dist/core/upgradeMod.js +71 -0
- package/dist/customStageMetadata.json +1 -0
- package/dist/data/itempools.json +16625 -0
- package/dist/decorators.js +21 -0
- package/dist/enums/AmbushType.js +9 -0
- package/dist/enums/CornerType.js +11 -0
- package/dist/enums/HealthType.js +20 -0
- package/dist/enums/ISCFeature.js +65 -0
- package/dist/enums/LadderSubTypeCustom.js +20 -0
- package/dist/enums/ModCallbackCustom.js +2477 -0
- package/dist/enums/MysteriousPaperEffect.js +16 -0
- package/dist/enums/PlayerStat.js +37 -0
- package/dist/enums/PocketItemType.js +13 -0
- package/dist/enums/RockAltType.js +23 -0
- package/dist/enums/SaveDataKey.js +14 -0
- package/dist/enums/SerializationType.js +10 -0
- package/dist/enums/SlotDestructionType.js +22 -0
- package/dist/enums/private/GridEntityTypeCustom.js +10 -0
- package/dist/enums/private/SerializationBrand.js +42 -0
- package/dist/enums/private/StageTravelState.js +13 -0
- package/dist/enums/private/TrapdoorAnimation.js +9 -0
- package/dist/enums/private/UIStreakAnimation.js +10 -0
- package/dist/features.js +150 -0
- package/dist/functions/ambush.js +26 -0
- package/dist/functions/array.js +586 -0
- package/dist/functions/arrayLua.js +81 -0
- package/dist/functions/benchmark.js +36 -0
- package/dist/functions/bitSet128.js +64 -0
- package/dist/functions/bitwise.js +82 -0
- package/dist/functions/bombs.js +14 -0
- package/dist/functions/bosses.js +238 -0
- package/dist/functions/cards.js +164 -0
- package/dist/functions/challenges.js +117 -0
- package/dist/functions/characters.js +182 -0
- package/dist/functions/charge.js +251 -0
- package/dist/functions/chargeBar.js +54 -0
- package/dist/functions/collectibleTag.js +24 -0
- package/dist/functions/collectibles.js +581 -0
- package/dist/functions/color.js +88 -0
- package/dist/functions/console.js +18 -0
- package/dist/functions/curses.js +37 -0
- package/dist/functions/debugFunctions.js +108 -0
- package/dist/functions/decorators.js +113 -0
- package/dist/functions/deepCopy.js +406 -0
- package/dist/functions/deepCopyTests.js +361 -0
- package/dist/functions/dimensions.js +30 -0
- package/dist/functions/direction.js +78 -0
- package/dist/functions/doors.js +524 -0
- package/dist/functions/easing.js +327 -0
- package/dist/functions/effects.js +14 -0
- package/dist/functions/emptyRoom.js +79 -0
- package/dist/functions/entities.js +529 -0
- package/dist/functions/entitiesSpecific.js +582 -0
- package/dist/functions/entityTypes.js +9 -0
- package/dist/functions/enums.js +244 -0
- package/dist/functions/external.js +59 -0
- package/dist/functions/familiars.js +136 -0
- package/dist/functions/flag.js +146 -0
- package/dist/functions/frames.js +166 -0
- package/dist/functions/globals.js +291 -0
- package/dist/functions/gridEntities.js +990 -0
- package/dist/functions/gridEntitiesSpecific.js +456 -0
- package/dist/functions/gridIndex.js +35 -0
- package/dist/functions/hash.js +75 -0
- package/dist/functions/hex.js +57 -0
- package/dist/functions/input.js +185 -0
- package/dist/functions/isaacAPIClass.js +157 -0
- package/dist/functions/itemPool.js +118 -0
- package/dist/functions/jsonHelpers.js +73 -0
- package/dist/functions/jsonRoom.js +184 -0
- package/dist/functions/kColor.js +89 -0
- package/dist/functions/language.js +16 -0
- package/dist/functions/level.js +66 -0
- package/dist/functions/levelGrid.js +497 -0
- package/dist/functions/log.js +86 -0
- package/dist/functions/logEntities.js +308 -0
- package/dist/functions/logMisc.js +510 -0
- package/dist/functions/map.js +121 -0
- package/dist/functions/math.js +149 -0
- package/dist/functions/merge.js +159 -0
- package/dist/functions/mergeTests.js +313 -0
- package/dist/functions/minimap.js +204 -0
- package/dist/functions/modFeatures.js +39 -0
- package/dist/functions/newArray.js +30 -0
- package/dist/functions/nextStage.js +169 -0
- package/dist/functions/npcDataStructures.js +146 -0
- package/dist/functions/npcs.js +132 -0
- package/dist/functions/pickupVariants.js +63 -0
- package/dist/functions/pickups.js +168 -0
- package/dist/functions/pickupsSpecific.js +376 -0
- package/dist/functions/pills.js +200 -0
- package/dist/functions/playerCenter.js +53 -0
- package/dist/functions/playerCollectibles.js +300 -0
- package/dist/functions/playerDataStructures.js +145 -0
- package/dist/functions/playerEffects.js +63 -0
- package/dist/functions/playerHealth.js +604 -0
- package/dist/functions/playerIndex.js +186 -0
- package/dist/functions/playerTrinkets.js +149 -0
- package/dist/functions/players.js +471 -0
- package/dist/functions/pocketItems.js +165 -0
- package/dist/functions/positionVelocity.js +158 -0
- package/dist/functions/pressurePlate.js +26 -0
- package/dist/functions/projectiles.js +57 -0
- package/dist/functions/random.js +90 -0
- package/dist/functions/readOnly.js +33 -0
- package/dist/functions/render.js +36 -0
- package/dist/functions/revive.js +151 -0
- package/dist/functions/rng.js +140 -0
- package/dist/functions/rockAlt.js +50 -0
- package/dist/functions/roomData.js +155 -0
- package/dist/functions/roomGrid.js +97 -0
- package/dist/functions/roomShape.js +143 -0
- package/dist/functions/roomShapeWalls.js +187 -0
- package/dist/functions/roomTransition.js +43 -0
- package/dist/functions/rooms.js +782 -0
- package/dist/functions/run.js +121 -0
- package/dist/functions/seeds.js +22 -0
- package/dist/functions/serialization.js +98 -0
- package/dist/functions/set.js +215 -0
- package/dist/functions/slots.js +41 -0
- package/dist/functions/sort.js +158 -0
- package/dist/functions/sound.js +45 -0
- package/dist/functions/spawnCollectible.js +112 -0
- package/dist/functions/sprites.js +130 -0
- package/dist/functions/stage.js +540 -0
- package/dist/functions/stats.js +104 -0
- package/dist/functions/storyBosses.js +63 -0
- package/dist/functions/string.js +194 -0
- package/dist/functions/table.js +162 -0
- package/dist/functions/tears.js +128 -0
- package/dist/functions/transformations.js +89 -0
- package/dist/functions/trinketGive.js +145 -0
- package/dist/functions/trinkets.js +213 -0
- package/dist/functions/tstlClass.js +97 -0
- package/dist/functions/types.js +225 -0
- package/dist/functions/ui.js +148 -0
- package/dist/functions/utils.d.ts +2 -0
- package/dist/functions/utils.d.ts.map +1 -1
- package/dist/functions/utils.js +195 -0
- package/dist/functions/utils.lua +4 -1
- package/dist/functions/vector.js +150 -0
- package/dist/functions/versusScreen.js +58 -0
- package/dist/functions/weighted.js +57 -0
- package/dist/index.js +219 -0
- package/dist/index.rollup.d.ts +2 -0
- package/dist/indexLua.js +220 -0
- package/dist/interfaces/ChargeBarSprites.js +2 -0
- package/dist/interfaces/Corner.js +2 -0
- package/dist/interfaces/CustomStageTSConfig.js +2 -0
- package/dist/interfaces/GridEntityCustomData.js +2 -0
- package/dist/interfaces/JSONRoomsFile.js +2 -0
- package/dist/interfaces/PlayerHealth.js +2 -0
- package/dist/interfaces/PlayerStats.js +4 -0
- package/dist/interfaces/PocketItemDescription.js +2 -0
- package/dist/interfaces/RoomDescription.js +2 -0
- package/dist/interfaces/SaveData.js +98 -0
- package/dist/interfaces/StageHistoryEntry.js +2 -0
- package/dist/interfaces/TSTLClassMetatable.js +2 -0
- package/dist/interfaces/TrinketSituation.js +2 -0
- package/dist/interfaces/private/AddCallbackParametersCustom.js +4 -0
- package/dist/interfaces/private/CustomStage.js +2 -0
- package/dist/interfaces/private/CustomTrapdoorDescription.js +2 -0
- package/dist/interfaces/private/ModUpgradedInterface.js +2 -0
- package/dist/isaacscript-common.lua +5 -2
- package/dist/maps/PHDPillConversionsMap.js +23 -0
- package/dist/maps/cardNameToTypeMap.js +211 -0
- package/dist/maps/characterNameToTypeMap.js +91 -0
- package/dist/maps/collectibleNameToTypeMap.js +19 -0
- package/dist/maps/defaultPlayerStatMap.js +17 -0
- package/dist/maps/entityTypeVariantToBossIDMap.js +11 -0
- package/dist/maps/falsePHDPillConversionsMap.js +37 -0
- package/dist/maps/gridEntityTypeToBrokenStateMap.js +32 -0
- package/dist/maps/gridEntityXMLMap.js +133 -0
- package/dist/maps/itemPoolTypeToItemPoolName.js +38 -0
- package/dist/maps/keyboardToStringMap.js +71 -0
- package/dist/maps/pillNameToEffectMap.js +91 -0
- package/dist/maps/roomNameToTypeMap.js +43 -0
- package/dist/maps/roomShapeToTopLeftWallGridIndexMap.js +17 -0
- package/dist/maps/transformationNameToPlayerFormMap.js +35 -0
- package/dist/maps/trinketNameToTypeMap.js +19 -0
- package/dist/objects/LRoomShapeToRectangles.js +43 -0
- package/dist/objects/backdropTypeToRockAltType.js +68 -0
- package/dist/objects/batteryNames.js +13 -0
- package/dist/objects/bombNames.js +17 -0
- package/dist/objects/bossIDToEntityTypeVariant.js +228 -0
- package/dist/objects/bossNamePNGFileNames.js +120 -0
- package/dist/objects/bossNames.js +119 -0
- package/dist/objects/bossPortraitPNGFileNames.js +123 -0
- package/dist/objects/cardDescriptions.js +106 -0
- package/dist/objects/cardNames.js +106 -0
- package/dist/objects/challengeBosses.js +60 -0
- package/dist/objects/challengeCharacters.js +58 -0
- package/dist/objects/challengeCollectibleTypes.js +255 -0
- package/dist/objects/challengeNames.js +54 -0
- package/dist/objects/challengeTrinketType.js +58 -0
- package/dist/objects/characterDamageMultipliers.js +49 -0
- package/dist/objects/characterNames.js +48 -0
- package/dist/objects/characterSpritePNGFileNames.js +50 -0
- package/dist/objects/characterStartingCollectibleTypes.js +105 -0
- package/dist/objects/characterStartingTrinketTypes.js +90 -0
- package/dist/objects/chestNames.js +20 -0
- package/dist/objects/coinNames.js +16 -0
- package/dist/objects/coinSubTypeToValue.js +15 -0
- package/dist/objects/collectibleDescriptions.js +742 -0
- package/dist/objects/collectibleNames.js +745 -0
- package/dist/objects/colors.js +26 -0
- package/dist/objects/directionNames.js +11 -0
- package/dist/objects/directionToDegrees.js +11 -0
- package/dist/objects/directionToMoveAction.js +11 -0
- package/dist/objects/directionToShootAction.js +11 -0
- package/dist/objects/directionToVector.js +13 -0
- package/dist/objects/doorSlotFlagToDoorSlot.js +15 -0
- package/dist/objects/doorSlotToDirection.js +15 -0
- package/dist/objects/doorSlotToDoorSlotFlag.js +15 -0
- package/dist/objects/gridEntityTypeToANM2Name.js +37 -0
- package/dist/objects/heartNames.js +21 -0
- package/dist/objects/isaacAPIClassTypeToBrand.js +12 -0
- package/dist/objects/isaacAPIClassTypeToFunctions.js +46 -0
- package/dist/objects/itemPoolTypeToCollectibleTypesSet.js +57 -0
- package/dist/objects/kColors.js +27 -0
- package/dist/objects/keyNames.js +13 -0
- package/dist/objects/languageNames.js +13 -0
- package/dist/objects/oppositeDoorSlots.js +15 -0
- package/dist/objects/pillEffectClasses.js +57 -0
- package/dist/objects/pillEffectNames.js +57 -0
- package/dist/objects/pillEffectTypeToPillEffects.js +23 -0
- package/dist/objects/pillEffectTypes.js +57 -0
- package/dist/objects/playerNamePNGFileNames.js +57 -0
- package/dist/objects/playerPortraitPNGFileNames.js +54 -0
- package/dist/objects/roomShapeBounds.js +48 -0
- package/dist/objects/roomShapeCorners.js +330 -0
- package/dist/objects/roomShapeLayoutSizes.js +41 -0
- package/dist/objects/roomShapeToBottomRightPosition.js +25 -0
- package/dist/objects/roomShapeToDoorSlotCoordinates.js +111 -0
- package/dist/objects/roomShapeToDoorSlots.js +72 -0
- package/dist/objects/roomShapeToDoorSlotsToGridIndexDelta.js +118 -0
- package/dist/objects/roomShapeToGridWidth.js +20 -0
- package/dist/objects/roomShapeToTopLeftPosition.js +26 -0
- package/dist/objects/roomShapeVolumes.js +32 -0
- package/dist/objects/roomTypeNames.js +35 -0
- package/dist/objects/roomTypeSpecialGotoPrefixes.js +35 -0
- package/dist/objects/sackNames.js +11 -0
- package/dist/objects/slotNames.js +26 -0
- package/dist/objects/stageIDNames.js +43 -0
- package/dist/objects/stageToMusic.js +91 -0
- package/dist/objects/stageToStageID.js +117 -0
- package/dist/objects/stageTypeSuffixes.js +14 -0
- package/dist/objects/transformationNames.js +20 -0
- package/dist/objects/trinketDescriptions.js +199 -0
- package/dist/objects/trinketNames.js +202 -0
- package/dist/objects/versusScreenBackgroundColors.js +46 -0
- package/dist/objects/versusScreenDirtSpotColors.js +46 -0
- package/dist/patchErrorFunctions.js +65 -0
- package/dist/serialization.js +21 -0
- package/dist/sets/LRoomShapesSet.js +11 -0
- package/dist/sets/bigRoomShapesSet.js +14 -0
- package/dist/sets/bossSets.js +465 -0
- package/dist/sets/charactersThatStartWithAnActiveItemSet.js +18 -0
- package/dist/sets/charactersWithBlackHeartFromEternalHeartSet.js +9 -0
- package/dist/sets/charactersWithFreeDevilDealsSet.js +6 -0
- package/dist/sets/charactersWithNoRedHeartsSet.js +19 -0
- package/dist/sets/charactersWithNoSoulHeartsSet.js +16 -0
- package/dist/sets/consoleCommandsSet.js +64 -0
- package/dist/sets/entitiesWithArmorSet.js +59 -0
- package/dist/sets/familiarsThatShootPlayerTearsSet.js +15 -0
- package/dist/sets/itemConfigCardTypesForCards.js +14 -0
- package/dist/sets/lostStyleCharactersSet.js +16 -0
- package/dist/sets/mineShaftRoomSubTypesSet.js +12 -0
- package/dist/sets/narrowRoomShapesSet.js +11 -0
- package/dist/sets/poopGridEntityXMLTypesSet.js +16 -0
- package/dist/sets/redHeartSubTypesSet.js +10 -0
- package/dist/sets/repentanceBossIDsSet.js +30 -0
- package/dist/sets/sinEntityTypesSet.js +14 -0
- package/dist/sets/singleUseActiveCollectibleTypesSet.js +15 -0
- package/dist/shaderCrashFix.js +24 -0
- package/dist/shouldFire.js +226 -0
- package/dist/types/AddSubtract.js +2 -0
- package/dist/types/AllButFirst.js +2 -0
- package/dist/types/AllButLast.js +2 -0
- package/dist/types/AnyClass.js +2 -0
- package/dist/types/AnyEntity.js +2 -0
- package/dist/types/AnyFunction.js +2 -0
- package/dist/types/AnyGridEntity.js +2 -0
- package/dist/types/CompositionTypeSatisfiesEnum.js +11 -0
- package/dist/types/ConversionHeartSubType.js +2 -0
- package/dist/types/Decrement.js +2 -0
- package/dist/types/ERange.js +2 -0
- package/dist/types/EntityID.js +2 -0
- package/dist/types/FunctionTuple.js +2 -0
- package/dist/types/GridEntityID.js +2 -0
- package/dist/types/HasFunction.js +2 -0
- package/dist/types/IRange.js +2 -0
- package/dist/types/Immutable.js +2 -0
- package/dist/types/Increment.js +2 -0
- package/dist/types/LowercaseKeys.js +2 -0
- package/dist/types/NaturalNumbersLessThan.js +2 -0
- package/dist/types/NaturalNumbersLessThanOrEqualTo.js +2 -0
- package/dist/types/PickingUpItem.js +44 -0
- package/dist/types/PickupIndex.js +2 -0
- package/dist/types/PlayerIndex.js +2 -0
- package/dist/types/PossibleStatType.js +2 -0
- package/dist/types/PublicInterface.js +2 -0
- package/dist/types/ReadonlyMap.js +6 -0
- package/dist/types/ReadonlyRecord.js +2 -0
- package/dist/types/ReadonlySet.js +6 -0
- package/dist/types/StartsWithLowercase.js +2 -0
- package/dist/types/StartsWithUppercase.js +2 -0
- package/dist/types/TSTLClass.js +2 -0
- package/dist/types/Tuple.js +2 -0
- package/dist/types/TupleKeys.js +2 -0
- package/dist/types/TupleToIntersection.js +2 -0
- package/dist/types/TupleToUnion.js +2 -0
- package/dist/types/TupleWithLengthBetween.js +22 -0
- package/dist/types/TupleWithMaxLength.js +27 -0
- package/dist/types/UnionToIntersection.js +2 -0
- package/dist/types/UppercaseKeys.js +2 -0
- package/dist/types/WeightedArray.js +2 -0
- package/dist/types/WidenLiteral.js +2 -0
- package/dist/types/Writable.js +2 -0
- package/dist/types/private/CallbackTuple.js +2 -0
- package/dist/types/private/ModUpgradedWithFeatures.js +2 -0
- package/package.json +1 -1
- package/src/functions/utils.ts +4 -1
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setBlindfold = exports.removeDeadEyeMultiplier = exports.isVanillaPlayer = exports.isTaintedLazarus = exports.isTainted = exports.isPlayerAbleToAim = exports.isModdedPlayer = exports.isLost = exports.isKeeper = exports.isJacobOrEsau = exports.isFirstPlayer = exports.isEden = exports.isDamageFromPlayer = exports.isCharacter = exports.isBethany = exports.hasSpectral = exports.hasPiercing = exports.hasLostCurse = exports.hasHoming = exports.hasForm = exports.getPlayersWithControllerIndex = exports.getPlayersOnKeyboard = exports.getPlayersOfType = exports.getPlayerNumHitsRemaining = exports.getPlayerName = exports.getPlayerFromPtr = exports.getPlayerFromEntity = exports.getPlayerCloserThan = exports.getNewestPlayer = exports.getFinalPlayer = exports.getClosestPlayer = exports.getCharacters = exports.getAzazelBrimstoneDistance = exports.dequeueItem = exports.canPlayerCrushRocks = exports.anyPlayerIs = exports.anyPlayerHoldingItem = void 0;
|
|
4
|
+
const isaac_typescript_definitions_1 = require("isaac-typescript-definitions");
|
|
5
|
+
const cachedClasses_1 = require("../core/cachedClasses");
|
|
6
|
+
const ReadonlySet_1 = require("../types/ReadonlySet");
|
|
7
|
+
const characters_1 = require("./characters");
|
|
8
|
+
const flag_1 = require("./flag");
|
|
9
|
+
const playerIndex_1 = require("./playerIndex");
|
|
10
|
+
const types_1 = require("./types");
|
|
11
|
+
const utils_1 = require("./utils");
|
|
12
|
+
/**
|
|
13
|
+
* Helper function to check to see if any player is holding up an item (from e.g. an active item
|
|
14
|
+
* activation, a poop from IBS, etc.).
|
|
15
|
+
*/
|
|
16
|
+
function anyPlayerHoldingItem() {
|
|
17
|
+
const players = (0, playerIndex_1.getAllPlayers)();
|
|
18
|
+
return players.some((player) => player.IsHoldingItem());
|
|
19
|
+
}
|
|
20
|
+
exports.anyPlayerHoldingItem = anyPlayerHoldingItem;
|
|
21
|
+
/**
|
|
22
|
+
* Helper function to determine if the given character is present.
|
|
23
|
+
*
|
|
24
|
+
* This function is variadic, meaning that you can supply as many characters as you want to check
|
|
25
|
+
* for. Returns true if any of the characters supplied are present.
|
|
26
|
+
*/
|
|
27
|
+
function anyPlayerIs(...matchingCharacters) {
|
|
28
|
+
const matchingCharacterSet = new ReadonlySet_1.ReadonlySet(matchingCharacters);
|
|
29
|
+
const characters = getCharacters();
|
|
30
|
+
return characters.some((character) => matchingCharacterSet.has(character));
|
|
31
|
+
}
|
|
32
|
+
exports.anyPlayerIs = anyPlayerIs;
|
|
33
|
+
/**
|
|
34
|
+
* Helper function to determine if a player will destroy a rock/pot/skull if they walk over it.
|
|
35
|
+
*
|
|
36
|
+
* The following situations allow for this to be true:
|
|
37
|
+
* - the player has Leo (collectible 302)
|
|
38
|
+
* - the player has Thunder Thighs (collectible 314)
|
|
39
|
+
* - the player is under the effects of Mega Mush (collectible 625)
|
|
40
|
+
* - the player has Stompy (transformation 13)
|
|
41
|
+
*/
|
|
42
|
+
function canPlayerCrushRocks(player) {
|
|
43
|
+
const effects = player.GetEffects();
|
|
44
|
+
return (player.HasCollectible(isaac_typescript_definitions_1.CollectibleType.LEO) ||
|
|
45
|
+
player.HasCollectible(isaac_typescript_definitions_1.CollectibleType.THUNDER_THIGHS) ||
|
|
46
|
+
effects.HasCollectibleEffect(isaac_typescript_definitions_1.CollectibleType.MEGA_MUSH) ||
|
|
47
|
+
player.HasPlayerForm(isaac_typescript_definitions_1.PlayerForm.STOMPY));
|
|
48
|
+
}
|
|
49
|
+
exports.canPlayerCrushRocks = canPlayerCrushRocks;
|
|
50
|
+
/**
|
|
51
|
+
* Helper function to remove a collectible or trinket that is currently queued to go into a player's
|
|
52
|
+
* inventory (i.e. the item is being held over their head).
|
|
53
|
+
*
|
|
54
|
+
* If the player does not have an item currently queued, then this function will be a no-op.
|
|
55
|
+
*
|
|
56
|
+
* Returns whether an item was actually dequeued.
|
|
57
|
+
*
|
|
58
|
+
* Under the hood, this clones the `QueuedItemData`, since directly setting the `Item` field to
|
|
59
|
+
* `undefined` does not work for some reason.
|
|
60
|
+
*/
|
|
61
|
+
function dequeueItem(player) {
|
|
62
|
+
if (player.QueuedItem.Item === undefined) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
// Doing `player.QueuedItem.Item = undefined` does not work for some reason.
|
|
66
|
+
const queue = player.QueuedItem;
|
|
67
|
+
queue.Item = undefined;
|
|
68
|
+
player.QueuedItem = queue;
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
exports.dequeueItem = dequeueItem;
|
|
72
|
+
/**
|
|
73
|
+
* Helper function to get how long Azazel's Brimstone laser should be. You can pass either an
|
|
74
|
+
* `EntityPlayer` object or a tear height stat.
|
|
75
|
+
*
|
|
76
|
+
* The formula for calculating it is: 32 - 2.5 * tearHeight
|
|
77
|
+
*/
|
|
78
|
+
function getAzazelBrimstoneDistance(playerOrTearHeight) {
|
|
79
|
+
const tearHeight = (0, types_1.isNumber)(playerOrTearHeight)
|
|
80
|
+
? playerOrTearHeight
|
|
81
|
+
: playerOrTearHeight.TearHeight;
|
|
82
|
+
return 32 - 2.5 * tearHeight;
|
|
83
|
+
}
|
|
84
|
+
exports.getAzazelBrimstoneDistance = getAzazelBrimstoneDistance;
|
|
85
|
+
/** Helper function to get an array containing the characters of all of the current players. */
|
|
86
|
+
function getCharacters() {
|
|
87
|
+
const players = (0, playerIndex_1.getPlayers)();
|
|
88
|
+
return players.map((player) => player.GetPlayerType());
|
|
89
|
+
}
|
|
90
|
+
exports.getCharacters = getCharacters;
|
|
91
|
+
/**
|
|
92
|
+
* Helper function to get the closest player to a certain position. Note that this will never
|
|
93
|
+
* include players with a non-undefined parent, since they are not real players (e.g. the Strawman
|
|
94
|
+
* Keeper).
|
|
95
|
+
*/
|
|
96
|
+
function getClosestPlayer(position) {
|
|
97
|
+
let closestPlayer;
|
|
98
|
+
let closestDistance = math.huge;
|
|
99
|
+
for (const player of (0, playerIndex_1.getPlayers)()) {
|
|
100
|
+
const distance = position.Distance(player.Position);
|
|
101
|
+
if (distance < closestDistance) {
|
|
102
|
+
closestPlayer = player;
|
|
103
|
+
closestDistance = distance;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
(0, utils_1.assertDefined)(closestPlayer, "Failed to find the closest player.");
|
|
107
|
+
return closestPlayer;
|
|
108
|
+
}
|
|
109
|
+
exports.getClosestPlayer = getClosestPlayer;
|
|
110
|
+
/**
|
|
111
|
+
* Helper function to return the player with the highest ID, according to the `Isaac.GetPlayer`
|
|
112
|
+
* method.
|
|
113
|
+
*/
|
|
114
|
+
function getFinalPlayer() {
|
|
115
|
+
const players = (0, playerIndex_1.getPlayers)();
|
|
116
|
+
const lastPlayer = players.at(-1);
|
|
117
|
+
(0, utils_1.assertDefined)(lastPlayer, "Failed to get the final player since there were 0 players.");
|
|
118
|
+
return lastPlayer;
|
|
119
|
+
}
|
|
120
|
+
exports.getFinalPlayer = getFinalPlayer;
|
|
121
|
+
/**
|
|
122
|
+
* Helper function to get the first player with the lowest frame count. Useful to find a freshly
|
|
123
|
+
* spawned player after using items like Esau Jr. Don't use this function if two or more players
|
|
124
|
+
* will be spawned on the same frame.
|
|
125
|
+
*/
|
|
126
|
+
function getNewestPlayer() {
|
|
127
|
+
let newestPlayer;
|
|
128
|
+
let lowestFrame = math.huge;
|
|
129
|
+
for (const player of (0, playerIndex_1.getPlayers)()) {
|
|
130
|
+
if (player.FrameCount < lowestFrame) {
|
|
131
|
+
newestPlayer = player;
|
|
132
|
+
lowestFrame = player.FrameCount;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
(0, utils_1.assertDefined)(newestPlayer, "Failed to find the newest player.");
|
|
136
|
+
return newestPlayer;
|
|
137
|
+
}
|
|
138
|
+
exports.getNewestPlayer = getNewestPlayer;
|
|
139
|
+
/**
|
|
140
|
+
* Iterates over all players and checks if any are close enough to the specified position.
|
|
141
|
+
*
|
|
142
|
+
* @returns The first player found when iterating upwards from index 0.
|
|
143
|
+
*/
|
|
144
|
+
function getPlayerCloserThan(position, distance) {
|
|
145
|
+
const players = (0, playerIndex_1.getPlayers)();
|
|
146
|
+
return players.find((player) => player.Position.Distance(position) <= distance);
|
|
147
|
+
}
|
|
148
|
+
exports.getPlayerCloserThan = getPlayerCloserThan;
|
|
149
|
+
/**
|
|
150
|
+
* Helper function to get the player from a tear, laser, bomb, etc. Returns undefined if the entity
|
|
151
|
+
* does not correspond to any particular player.
|
|
152
|
+
*
|
|
153
|
+
* This function works by looking at the `Parent` and the `SpawnerEntity` fields (in that order). As
|
|
154
|
+
* a last resort, it will attempt to use the `Entity.ToPlayer` method on the entity itself.
|
|
155
|
+
*/
|
|
156
|
+
function getPlayerFromEntity(entity) {
|
|
157
|
+
if (entity.Parent !== undefined) {
|
|
158
|
+
const player = entity.Parent.ToPlayer();
|
|
159
|
+
if (player !== undefined) {
|
|
160
|
+
return player;
|
|
161
|
+
}
|
|
162
|
+
const familiar = entity.Parent.ToFamiliar();
|
|
163
|
+
if (familiar !== undefined) {
|
|
164
|
+
return familiar.Player;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (entity.SpawnerEntity !== undefined) {
|
|
168
|
+
const player = entity.SpawnerEntity.ToPlayer();
|
|
169
|
+
if (player !== undefined) {
|
|
170
|
+
return player;
|
|
171
|
+
}
|
|
172
|
+
const familiar = entity.SpawnerEntity.ToFamiliar();
|
|
173
|
+
if (familiar !== undefined) {
|
|
174
|
+
return familiar.Player;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return entity.ToPlayer();
|
|
178
|
+
}
|
|
179
|
+
exports.getPlayerFromEntity = getPlayerFromEntity;
|
|
180
|
+
/**
|
|
181
|
+
* Helper function to get an `EntityPlayer` object from an `EntityPtr`. Returns undefined if the
|
|
182
|
+
* entity has gone out of scope or if the associated entity is not a player.
|
|
183
|
+
*/
|
|
184
|
+
function getPlayerFromPtr(entityPtr) {
|
|
185
|
+
const entity = entityPtr.Ref;
|
|
186
|
+
if (entity === undefined) {
|
|
187
|
+
return undefined;
|
|
188
|
+
}
|
|
189
|
+
return entity.ToPlayer();
|
|
190
|
+
}
|
|
191
|
+
exports.getPlayerFromPtr = getPlayerFromPtr;
|
|
192
|
+
/**
|
|
193
|
+
* Helper function to get the proper name of the player. Use this instead of the
|
|
194
|
+
* `EntityPlayer.GetName` method because it accounts for Blue Baby, Lazarus II, and Tainted
|
|
195
|
+
* characters.
|
|
196
|
+
*/
|
|
197
|
+
function getPlayerName(player) {
|
|
198
|
+
const character = player.GetPlayerType();
|
|
199
|
+
// Account for modded characters.
|
|
200
|
+
return isModdedPlayer(player)
|
|
201
|
+
? player.GetName()
|
|
202
|
+
: (0, characters_1.getCharacterName)(character);
|
|
203
|
+
}
|
|
204
|
+
exports.getPlayerName = getPlayerName;
|
|
205
|
+
/**
|
|
206
|
+
* Returns the combined value of all of the player's red hearts, soul/black hearts, and bone hearts,
|
|
207
|
+
* minus the value of the player's rotten hearts.
|
|
208
|
+
*
|
|
209
|
+
* This is equivalent to the number of hits that the player can currently take, but does not take
|
|
210
|
+
* into account double damage from champion enemies and/or being on later floors. (For example, on
|
|
211
|
+
* Womb 1, players who have 1 soul heart remaining would die in 1 hit to anything, even though this
|
|
212
|
+
* function would report that they have 2 hits remaining.)
|
|
213
|
+
*/
|
|
214
|
+
function getPlayerNumHitsRemaining(player) {
|
|
215
|
+
const hearts = player.GetHearts();
|
|
216
|
+
const soulHearts = player.GetSoulHearts();
|
|
217
|
+
const boneHearts = player.GetBoneHearts();
|
|
218
|
+
const eternalHearts = player.GetEternalHearts();
|
|
219
|
+
const rottenHearts = player.GetRottenHearts();
|
|
220
|
+
return hearts + soulHearts + boneHearts + eternalHearts - rottenHearts;
|
|
221
|
+
}
|
|
222
|
+
exports.getPlayerNumHitsRemaining = getPlayerNumHitsRemaining;
|
|
223
|
+
/**
|
|
224
|
+
* Helper function to get all of the players that are a certain character.
|
|
225
|
+
*
|
|
226
|
+
* This function is variadic, meaning that you can supply as many characters as you want to check
|
|
227
|
+
* for. Returns true if any of the characters supplied are present.
|
|
228
|
+
*/
|
|
229
|
+
function getPlayersOfType(...characters) {
|
|
230
|
+
const charactersSet = new ReadonlySet_1.ReadonlySet(characters);
|
|
231
|
+
const players = (0, playerIndex_1.getPlayers)();
|
|
232
|
+
return players.filter((player) => {
|
|
233
|
+
const character = player.GetPlayerType();
|
|
234
|
+
return charactersSet.has(character);
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
exports.getPlayersOfType = getPlayersOfType;
|
|
238
|
+
/**
|
|
239
|
+
* Helper function to get all of the players that are using keyboard (i.e.
|
|
240
|
+
* `ControllerIndex.KEYBOARD`). This function returns an array of players because it is possible
|
|
241
|
+
* that there is more than one player with the same controller index (e.g. Jacob & Esau).
|
|
242
|
+
*
|
|
243
|
+
* Note that this function includes players with a non-undefined parent like e.g. the Strawman
|
|
244
|
+
* Keeper.
|
|
245
|
+
*/
|
|
246
|
+
function getPlayersOnKeyboard() {
|
|
247
|
+
const players = (0, playerIndex_1.getAllPlayers)();
|
|
248
|
+
return players.filter((player) => player.ControllerIndex === isaac_typescript_definitions_1.ControllerIndex.KEYBOARD);
|
|
249
|
+
}
|
|
250
|
+
exports.getPlayersOnKeyboard = getPlayersOnKeyboard;
|
|
251
|
+
/**
|
|
252
|
+
* Helper function to get all of the players that match the provided controller index. This function
|
|
253
|
+
* returns an array of players because it is possible that there is more than one player with the
|
|
254
|
+
* same controller index (e.g. Jacob & Esau).
|
|
255
|
+
*
|
|
256
|
+
* Note that this function includes players with a non-undefined parent like e.g. the Strawman
|
|
257
|
+
* Keeper.
|
|
258
|
+
*/
|
|
259
|
+
function getPlayersWithControllerIndex(controllerIndex) {
|
|
260
|
+
const players = (0, playerIndex_1.getAllPlayers)();
|
|
261
|
+
return players.filter((player) => player.ControllerIndex === controllerIndex);
|
|
262
|
+
}
|
|
263
|
+
exports.getPlayersWithControllerIndex = getPlayersWithControllerIndex;
|
|
264
|
+
/**
|
|
265
|
+
* Helper function to check to see if a player has one or more transformations.
|
|
266
|
+
*
|
|
267
|
+
* This function is variadic, meaning that you can supply as many transformations as you want to
|
|
268
|
+
* check for. Returns true if the player has any of the supplied transformations.
|
|
269
|
+
*/
|
|
270
|
+
function hasForm(player, ...playerForms) {
|
|
271
|
+
return playerForms.some((playerForm) => player.HasPlayerForm(playerForm));
|
|
272
|
+
}
|
|
273
|
+
exports.hasForm = hasForm;
|
|
274
|
+
/**
|
|
275
|
+
* Helper function to check if a player has homing tears.
|
|
276
|
+
*
|
|
277
|
+
* Under the hood, this checks the `EntityPlayer.TearFlags` variable for `TearFlag.HOMING` (1 << 2).
|
|
278
|
+
*/
|
|
279
|
+
function hasHoming(player) {
|
|
280
|
+
return (0, flag_1.hasFlag)(player.TearFlags, isaac_typescript_definitions_1.TearFlag.HOMING);
|
|
281
|
+
}
|
|
282
|
+
exports.hasHoming = hasHoming;
|
|
283
|
+
/** After touching a white fire, a player will turn into The Lost until they clear a room. */
|
|
284
|
+
function hasLostCurse(player) {
|
|
285
|
+
const effects = player.GetEffects();
|
|
286
|
+
return effects.HasNullEffect(isaac_typescript_definitions_1.NullItemID.LOST_CURSE);
|
|
287
|
+
}
|
|
288
|
+
exports.hasLostCurse = hasLostCurse;
|
|
289
|
+
/**
|
|
290
|
+
* Helper function to check if a player has piercing tears.
|
|
291
|
+
*
|
|
292
|
+
* Under the hood, this checks the `EntityPlayer.TearFlags` variable for `TearFlag.PIERCING` (1 <<
|
|
293
|
+
* 1).
|
|
294
|
+
*/
|
|
295
|
+
function hasPiercing(player) {
|
|
296
|
+
return (0, flag_1.hasFlag)(player.TearFlags, isaac_typescript_definitions_1.TearFlag.PIERCING);
|
|
297
|
+
}
|
|
298
|
+
exports.hasPiercing = hasPiercing;
|
|
299
|
+
/**
|
|
300
|
+
* Helper function to check if a player has spectral tears.
|
|
301
|
+
*
|
|
302
|
+
* Under the hood, this checks the `EntityPlayer.TearFlags` variable for `TearFlag.SPECTRAL` (1 <<
|
|
303
|
+
* 0).
|
|
304
|
+
*/
|
|
305
|
+
function hasSpectral(player) {
|
|
306
|
+
return (0, flag_1.hasFlag)(player.TearFlags, isaac_typescript_definitions_1.TearFlag.SPECTRAL);
|
|
307
|
+
}
|
|
308
|
+
exports.hasSpectral = hasSpectral;
|
|
309
|
+
/**
|
|
310
|
+
* Helper function for detecting when a player is Bethany or Tainted Bethany. This is useful if you
|
|
311
|
+
* need to adjust UI elements to account for Bethany's soul charges or Tainted Bethany's blood
|
|
312
|
+
* charges.
|
|
313
|
+
*/
|
|
314
|
+
function isBethany(player) {
|
|
315
|
+
const character = player.GetPlayerType();
|
|
316
|
+
return character === isaac_typescript_definitions_1.PlayerType.BETHANY || character === isaac_typescript_definitions_1.PlayerType.BETHANY_B;
|
|
317
|
+
}
|
|
318
|
+
exports.isBethany = isBethany;
|
|
319
|
+
/**
|
|
320
|
+
* Helper function to check if a player is a specific character (i.e. `PlayerType`).
|
|
321
|
+
*
|
|
322
|
+
* This function is variadic, meaning that you can supply as many characters as you want to check
|
|
323
|
+
* for. Returns true if the player is any of the supplied characters.
|
|
324
|
+
*/
|
|
325
|
+
function isCharacter(player, ...characters) {
|
|
326
|
+
const characterSet = new ReadonlySet_1.ReadonlySet(characters);
|
|
327
|
+
const character = player.GetPlayerType();
|
|
328
|
+
return characterSet.has(character);
|
|
329
|
+
}
|
|
330
|
+
exports.isCharacter = isCharacter;
|
|
331
|
+
/**
|
|
332
|
+
* Helper function to see if a damage source is from a player. Use this instead of comparing to the
|
|
333
|
+
* entity directly because it takes familiars into account.
|
|
334
|
+
*/
|
|
335
|
+
function isDamageFromPlayer(damageSource) {
|
|
336
|
+
const player = damageSource.ToPlayer();
|
|
337
|
+
if (player !== undefined) {
|
|
338
|
+
return true;
|
|
339
|
+
}
|
|
340
|
+
const indirectPlayer = getPlayerFromEntity(damageSource);
|
|
341
|
+
return indirectPlayer !== undefined;
|
|
342
|
+
}
|
|
343
|
+
exports.isDamageFromPlayer = isDamageFromPlayer;
|
|
344
|
+
/**
|
|
345
|
+
* Helper function for detecting when a player is Eden or Tainted Eden. Useful for situations where
|
|
346
|
+
* you want to know if the starting stats were randomized, for example.
|
|
347
|
+
*/
|
|
348
|
+
function isEden(player) {
|
|
349
|
+
const character = player.GetPlayerType();
|
|
350
|
+
return character === isaac_typescript_definitions_1.PlayerType.EDEN || character === isaac_typescript_definitions_1.PlayerType.EDEN_B;
|
|
351
|
+
}
|
|
352
|
+
exports.isEden = isEden;
|
|
353
|
+
function isFirstPlayer(player) {
|
|
354
|
+
return (0, playerIndex_1.getPlayerIndexVanilla)(player) === 0;
|
|
355
|
+
}
|
|
356
|
+
exports.isFirstPlayer = isFirstPlayer;
|
|
357
|
+
/**
|
|
358
|
+
* Helper function for detecting when a player is Jacob or Esau. This will only match the
|
|
359
|
+
* non-tainted versions of these characters.
|
|
360
|
+
*/
|
|
361
|
+
function isJacobOrEsau(player) {
|
|
362
|
+
const character = player.GetPlayerType();
|
|
363
|
+
return character === isaac_typescript_definitions_1.PlayerType.JACOB || character === isaac_typescript_definitions_1.PlayerType.ESAU;
|
|
364
|
+
}
|
|
365
|
+
exports.isJacobOrEsau = isJacobOrEsau;
|
|
366
|
+
/**
|
|
367
|
+
* Helper function for detecting when a player is Keeper or Tainted Keeper. Useful for situations
|
|
368
|
+
* where you want to know if the health is coin hearts, for example.
|
|
369
|
+
*/
|
|
370
|
+
function isKeeper(player) {
|
|
371
|
+
const character = player.GetPlayerType();
|
|
372
|
+
return character === isaac_typescript_definitions_1.PlayerType.KEEPER || character === isaac_typescript_definitions_1.PlayerType.KEEPER_B;
|
|
373
|
+
}
|
|
374
|
+
exports.isKeeper = isKeeper;
|
|
375
|
+
/** Helper function for detecting when a player is The Lost or Tainted Lost. */
|
|
376
|
+
function isLost(player) {
|
|
377
|
+
const character = player.GetPlayerType();
|
|
378
|
+
return character === isaac_typescript_definitions_1.PlayerType.LOST || character === isaac_typescript_definitions_1.PlayerType.LOST_B;
|
|
379
|
+
}
|
|
380
|
+
exports.isLost = isLost;
|
|
381
|
+
function isModdedPlayer(player) {
|
|
382
|
+
return !isVanillaPlayer(player);
|
|
383
|
+
}
|
|
384
|
+
exports.isModdedPlayer = isModdedPlayer;
|
|
385
|
+
/**
|
|
386
|
+
* Helper function for determining if a player is able to turn their head by pressing the shooting
|
|
387
|
+
* buttons.
|
|
388
|
+
*
|
|
389
|
+
* Under the hood, this function uses the `EntityPlayer.IsExtraAnimationFinished` method.
|
|
390
|
+
*/
|
|
391
|
+
function isPlayerAbleToAim(player) {
|
|
392
|
+
return player.IsExtraAnimationFinished();
|
|
393
|
+
}
|
|
394
|
+
exports.isPlayerAbleToAim = isPlayerAbleToAim;
|
|
395
|
+
/** Helper function for detecting if a player is one of the Tainted characters. */
|
|
396
|
+
function isTainted(player) {
|
|
397
|
+
const character = player.GetPlayerType();
|
|
398
|
+
return isVanillaPlayer(player)
|
|
399
|
+
? character >= isaac_typescript_definitions_1.PlayerType.ISAAC_B
|
|
400
|
+
: isTaintedModded(player);
|
|
401
|
+
}
|
|
402
|
+
exports.isTainted = isTainted;
|
|
403
|
+
/** Helper function for detecting when a player is Tainted Lazarus or Dead Tainted Lazarus. */
|
|
404
|
+
function isTaintedLazarus(player) {
|
|
405
|
+
const character = player.GetPlayerType();
|
|
406
|
+
return (character === isaac_typescript_definitions_1.PlayerType.LAZARUS_B || character === isaac_typescript_definitions_1.PlayerType.LAZARUS_2_B);
|
|
407
|
+
}
|
|
408
|
+
exports.isTaintedLazarus = isTaintedLazarus;
|
|
409
|
+
function isVanillaPlayer(player) {
|
|
410
|
+
const character = player.GetPlayerType();
|
|
411
|
+
return (0, characters_1.isVanillaCharacter)(character);
|
|
412
|
+
}
|
|
413
|
+
exports.isVanillaPlayer = isVanillaPlayer;
|
|
414
|
+
/**
|
|
415
|
+
* Helper function to remove the Dead Eye multiplier from a player.
|
|
416
|
+
*
|
|
417
|
+
* Note that each time the `EntityPlayer.ClearDeadEyeCharge` method is called, it only has a chance
|
|
418
|
+
* of working, so this function calls it 100 times to be safe.
|
|
419
|
+
*/
|
|
420
|
+
function removeDeadEyeMultiplier(player) {
|
|
421
|
+
(0, utils_1.repeat)(100, () => {
|
|
422
|
+
player.ClearDeadEyeCharge();
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
exports.removeDeadEyeMultiplier = removeDeadEyeMultiplier;
|
|
426
|
+
/**
|
|
427
|
+
* Helper function to blindfold the player by using a hack with the challenge variable.
|
|
428
|
+
*
|
|
429
|
+
* Note that if the player dies and respawns (from e.g. Dead Cat), the blindfold will have to be
|
|
430
|
+
* reapplied.
|
|
431
|
+
*
|
|
432
|
+
* Under the hood, this function sets the challenge to one with a blindfold, changes the player to
|
|
433
|
+
* the same character that they currently are, and then changes the challenge back. This method was
|
|
434
|
+
* discovered by im_tem.
|
|
435
|
+
*
|
|
436
|
+
* @param player The player to apply or remove the blindfold state from.
|
|
437
|
+
* @param enabled Whether to apply or remove the blindfold.
|
|
438
|
+
* @param modifyCostume Optional. Whether to add or remove the blindfold costume. Default is true.
|
|
439
|
+
*/
|
|
440
|
+
function setBlindfold(player, enabled, modifyCostume = true) {
|
|
441
|
+
const character = player.GetPlayerType();
|
|
442
|
+
const challenge = Isaac.GetChallenge();
|
|
443
|
+
if (enabled) {
|
|
444
|
+
cachedClasses_1.game.Challenge = isaac_typescript_definitions_1.Challenge.SOLAR_SYSTEM; // This challenge has a blindfold
|
|
445
|
+
player.ChangePlayerType(character);
|
|
446
|
+
cachedClasses_1.game.Challenge = challenge;
|
|
447
|
+
// The costume is applied automatically.
|
|
448
|
+
if (!modifyCostume) {
|
|
449
|
+
player.TryRemoveNullCostume(isaac_typescript_definitions_1.NullItemID.BLINDFOLD);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
else {
|
|
453
|
+
cachedClasses_1.game.Challenge = isaac_typescript_definitions_1.Challenge.NULL;
|
|
454
|
+
player.ChangePlayerType(character);
|
|
455
|
+
cachedClasses_1.game.Challenge = challenge;
|
|
456
|
+
if (modifyCostume) {
|
|
457
|
+
player.TryRemoveNullCostume(isaac_typescript_definitions_1.NullItemID.BLINDFOLD);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
exports.setBlindfold = setBlindfold;
|
|
462
|
+
/** Not exported since end-users should use the `isTainted` helper function directly. */
|
|
463
|
+
function isTaintedModded(player) {
|
|
464
|
+
// This algorithm only works for modded characters because the `Isaac.GetPlayerTypeByName` method
|
|
465
|
+
// is bugged.
|
|
466
|
+
// https://github.com/Meowlala/RepentanceAPIIssueTracker/issues/117
|
|
467
|
+
const character = player.GetPlayerType();
|
|
468
|
+
const name = player.GetName();
|
|
469
|
+
const taintedCharacter = Isaac.GetPlayerTypeByName(name, true);
|
|
470
|
+
return character === taintedCharacter;
|
|
471
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pocketItemsEquals = exports.isFirstSlotPocketActiveItem = exports.hasOpenPocketItemSlot = exports.getPocketItems = exports.getFirstPill = exports.getFirstCardOrPill = exports.getFirstCard = exports.getActivePocketItemSlot = void 0;
|
|
4
|
+
const isaac_typescript_definitions_1 = require("isaac-typescript-definitions");
|
|
5
|
+
const cachedEnumValues_1 = require("../arrays/cachedEnumValues");
|
|
6
|
+
const PocketItemType_1 = require("../enums/PocketItemType");
|
|
7
|
+
const players_1 = require("./players");
|
|
8
|
+
/**
|
|
9
|
+
* Helper function to get the `PocketItemSlot` that the player's pocket active collectible item is
|
|
10
|
+
* in, if any. Returns undefined if the player does not have a pocket active item.
|
|
11
|
+
*/
|
|
12
|
+
function getActivePocketItemSlot(player) {
|
|
13
|
+
const pocketItems = getPocketItems(player);
|
|
14
|
+
for (const pocketItem of pocketItems) {
|
|
15
|
+
if (pocketItem.type === PocketItemType_1.PocketItemType.ACTIVE_ITEM) {
|
|
16
|
+
return pocketItem.slot;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
exports.getActivePocketItemSlot = getActivePocketItemSlot;
|
|
22
|
+
/** Helper item to get the first card that a player is holding in their pocket item slots. */
|
|
23
|
+
function getFirstCard(player) {
|
|
24
|
+
const pocketItems = getPocketItems(player);
|
|
25
|
+
return pocketItems.find((pocketItem) => pocketItem.type === PocketItemType_1.PocketItemType.CARD);
|
|
26
|
+
}
|
|
27
|
+
exports.getFirstCard = getFirstCard;
|
|
28
|
+
/**
|
|
29
|
+
* Helper item to get the first card or pill that a player is holding in their pocket item slots.
|
|
30
|
+
*/
|
|
31
|
+
function getFirstCardOrPill(player) {
|
|
32
|
+
const pocketItems = getPocketItems(player);
|
|
33
|
+
return pocketItems.find((pocketItem) => pocketItem.type === PocketItemType_1.PocketItemType.CARD ||
|
|
34
|
+
pocketItem.type === PocketItemType_1.PocketItemType.PILL);
|
|
35
|
+
}
|
|
36
|
+
exports.getFirstCardOrPill = getFirstCardOrPill;
|
|
37
|
+
/** Helper item to get the first pill that a player is holding in their pocket item slots. */
|
|
38
|
+
function getFirstPill(player) {
|
|
39
|
+
const pocketItems = getPocketItems(player);
|
|
40
|
+
return pocketItems.find((pocketItem) => pocketItem.type === PocketItemType_1.PocketItemType.PILL);
|
|
41
|
+
}
|
|
42
|
+
exports.getFirstPill = getFirstPill;
|
|
43
|
+
/**
|
|
44
|
+
* Use this helper function as a workaround for the `EntityPlayer.GetPocketItem` method not working
|
|
45
|
+
* correctly.
|
|
46
|
+
*
|
|
47
|
+
* Note that due to API limitations, there is no way to determine the location of a Dice Bag trinket
|
|
48
|
+
* dice. Furthermore, when the player has a Dice Bag trinket dice and a pocket active at the same
|
|
49
|
+
* time, there is no way to determine the location of the pocket active item. If this function
|
|
50
|
+
* cannot determine the identity of a particular slot, it will mark the type of the slot as
|
|
51
|
+
* `PocketItemType.UNDETERMINABLE`.
|
|
52
|
+
*/
|
|
53
|
+
function getPocketItems(player) {
|
|
54
|
+
const pocketItem = player.GetActiveItem(isaac_typescript_definitions_1.ActiveSlot.POCKET);
|
|
55
|
+
const hasPocketItem = pocketItem !== isaac_typescript_definitions_1.CollectibleType.NULL;
|
|
56
|
+
const pocketItem2 = player.GetActiveItem(isaac_typescript_definitions_1.ActiveSlot.POCKET_SINGLE_USE);
|
|
57
|
+
const hasPocketItem2 = pocketItem2 !== isaac_typescript_definitions_1.CollectibleType.NULL;
|
|
58
|
+
const maxPocketItems = player.GetMaxPocketItems();
|
|
59
|
+
const pocketItems = [];
|
|
60
|
+
let pocketItemIdentified = false;
|
|
61
|
+
let pocketItem2Identified = false;
|
|
62
|
+
for (const slot of cachedEnumValues_1.POCKET_ITEM_SLOT_VALUES) {
|
|
63
|
+
const cardType = player.GetCard(slot);
|
|
64
|
+
const pillColor = player.GetPill(slot);
|
|
65
|
+
if (cardType !== isaac_typescript_definitions_1.CardType.NULL) {
|
|
66
|
+
pocketItems.push({
|
|
67
|
+
slot,
|
|
68
|
+
type: PocketItemType_1.PocketItemType.CARD,
|
|
69
|
+
subType: cardType,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
else if (pillColor !== isaac_typescript_definitions_1.PillColor.NULL) {
|
|
73
|
+
pocketItems.push({
|
|
74
|
+
slot,
|
|
75
|
+
type: PocketItemType_1.PocketItemType.PILL,
|
|
76
|
+
subType: pillColor,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
else if (hasPocketItem && !hasPocketItem2 && !pocketItemIdentified) {
|
|
80
|
+
pocketItemIdentified = true;
|
|
81
|
+
pocketItems.push({
|
|
82
|
+
slot,
|
|
83
|
+
type: PocketItemType_1.PocketItemType.ACTIVE_ITEM,
|
|
84
|
+
subType: pocketItem,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
else if (!hasPocketItem && hasPocketItem2 && !pocketItem2Identified) {
|
|
88
|
+
pocketItem2Identified = true;
|
|
89
|
+
pocketItems.push({
|
|
90
|
+
slot,
|
|
91
|
+
type: PocketItemType_1.PocketItemType.DICE_BAG_DICE,
|
|
92
|
+
subType: pocketItem2,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
else if (hasPocketItem && hasPocketItem2) {
|
|
96
|
+
pocketItems.push({
|
|
97
|
+
slot,
|
|
98
|
+
type: PocketItemType_1.PocketItemType.UNDETERMINABLE,
|
|
99
|
+
subType: 0,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
pocketItems.push({
|
|
104
|
+
slot,
|
|
105
|
+
type: PocketItemType_1.PocketItemType.EMPTY,
|
|
106
|
+
subType: 0,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
if (slot + 1 === maxPocketItems) {
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return pocketItems;
|
|
114
|
+
}
|
|
115
|
+
exports.getPocketItems = getPocketItems;
|
|
116
|
+
/**
|
|
117
|
+
* Returns whether the player can hold an additional pocket item, beyond what they are currently
|
|
118
|
+
* carrying. This takes into account items that modify the max number of pocket items, like Starter
|
|
119
|
+
* Deck.
|
|
120
|
+
*
|
|
121
|
+
* If the player is the Tainted Soul, this always returns false, since that character cannot pick up
|
|
122
|
+
* items. (Only Tainted Forgotten can pick up items.)
|
|
123
|
+
*/
|
|
124
|
+
function hasOpenPocketItemSlot(player) {
|
|
125
|
+
if ((0, players_1.isCharacter)(player, isaac_typescript_definitions_1.PlayerType.SOUL_B)) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
const pocketItems = getPocketItems(player);
|
|
129
|
+
return pocketItems.some((pocketItem) => pocketItem.type === PocketItemType_1.PocketItemType.EMPTY);
|
|
130
|
+
}
|
|
131
|
+
exports.hasOpenPocketItemSlot = hasOpenPocketItemSlot;
|
|
132
|
+
/**
|
|
133
|
+
* Helper function to determine whether the player's "active" pocket item slot is set to their
|
|
134
|
+
* pocket active item.
|
|
135
|
+
*/
|
|
136
|
+
function isFirstSlotPocketActiveItem(player) {
|
|
137
|
+
const pocketItems = getPocketItems(player);
|
|
138
|
+
const firstPocketItem = pocketItems[0];
|
|
139
|
+
if (firstPocketItem === undefined) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
return firstPocketItem.type === PocketItemType_1.PocketItemType.ACTIVE_ITEM;
|
|
143
|
+
}
|
|
144
|
+
exports.isFirstSlotPocketActiveItem = isFirstSlotPocketActiveItem;
|
|
145
|
+
/** Helper function to see if two sets of pocket item descriptions are identical. */
|
|
146
|
+
function pocketItemsEquals(pocketItems1, pocketItems2) {
|
|
147
|
+
if (pocketItems1.length !== pocketItems2.length) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
// eslint-disable-next-line unicorn/no-for-loop
|
|
151
|
+
for (let i = 0; i < pocketItems1.length; i++) {
|
|
152
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
153
|
+
const pocketItem1 = pocketItems1[i];
|
|
154
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
155
|
+
const pocketItem2 = pocketItems2[i];
|
|
156
|
+
const keys = Object.keys(pocketItem1);
|
|
157
|
+
for (const key of keys) {
|
|
158
|
+
if (pocketItem1[key] !== pocketItem2[key]) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
exports.pocketItemsEquals = pocketItemsEquals;
|